@startlibs/components 1.0.0-alpha-7s → 1.0.0-alpha-7x
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/lib/index.js +855 -473
- package/package.json +2 -2
- package/src/index.js +30 -0
package/lib/index.js
CHANGED
|
@@ -18,29 +18,29 @@ var _createClass = _interopDefault(require('@babel/runtime/helpers/createClass')
|
|
|
18
18
|
var _possibleConstructorReturn = _interopDefault(require('@babel/runtime/helpers/possibleConstructorReturn'));
|
|
19
19
|
var _getPrototypeOf = _interopDefault(require('@babel/runtime/helpers/getPrototypeOf'));
|
|
20
20
|
var _inherits = _interopDefault(require('@babel/runtime/helpers/inherits'));
|
|
21
|
-
var
|
|
22
|
-
var _slicedToArray = _interopDefault(require('@babel/runtime/helpers/slicedToArray'));
|
|
21
|
+
var router = require('@reach/router');
|
|
23
22
|
var _assign = _interopDefault(require('lodash/fp/assign'));
|
|
24
23
|
var core = require('@startlibs/core');
|
|
24
|
+
var _slicedToArray = _interopDefault(require('@babel/runtime/helpers/slicedToArray'));
|
|
25
25
|
var _get = _interopDefault(require('lodash/fp/get'));
|
|
26
26
|
var _objectSpread = _interopDefault(require('@babel/runtime/helpers/objectSpread'));
|
|
27
27
|
var _uniqueId = _interopDefault(require('lodash/fp/uniqueId'));
|
|
28
|
+
var _max = _interopDefault(require('lodash/fp/max'));
|
|
28
29
|
var _identity = _interopDefault(require('lodash/fp/identity'));
|
|
29
|
-
var
|
|
30
|
+
var _isString = _interopDefault(require('lodash/fp/isString'));
|
|
30
31
|
var _toConsumableArray = _interopDefault(require('@babel/runtime/helpers/toConsumableArray'));
|
|
31
|
-
var
|
|
32
|
-
var _typeof = _interopDefault(require('@babel/runtime/helpers/typeof'));
|
|
33
|
-
var emotion = require('emotion');
|
|
32
|
+
var _isObject = _interopDefault(require('lodash/fp/isObject'));
|
|
34
33
|
var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty'));
|
|
35
|
-
var mitt = _interopDefault(require('mitt'));
|
|
36
|
-
var _debounce = _interopDefault(require('lodash/fp/debounce'));
|
|
37
34
|
var _assertThisInitialized = _interopDefault(require('@babel/runtime/helpers/assertThisInitialized'));
|
|
38
35
|
var _set = _interopDefault(require('lodash/fp/set'));
|
|
39
36
|
var _pullAt = _interopDefault(require('lodash/fp/pullAt'));
|
|
40
37
|
var _map = _interopDefault(require('lodash/fp/map'));
|
|
38
|
+
var ReactDOM = _interopDefault(require('react-dom'));
|
|
41
39
|
var reactHotLoader = require('react-hot-loader');
|
|
42
40
|
var _isFunction = _interopDefault(require('lodash/fp/isFunction'));
|
|
43
41
|
var reactIs = require('react-is');
|
|
42
|
+
var mitt = _interopDefault(require('mitt'));
|
|
43
|
+
var _typeof = _interopDefault(require('@babel/runtime/helpers/typeof'));
|
|
44
44
|
var _without = _interopDefault(require('lodash/fp/without'));
|
|
45
45
|
|
|
46
46
|
var IconComponent =
|
|
@@ -116,7 +116,8 @@ var Icon = styled__default(styled.withTheme(IconComponent)).withConfig({
|
|
|
116
116
|
return props.clickable && "\n cursor: pointer;\n &:hover {\n opacity: 0.85;\n }\n ";
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
// import {Link as RouterLink} from 'react-router-dom'
|
|
120
|
+
var Link = router.Link;
|
|
120
121
|
|
|
121
122
|
var Loading = styled__default.div.withConfig({
|
|
122
123
|
displayName: "Loading",
|
|
@@ -144,7 +145,7 @@ function _templateObject3() {
|
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
function _templateObject2() {
|
|
147
|
-
var data = _taggedTemplateLiteral(["\n ", "\n "]);
|
|
148
|
+
var data = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n "]);
|
|
148
149
|
|
|
149
150
|
_templateObject2 = function _templateObject2() {
|
|
150
151
|
return data;
|
|
@@ -154,7 +155,7 @@ function _templateObject2() {
|
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
function _templateObject() {
|
|
157
|
-
var data = _taggedTemplateLiteral(["\n position: absolute;\n top: 51%;\n transform: translateY(-50%);\n right: 1rem;\n"]);
|
|
158
|
+
var data = _taggedTemplateLiteral(["\n position: absolute;\n top: 51%;\n transform: translateY(-50%);\n right: 1rem;\n font-size: 12px;\n"]);
|
|
158
159
|
|
|
159
160
|
_templateObject = function _templateObject() {
|
|
160
161
|
return data;
|
|
@@ -179,6 +180,7 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
|
|
|
179
180
|
success = _ref.success,
|
|
180
181
|
alert = _ref.alert,
|
|
181
182
|
highlight = _ref.highlight,
|
|
183
|
+
light = _ref.light,
|
|
182
184
|
hover = _ref.hover,
|
|
183
185
|
white = _ref.white,
|
|
184
186
|
icon = _ref.icon,
|
|
@@ -204,7 +206,7 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
|
|
|
204
206
|
concealed = _ref.concealed,
|
|
205
207
|
concealedModule = _ref.concealedModule,
|
|
206
208
|
buttonRef = _ref.buttonRef,
|
|
207
|
-
props = _objectWithoutProperties(_ref, ["type", "locked", "color", "alpha", "success", "alert", "highlight", "hover", "white", "icon", "onlyIcon", "small", "withDropdown", "onlyDropdown", "outline", "dashed", "textOnly", "isLoading", "dark", "innerAs", "className", "children", "rounded", "tabIndex", "focused", "noFocus", "colorSet", "concealed", "concealedModule", "buttonRef"]);
|
|
209
|
+
props = _objectWithoutProperties(_ref, ["type", "locked", "color", "alpha", "success", "alert", "highlight", "light", "hover", "white", "icon", "onlyIcon", "small", "withDropdown", "onlyDropdown", "outline", "dashed", "textOnly", "isLoading", "dark", "innerAs", "className", "children", "rounded", "tabIndex", "focused", "noFocus", "colorSet", "concealed", "concealedModule", "buttonRef"]);
|
|
208
210
|
|
|
209
211
|
return React__default.createElement(Wrapper, _extends({
|
|
210
212
|
ref: ref || buttonRef,
|
|
@@ -218,20 +220,24 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
|
|
|
218
220
|
}), locked && React__default.createElement(LockIcon, {
|
|
219
221
|
icon: "lock"
|
|
220
222
|
}), children, isLoading && React__default.createElement(Loading, {
|
|
221
|
-
white:
|
|
222
|
-
absolute: true
|
|
223
|
+
white: !outline || !dashed || !white,
|
|
224
|
+
absolute: true,
|
|
225
|
+
size: small && '16',
|
|
226
|
+
borderWidth: small && '3'
|
|
223
227
|
}));
|
|
224
228
|
})).withConfig({
|
|
225
229
|
displayName: "Button",
|
|
226
230
|
componentId: "qe54pl-1"
|
|
227
|
-
})(["vertical-align:top;border:0;font-size:12px;border-radius:", ";background:", ";color:white;min-width:8rem;font-weight:500;display:inline-block;line-height:16px;text-align:center;padding:10px 1.25rem;outline:none;cursor:pointer;position:relative;text-decoration:none;user-select:none;:hover{background:", ";}:active{background:", ";}", " + .styled-button{margin-left:1rem;}", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
|
|
231
|
+
})(["vertical-align:top;border:0;font-size:12px;border-radius:", ";background:", ";color:white;min-width:8rem;font-weight:500;display:inline-block;line-height:16px;text-align:center;padding:10px 1.25rem;outline:none;cursor:pointer;position:relative;text-decoration:none;user-select:none;flex-shrink:0;:hover{background:", ";}:active{background:", ";}", " ", " + .styled-button{margin-left:1rem;}", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
|
|
228
232
|
return props.rounded ? '100px' : '6px';
|
|
229
233
|
}, utils.getColor, function (props) {
|
|
230
234
|
return polished.darken(0.05, utils.getColor(props, true));
|
|
231
235
|
}, function (props) {
|
|
232
236
|
return polished.darken(0.08, utils.getColor(props, true));
|
|
233
237
|
}, function (props) {
|
|
234
|
-
return
|
|
238
|
+
return props.nowrap && "\n white-space: nowrap;\n ";
|
|
239
|
+
}, function (props) {
|
|
240
|
+
return !props.noFocus && !props.isLoading && styled.css([":focus{", "}", ""], focus, function (props) {
|
|
235
241
|
return props.focused && focus;
|
|
236
242
|
});
|
|
237
243
|
}, function (props) {
|
|
@@ -244,6 +250,12 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
|
|
|
244
250
|
return props.withDropdown && styled.css(["padding-right:2.25rem;text-align:left;"]);
|
|
245
251
|
}, function (props) {
|
|
246
252
|
return props.onlyDropdown && styled.css(["", "{right:50%;transform:translate(50%,-50%);}"], DropdownIcon);
|
|
253
|
+
}, function (props) {
|
|
254
|
+
return props.light && styled.css(["background:", ";color:", ";:hover{background:", ";}:active{background:", ";}"], utils.getColor('bluishGray'), utils.getColor('gray120'), function (props) {
|
|
255
|
+
return polished.darken(0.05, utils.getColor('bluishGray')(props));
|
|
256
|
+
}, function (props) {
|
|
257
|
+
return polished.darken(0.08, utils.getColor('bluishGray')(props));
|
|
258
|
+
});
|
|
247
259
|
}, function (props) {
|
|
248
260
|
return (props.outline || props.dashed || props.textOnly) && styled.css(["color:", ";background:none;", ",", "{color:", ";}:before{content:'';border:1px ", " ", ";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:", ";pointer-events:none;}:hover{background-color:rgba(0,0,0,0.05);}:active{background-color:rgba(0,0,0,0.08);}:focus{:before{box-shadow:0 0 0 2px rgba(0,0,0,0.1);", "}:after{content:none;}}"], props.white ? 'white' : props.highlight ? utils.getColor('main') : 'rgba(0,0,0,0.6)', Icon, DropdownIcon, props.white ? 'white' : props.highlight ? utils.getColor('main') : 'rgba(0,0,0,0.5)', props.outline ? 'solid' : props.dashed ? 'dashed' : '', props.white ? 'white' : props.highlight ? utils.getColor('main') : 'rgba(0,0,0,0.35)', props.rounded ? '100px' : '6px', props.textOnly && 'content: none;');
|
|
249
261
|
}, function (props) {
|
|
@@ -253,10 +265,16 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
|
|
|
253
265
|
}, function (props) {
|
|
254
266
|
return props.isLoading && styled.css(["color:transparent !important;pointer-events:none;", "{visibility:hidden;}"], Icon);
|
|
255
267
|
}, utils.media.mobile(_templateObject2(), function (props) {
|
|
256
|
-
return !props.small && styled.css(["padding:13px 1.5rem;font-size:13px;"]);
|
|
268
|
+
return !props.small && !props.onlyIcon && styled.css(["padding:13px 1.5rem;font-size:13px;"]);
|
|
269
|
+
}, function (props) {
|
|
270
|
+
return !props.small && props.onlyIcon && styled.css(["min-width:3.5rem;min-height:3.5rem;"]);
|
|
271
|
+
}, function (props) {
|
|
272
|
+
return props.withDropdown && styled.css(["padding-right:2.5rem;", "{right:14px;}"], DropdownIcon);
|
|
257
273
|
}), utils.media.max(359)(_templateObject3(), function (props) {
|
|
258
|
-
return !props.small && !props.onlyIcon && !props.onlyDropdown && styled.css(["
|
|
259
|
-
}),
|
|
274
|
+
return !props.small && !props.onlyIcon && !props.onlyDropdown && styled.css(["min-width:0;"]);
|
|
275
|
+
}), function (props) {
|
|
276
|
+
return props.fullwidth && "\n width: 100%;\n ";
|
|
277
|
+
}, utils.customTheme("Button"));
|
|
260
278
|
|
|
261
279
|
Button.a = function (props) {
|
|
262
280
|
return React__default.createElement(Button, _extends({}, props, {
|
|
@@ -309,6 +327,10 @@ function (_React$Component) {
|
|
|
309
327
|
value: function componentDidCatch(e, info) {
|
|
310
328
|
var error = e && e.stack;
|
|
311
329
|
|
|
330
|
+
if (e === null || e === void 0 ? void 0 : e.notFound) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
|
|
312
334
|
try {
|
|
313
335
|
if (!e || !e.stack) {
|
|
314
336
|
JSON.stringify(e);
|
|
@@ -365,100 +387,10 @@ function (_React$Component) {
|
|
|
365
387
|
return ErrorBoundary;
|
|
366
388
|
}(React__default.Component); // StartlibsProvider.registerInternal('ErrorBoundary',ErrorBoundary)
|
|
367
389
|
|
|
368
|
-
var scrollWidth = function () {
|
|
369
|
-
if (!window.document) return 0;
|
|
370
|
-
var html = document.documentElement;
|
|
371
|
-
var oldOverflow = html.style.overflowY;
|
|
372
|
-
html.style.overflowY = 'scroll';
|
|
373
|
-
var width = window.innerWidth - html.clientWidth;
|
|
374
|
-
html.style.overflowY = oldOverflow;
|
|
375
|
-
return width;
|
|
376
|
-
}();
|
|
377
|
-
|
|
378
|
-
var callIfFunction = function callIfFunction(prop) {
|
|
379
|
-
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
380
|
-
args[_key6 - 1] = arguments[_key6];
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
return typeof prop === "function" ? prop.apply(void 0, args) : prop;
|
|
384
|
-
};
|
|
385
|
-
var ifUndefined = function ifUndefined(v) {
|
|
386
|
-
for (var _len10 = arguments.length, or = new Array(_len10 > 1 ? _len10 - 1 : 0), _key10 = 1; _key10 < _len10; _key10++) {
|
|
387
|
-
or[_key10 - 1] = arguments[_key10];
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
return v !== undefined ? v : or.length === 1 ? or[0] : ifUndefined.apply(void 0, [or[0]].concat(_toConsumableArray(or.slice(1))));
|
|
391
|
-
};
|
|
392
|
-
|
|
393
390
|
function _templateObject$1() {
|
|
394
|
-
var data = _taggedTemplateLiteral(["\n ", ""]);
|
|
395
|
-
|
|
396
|
-
_templateObject$1 = function _templateObject() {
|
|
397
|
-
return data;
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
return data;
|
|
401
|
-
}
|
|
402
|
-
var media = function media() {
|
|
403
|
-
for (var _len = arguments.length, sizePairs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
404
|
-
sizePairs[_key] = arguments[_key];
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
return function () {
|
|
408
|
-
return styled.css(["@media screen and ", "{", "}"], sizePairs.map(function (_ref4) {
|
|
409
|
-
var _ref5 = _slicedToArray(_ref4, 2),
|
|
410
|
-
size = _ref5[0],
|
|
411
|
-
type = _ref5[1];
|
|
412
|
-
|
|
413
|
-
return "(".concat(type, ": ").concat(size + scrollWidth, "px)");
|
|
414
|
-
}).join(' and '), styled.css.apply(void 0, arguments));
|
|
415
|
-
};
|
|
416
|
-
};
|
|
417
|
-
media.mobile = media([600, 'max-width']);
|
|
418
|
-
|
|
419
|
-
media.between = function (min, max) {
|
|
420
|
-
return media([min, 'min-width'], [max, 'max-width']);
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
media.max = function (n) {
|
|
424
|
-
return media([n, 'max-width']);
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
media.min = function (n) {
|
|
428
|
-
return media([n, 'min-width']);
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
media.desktop = media([601, 'min-width']);
|
|
432
|
-
|
|
433
|
-
var getFrameOffset = function getFrameOffset(i, total) {
|
|
434
|
-
return Math.round(i * 100 / (total - 1));
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
var oneWayAnimation = function oneWayAnimation() {
|
|
438
|
-
for (var _len2 = arguments.length, frames = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
439
|
-
frames[_key2] = arguments[_key2];
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return emotion.keyframes(_templateObject$1(), frames.map(function (frame, i) {
|
|
443
|
-
return !frame ? '' : "".concat(getFrameOffset(i, frames.length), "% {\n ").concat(frame, "\n }");
|
|
444
|
-
}));
|
|
445
|
-
};
|
|
446
|
-
var twoWayAnimation = function twoWayAnimation() {
|
|
447
|
-
for (var _len3 = arguments.length, frames = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
448
|
-
frames[_key3] = arguments[_key3];
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
return [frames, _.reverse(frames)].map(function (frames) {
|
|
452
|
-
return oneWayAnimation.apply(void 0, _toConsumableArray(frames));
|
|
453
|
-
});
|
|
454
|
-
};
|
|
455
|
-
var identityTranslateFrames = oneWayAnimation('transform: translateY(0);', 'transform: translateY(0);');
|
|
456
|
-
var identityOpacityFrames = oneWayAnimation('opacity: 1;', 'opacity:1;');
|
|
457
|
-
|
|
458
|
-
function _templateObject$2() {
|
|
459
391
|
var data = _taggedTemplateLiteral(["test"]);
|
|
460
392
|
|
|
461
|
-
_templateObject$
|
|
393
|
+
_templateObject$1 = function _templateObject() {
|
|
462
394
|
return data;
|
|
463
395
|
};
|
|
464
396
|
|
|
@@ -470,13 +402,39 @@ var getMargins = function getMargins(domNode) {
|
|
|
470
402
|
marginTop = _window$getComputedSt.marginTop,
|
|
471
403
|
marginLeft = _window$getComputedSt.marginLeft,
|
|
472
404
|
marginBottom = _window$getComputedSt.marginBottom,
|
|
473
|
-
marginRight = _window$getComputedSt.marginRight
|
|
405
|
+
marginRight = _window$getComputedSt.marginRight,
|
|
406
|
+
paddingTop = _window$getComputedSt.paddingTop;
|
|
474
407
|
|
|
475
408
|
return {
|
|
476
409
|
marginTop: marginTop,
|
|
477
410
|
marginLeft: marginLeft,
|
|
478
411
|
marginBottom: marginBottom,
|
|
479
|
-
marginRight: marginRight
|
|
412
|
+
marginRight: marginRight,
|
|
413
|
+
paddingTop: paddingTop
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
var getParentProperties = function getParentProperties(parentNode) {
|
|
418
|
+
if (!parentNode) return {};
|
|
419
|
+
|
|
420
|
+
var _window$getComputedSt2 = window.getComputedStyle(parentNode),
|
|
421
|
+
marginTop = _window$getComputedSt2.marginTop,
|
|
422
|
+
marginLeft = _window$getComputedSt2.marginLeft,
|
|
423
|
+
marginBottom = _window$getComputedSt2.marginBottom,
|
|
424
|
+
marginRight = _window$getComputedSt2.marginRight,
|
|
425
|
+
paddingBottom = _window$getComputedSt2.paddingBottom,
|
|
426
|
+
paddingTop = _window$getComputedSt2.paddingTop;
|
|
427
|
+
|
|
428
|
+
return {
|
|
429
|
+
parentStyle: {
|
|
430
|
+
marginTop: marginTop,
|
|
431
|
+
marginLeft: marginLeft,
|
|
432
|
+
marginBottom: marginBottom,
|
|
433
|
+
marginRight: marginRight,
|
|
434
|
+
paddingBottom: paddingBottom,
|
|
435
|
+
paddingTop: paddingTop
|
|
436
|
+
},
|
|
437
|
+
parentNode: parentNode
|
|
480
438
|
};
|
|
481
439
|
};
|
|
482
440
|
|
|
@@ -504,12 +462,11 @@ var toPosition = function toPosition(domNode) {
|
|
|
504
462
|
return _objectSpread({
|
|
505
463
|
domNode: domNode,
|
|
506
464
|
nextSibling: domNode.nextSibling,
|
|
507
|
-
parentNode: domNode.parentNode,
|
|
508
465
|
top: finalPosition ? domNode.offsetTop : top - parentRect.top,
|
|
509
466
|
left: finalPosition ? domNode.offsetLeft : left - parentRect.left,
|
|
510
467
|
height: height,
|
|
511
468
|
width: width
|
|
512
|
-
}, margins);
|
|
469
|
+
}, getParentProperties(domNode.parentNode), margins);
|
|
513
470
|
};
|
|
514
471
|
|
|
515
472
|
var sumWithPx = function sumWithPx() {
|
|
@@ -554,7 +511,7 @@ var defaultSwitchAnimation = utils.oneWayAnimation("opacity: 1;", "opacity: 0;",
|
|
|
554
511
|
var SHORT_ANIMATIONS = {
|
|
555
512
|
fadeIn: defaultEnterAnimation
|
|
556
513
|
};
|
|
557
|
-
var b = styled.createGlobalStyle(_templateObject$
|
|
514
|
+
var b = styled.createGlobalStyle(_templateObject$1());
|
|
558
515
|
|
|
559
516
|
var applyDefault = function applyDefault(k) {
|
|
560
517
|
return SHORT_ANIMATIONS[k] || k;
|
|
@@ -587,15 +544,15 @@ var cloneWrapper = function cloneWrapper(element) {
|
|
|
587
544
|
return tempWrapper.append(c);
|
|
588
545
|
});
|
|
589
546
|
|
|
590
|
-
var _window$
|
|
591
|
-
display = _window$
|
|
592
|
-
width = _window$
|
|
593
|
-
height = _window$
|
|
594
|
-
padding = _window$
|
|
595
|
-
borderLeftWidth = _window$
|
|
596
|
-
borderRightWidth = _window$
|
|
597
|
-
borderBottomWidth = _window$
|
|
598
|
-
borderTopWidth = _window$
|
|
547
|
+
var _window$getComputedSt3 = window.getComputedStyle(element),
|
|
548
|
+
display = _window$getComputedSt3.display,
|
|
549
|
+
width = _window$getComputedSt3.width,
|
|
550
|
+
height = _window$getComputedSt3.height,
|
|
551
|
+
padding = _window$getComputedSt3.padding,
|
|
552
|
+
borderLeftWidth = _window$getComputedSt3.borderLeftWidth,
|
|
553
|
+
borderRightWidth = _window$getComputedSt3.borderRightWidth,
|
|
554
|
+
borderBottomWidth = _window$getComputedSt3.borderBottomWidth,
|
|
555
|
+
borderTopWidth = _window$getComputedSt3.borderTopWidth;
|
|
599
556
|
|
|
600
557
|
Object.assign(tempWrapper.style, {
|
|
601
558
|
display: display,
|
|
@@ -696,6 +653,8 @@ var getClientRectAnimation = function getClientRectAnimation(oldSnap, newSnap) {
|
|
|
696
653
|
skipTransform = _ref5.skipTransform;
|
|
697
654
|
|
|
698
655
|
if (hasClientRectChanged(oldSnap, newSnap)) {
|
|
656
|
+
var _oldSnap$parentStyle, _newSnap$parentStyle, _oldSnap$parentStyle2, _newSnap$parentStyle2;
|
|
657
|
+
|
|
699
658
|
var node = newSnap.domNode;
|
|
700
659
|
var offsetLeft = node.offsetLeft,
|
|
701
660
|
offsetTop = node.offsetTop,
|
|
@@ -712,8 +671,8 @@ var getClientRectAnimation = function getClientRectAnimation(oldSnap, newSnap) {
|
|
|
712
671
|
var finalPadding = '';
|
|
713
672
|
|
|
714
673
|
if (deltaHeight > 0) {
|
|
715
|
-
var _window$
|
|
716
|
-
paddingBottom = _window$
|
|
674
|
+
var _window$getComputedSt4 = window.getComputedStyle(node),
|
|
675
|
+
paddingBottom = _window$getComputedSt4.paddingBottom;
|
|
717
676
|
|
|
718
677
|
finalPadding = 'padding-bottom:' + paddingBottom + ';';
|
|
719
678
|
heightFix = "padding-bottom: ".concat(sumWithPx(deltaHeight, paddingBottom));
|
|
@@ -721,20 +680,81 @@ var getClientRectAnimation = function getClientRectAnimation(oldSnap, newSnap) {
|
|
|
721
680
|
|
|
722
681
|
var overflowFix = scrollHeight > clientHeight || scrollWidth > clientWidth ? "overflow: hidden" : "";
|
|
723
682
|
var transform = (left !== 0 || top !== 0) && !skipTransform ? "transform: translate(".concat(left, "px,").concat(top, "px);") : '';
|
|
683
|
+
var parentPaddingTopDelta = (parseInt((_oldSnap$parentStyle = oldSnap.parentStyle) === null || _oldSnap$parentStyle === void 0 ? void 0 : _oldSnap$parentStyle.paddingTop) || 0) - (parseInt((_newSnap$parentStyle = newSnap.parentStyle) === null || _newSnap$parentStyle === void 0 ? void 0 : _newSnap$parentStyle.paddingTop) || 0);
|
|
684
|
+
var parentPaddingBottomDelta = (parseInt((_oldSnap$parentStyle2 = oldSnap.parentStyle) === null || _oldSnap$parentStyle2 === void 0 ? void 0 : _oldSnap$parentStyle2.paddingBottom) || 0) - (parseInt((_newSnap$parentStyle2 = newSnap.parentStyle) === null || _newSnap$parentStyle2 === void 0 ? void 0 : _newSnap$parentStyle2.paddingBottom) || 0);
|
|
685
|
+
var oldMarginTop = (parseInt(oldSnap.marginTop) || 0) + parentPaddingTopDelta;
|
|
686
|
+
var oldMarginBottom = (parseInt(oldSnap.marginBottom) || 0) + parentPaddingBottomDelta;
|
|
724
687
|
var oldTransform = node.style.transform;
|
|
725
|
-
return [utils.oneWayAnimation("\n ".concat(transform, "\n ").concat(heightFix, "\n ").concat(overflowFix, "\n margin-top:").concat(
|
|
688
|
+
return [utils.oneWayAnimation("\n ".concat(transform, "\n ").concat(heightFix, "\n ").concat(overflowFix, "\n margin-top: ").concat(oldMarginTop, "px;\n margin-bottom: ").concat(oldMarginBottom, "px;\n width: ").concat(oldSnap.width, "px;\n height: ").concat(oldSnap.height, "px;\n "), "\n ".concat(finalPadding, "\n ").concat(oldTransform ? "transform:".concat(oldTransform) : '', "\n ").concat(overflowFix, "\n margin-top:").concat(newSnap.marginTop || 0, "px;\n margin-bottom:").concat(newSnap.marginBottom || 0, "px;\n width: ").concat(newSnap.width, "px;\n height: ").concat(newSnap.height, "px;\n "))];
|
|
726
689
|
} else {
|
|
727
690
|
return [];
|
|
728
691
|
}
|
|
729
692
|
};
|
|
730
693
|
|
|
731
|
-
var
|
|
732
|
-
var
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
694
|
+
var getClientRectAnimationForSwitch = function getClientRectAnimationForSwitch(oldSnap, newSnap) {
|
|
695
|
+
var _ref6 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
696
|
+
skipTransform = _ref6.skipTransform;
|
|
697
|
+
|
|
698
|
+
if (hasClientRectChanged(oldSnap, newSnap)) {
|
|
699
|
+
var _node$parentNode, _node$parentNode2;
|
|
700
|
+
|
|
701
|
+
var node = newSnap.domNode;
|
|
702
|
+
var offsetLeft = node.offsetLeft,
|
|
703
|
+
offsetTop = node.offsetTop,
|
|
704
|
+
scrollHeight = node.scrollHeight,
|
|
705
|
+
clientHeight = node.clientHeight,
|
|
706
|
+
scrollWidth = node.scrollWidth,
|
|
707
|
+
clientWidth = node.clientWidth;
|
|
708
|
+
var scrollTop = ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.scrollTop) || 0;
|
|
709
|
+
var scrollLeft = ((_node$parentNode2 = node.parentNode) === null || _node$parentNode2 === void 0 ? void 0 : _node$parentNode2.scrollLeft) || 0; // get margin-bottom
|
|
710
|
+
|
|
711
|
+
var prevBorder = node.style.border;
|
|
712
|
+
node.style.border = '1px solid transparent';
|
|
713
|
+
var borderHeight = node.clientHeight;
|
|
714
|
+
node.style.border = prevBorder; // get negative margin top
|
|
715
|
+
|
|
716
|
+
var prevPadding = newSnap.paddingTop;
|
|
717
|
+
var nonPaddingFixTop = newSnap.clonedNode.getBoundingClientRect().top;
|
|
718
|
+
var topWithPaddingFix = nonPaddingFixTop;
|
|
719
|
+
|
|
720
|
+
if (!parseInt(prevPadding)) {
|
|
721
|
+
node.style.paddingTop = '1px';
|
|
722
|
+
topWithPaddingFix = newSnap.clonedNode.getBoundingClientRect().top;
|
|
723
|
+
node.style.paddingTop = '';
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
var newSnapNegativeTopMarginDelta = topWithPaddingFix - nonPaddingFixTop;
|
|
727
|
+
var newSnapBottomMarginDelta = clientHeight - borderHeight;
|
|
728
|
+
var left = oldSnap.left - offsetLeft + scrollLeft;
|
|
729
|
+
var top = oldSnap.top - offsetTop + scrollTop - newSnapNegativeTopMarginDelta;
|
|
730
|
+
var deltaHeight = oldSnap.height - newSnap.height;
|
|
731
|
+
var heightFix = '';
|
|
732
|
+
var finalPadding = '';
|
|
733
|
+
|
|
734
|
+
if (deltaHeight > 0) {
|
|
735
|
+
var _window$getComputedSt5 = window.getComputedStyle(node),
|
|
736
|
+
paddingBottom = _window$getComputedSt5.paddingBottom;
|
|
737
|
+
|
|
738
|
+
finalPadding = 'padding-bottom:' + paddingBottom + ';';
|
|
739
|
+
heightFix = "padding-bottom: ".concat(sumWithPx(deltaHeight, paddingBottom), ";");
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
var overflowFix = scrollHeight > clientHeight || scrollWidth > clientWidth ? "overflow: hidden;" : "";
|
|
743
|
+
var transform = (left !== 0 || top !== 0) && !skipTransform ? "transform: translate(".concat(left, "px,").concat(top, "px);") : '';
|
|
744
|
+
var oldTransform = node.style.transform;
|
|
745
|
+
return [utils.oneWayAnimation("\n ".concat(transform, "\n ").concat(heightFix, "\n ").concat(overflowFix, "\n width: ").concat(oldSnap.width, "px;\n height: ").concat(oldSnap.height, "px;\n "), "\n ".concat(finalPadding, "\n ").concat(oldTransform ? "transform:".concat(oldTransform, ";") : '', "\n ").concat(overflowFix, "\n width: ").concat(newSnap.width, "px;\n height: ").concat(newSnap.height - newSnapBottomMarginDelta, "px;\n "))];
|
|
746
|
+
} else {
|
|
747
|
+
return [];
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
var willPlaySwitch = function willPlaySwitch(oldSnap, newSnap, _ref7) {
|
|
752
|
+
var switchIn = _ref7.switchIn,
|
|
753
|
+
switchOut = _ref7.switchOut,
|
|
754
|
+
switchAnimation = _ref7.switchAnimation,
|
|
755
|
+
timing = _ref7.timing,
|
|
756
|
+
_ref7$transformHeight = _ref7.transformHeight,
|
|
757
|
+
transformHeight = _ref7$transformHeight === void 0 ? _identity : _ref7$transformHeight;
|
|
738
758
|
var realWrapper = newSnap.domNode;
|
|
739
759
|
var newChildren = [].slice.call(realWrapper.children); // realWrapper.style.willChange = 'width,height,margin-top;'
|
|
740
760
|
|
|
@@ -751,7 +771,7 @@ var playSwitch = function playSwitch(oldSnap, newSnap, _ref6) {
|
|
|
751
771
|
// oldSnap.clonedNode.style.willChange = 'width,height,opacity'
|
|
752
772
|
|
|
753
773
|
var realWrapperRect = realWrapper.getBoundingClientRect();
|
|
754
|
-
var resizeToNew = utils.oneWayAnimation("\n overflow: hidden;\n width: ".concat(
|
|
774
|
+
var resizeToNew = utils.oneWayAnimation("\n overflow: hidden;\n width: ".concat(oldSnap.width, "px;\n height: ").concat(oldSnap.height, "px;\n "), "\n overflow: hidden;\n width: ".concat(newSnap.clonedNode.style.width, ";\n height: ").concat(utils.callIfFunction(transformHeight, newSnap.clonedNode.style.height, realWrapperRect), ";\n "));
|
|
755
775
|
childMAp(newChildren, function (c) {
|
|
756
776
|
if (c.dataset && !c.dataset.noFlip) {
|
|
757
777
|
if (c.style.opacity) {
|
|
@@ -768,12 +788,14 @@ var playSwitch = function playSwitch(oldSnap, newSnap, _ref6) {
|
|
|
768
788
|
});
|
|
769
789
|
var resizeOld = oldSnap.width > newSnap.width || oldSnap.height > newSnap.height ? [resizeToNew] : [resizeToNew];
|
|
770
790
|
var resizeNew = oldSnap.width < newSnap.width || oldSnap.height < newSnap.height ? [resizeToNew] : [resizeToNew];
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
791
|
+
return function () {
|
|
792
|
+
morph(oldSnap.clonedNode, formatAnimation([].concat(switchOut || switchAnimation, resizeOld), timing), function () {
|
|
793
|
+
return oldSnap.clonedNode.remove();
|
|
794
|
+
});
|
|
795
|
+
newSnap.clonedNode.style.opacity = '0';
|
|
796
|
+
continueSwitchCallbacks.set(realWrapper, continueSwitchOnClone(realWrapper));
|
|
797
|
+
morph(newSnap.clonedNode, formatAnimation([formatAnimation(switchIn || switchAnimation, timing, !switchIn)].concat(resizeNew), timing), finishSwitchNew(newSnap.clonedNode, realWrapper));
|
|
798
|
+
};
|
|
777
799
|
};
|
|
778
800
|
|
|
779
801
|
var getDelays = function getDelays(el, animation) {
|
|
@@ -815,9 +837,9 @@ function (_React$Component) {
|
|
|
815
837
|
return Snapshoter;
|
|
816
838
|
}(React__default.Component);
|
|
817
839
|
|
|
818
|
-
var useFlip = function useFlip(
|
|
819
|
-
var on =
|
|
820
|
-
moveOn =
|
|
840
|
+
var useFlip = function useFlip(_ref8) {
|
|
841
|
+
var on = _ref8.on,
|
|
842
|
+
moveOn = _ref8.moveOn;
|
|
821
843
|
core.useHiddenFill(React__default.createElement(Snapshoter, {
|
|
822
844
|
on: on,
|
|
823
845
|
moveOn: moveOn,
|
|
@@ -859,16 +881,21 @@ var willUseFlip = function willUseFlip() {
|
|
|
859
881
|
var useEnterAnimation = function useEnterAnimation(ref) {
|
|
860
882
|
var onEnter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultEnterAnimation;
|
|
861
883
|
|
|
862
|
-
var
|
|
863
|
-
onEnterEnd =
|
|
864
|
-
|
|
865
|
-
timing =
|
|
884
|
+
var _ref9 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
885
|
+
onEnterEnd = _ref9.onEnterEnd,
|
|
886
|
+
_ref9$timing = _ref9.timing,
|
|
887
|
+
timing = _ref9$timing === void 0 ? defaultAnimationMaker : _ref9$timing,
|
|
888
|
+
enterEffect = _ref9.enterEffect;
|
|
866
889
|
|
|
867
890
|
React.useLayoutEffect(function () {
|
|
868
891
|
if (!morphEnabled && onEnter && ref.current) {
|
|
869
892
|
var el = ref.current;
|
|
870
893
|
var animation = formatAnimation(onEnter, timing);
|
|
871
|
-
|
|
894
|
+
var endEffect = utils.callIfFunction(enterEffect, el);
|
|
895
|
+
morph(el, animation, function () {
|
|
896
|
+
utils.callIfFunction(onEnterEnd);
|
|
897
|
+
utils.callIfFunction(endEffect, el);
|
|
898
|
+
});
|
|
872
899
|
enterChildrenCallback(timing);
|
|
873
900
|
}
|
|
874
901
|
}, [onEnter]);
|
|
@@ -877,16 +904,17 @@ var willUseFlip = function willUseFlip() {
|
|
|
877
904
|
var useLeaveAnimation = function useLeaveAnimation(ref) {
|
|
878
905
|
var onLeave = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultEnterAnimation;
|
|
879
906
|
|
|
880
|
-
var
|
|
881
|
-
removeRef =
|
|
882
|
-
|
|
883
|
-
timing =
|
|
884
|
-
|
|
885
|
-
nestedFlip =
|
|
886
|
-
|
|
887
|
-
events =
|
|
888
|
-
|
|
889
|
-
reverse =
|
|
907
|
+
var _ref10 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
908
|
+
removeRef = _ref10.ref,
|
|
909
|
+
leaveEffect = _ref10.leaveEffect,
|
|
910
|
+
_ref10$timing = _ref10.timing,
|
|
911
|
+
timing = _ref10$timing === void 0 ? defaultAnimationMaker : _ref10$timing,
|
|
912
|
+
_ref10$nestedFlip = _ref10.nestedFlip,
|
|
913
|
+
nestedFlip = _ref10$nestedFlip === void 0 ? false : _ref10$nestedFlip,
|
|
914
|
+
_ref10$events = _ref10.events,
|
|
915
|
+
events = _ref10$events === void 0 ? {} : _ref10$events,
|
|
916
|
+
_ref10$reverse = _ref10.reverse,
|
|
917
|
+
reverse = _ref10$reverse === void 0 ? true : _ref10$reverse;
|
|
890
918
|
|
|
891
919
|
React.useLayoutEffect(function () {
|
|
892
920
|
return function () {
|
|
@@ -898,6 +926,12 @@ var willUseFlip = function willUseFlip() {
|
|
|
898
926
|
var isNested = utils.callIfFunction(nestedFlip);
|
|
899
927
|
var clone = isNested ? el : el.cloneNode(true);
|
|
900
928
|
|
|
929
|
+
utils._s.each(function (callback, type) {
|
|
930
|
+
return clone.addEventListener(type, callback);
|
|
931
|
+
}, events);
|
|
932
|
+
|
|
933
|
+
var endEffect = utils.callIfFunction(leaveEffect, clone, el);
|
|
934
|
+
|
|
901
935
|
if (removeRef) {
|
|
902
936
|
removeRef.current = clone;
|
|
903
937
|
}
|
|
@@ -905,11 +939,7 @@ var willUseFlip = function willUseFlip() {
|
|
|
905
939
|
if (!isNested) {
|
|
906
940
|
el.parentNode.insertBefore(clone, el);
|
|
907
941
|
} // sometimes the clone may need to trigger events (usual case: onmouseover to reopen the element)
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
utils._s.each(function (callback, type) {
|
|
911
|
-
return clone.addEventListener(type, callback);
|
|
912
|
-
}, events); // allow clone to be continued by another animation
|
|
942
|
+
// allow clone to be continued by another animation
|
|
913
943
|
|
|
914
944
|
|
|
915
945
|
controlElement = clone; // the animation
|
|
@@ -918,18 +948,27 @@ var willUseFlip = function willUseFlip() {
|
|
|
918
948
|
morph(clone, animation, function () {
|
|
919
949
|
clone.remove();
|
|
920
950
|
disableMorph();
|
|
951
|
+
utils.callIfFunction(endEffect, clone, el);
|
|
921
952
|
});
|
|
922
953
|
}; // wait for current animation to end and then animate
|
|
923
954
|
|
|
924
955
|
|
|
925
956
|
if (clone.style.animation) {
|
|
957
|
+
var maxAnimationTime = _max((clone.style.animationDuration.split(",") || ["0.25s"]).map(function (s) {
|
|
958
|
+
return parseFloat(s.trim() || "0.25") * (s.indexOf("m") > 0 ? 1 : 1000);
|
|
959
|
+
}));
|
|
960
|
+
|
|
961
|
+
var timeoutRef = {};
|
|
962
|
+
|
|
926
963
|
var animationEnd = function animationEnd(e) {
|
|
927
|
-
|
|
928
|
-
e.stopImmediatePropagation();
|
|
964
|
+
clearTimeout(timeoutRef.current || -1);
|
|
929
965
|
clone.removeEventListener('animationend', animationEnd);
|
|
966
|
+
clone.animationDelay = '';
|
|
967
|
+
e === null || e === void 0 ? void 0 : e.stopImmediatePropagation();
|
|
930
968
|
setTimeout(animate, 1);
|
|
931
969
|
};
|
|
932
970
|
|
|
971
|
+
timeoutRef.current = setTimeout(animationEnd, maxAnimationTime);
|
|
933
972
|
clone.addEventListener('animationend', animationEnd);
|
|
934
973
|
clone.style.animationDelay = getDelays(el, clone.style.animation);
|
|
935
974
|
} else {
|
|
@@ -943,9 +982,9 @@ var willUseFlip = function willUseFlip() {
|
|
|
943
982
|
var useMorphAnimation = function useMorphAnimation(ref) {
|
|
944
983
|
var ready = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
945
984
|
|
|
946
|
-
var
|
|
947
|
-
|
|
948
|
-
timing =
|
|
985
|
+
var _ref11 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
986
|
+
_ref11$timing = _ref11.timing,
|
|
987
|
+
timing = _ref11$timing === void 0 ? defaultAnimationMaker : _ref11$timing;
|
|
949
988
|
|
|
950
989
|
React.useLayoutEffect(function () {
|
|
951
990
|
if (ready && controlElement && ref.current) {
|
|
@@ -972,10 +1011,10 @@ var willUseFlip = function willUseFlip() {
|
|
|
972
1011
|
});
|
|
973
1012
|
|
|
974
1013
|
if (rectAnimation.length) {
|
|
975
|
-
|
|
1014
|
+
willPlaySwitch(oldSnap, newSnap, {
|
|
976
1015
|
switchAnimation: defaultSwitchAnimation,
|
|
977
1016
|
timing: timing
|
|
978
|
-
});
|
|
1017
|
+
})();
|
|
979
1018
|
}
|
|
980
1019
|
|
|
981
1020
|
controlElement.remove();
|
|
@@ -993,8 +1032,8 @@ var willUseFlip = function willUseFlip() {
|
|
|
993
1032
|
};
|
|
994
1033
|
|
|
995
1034
|
var useNestedEnterAnimation = function useNestedEnterAnimation(ref, onEnter) {
|
|
996
|
-
var
|
|
997
|
-
timing =
|
|
1035
|
+
var _ref12 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
1036
|
+
timing = _ref12.timing;
|
|
998
1037
|
|
|
999
1038
|
useRegisterEnter(function (parentTiming) {
|
|
1000
1039
|
var el = ref.current;
|
|
@@ -1005,9 +1044,9 @@ var willUseFlip = function willUseFlip() {
|
|
|
1005
1044
|
};
|
|
1006
1045
|
|
|
1007
1046
|
var useNestLeaveAnimation = function useNestLeaveAnimation(ref, onLeave) {
|
|
1008
|
-
var
|
|
1009
|
-
timing =
|
|
1010
|
-
events =
|
|
1047
|
+
var _ref13 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
1048
|
+
timing = _ref13.timing,
|
|
1049
|
+
events = _ref13.events;
|
|
1011
1050
|
|
|
1012
1051
|
useRegisterLeave(function (parentTiming) {
|
|
1013
1052
|
var el = ref.current;
|
|
@@ -1022,7 +1061,9 @@ var willUseFlip = function willUseFlip() {
|
|
|
1022
1061
|
|
|
1023
1062
|
return function (ref) {
|
|
1024
1063
|
React.useLayoutEffect(function () {
|
|
1025
|
-
|
|
1064
|
+
var _ref$current;
|
|
1065
|
+
|
|
1066
|
+
if ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.dataset) {
|
|
1026
1067
|
ref.current.dataset.morphId = morphId;
|
|
1027
1068
|
}
|
|
1028
1069
|
});
|
|
@@ -1062,21 +1103,22 @@ var willUseFlipSwitch = function willUseFlipSwitch() {
|
|
|
1062
1103
|
};
|
|
1063
1104
|
|
|
1064
1105
|
return function (ref, onEnter, onLeave) {
|
|
1065
|
-
var
|
|
1066
|
-
|
|
1067
|
-
timing =
|
|
1068
|
-
|
|
1069
|
-
switchAnimation =
|
|
1070
|
-
effect =
|
|
1106
|
+
var _ref14 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
|
|
1107
|
+
_ref14$timing = _ref14.timing,
|
|
1108
|
+
timing = _ref14$timing === void 0 ? defaultAnimationMaker : _ref14$timing,
|
|
1109
|
+
_ref14$switchAnimatio = _ref14.switchAnimation,
|
|
1110
|
+
switchAnimation = _ref14$switchAnimatio === void 0 ? defaultSwitchAnimation : _ref14$switchAnimatio,
|
|
1111
|
+
effect = _ref14.effect;
|
|
1071
1112
|
|
|
1072
1113
|
React.useLayoutEffect(function () {
|
|
1073
1114
|
if (oldSnap && ref.current) {
|
|
1074
1115
|
var newSnap = getTempWrapper(ref.current, {
|
|
1075
1116
|
withMargins: true
|
|
1076
1117
|
});
|
|
1118
|
+
var switchToPlay = _identity;
|
|
1077
1119
|
|
|
1078
1120
|
if (oldSnap.clonedNode) {
|
|
1079
|
-
|
|
1121
|
+
switchToPlay = willPlaySwitch(oldSnap, newSnap, {
|
|
1080
1122
|
switchIn: utils.callIfFunction(onEnter),
|
|
1081
1123
|
switchOut: utils.callIfFunction(onLeave),
|
|
1082
1124
|
switchAnimation: utils.callIfFunction(switchAnimation),
|
|
@@ -1084,8 +1126,9 @@ var willUseFlipSwitch = function willUseFlipSwitch() {
|
|
|
1084
1126
|
});
|
|
1085
1127
|
}
|
|
1086
1128
|
|
|
1087
|
-
var animation =
|
|
1088
|
-
var endEffect = utils.callIfFunction(effect, oldSnap.clonedNode, newSnap.clonedNode);
|
|
1129
|
+
var animation = getClientRectAnimationForSwitch(oldSnap, newSnap);
|
|
1130
|
+
var endEffect = utils.callIfFunction(effect, oldSnap.clonedNode, newSnap.clonedNode, ref.current);
|
|
1131
|
+
switchToPlay();
|
|
1089
1132
|
morph(newSnap.domNode, formatAnimation(animation, timing), function () {
|
|
1090
1133
|
return utils.callIfFunction(endEffect, oldSnap.clonedNode, newSnap.clonedNode);
|
|
1091
1134
|
});
|
|
@@ -1108,8 +1151,8 @@ var _willUseFlip = willUseFlip(),
|
|
|
1108
1151
|
var useFlipAnimation = function useFlipAnimation(ref, onEnterOrBoth) {
|
|
1109
1152
|
var onLeaveOrIgnore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
1110
1153
|
var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1111
|
-
var onEnter = ifUndefined(onEnterOrBoth && onEnterOrBoth.onEnter, onEnterOrBoth);
|
|
1112
|
-
var onLeave = ifUndefined(onEnterOrBoth && onEnterOrBoth.onLeave, onLeaveOrIgnore);
|
|
1154
|
+
var onEnter = utils.ifUndefined(onEnterOrBoth && onEnterOrBoth.onEnter, onEnterOrBoth);
|
|
1155
|
+
var onLeave = utils.ifUndefined(onEnterOrBoth && onEnterOrBoth.onLeave, onLeaveOrIgnore);
|
|
1113
1156
|
useFlipEnter(ref, onEnter, config);
|
|
1114
1157
|
useFlipLeave(ref, onLeave === true ? onEnter : onLeave, _objectSpread({}, config, {
|
|
1115
1158
|
reverse: onLeave === true
|
|
@@ -1126,10 +1169,10 @@ function _templateObject2$1() {
|
|
|
1126
1169
|
return data;
|
|
1127
1170
|
}
|
|
1128
1171
|
|
|
1129
|
-
function _templateObject$
|
|
1130
|
-
var data = _taggedTemplateLiteral(["\n padding:
|
|
1172
|
+
function _templateObject$2() {
|
|
1173
|
+
var data = _taggedTemplateLiteral(["\n padding: ", ";\n "]);
|
|
1131
1174
|
|
|
1132
|
-
_templateObject$
|
|
1175
|
+
_templateObject$2 = function _templateObject() {
|
|
1133
1176
|
return data;
|
|
1134
1177
|
};
|
|
1135
1178
|
|
|
@@ -1154,7 +1197,9 @@ var DialogCenter = styled__default.div.withConfig({
|
|
|
1154
1197
|
componentId: "wendlg-2"
|
|
1155
1198
|
})(["@supports (position:sticky){will-change:transform,opacity;&.JS-wc-off{will-change:auto;}}display:-webkit-box;display:-ms-flexbox;display:flex;overflow-y:", ";overflow-x:hidden;position:fixed;top:0;bottom:0;left:0;right:0;align-items:center;", " ", ""], function (props) {
|
|
1156
1199
|
return props.withScroll ? "scroll" : "hidden";
|
|
1157
|
-
}, utils.media.desktop(_templateObject$
|
|
1200
|
+
}, utils.media.desktop(_templateObject$2(), function (props) {
|
|
1201
|
+
return props.fullscreen ? '1rem' : '3rem 0.5rem;';
|
|
1202
|
+
}), utils.media.mobile(_templateObject2$1(), function (props) {
|
|
1158
1203
|
return props.fullscreenOnMobile ? '0' : '0.5rem';
|
|
1159
1204
|
}));
|
|
1160
1205
|
var PopupSlot = styled__default(core.Slot).withConfig({
|
|
@@ -1216,10 +1261,9 @@ var removeWindowScroll = function removeWindowScroll(opening) {
|
|
|
1216
1261
|
}
|
|
1217
1262
|
}
|
|
1218
1263
|
|
|
1219
|
-
var finishReset = function finishReset(
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
window.scroll(window.scrollLeft, scrollTop);
|
|
1264
|
+
var finishReset = function finishReset(marginRight, scrollTop) {
|
|
1265
|
+
// body.style.paddingRight = marginRight + 'px'
|
|
1266
|
+
window.scroll(window.scrollLeft || window.scrollX || 0, scrollTop);
|
|
1223
1267
|
fixPosition('.navbar,.JS-fix-dialog-scroll', function (n) {
|
|
1224
1268
|
if (opening) {
|
|
1225
1269
|
var _window$getComputedSt = window.getComputedStyle(n),
|
|
@@ -1237,25 +1281,37 @@ var removeWindowScroll = function removeWindowScroll(opening) {
|
|
|
1237
1281
|
n.style.transform = null;
|
|
1238
1282
|
}
|
|
1239
1283
|
});
|
|
1240
|
-
window.
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1284
|
+
window.requestAnimationFrame(function () {
|
|
1285
|
+
return window.dispatchEvent(new CustomEvent('resize', {
|
|
1286
|
+
detail: {
|
|
1287
|
+
dialog: true
|
|
1288
|
+
}
|
|
1289
|
+
}));
|
|
1290
|
+
});
|
|
1245
1291
|
};
|
|
1246
1292
|
|
|
1247
1293
|
var body = document.body;
|
|
1248
1294
|
var bodyWidth = body.offsetWidth;
|
|
1249
|
-
var scrollTop = window.pageYOffset;
|
|
1250
1295
|
|
|
1251
1296
|
if (opening) {
|
|
1297
|
+
var scrollTop = window.pageYOffset;
|
|
1252
1298
|
body.style.overflow = 'hidden';
|
|
1253
|
-
|
|
1299
|
+
var marginRight = body.offsetWidth - bodyWidth;
|
|
1300
|
+
body.style.position = 'fixed';
|
|
1301
|
+
body.style.top = -scrollTop + "px";
|
|
1302
|
+
body.style.left = '0';
|
|
1303
|
+
body.style.right = marginRight + 'px';
|
|
1304
|
+
finishReset(marginRight, scrollTop);
|
|
1254
1305
|
} else {
|
|
1255
1306
|
// setTimeout(() => {
|
|
1307
|
+
var _scrollTop = parseInt(body.style.top);
|
|
1308
|
+
|
|
1256
1309
|
body.style.overflow = '';
|
|
1257
|
-
|
|
1258
|
-
|
|
1310
|
+
body.style.position = '';
|
|
1311
|
+
body.style.top = '';
|
|
1312
|
+
body.style.left = '';
|
|
1313
|
+
body.style.right = '';
|
|
1314
|
+
finishReset(0, -_scrollTop); // },250)
|
|
1259
1315
|
}
|
|
1260
1316
|
};
|
|
1261
1317
|
|
|
@@ -1282,13 +1338,16 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1282
1338
|
_ref$animation = _ref.animation,
|
|
1283
1339
|
animation = _ref$animation === void 0 ? dialogFadeInDown : _ref$animation,
|
|
1284
1340
|
animationTiming = _ref.animationTiming,
|
|
1341
|
+
animationLeaveEffect = _ref.animationLeaveEffect,
|
|
1342
|
+
animationEnterEffect = _ref.animationEnterEffect,
|
|
1285
1343
|
skipKeys = _ref.skipKeys,
|
|
1286
1344
|
fullscreenOnMobile = _ref.fullscreenOnMobile,
|
|
1287
1345
|
_ref$confirmChanges = _ref.confirmChanges,
|
|
1288
1346
|
confirmChanges = _ref$confirmChanges === void 0 ? true : _ref$confirmChanges,
|
|
1289
1347
|
skipDom = _ref.skipDom,
|
|
1290
1348
|
modalRef = _ref.modalRef,
|
|
1291
|
-
skipCheckFocus = _ref.skipCheckFocus
|
|
1349
|
+
skipCheckFocus = _ref.skipCheckFocus,
|
|
1350
|
+
autoComplete = _ref.autoComplete;
|
|
1292
1351
|
var dialogRef = core.useEnsureRef(forwardedRef);
|
|
1293
1352
|
var prevActiveElement = core.useRefState(document.activeElement);
|
|
1294
1353
|
var modal = core.useEnsureRef(modalRef);
|
|
@@ -1311,7 +1370,7 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1311
1370
|
}
|
|
1312
1371
|
}); // clearPreventDialogPop()
|
|
1313
1372
|
|
|
1314
|
-
if (document.body.scrollHeight
|
|
1373
|
+
if (document.body.scrollHeight === document.body.clientHeight) {
|
|
1315
1374
|
modal.current.style.overflowY = "scroll";
|
|
1316
1375
|
|
|
1317
1376
|
if (modalScroll.current) {
|
|
@@ -1424,7 +1483,9 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1424
1483
|
};
|
|
1425
1484
|
|
|
1426
1485
|
var checkKey = function checkKey(e) {
|
|
1427
|
-
|
|
1486
|
+
var _e$target, _e$target$className;
|
|
1487
|
+
|
|
1488
|
+
if (!isTop() || skipKeys || ((_e$target = e.target) === null || _e$target === void 0 ? void 0 : (_e$target$className = _e$target.className) === null || _e$target$className === void 0 ? void 0 : _e$target$className.indexOf("JS-dialog-skip-evts")) >= 0) return;
|
|
1428
1489
|
|
|
1429
1490
|
if (modal.current && e.shiftKey && e.keyCode === 9 && modal.current.querySelector('[tabindex]') === document.activeElement) {
|
|
1430
1491
|
e.preventDefault();
|
|
@@ -1482,7 +1543,7 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1482
1543
|
removeWindowScroll(true);
|
|
1483
1544
|
}
|
|
1484
1545
|
|
|
1485
|
-
if (document.body.scrollHeight
|
|
1546
|
+
if (document.body.scrollHeight === document.body.clientHeight) {
|
|
1486
1547
|
modal.current.style.overflowY = "none";
|
|
1487
1548
|
}
|
|
1488
1549
|
|
|
@@ -1490,6 +1551,8 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1490
1551
|
modalScroll.current.style.overflowY = "scroll";
|
|
1491
1552
|
}
|
|
1492
1553
|
},
|
|
1554
|
+
leaveEffect: animationLeaveEffect,
|
|
1555
|
+
enterEffect: animationEnterEffect,
|
|
1493
1556
|
timing: animationTiming
|
|
1494
1557
|
});
|
|
1495
1558
|
useFlipAnimation(modal, !skipDom && utils.identityOpacityFrames, true, {
|
|
@@ -1511,6 +1574,7 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1511
1574
|
}), React__default.createElement(ModalContainer, {
|
|
1512
1575
|
ref: modal
|
|
1513
1576
|
}, React__default.createElement(DialogCenter, {
|
|
1577
|
+
autoComplete: autoComplete,
|
|
1514
1578
|
className: "JS-has-wc",
|
|
1515
1579
|
withScroll: getSize() > 1,
|
|
1516
1580
|
fullscreenOnMobile: fullscreenOnMobile,
|
|
@@ -1524,16 +1588,20 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1524
1588
|
var AnimatedModal = React__default.forwardRef(function (_ref2, ref) {
|
|
1525
1589
|
var timing = _ref2.timing,
|
|
1526
1590
|
nestedFlip = _ref2.nestedFlip,
|
|
1591
|
+
enterEffect = _ref2.enterEffect,
|
|
1592
|
+
leaveEffect = _ref2.leaveEffect,
|
|
1527
1593
|
_ref2$modalIn = _ref2.modalIn,
|
|
1528
1594
|
modalIn = _ref2$modalIn === void 0 ? dialogModalIn : _ref2$modalIn,
|
|
1529
1595
|
_ref2$modalOut = _ref2.modalOut,
|
|
1530
1596
|
modalOut = _ref2$modalOut === void 0 ? dialogModalOut : _ref2$modalOut,
|
|
1531
|
-
props = _objectWithoutProperties(_ref2, ["timing", "nestedFlip", "modalIn", "modalOut"]);
|
|
1597
|
+
props = _objectWithoutProperties(_ref2, ["timing", "nestedFlip", "enterEffect", "leaveEffect", "modalIn", "modalOut"]);
|
|
1532
1598
|
|
|
1533
1599
|
var modal = core.useEnsureRef(ref);
|
|
1534
1600
|
useFlipAnimation(modal, modalIn, modalOut, {
|
|
1535
1601
|
timing: timing,
|
|
1536
|
-
nestedFlip: nestedFlip
|
|
1602
|
+
nestedFlip: nestedFlip,
|
|
1603
|
+
leaveEffect: leaveEffect,
|
|
1604
|
+
enterEffect: enterEffect
|
|
1537
1605
|
});
|
|
1538
1606
|
return React__default.createElement(Modal, _extends({}, props, {
|
|
1539
1607
|
ref: modal
|
|
@@ -1550,10 +1618,10 @@ function _templateObject2$2() {
|
|
|
1550
1618
|
return data;
|
|
1551
1619
|
}
|
|
1552
1620
|
|
|
1553
|
-
function _templateObject$
|
|
1554
|
-
var data = _taggedTemplateLiteral(["\n
|
|
1621
|
+
function _templateObject$3() {
|
|
1622
|
+
var data = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n margin-left: -", "rem;\n margin-right: -", "rem;\n margin-top: -", "rem;\n > * {\n flex-basis: 0;\n flex-grow: 1;\n margin-left: ", "rem;\n margin-right: ", "rem;\n margin-top: ", "rem;\n }\n "]);
|
|
1555
1623
|
|
|
1556
|
-
_templateObject$
|
|
1624
|
+
_templateObject$3 = function _templateObject() {
|
|
1557
1625
|
return data;
|
|
1558
1626
|
};
|
|
1559
1627
|
|
|
@@ -1579,7 +1647,7 @@ var SplitColumnsContainer = styled__default.div.withConfig({
|
|
|
1579
1647
|
displayName: "SplitColumnsContainer",
|
|
1580
1648
|
componentId: "sc-1h4sw88-0"
|
|
1581
1649
|
})(["margin-bottom:", "rem;", " ", ""], getMarginFromFieldChild, function (props) {
|
|
1582
|
-
return styled.css(["", ""], utils.media.min(props.viewportMinWidth || 0)(_templateObject$
|
|
1650
|
+
return styled.css(["", ""], utils.media.min(props.viewportMinWidth || 0)(_templateObject$3(), function (props) {
|
|
1583
1651
|
return utils.getMargin(splitColumnMargins)(props) / 2;
|
|
1584
1652
|
}, function (props) {
|
|
1585
1653
|
return utils.getMargin(splitColumnMargins)(props) / 2;
|
|
@@ -1619,9 +1687,114 @@ var fixDoubledLastMarginBottom = function fixDoubledLastMarginBottom(children) {
|
|
|
1619
1687
|
return React__default.Children.map(children, processChild);
|
|
1620
1688
|
};
|
|
1621
1689
|
|
|
1622
|
-
|
|
1690
|
+
var _twoWayAnimation$1 = utils.twoWayAnimation('opacity:0;', 'opacity:1;'),
|
|
1691
|
+
_twoWayAnimation2$1 = _slicedToArray(_twoWayAnimation$1, 2),
|
|
1692
|
+
loadingEnter = _twoWayAnimation2$1[0],
|
|
1693
|
+
loadingLeave = _twoWayAnimation2$1[1];
|
|
1694
|
+
|
|
1695
|
+
var _twoWayAnimation3 = utils.twoWayAnimation('opacity:0; transform:translateY(50%)', 'opacity:1;transform:translateY(0)'),
|
|
1696
|
+
_twoWayAnimation4 = _slicedToArray(_twoWayAnimation3, 2),
|
|
1697
|
+
onEnter = _twoWayAnimation4[0],
|
|
1698
|
+
onLeave = _twoWayAnimation4[1];
|
|
1699
|
+
|
|
1700
|
+
var BlockContainer = styled__default.div.withConfig({
|
|
1701
|
+
displayName: "LoadingDiv__BlockContainer",
|
|
1702
|
+
componentId: "sc-1g7ljba-0"
|
|
1703
|
+
})(["position:relative;"]);
|
|
1704
|
+
|
|
1705
|
+
var FlipDiv = function FlipDiv(_ref) {
|
|
1706
|
+
var useAnimation = _ref.useAnimation,
|
|
1707
|
+
outerRef = _ref.outerRef,
|
|
1708
|
+
_ref$onEnter = _ref.onEnter,
|
|
1709
|
+
onEnter = _ref$onEnter === void 0 ? onEnter : _ref$onEnter,
|
|
1710
|
+
_ref$onLeave = _ref.onLeave,
|
|
1711
|
+
onLeave = _ref$onLeave === void 0 ? onLeave : _ref$onLeave,
|
|
1712
|
+
props = _objectWithoutProperties(_ref, ["useAnimation", "outerRef", "onEnter", "onLeave"]);
|
|
1713
|
+
|
|
1714
|
+
var ensuredRef = core.useEnsureRef(outerRef);
|
|
1715
|
+
useAnimation(ensuredRef, onEnter, onLeave);
|
|
1716
|
+
return React__default.createElement(BlockContainer, _extends({}, props, {
|
|
1717
|
+
ref: ensuredRef
|
|
1718
|
+
}));
|
|
1719
|
+
};
|
|
1720
|
+
|
|
1721
|
+
var PaddingDiv = styled__default.div.withConfig({
|
|
1722
|
+
displayName: "LoadingDiv__PaddingDiv",
|
|
1723
|
+
componentId: "sc-1g7ljba-1"
|
|
1724
|
+
})(["padding:", " 0;"], function (props) {
|
|
1725
|
+
return props.height;
|
|
1726
|
+
});
|
|
1727
|
+
var LoadingDiv = function LoadingDiv(_ref2) {
|
|
1728
|
+
var _ref2$defaultToSuspen = _ref2.defaultToSuspense,
|
|
1729
|
+
defaultToSuspense = _ref2$defaultToSuspen === void 0 ? true : _ref2$defaultToSuspen,
|
|
1730
|
+
fallback = _ref2.fallback,
|
|
1731
|
+
isLoading = _ref2.isLoading,
|
|
1732
|
+
className = _ref2.className,
|
|
1733
|
+
_ref2$height = _ref2.height,
|
|
1734
|
+
height = _ref2$height === void 0 ? 12 : _ref2$height,
|
|
1735
|
+
_ref2$size = _ref2.size,
|
|
1736
|
+
size = _ref2$size === void 0 ? 32 : _ref2$size,
|
|
1737
|
+
_ref2$borderWidth = _ref2.borderWidth,
|
|
1738
|
+
borderWidth = _ref2$borderWidth === void 0 ? 5 : _ref2$borderWidth,
|
|
1739
|
+
children = _ref2.children;
|
|
1740
|
+
var flipAnimation = core.useLazyConstant(willUseFlipSwitch);
|
|
1741
|
+
var loadingBlock = React__default.createElement(PaddingDiv, {
|
|
1742
|
+
height: _isString(height) ? borderWidth : height + 'rem'
|
|
1743
|
+
}, React__default.createElement(Loading, {
|
|
1744
|
+
autoFocus: true,
|
|
1745
|
+
absolute: true,
|
|
1746
|
+
size: size,
|
|
1747
|
+
borderWidth: borderWidth
|
|
1748
|
+
}));
|
|
1749
|
+
return React__default.createElement(React__default.Suspense, {
|
|
1750
|
+
fallback: React__default.createElement(FlipDiv, {
|
|
1751
|
+
key: "loading",
|
|
1752
|
+
padded: true,
|
|
1753
|
+
onEnter: loadingEnter,
|
|
1754
|
+
onLeave: loadingLeave,
|
|
1755
|
+
useAnimation: flipAnimation,
|
|
1756
|
+
className: className
|
|
1757
|
+
}, fallback, loadingBlock)
|
|
1758
|
+
}, typeof isLoading === 'boolean' || defaultToSuspense ? isLoading ? React__default.createElement(FlipDiv, {
|
|
1759
|
+
key: "loading",
|
|
1760
|
+
padded: true,
|
|
1761
|
+
onEnter: loadingEnter,
|
|
1762
|
+
onLeave: loadingLeave,
|
|
1763
|
+
useAnimation: flipAnimation,
|
|
1764
|
+
className: className
|
|
1765
|
+
}, fallback, loadingBlock) : React__default.createElement(FlipDiv, {
|
|
1766
|
+
key: "loaded",
|
|
1767
|
+
loaded: true,
|
|
1768
|
+
onEnter: loadingEnter,
|
|
1769
|
+
onLeave: loadingLeave,
|
|
1770
|
+
useAnimation: flipAnimation,
|
|
1771
|
+
className: className
|
|
1772
|
+
}, children) : children);
|
|
1773
|
+
};
|
|
1774
|
+
|
|
1775
|
+
function _templateObject8() {
|
|
1623
1776
|
var data = _taggedTemplateLiteral(["\n padding: 1.5rem 1.5rem 1.5rem;\n max-width: 100%;\n ", ";\n "]);
|
|
1624
1777
|
|
|
1778
|
+
_templateObject8 = function _templateObject8() {
|
|
1779
|
+
return data;
|
|
1780
|
+
};
|
|
1781
|
+
|
|
1782
|
+
return data;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
function _templateObject7() {
|
|
1786
|
+
var data = _taggedTemplateLiteral(["\n padding: 1.5rem 1.5rem 0;\n margin: -1.5rem;\n "]);
|
|
1787
|
+
|
|
1788
|
+
_templateObject7 = function _templateObject7() {
|
|
1789
|
+
return data;
|
|
1790
|
+
};
|
|
1791
|
+
|
|
1792
|
+
return data;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
function _templateObject6() {
|
|
1796
|
+
var data = _taggedTemplateLiteral(["\n padding: 1.5rem;\n margin: -1.5rem;\n "]);
|
|
1797
|
+
|
|
1625
1798
|
_templateObject6 = function _templateObject6() {
|
|
1626
1799
|
return data;
|
|
1627
1800
|
};
|
|
@@ -1669,10 +1842,10 @@ function _templateObject2$3() {
|
|
|
1669
1842
|
return data;
|
|
1670
1843
|
}
|
|
1671
1844
|
|
|
1672
|
-
function _templateObject$
|
|
1845
|
+
function _templateObject$4() {
|
|
1673
1846
|
var data = _taggedTemplateLiteral(["\n top: 0\n "]);
|
|
1674
1847
|
|
|
1675
|
-
_templateObject$
|
|
1848
|
+
_templateObject$4 = function _templateObject() {
|
|
1676
1849
|
return data;
|
|
1677
1850
|
};
|
|
1678
1851
|
|
|
@@ -1681,7 +1854,7 @@ function _templateObject$5() {
|
|
|
1681
1854
|
var DialogIcon = styled__default(Icon).withConfig({
|
|
1682
1855
|
displayName: "Dialog__DialogIcon",
|
|
1683
1856
|
componentId: "gai4ey-0"
|
|
1684
|
-
})(["font-size:60px;width:8rem;text-align:center;color:#d2d2d2;right:0;top:1rem;position:absolute;", ""], utils.media.desktop(_templateObject$
|
|
1857
|
+
})(["font-size:60px;width:8rem;text-align:center;color:#d2d2d2;right:0;top:1rem;position:absolute;", ""], utils.media.desktop(_templateObject$4()));
|
|
1685
1858
|
var CloseIcon = styled__default(Icon).attrs(_assign({
|
|
1686
1859
|
icon: 'x'
|
|
1687
1860
|
})).withConfig({
|
|
@@ -1717,118 +1890,72 @@ var DialogFooter = styled__default.div.withConfig({
|
|
|
1717
1890
|
var FooterAuxiliaryContainer = styled__default.div.withConfig({
|
|
1718
1891
|
displayName: "Dialog__FooterAuxiliaryContainer",
|
|
1719
1892
|
componentId: "gai4ey-6"
|
|
1720
|
-
})(["flex-grow:1;align-self:center;display:inline-block;padding-right:1rem;float:left;"]);
|
|
1721
|
-
|
|
1722
|
-
var _twoWayAnimation$1 = utils.twoWayAnimation('opacity:0;', 'opacity:1;'),
|
|
1723
|
-
_twoWayAnimation2$1 = _slicedToArray(_twoWayAnimation$1, 2),
|
|
1724
|
-
loadingEnter = _twoWayAnimation2$1[0],
|
|
1725
|
-
loadingLeave = _twoWayAnimation2$1[1];
|
|
1726
|
-
|
|
1727
|
-
var _twoWayAnimation3 = utils.twoWayAnimation('opacity:0; transform:translateY(50%)', 'opacity:1;transform:translateY(0)'),
|
|
1728
|
-
_twoWayAnimation4 = _slicedToArray(_twoWayAnimation3, 2),
|
|
1729
|
-
onEnter = _twoWayAnimation4[0],
|
|
1730
|
-
onLeave = _twoWayAnimation4[1];
|
|
1893
|
+
})(["flex-grow:1;align-self:center;display:inline-block;padding-right:1rem;float:left;"]); // THIS IS NEEDED FOR LOADING ANIMATION ON DialogWithImageHeader
|
|
1731
1894
|
|
|
1732
|
-
var
|
|
1733
|
-
displayName: "
|
|
1895
|
+
var DialogContentWrapper = styled__default(LoadingDiv).withConfig({
|
|
1896
|
+
displayName: "Dialog__DialogContentWrapper",
|
|
1734
1897
|
componentId: "gai4ey-7"
|
|
1735
|
-
})(["
|
|
1736
|
-
|
|
1737
|
-
|
|
1898
|
+
})(["padding:2rem;margin:-2rem;", ""], utils.media.mobile(_templateObject6()));
|
|
1899
|
+
var DialogAlwaysVisibleDiv = styled__default.div.withConfig({
|
|
1900
|
+
displayName: "Dialog__DialogAlwaysVisibleDiv",
|
|
1901
|
+
componentId: "gai4ey-8"
|
|
1902
|
+
})(["padding:2rem 2rem 0;margin:-2rem;", ""], utils.media.mobile(_templateObject7())); // END
|
|
1738
1903
|
|
|
1739
|
-
var
|
|
1740
|
-
var
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1904
|
+
var Dialog = styled__default(React__default.forwardRef(function (_ref, outerRef) {
|
|
1905
|
+
var className = _ref.className,
|
|
1906
|
+
skipWrap = _ref.skipWrap,
|
|
1907
|
+
skipCloseIcon = _ref.skipCloseIcon,
|
|
1908
|
+
isLoading = _ref.isLoading,
|
|
1909
|
+
footer = _ref.footer,
|
|
1910
|
+
Content = _ref.Content,
|
|
1911
|
+
children = _ref.children,
|
|
1912
|
+
title = _ref.title,
|
|
1913
|
+
illustration = _ref.illustration,
|
|
1914
|
+
icon = _ref.icon,
|
|
1915
|
+
auxiliarActions = _ref.auxiliarActions,
|
|
1916
|
+
_ref$container = _ref.container,
|
|
1917
|
+
container = _ref$container === void 0 ? true : _ref$container,
|
|
1918
|
+
props = _objectWithoutProperties(_ref, ["className", "skipWrap", "skipCloseIcon", "isLoading", "footer", "Content", "children", "title", "illustration", "icon", "auxiliarActions", "container"]);
|
|
1747
1919
|
|
|
1748
|
-
var
|
|
1749
|
-
useAnimation(ensuredRef, onEnter, onLeave);
|
|
1750
|
-
return React__default.createElement(BlockContainer, _extends({}, props, {
|
|
1751
|
-
ref: ensuredRef
|
|
1752
|
-
}));
|
|
1753
|
-
};
|
|
1920
|
+
var ref = core.useEnsureRef(outerRef);
|
|
1754
1921
|
|
|
1755
|
-
var
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
title = _ref2.title,
|
|
1762
|
-
illustration = _ref2.illustration,
|
|
1763
|
-
icon = _ref2.icon,
|
|
1764
|
-
auxiliarActions = _ref2.auxiliarActions,
|
|
1765
|
-
_ref2$container = _ref2.container,
|
|
1766
|
-
container = _ref2$container === void 0 ? true : _ref2$container,
|
|
1767
|
-
props = _objectWithoutProperties(_ref2, ["className", "isLoading", "footer", "Content", "children", "title", "illustration", "icon", "auxiliarActions", "container"]);
|
|
1922
|
+
var alwaysVisible = function alwaysVisible(confirmCloseDialog) {
|
|
1923
|
+
return React__default.createElement(React__default.Fragment, null, props.closeDialog && !skipCloseIcon && React__default.createElement(CloseIcon, {
|
|
1924
|
+
className: "JS-dialog-close",
|
|
1925
|
+
onClick: confirmCloseDialog
|
|
1926
|
+
}), title && React__default.createElement(DialogTitle, null, utils.callIfFunction(title)));
|
|
1927
|
+
};
|
|
1768
1928
|
|
|
1769
|
-
var
|
|
1770
|
-
var flipAnimation = core.useLazyConstant(willUseFlipSwitch);
|
|
1771
|
-
var content = React__default.createElement(React__default.Fragment, null, !Content && children && React__default.createElement(DialogContent, {
|
|
1929
|
+
var content = React__default.createElement(React__default.Fragment, null, Content && React__default.createElement(DialogContent, {
|
|
1772
1930
|
icon: icon,
|
|
1773
1931
|
illustration: illustration
|
|
1774
|
-
}, utils.callIfFunction(
|
|
1932
|
+
}, utils.callIfFunction(Content)), !Content && children && React__default.createElement(DialogContent, {
|
|
1933
|
+
icon: icon,
|
|
1934
|
+
illustration: illustration
|
|
1935
|
+
}, utils.callIfFunction(children)), Content && children && utils.callIfFunction(children), footer && React__default.createElement(DialogFooter, null, auxiliarActions && React__default.createElement(FooterAuxiliaryContainer, null, utils.callIfFunction(auxiliarActions)), utils.callIfFunction(footer)));
|
|
1775
1936
|
|
|
1776
1937
|
var dialog = function dialog(confirmCloseDialog) {
|
|
1777
1938
|
return React__default.createElement("div", {
|
|
1778
|
-
className: className + " JS-has-wc",
|
|
1939
|
+
className: className + " JS-has-wc JS-dialog",
|
|
1779
1940
|
ref: ref
|
|
1780
|
-
},
|
|
1781
|
-
|
|
1782
|
-
}
|
|
1783
|
-
icon: icon,
|
|
1784
|
-
illustration: illustration
|
|
1785
|
-
}, utils.callIfFunction(Content)), React__default.createElement(React__default.Suspense, {
|
|
1786
|
-
fallback: React__default.createElement(FlipDiv, {
|
|
1787
|
-
key: "loading",
|
|
1788
|
-
padded: true,
|
|
1789
|
-
onEnter: loadingEnter,
|
|
1790
|
-
onLeave: loadingLeave,
|
|
1791
|
-
useAnimation: flipAnimation,
|
|
1792
|
-
className: className
|
|
1793
|
-
}, React__default.createElement(Loading, {
|
|
1794
|
-
autoFocus: true,
|
|
1795
|
-
absolute: true,
|
|
1796
|
-
size: 40,
|
|
1797
|
-
borderWidth: 6
|
|
1798
|
-
}))
|
|
1799
|
-
}, typeof isLoading === 'boolean' ? isLoading ? React__default.createElement(FlipDiv, {
|
|
1800
|
-
key: "loading",
|
|
1801
|
-
padded: true,
|
|
1802
|
-
onEnter: loadingEnter,
|
|
1803
|
-
onLeave: loadingLeave,
|
|
1804
|
-
useAnimation: flipAnimation,
|
|
1805
|
-
className: className
|
|
1806
|
-
}, React__default.createElement(Loading, {
|
|
1807
|
-
autoFocus: true,
|
|
1808
|
-
absolute: true,
|
|
1809
|
-
size: 40,
|
|
1810
|
-
borderWidth: 6
|
|
1811
|
-
})) : React__default.createElement(FlipDiv, {
|
|
1812
|
-
key: "loaded",
|
|
1813
|
-
onEnter: loadingEnter,
|
|
1814
|
-
onLeave: loadingLeave,
|
|
1815
|
-
useAnimation: flipAnimation
|
|
1816
|
-
}, content) : content), footer && React__default.createElement(DialogFooter, null, auxiliarActions && React__default.createElement(FooterAuxiliaryContainer, null, utils.callIfFunction(auxiliarActions)), utils.callIfFunction(footer)));
|
|
1941
|
+
}, skipWrap ? React__default.createElement(React__default.Fragment, null, alwaysVisible(confirmCloseDialog), content) : React__default.createElement(React__default.Fragment, null, React__default.createElement(DialogAlwaysVisibleDiv, null, alwaysVisible(confirmCloseDialog)), React__default.createElement(DialogContentWrapper, {
|
|
1942
|
+
isLoading: isLoading
|
|
1943
|
+
}, content)));
|
|
1817
1944
|
};
|
|
1818
1945
|
|
|
1819
1946
|
return container ? React__default.createElement(DialogContainer, _extends({}, props, {
|
|
1820
1947
|
DialogErrorContent: DialogErrorContent,
|
|
1821
1948
|
ref: ref,
|
|
1822
1949
|
title: title
|
|
1823
|
-
}), function (
|
|
1824
|
-
var confirmCloseDialog =
|
|
1950
|
+
}), function (_ref2) {
|
|
1951
|
+
var confirmCloseDialog = _ref2.confirmCloseDialog;
|
|
1825
1952
|
return dialog(confirmCloseDialog);
|
|
1826
1953
|
}) : dialog(props.closeDialog);
|
|
1827
1954
|
})).withConfig({
|
|
1828
1955
|
displayName: "Dialog",
|
|
1829
|
-
componentId: "gai4ey-
|
|
1830
|
-
})(["@supports (position:sticky){will-change:transform,opacity;&.JS-wc-off{will-change:auto;}}border-radius:12px;padding:2rem;background-color:white;width:100%;max-width:45rem;margin:auto;position:relative;align-self:baseline;display:block;> h3:first-child{margin-top:0.5rem;}p{line-height:140%;}", " ", " ", ""], utils.media.mobile(
|
|
1831
|
-
return props.fullscreenOnMobile && "\n border-radius: 0;\n ";
|
|
1956
|
+
componentId: "gai4ey-9"
|
|
1957
|
+
})(["@supports (position:sticky){will-change:transform,opacity;&.JS-wc-off{will-change:auto;}}border-radius:12px;padding:2rem;background-color:white;width:100%;max-width:45rem;margin:auto;position:relative;align-self:baseline;display:block;> h3:first-child{margin-top:0.5rem;}p{line-height:140%;}", " ", " ", ""], utils.media.mobile(_templateObject8(), function (props) {
|
|
1958
|
+
return props.fullscreenOnMobile && "\n border-radius: 0;\n min-height: 100%;\n ";
|
|
1832
1959
|
}), function (props) {
|
|
1833
1960
|
return props.closeDialog && styled.css(["", "{padding-right:2rem;}"], DialogTitle);
|
|
1834
1961
|
}, utils.customTheme('Dialog'));
|
|
@@ -1838,8 +1965,8 @@ var ConfirmDialog = function ConfirmDialog(props) {
|
|
|
1838
1965
|
}), props.children);
|
|
1839
1966
|
};
|
|
1840
1967
|
var DefaultConfirmDialog = function DefaultConfirmDialog(props) {
|
|
1841
|
-
return React__default.createElement(core.StartlibsConsumer, null, function (
|
|
1842
|
-
var confirmDialogLabels =
|
|
1968
|
+
return React__default.createElement(core.StartlibsConsumer, null, function (_ref3) {
|
|
1969
|
+
var confirmDialogLabels = _ref3.confirmDialogLabels;
|
|
1843
1970
|
return React__default.createElement(ConfirmDialog, {
|
|
1844
1971
|
title: confirmDialogLabels.title,
|
|
1845
1972
|
closeDialog: props.onCancel,
|
|
@@ -1858,14 +1985,14 @@ var DefaultConfirmDialog = function DefaultConfirmDialog(props) {
|
|
|
1858
1985
|
}, React__default.createElement("p", null, confirmDialogLabels.content));
|
|
1859
1986
|
});
|
|
1860
1987
|
};
|
|
1861
|
-
var DialogErrorContent = function DialogErrorContent(
|
|
1862
|
-
var closeDialog =
|
|
1863
|
-
title =
|
|
1864
|
-
return React__default.createElement(core.StartlibsConsumer, null, function (
|
|
1865
|
-
var
|
|
1866
|
-
title =
|
|
1867
|
-
content =
|
|
1868
|
-
close =
|
|
1988
|
+
var DialogErrorContent = function DialogErrorContent(_ref4) {
|
|
1989
|
+
var closeDialog = _ref4.closeDialog,
|
|
1990
|
+
title = _ref4.title;
|
|
1991
|
+
return React__default.createElement(core.StartlibsConsumer, null, function (_ref5) {
|
|
1992
|
+
var _ref5$ErrorDialog = _ref5.ErrorDialog,
|
|
1993
|
+
title = _ref5$ErrorDialog.title,
|
|
1994
|
+
content = _ref5$ErrorDialog.content,
|
|
1995
|
+
close = _ref5$ErrorDialog.close;
|
|
1869
1996
|
return React__default.createElement(Dialog, {
|
|
1870
1997
|
as: "div"
|
|
1871
1998
|
}, closeDialog && React__default.createElement(CloseIcon, {
|
|
@@ -1877,13 +2004,13 @@ var DialogErrorContent = function DialogErrorContent(_ref5) {
|
|
|
1877
2004
|
}, close)));
|
|
1878
2005
|
});
|
|
1879
2006
|
};
|
|
1880
|
-
var DialogError = function DialogError(
|
|
1881
|
-
var closeDialog =
|
|
1882
|
-
return React__default.createElement(core.StartlibsConsumer, null, function (
|
|
1883
|
-
var
|
|
1884
|
-
title =
|
|
1885
|
-
content =
|
|
1886
|
-
close =
|
|
2007
|
+
var DialogError = function DialogError(_ref6) {
|
|
2008
|
+
var closeDialog = _ref6.closeDialog;
|
|
2009
|
+
return React__default.createElement(core.StartlibsConsumer, null, function (_ref7) {
|
|
2010
|
+
var _ref7$ErrorDialog = _ref7.ErrorDialog,
|
|
2011
|
+
title = _ref7$ErrorDialog.title,
|
|
2012
|
+
content = _ref7$ErrorDialog.content,
|
|
2013
|
+
close = _ref7$ErrorDialog.close;
|
|
1887
2014
|
return React__default.createElement(Dialog, {
|
|
1888
2015
|
closeDialog: closeDialog,
|
|
1889
2016
|
title: title
|
|
@@ -1893,6 +2020,78 @@ var DialogError = function DialogError(_ref7) {
|
|
|
1893
2020
|
});
|
|
1894
2021
|
};
|
|
1895
2022
|
|
|
2023
|
+
var useDialog = function useDialog(dialog) {
|
|
2024
|
+
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
2025
|
+
var toggleCallback = arguments.length > 2 ? arguments[2] : undefined;
|
|
2026
|
+
var toggle = core.useToggle(false, toggleCallback);
|
|
2027
|
+
core.useFill("Dialog", toggle.isOpen !== false && dialog(toggle.close), [toggle.isOpen].concat(_toConsumableArray(args)));
|
|
2028
|
+
return toggle.open;
|
|
2029
|
+
};
|
|
2030
|
+
var useDialogWithToggle = function useDialogWithToggle(dialog) {
|
|
2031
|
+
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
2032
|
+
var toggle = core.useToggle();
|
|
2033
|
+
core.useFill("Dialog", toggle.isOpen !== false && dialog(toggle), [toggle.isOpen].concat(_toConsumableArray(args)));
|
|
2034
|
+
return toggle;
|
|
2035
|
+
};
|
|
2036
|
+
|
|
2037
|
+
var WarningDialog = styled__default(function (_ref) {
|
|
2038
|
+
var content = _ref.content,
|
|
2039
|
+
closeDialog = _ref.closeDialog,
|
|
2040
|
+
className = _ref.className,
|
|
2041
|
+
_ref$icon = _ref.icon,
|
|
2042
|
+
icon = _ref$icon === void 0 ? "warning" : _ref$icon,
|
|
2043
|
+
_ref$confirmLabel = _ref.confirmLabel,
|
|
2044
|
+
confirmLabel = _ref$confirmLabel === void 0 ? "Entendi" : _ref$confirmLabel;
|
|
2045
|
+
return React__default.createElement(Dialog, {
|
|
2046
|
+
className: className
|
|
2047
|
+
}, React__default.createElement(MainIcon, {
|
|
2048
|
+
icon: icon
|
|
2049
|
+
}), React__default.createElement("p", null, content), React__default.createElement(Button, {
|
|
2050
|
+
highlight: true,
|
|
2051
|
+
onClick: closeDialog
|
|
2052
|
+
}, confirmLabel));
|
|
2053
|
+
}).withConfig({
|
|
2054
|
+
displayName: "WarningDialog",
|
|
2055
|
+
componentId: "sc-1jw779e-0"
|
|
2056
|
+
})(["text-align:center;max-width:36rem;padding:2.5rem;p{font-size:16px;font-weight:500;max-width:27rem;margin:0 auto 2rem;}"]);
|
|
2057
|
+
var MainIcon = styled__default(Icon).withConfig({
|
|
2058
|
+
displayName: "WarningDialog__MainIcon",
|
|
2059
|
+
componentId: "sc-1jw779e-1"
|
|
2060
|
+
})(["color:", ";font-size:46px;display:block;margin-bottom:1.25rem;"], function (props) {
|
|
2061
|
+
return props.icon === 'warning' ? utils.getColor('alert') : utils.getColor('main');
|
|
2062
|
+
});
|
|
2063
|
+
var useWarningDialog = function useWarningDialog() {
|
|
2064
|
+
return useDialogWithToggle(function (toggle) {
|
|
2065
|
+
return React__default.createElement(WarningDialog, _extends({}, toggle.isOpen, {
|
|
2066
|
+
closeDialog: toggle.close
|
|
2067
|
+
}));
|
|
2068
|
+
});
|
|
2069
|
+
};
|
|
2070
|
+
|
|
2071
|
+
var _willUseSharedState = core.willUseSharedState(),
|
|
2072
|
+
_willUseSharedState2 = _slicedToArray(_willUseSharedState, 3),
|
|
2073
|
+
useRenderDefaultWarningDialog = _willUseSharedState2[0],
|
|
2074
|
+
_setWarningDialog = _willUseSharedState2[2];
|
|
2075
|
+
|
|
2076
|
+
var setWarningDialog = function setWarningDialog(props) {
|
|
2077
|
+
return _setWarningDialog(React__default.createElement(WarningDialog, _extends({}, props, {
|
|
2078
|
+
closeDialog: function closeDialog() {
|
|
2079
|
+
return _setWarningDialog(null);
|
|
2080
|
+
}
|
|
2081
|
+
})));
|
|
2082
|
+
};
|
|
2083
|
+
var DefaultWarningDialog = function DefaultWarningDialog() {
|
|
2084
|
+
var _useRenderDefaultWarn = useRenderDefaultWarningDialog(),
|
|
2085
|
+
_useRenderDefaultWarn2 = _slicedToArray(_useRenderDefaultWarn, 1),
|
|
2086
|
+
warningDialog = _useRenderDefaultWarn2[0];
|
|
2087
|
+
|
|
2088
|
+
if (warningDialog) {
|
|
2089
|
+
return warningDialog;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
return null;
|
|
2093
|
+
};
|
|
2094
|
+
|
|
1896
2095
|
var NotificationContainer = styled__default.div.withConfig({
|
|
1897
2096
|
displayName: "Notifications__NotificationContainer",
|
|
1898
2097
|
componentId: "naxsn6-0"
|
|
@@ -1900,13 +2099,15 @@ var NotificationContainer = styled__default.div.withConfig({
|
|
|
1900
2099
|
var Notification = styled__default.div.withConfig({
|
|
1901
2100
|
displayName: "Notifications__Notification",
|
|
1902
2101
|
componentId: "naxsn6-1"
|
|
1903
|
-
})(["padding:1rem 3.5rem 1rem 1rem;border-radius:5px;color:white;text-align:left;line-height:20px;background:", ";box-shadow:0 2px 0px 0px rgba(0,0,0,0.25);min-width:12rem;min-height:44px;display:inline-block;position:relative;top:1rem;", "{color:white;display:inline-block;background-color:rgba(0,0,0,0.2);font-size:14px;width:20px;height:20px;text-align:center;line-height:20px;border-radius:50%;cursor:pointer;position:absolute;top:1rem;right:1rem;&:hover{background-color:rgba(0,0,0,0.3);}}"],
|
|
2102
|
+
})(["padding:1rem 3.5rem 1rem 1rem;border-radius:5px;color:white;text-align:left;line-height:20px;background:", ";box-shadow:0 2px 0px 0px rgba(0,0,0,0.25);min-width:12rem;min-height:44px;display:inline-block;position:relative;top:1rem;", "{color:white;display:inline-block;background-color:rgba(0,0,0,0.2);font-size:14px;width:20px;height:20px;text-align:center;line-height:20px;border-radius:50%;cursor:pointer;position:absolute;top:1rem;right:1rem;&:hover{background-color:rgba(0,0,0,0.3);}}"], function (props) {
|
|
2103
|
+
return utils.getColor(props.type)(props);
|
|
2104
|
+
}, Icon);
|
|
1904
2105
|
|
|
1905
|
-
var _willUseSharedState = core.willUseSharedState(),
|
|
1906
|
-
_willUseSharedState2 = _slicedToArray(_willUseSharedState, 3),
|
|
1907
|
-
useNotification = _willUseSharedState2[0],
|
|
1908
|
-
useNotificationRef = _willUseSharedState2[1],
|
|
1909
|
-
setNotification = _willUseSharedState2[2];
|
|
2106
|
+
var _willUseSharedState$1 = core.willUseSharedState(),
|
|
2107
|
+
_willUseSharedState2$1 = _slicedToArray(_willUseSharedState$1, 3),
|
|
2108
|
+
useNotification = _willUseSharedState2$1[0],
|
|
2109
|
+
useNotificationRef = _willUseSharedState2$1[1],
|
|
2110
|
+
setNotification = _willUseSharedState2$1[2];
|
|
1910
2111
|
var willSetNotification = function willSetNotification(str) {
|
|
1911
2112
|
return function () {
|
|
1912
2113
|
return setNotification(str);
|
|
@@ -1918,15 +2119,24 @@ var Notifications = function Notifications() {
|
|
|
1918
2119
|
|
|
1919
2120
|
var _useNotification = useNotification(),
|
|
1920
2121
|
_useNotification2 = _slicedToArray(_useNotification, 2),
|
|
1921
|
-
|
|
2122
|
+
rawNotification = _useNotification2[0],
|
|
1922
2123
|
setNotification = _useNotification2[1];
|
|
1923
2124
|
|
|
2125
|
+
var _ref = _isObject(rawNotification) ? rawNotification : {
|
|
2126
|
+
type: "success",
|
|
2127
|
+
msg: rawNotification
|
|
2128
|
+
},
|
|
2129
|
+
msg = _ref.msg,
|
|
2130
|
+
type = _ref.type,
|
|
2131
|
+
_ref$timeout = _ref.timeout,
|
|
2132
|
+
timeout = _ref$timeout === void 0 ? 5000 : _ref$timeout;
|
|
2133
|
+
|
|
1924
2134
|
React.useEffect(function () {
|
|
1925
|
-
if (
|
|
2135
|
+
if (msg) {
|
|
1926
2136
|
toggle.open();
|
|
1927
|
-
setTimeout(toggle.willCloseAfter(
|
|
2137
|
+
setTimeout(toggle.willCloseAfter(timeout), 100);
|
|
1928
2138
|
}
|
|
1929
|
-
}, [
|
|
2139
|
+
}, [msg]);
|
|
1930
2140
|
React.useEffect(function () {
|
|
1931
2141
|
if (!toggle.isOpen) {
|
|
1932
2142
|
setNotification(null);
|
|
@@ -1934,7 +2144,9 @@ var Notifications = function Notifications() {
|
|
|
1934
2144
|
}, [toggle.isOpen]);
|
|
1935
2145
|
return toggle.isOpen && React__default.createElement(core.Fill, {
|
|
1936
2146
|
name: "Notifications"
|
|
1937
|
-
}, React__default.createElement(FlipNotification,
|
|
2147
|
+
}, React__default.createElement(FlipNotification, {
|
|
2148
|
+
type: type
|
|
2149
|
+
}, utils.callIfFunction(msg, toggle.close), React__default.createElement(Icon, {
|
|
1938
2150
|
icon: "x",
|
|
1939
2151
|
onClick: toggle.close
|
|
1940
2152
|
})));
|
|
@@ -1973,27 +2185,42 @@ var ARROW_KEY_POSITIONS = {
|
|
|
1973
2185
|
top: '0',
|
|
1974
2186
|
bottom: '-0'
|
|
1975
2187
|
};
|
|
2188
|
+
var POSITIONING_BOUNDS = {
|
|
2189
|
+
left: 0,
|
|
2190
|
+
top: 0,
|
|
2191
|
+
right: 0,
|
|
2192
|
+
bottom: 0
|
|
2193
|
+
};
|
|
2194
|
+
var addPositioningBound = function addPositioningBound(key, value) {
|
|
2195
|
+
POSITIONING_BOUNDS[key] += value;
|
|
2196
|
+
return function () {
|
|
2197
|
+
return POSITIONING_BOUNDS[key] -= value;
|
|
2198
|
+
};
|
|
2199
|
+
};
|
|
1976
2200
|
|
|
1977
|
-
function getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision, mapping) {
|
|
2201
|
+
function getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision, mapping, boundMargin) {
|
|
1978
2202
|
// 0 pra left ou top, 1/2 pra center, 1 pra right ou bottom
|
|
1979
2203
|
var originDiff = originSize * (mapping.indexOf(originalAlignment) / 2); // 0 pra left ou top, -1/2 pra center, -1 pra right ou bottom
|
|
1980
2204
|
|
|
1981
2205
|
var selfDiff = -(selfSize * (mapping.indexOf(selfAlignment) / 2));
|
|
1982
|
-
var
|
|
1983
|
-
var
|
|
2206
|
+
var respectingBounds = boundMargin !== false;
|
|
2207
|
+
var upperBound = respectingBounds ? POSITIONING_BOUNDS[mapping[0]] + boundMargin : Number.MIN_SAFE_INTEGER;
|
|
2208
|
+
var lowerBound = respectingBounds ? POSITIONING_BOUNDS[mapping[2]] + boundMargin : 0;
|
|
2209
|
+
var newPosition = Math.max(upperBound, origin + selfDiff + originDiff + offset);
|
|
2210
|
+
var collision = Math.max(-newPosition, newPosition + selfSize - max + lowerBound);
|
|
1984
2211
|
|
|
1985
2212
|
if (collision > 0 && onCollision !== 'none') {
|
|
1986
2213
|
if (onCollision.indexOf('flip') >= 0) {
|
|
1987
|
-
var flippedPosition = getPosition(origin, -offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision.indexOf('fit') >= 0 ? 'fit' : 'none', mapping.slice().reverse());
|
|
2214
|
+
var flippedPosition = getPosition(origin, -offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision.indexOf('fit') >= 0 ? 'fit' : 'none', mapping.slice().reverse(), boundMargin);
|
|
1988
2215
|
var flippedCollision = Math.max(-flippedPosition[0], flippedPosition[0] + selfSize - max);
|
|
1989
2216
|
|
|
1990
|
-
if (collision > 0 && flippedCollision > 0) {
|
|
1991
|
-
return getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, 'fit', mapping);
|
|
2217
|
+
if (collision > 0 && flippedCollision > 0 || flippedPosition[0] < upperBound) {
|
|
2218
|
+
return getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, 'fit', mapping, boundMargin);
|
|
1992
2219
|
}
|
|
1993
2220
|
|
|
1994
2221
|
return collision < flippedCollision ? [newPosition, 'none'] : [flippedPosition[0], flippedPosition[1] === 'fit' ? 'flipfit' : 'flip'];
|
|
1995
2222
|
} else {
|
|
1996
|
-
return newPosition <
|
|
2223
|
+
return newPosition < upperBound ? [upperBound, 'fitted'] : [Math.max(upperBound, newPosition - collision), collision !== 0 ? 'fit' : 'none'];
|
|
1997
2224
|
}
|
|
1998
2225
|
} else {
|
|
1999
2226
|
return [newPosition, 'none'];
|
|
@@ -2037,7 +2264,10 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2037
2264
|
onRight = _ref.right,
|
|
2038
2265
|
onTop = _ref.top,
|
|
2039
2266
|
_ref$keepWidth = _ref.keepWidth,
|
|
2040
|
-
keepWidth = _ref$keepWidth === void 0 ? true : _ref$keepWidth
|
|
2267
|
+
keepWidth = _ref$keepWidth === void 0 ? true : _ref$keepWidth,
|
|
2268
|
+
_ref$boundMargin = _ref.boundMargin,
|
|
2269
|
+
boundMargin = _ref$boundMargin === void 0 ? 6 : _ref$boundMargin,
|
|
2270
|
+
respectBounds = _ref.respectBounds;
|
|
2041
2271
|
var placeholder = React.useRef();
|
|
2042
2272
|
var arrowRef = core.useEnsureRef(arrowRefOpt);
|
|
2043
2273
|
|
|
@@ -2081,9 +2311,9 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2081
2311
|
|
|
2082
2312
|
var left = leftPlusBorder - parseInt(borderLeftWidth, 10);
|
|
2083
2313
|
var top = topPlusBorder - parseInt(borderTopWidth, 10);
|
|
2084
|
-
var
|
|
2085
|
-
parentOffsetWidth =
|
|
2086
|
-
parentOffsetHeight =
|
|
2314
|
+
var _placeholder$current$2 = placeholder.current.offsetParent,
|
|
2315
|
+
parentOffsetWidth = _placeholder$current$2.offsetWidth,
|
|
2316
|
+
parentOffsetHeight = _placeholder$current$2.offsetHeight;
|
|
2087
2317
|
var _element$current = element.current,
|
|
2088
2318
|
popupOffsetWidth = _element$current.offsetWidth,
|
|
2089
2319
|
popupOffsetHeight = _element$current.offsetHeight;
|
|
@@ -2122,12 +2352,12 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2122
2352
|
verticalAt = _replace$split4[0],
|
|
2123
2353
|
horizontalAt = _replace$split4[1];
|
|
2124
2354
|
|
|
2125
|
-
var _getPosition = getPosition(left, offsetX, bodyWidth, parentOffsetWidth, fill ? parentOffsetWidth : popupOffsetWidth, horizontalAt, horizontalMy, horizontalCollision, HORIZONTAL_MAPPING),
|
|
2355
|
+
var _getPosition = getPosition(left, offsetX, bodyWidth, parentOffsetWidth, fill ? parentOffsetWidth : popupOffsetWidth, horizontalAt, horizontalMy, horizontalCollision, HORIZONTAL_MAPPING, !!respectBounds && boundMargin),
|
|
2126
2356
|
_getPosition2 = _slicedToArray(_getPosition, 2),
|
|
2127
2357
|
processedLeft = _getPosition2[0],
|
|
2128
2358
|
collisionH = _getPosition2[1];
|
|
2129
2359
|
|
|
2130
|
-
var _getPosition3 = getPosition(top, offsetY, windowHeight, parentOffsetHeight, popupOffsetHeight, verticalAt, verticalMy, verticalCollision, VERTICAL_MAPPING),
|
|
2360
|
+
var _getPosition3 = getPosition(top, offsetY, windowHeight, parentOffsetHeight, popupOffsetHeight, verticalAt, verticalMy, verticalCollision, VERTICAL_MAPPING, !!respectBounds && boundMargin),
|
|
2131
2361
|
_getPosition4 = _slicedToArray(_getPosition3, 2),
|
|
2132
2362
|
processedTop = _getPosition4[0],
|
|
2133
2363
|
collisionV = _getPosition4[1];
|
|
@@ -2140,13 +2370,23 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2140
2370
|
var arrowOnVerticalSide = arrowSide === 'left' || arrowSide === 'right';
|
|
2141
2371
|
var arrowSize = arrowElement ? arrowElement.getBoundingClientRect()[arrowOnVerticalSide ? 'height' : 'width'] : ARROW_DEFAULT_SIZE * Math.sqrt(2);
|
|
2142
2372
|
|
|
2143
|
-
var
|
|
2144
|
-
|
|
2145
|
-
arrowOffset =
|
|
2146
|
-
popupArrowOffset =
|
|
2373
|
+
var _ref2 = arrowOnVerticalSide ? processArrow(ARROW_KEY_POSITIONS[arrow] || arrow, arrowSize, arrowOnVerticalSide, parentOffsetHeight, popupOffsetHeight, processedTop - top, flippedV) : processArrow(ARROW_KEY_POSITIONS[arrow] || arrow, arrowSize, arrowOnVerticalSide, parentOffsetWidth, popupOffsetWidth, processedLeft - left, flippedV),
|
|
2374
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
2375
|
+
arrowOffset = _ref3[0],
|
|
2376
|
+
popupArrowOffset = _ref3[1];
|
|
2377
|
+
|
|
2378
|
+
var maxHeight = window.innerHeight - (POSITIONING_BOUNDS.top + POSITIONING_BOUNDS.bottom) - (respectBounds ? boundMargin * 2 : 0);
|
|
2379
|
+
var maxWidth = window.innerWidth - (POSITIONING_BOUNDS.left + POSITIONING_BOUNDS.right) - (respectBounds ? boundMargin * 2 : 0);
|
|
2380
|
+
element.current.style.maxHeight = '';
|
|
2381
|
+
|
|
2382
|
+
if (parseInt(window.getComputedStyle(element.current).maxHeight) > maxHeight) {
|
|
2383
|
+
element.current.style.maxHeight = maxHeight + 'px';
|
|
2384
|
+
}
|
|
2147
2385
|
|
|
2148
2386
|
if (keepWidth) {
|
|
2149
2387
|
element.current.style.width = Math.ceil(popupCurrentWidth) + "px";
|
|
2388
|
+
} else {
|
|
2389
|
+
element.current.style.maxWidth = maxWidth + 'px';
|
|
2150
2390
|
} // console.log({processedTop,top,offsetY,scrollY})
|
|
2151
2391
|
|
|
2152
2392
|
|
|
@@ -2167,6 +2407,8 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2167
2407
|
atBottom: verticalAt === 'bottom' && !flippedV || verticalAt === 'top' && flippedV,
|
|
2168
2408
|
atLeft: horizontalAt === 'left' && !flippedH || verticalAt === 'right' && flippedH,
|
|
2169
2409
|
atRight: horizontalAt === 'right' && !flippedH || verticalAt === 'left' && flippedH,
|
|
2410
|
+
fullHeight: popupOffsetHeight > maxHeight,
|
|
2411
|
+
fullWidth: popupOffsetWidth > maxWidth,
|
|
2170
2412
|
arrowSide: arrowSide,
|
|
2171
2413
|
arrowOffset: arrowOffset,
|
|
2172
2414
|
arrowStyle: arrowStyle
|
|
@@ -2183,8 +2425,6 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2183
2425
|
|
|
2184
2426
|
React.useLayoutEffect(setPosition, []);
|
|
2185
2427
|
React.useEffect(function () {
|
|
2186
|
-
var debouncedSetPosition = _debounce(100, setPosition);
|
|
2187
|
-
|
|
2188
2428
|
window.addEventListener('portalReposition', setPosition);
|
|
2189
2429
|
window.addEventListener('stepResize', setPosition);
|
|
2190
2430
|
window.addEventListener('scroll', setPosition);
|
|
@@ -2304,6 +2544,7 @@ function (_React$Component) {
|
|
|
2304
2544
|
removeAnimation = _this$props.removeAnimation,
|
|
2305
2545
|
onEndAnimation = _this$props.onEndAnimation,
|
|
2306
2546
|
onStartAnimation = _this$props.onStartAnimation,
|
|
2547
|
+
effect = _this$props.effect,
|
|
2307
2548
|
skipChromeFix = _this$props.skipChromeFix,
|
|
2308
2549
|
timing = _this$props.timing;
|
|
2309
2550
|
newSnap.children.forEach(function (newItemSnap) {
|
|
@@ -2340,8 +2581,12 @@ function (_React$Component) {
|
|
|
2340
2581
|
var rectAnimation = getClientRectAnimation(oldSnap.parent, newSnap.parent, {
|
|
2341
2582
|
skipTransform: true
|
|
2342
2583
|
});
|
|
2343
|
-
callIfFunction(
|
|
2344
|
-
|
|
2584
|
+
var endEffect = utils.callIfFunction(effect, newSnap.parent.domNode, {
|
|
2585
|
+
newSnap: newSnap,
|
|
2586
|
+
oldSnap: oldSnap
|
|
2587
|
+
});
|
|
2588
|
+
utils.callIfFunction(onStartAnimation);
|
|
2589
|
+
morph(newSnap.parent.domNode, formatAnimation(rectAnimation, timing), endEffect || onEndAnimation);
|
|
2345
2590
|
};
|
|
2346
2591
|
|
|
2347
2592
|
_this.reinsertSnap = function (item, scrollDelta, allChildren) {
|
|
@@ -2432,6 +2677,7 @@ function (_React$Component) {
|
|
|
2432
2677
|
var newSnap = this.calculatePositionForAnimation();
|
|
2433
2678
|
|
|
2434
2679
|
if (newSnap) {
|
|
2680
|
+
// se não tiver parentNode, verficar se há uma div sendo offsetParent, body não serve
|
|
2435
2681
|
this.play(snap, newSnap);
|
|
2436
2682
|
}
|
|
2437
2683
|
}
|
|
@@ -2486,7 +2732,9 @@ var _React$createContext = React__default.createContext({}),
|
|
|
2486
2732
|
var DropPosition = styled__default.div.withConfig({
|
|
2487
2733
|
displayName: "Draggable__DropPosition",
|
|
2488
2734
|
componentId: "sc-1g7nmwq-0"
|
|
2489
|
-
})(["border:2px dashed rgba(0,0,0,0.1);background-color:rgba(0,0,0,0.025);border-radius:8px;position:absolute;top:0;bottom:0;right:0;left:0;visibility:visible;display:block;"])
|
|
2735
|
+
})(["border:2px dashed rgba(0,0,0,0.1);background-color:rgba(0,0,0,0.025);border-radius:8px;position:absolute;top:0;bottom:0;right:0;left:0;visibility:visible;display:block;", ""], function (props) {
|
|
2736
|
+
return props.rounded && "\n border-radius: 1000rem;\n ";
|
|
2737
|
+
});
|
|
2490
2738
|
var EmptyPlaceholder = styled__default.div.withConfig({
|
|
2491
2739
|
displayName: "Draggable__EmptyPlaceholder",
|
|
2492
2740
|
componentId: "sc-1g7nmwq-1"
|
|
@@ -2566,19 +2814,24 @@ function (_React$Component) {
|
|
|
2566
2814
|
isDragging = _this$props.isDragging,
|
|
2567
2815
|
droppable = _this$props.droppable,
|
|
2568
2816
|
dragIndex = _this$props.dragIndex,
|
|
2817
|
+
roundedPlaceholder = _this$props.roundedPlaceholder,
|
|
2569
2818
|
children = _this$props.children,
|
|
2570
|
-
props = _objectWithoutProperties(_this$props, ["DragTag", "as", "eventHandlers", "className", "isDragging", "droppable", "dragIndex", "children"]);
|
|
2819
|
+
props = _objectWithoutProperties(_this$props, ["DragTag", "as", "eventHandlers", "className", "isDragging", "droppable", "dragIndex", "roundedPlaceholder", "children"]);
|
|
2571
2820
|
|
|
2572
2821
|
var Wrapper = DragTag || as;
|
|
2573
2822
|
var extraClassName = (isDragging ? ' drag-drop-placeholder' : '') + ' drag-drop-item';
|
|
2574
2823
|
return typeof children === 'function' ? children(_objectSpread({
|
|
2575
2824
|
className: extraClassName
|
|
2576
2825
|
}, this.events, {
|
|
2577
|
-
children: isDragging && React__default.createElement(DropPosition,
|
|
2826
|
+
children: isDragging && React__default.createElement(DropPosition, {
|
|
2827
|
+
rounded: roundedPlaceholder
|
|
2828
|
+
})
|
|
2578
2829
|
})) : React__default.createElement(Wrapper, _extends({
|
|
2579
2830
|
className: className + extraClassName,
|
|
2580
2831
|
isDragging: isDragging
|
|
2581
|
-
}, props, this.events), children, isDragging && React__default.createElement(DropPosition,
|
|
2832
|
+
}, props, this.events), children, isDragging && React__default.createElement(DropPosition, {
|
|
2833
|
+
rounded: roundedPlaceholder
|
|
2834
|
+
}));
|
|
2582
2835
|
}
|
|
2583
2836
|
}]);
|
|
2584
2837
|
|
|
@@ -2672,6 +2925,11 @@ function (_React$Component2) {
|
|
|
2672
2925
|
}
|
|
2673
2926
|
|
|
2674
2927
|
var parent = ReactDOM.findDOMNode(_assertThisInitialized(_assertThisInitialized(_this2))).offsetParent;
|
|
2928
|
+
|
|
2929
|
+
if (!parent) {
|
|
2930
|
+
return [];
|
|
2931
|
+
}
|
|
2932
|
+
|
|
2675
2933
|
var parentRect = parent.getBoundingClientRect();
|
|
2676
2934
|
|
|
2677
2935
|
var toPosition = _this2.toPosition(parentRect, scrollXY);
|
|
@@ -2856,7 +3114,14 @@ function (_React$Component3) {
|
|
|
2856
3114
|
};
|
|
2857
3115
|
|
|
2858
3116
|
_this3.dragStart = function (draggable) {
|
|
2859
|
-
return function (
|
|
3117
|
+
return function (e, _ref4) {
|
|
3118
|
+
var pageX = _ref4.pageX,
|
|
3119
|
+
pageY = _ref4.pageY,
|
|
3120
|
+
clientX = _ref4.clientX,
|
|
3121
|
+
clientY = _ref4.clientY;
|
|
3122
|
+
_this3.dragHasEnded = false;
|
|
3123
|
+
var currentTarget = e.currentTarget;
|
|
3124
|
+
|
|
2860
3125
|
if (shouldPreventDrag(e) || _this3.props.disabled) {
|
|
2861
3126
|
return;
|
|
2862
3127
|
}
|
|
@@ -2877,7 +3142,12 @@ function (_React$Component3) {
|
|
|
2877
3142
|
if (window.navigator.vibrate) window.navigator.vibrate([65]);
|
|
2878
3143
|
|
|
2879
3144
|
if (!_this3.state.dragInfo.active) {
|
|
2880
|
-
_this3.dragMove(
|
|
3145
|
+
_this3.dragMove(e, {
|
|
3146
|
+
pageX: pageX,
|
|
3147
|
+
pageY: pageY,
|
|
3148
|
+
clientX: clientX,
|
|
3149
|
+
clientY: clientY
|
|
3150
|
+
});
|
|
2881
3151
|
}
|
|
2882
3152
|
}, holdTouchTimer);
|
|
2883
3153
|
}
|
|
@@ -3065,15 +3335,20 @@ function (_React$Component3) {
|
|
|
3065
3335
|
area: intersectionArea / area,
|
|
3066
3336
|
distance: distance
|
|
3067
3337
|
};
|
|
3068
|
-
}).reduce(function (iMax,
|
|
3069
|
-
var area =
|
|
3070
|
-
distance =
|
|
3338
|
+
}).reduce(function (iMax, _ref5, i, arr) {
|
|
3339
|
+
var area = _ref5.area,
|
|
3340
|
+
distance = _ref5.distance;
|
|
3071
3341
|
return area > arr[iMax].area || area === arr[iMax].area && distance < arr[iMax].distance ? i : iMax;
|
|
3072
3342
|
}, 0);
|
|
3073
3343
|
return centerInsideGhost[closestIndex];
|
|
3074
3344
|
};
|
|
3075
3345
|
|
|
3076
3346
|
_this3.stopMoving = function () {
|
|
3347
|
+
if (_this3.dragHasEnded) {
|
|
3348
|
+
return;
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
_this3.dragHasEnded = true;
|
|
3077
3352
|
var dragInfo = _this3.state.dragInfo;
|
|
3078
3353
|
var activeIndex = dragInfo.activeIndex,
|
|
3079
3354
|
startIndex = dragInfo.startIndex,
|
|
@@ -3081,6 +3356,11 @@ function (_React$Component3) {
|
|
|
3081
3356
|
activeDroppable = dragInfo.activeDroppable,
|
|
3082
3357
|
startDroppable = dragInfo.startDroppable;
|
|
3083
3358
|
|
|
3359
|
+
if (_this3.endTimeout) {
|
|
3360
|
+
clearTimeout(_this3.endTimeout);
|
|
3361
|
+
_this3.endTimeout = null;
|
|
3362
|
+
}
|
|
3363
|
+
|
|
3084
3364
|
_this3.setState({
|
|
3085
3365
|
saving: {
|
|
3086
3366
|
list: _this3.props.list,
|
|
@@ -3088,13 +3368,15 @@ function (_React$Component3) {
|
|
|
3088
3368
|
dragInfo: _set('active', false, dragInfo)
|
|
3089
3369
|
}
|
|
3090
3370
|
}, function () {
|
|
3371
|
+
var _this3$ghost;
|
|
3372
|
+
|
|
3091
3373
|
_this3.preventScroll = false;
|
|
3092
3374
|
|
|
3093
3375
|
_this3.props.setDragRef(null);
|
|
3094
3376
|
|
|
3095
3377
|
_this3.settedDragRef = false;
|
|
3096
3378
|
|
|
3097
|
-
if (_this3.ghost.parentNode) {
|
|
3379
|
+
if ((_this3$ghost = _this3.ghost) === null || _this3$ghost === void 0 ? void 0 : _this3$ghost.parentNode) {
|
|
3098
3380
|
reenableWillChange(_this3.ghost);
|
|
3099
3381
|
|
|
3100
3382
|
_this3.ghost.parentNode.removeChild(_this3.ghost);
|
|
@@ -3121,7 +3403,11 @@ function (_React$Component3) {
|
|
|
3121
3403
|
});
|
|
3122
3404
|
};
|
|
3123
3405
|
|
|
3124
|
-
_this3.dragMove = function (
|
|
3406
|
+
_this3.dragMove = function (e, _ref6) {
|
|
3407
|
+
var pageX = _ref6.pageX,
|
|
3408
|
+
pageY = _ref6.pageY,
|
|
3409
|
+
clientX = _ref6.clientX,
|
|
3410
|
+
clientY = _ref6.clientY;
|
|
3125
3411
|
var distance = Math.sqrt(Math.pow(_this3.positions.originalX - pageX, 2) + Math.pow(_this3.positions.originalY - pageY, 2));
|
|
3126
3412
|
|
|
3127
3413
|
if (e.type === 'mousemove') {
|
|
@@ -3327,6 +3613,8 @@ function (_React$Component3) {
|
|
|
3327
3613
|
_this3.ghost.style.transform = newTransform;
|
|
3328
3614
|
|
|
3329
3615
|
_this3.ghost.addEventListener('transitionend', _this3.stopMoving);
|
|
3616
|
+
|
|
3617
|
+
_this3.endTimeout = setTimeout(_this3.stopMoving, 300);
|
|
3330
3618
|
}
|
|
3331
3619
|
} else {
|
|
3332
3620
|
_this3.stopMoving();
|
|
@@ -3344,10 +3632,10 @@ function (_React$Component3) {
|
|
|
3344
3632
|
};
|
|
3345
3633
|
|
|
3346
3634
|
_this3.mouseDown = function (draggable) {
|
|
3347
|
-
return utils.normalizeMouse(_this3.dragStart(draggable));
|
|
3635
|
+
return utils.normalizeMouse(_this3.dragStart(draggable), _this3.dragEnd);
|
|
3348
3636
|
};
|
|
3349
3637
|
|
|
3350
|
-
_this3.mouseMove = utils.normalizeMouse(_this3.dragMove);
|
|
3638
|
+
_this3.mouseMove = utils.normalizeMouse(_this3.dragMove, _this3.dragEnd);
|
|
3351
3639
|
|
|
3352
3640
|
_this3.touchStart = function (draggable) {
|
|
3353
3641
|
return utils.normalizeTouch(_this3.dragStart(draggable), _this3.dragEnd);
|
|
@@ -3588,9 +3876,19 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
3588
3876
|
}, rest), content), children);
|
|
3589
3877
|
};
|
|
3590
3878
|
|
|
3591
|
-
function
|
|
3879
|
+
function _templateObject4$1() {
|
|
3592
3880
|
var data = _taggedTemplateLiteral(["\n font-size: 13px;\n position: absolute;\n right: 0;\n top: 50%;\n transform: translateY(-50%);\n width: 3rem;\n text-align: center;\n"]);
|
|
3593
3881
|
|
|
3882
|
+
_templateObject4$1 = function _templateObject4() {
|
|
3883
|
+
return data;
|
|
3884
|
+
};
|
|
3885
|
+
|
|
3886
|
+
return data;
|
|
3887
|
+
}
|
|
3888
|
+
|
|
3889
|
+
function _templateObject3$2() {
|
|
3890
|
+
var data = _taggedTemplateLiteral(["\n font-size: 12px;\n "]);
|
|
3891
|
+
|
|
3594
3892
|
_templateObject3$2 = function _templateObject3() {
|
|
3595
3893
|
return data;
|
|
3596
3894
|
};
|
|
@@ -3608,10 +3906,10 @@ function _templateObject2$4() {
|
|
|
3608
3906
|
return data;
|
|
3609
3907
|
}
|
|
3610
3908
|
|
|
3611
|
-
function _templateObject$
|
|
3612
|
-
var data = _taggedTemplateLiteral(["\n font-size:
|
|
3909
|
+
function _templateObject$5() {
|
|
3910
|
+
var data = _taggedTemplateLiteral(["\n font-size: 14px;\n & > * {\n padding-top: 15px;\n padding-bottom: 15px;\n }\n ", ", .icon {\n font-size: 25px;\n }\n "]);
|
|
3613
3911
|
|
|
3614
|
-
_templateObject$
|
|
3912
|
+
_templateObject$5 = function _templateObject() {
|
|
3615
3913
|
return data;
|
|
3616
3914
|
};
|
|
3617
3915
|
|
|
@@ -3626,24 +3924,34 @@ var popupAnimation = utils.animationTiming('0.2s ease-out');
|
|
|
3626
3924
|
var ListItem = styled__default.li.withConfig({
|
|
3627
3925
|
displayName: "ContextMenu__ListItem",
|
|
3628
3926
|
componentId: "sc-13y1vvt-0"
|
|
3629
|
-
})(["position:relative;& > *{padding:11px 3.
|
|
3927
|
+
})(["position:relative;font-size:13px;& > *{padding:11px 1.5rem 11px 3.5rem;display:block;}", ",.icon{font-size:23px;position:absolute;padding-left:0.25rem;left:0;top:50%;transform:translateY(-50%);width:3.5rem;text-align:center;}", " & > a{color:inherit;font-weight:inherit;text-decoration:inherit;}& > a,& > label{cursor:pointer;}", " ", " input[type=\"radio\"]{display:none;}", " ", " ", " ", ""], Icon, utils.media.mobile(_templateObject$5(), Icon), utils.ifProp('hover', styled.css(["& > a,& > label{background:", ";color:", ";color:", ";}"], function (props) {
|
|
3630
3928
|
return polished.lighten(0.53, utils.getColor("main")(props));
|
|
3631
3929
|
}, utils.getColor('main'), function (props) {
|
|
3632
3930
|
return polished.darken(0.03, utils.getColor("main")(props));
|
|
3633
|
-
})), utils.ifProp('highlight', styled.css(["color:", ";"], utils.getColor('main'))),
|
|
3931
|
+
})), utils.ifProp('highlight', styled.css(["color:", ";"], utils.getColor('main'))), utils.ifProp('noActions', "\n max-width: 17rem;\n color: rgba(0,0,0,0.4);\n pointer-events: none;\n text-align: center;\n white-space: normal;\n "), utils.ifProp('withButton', styled.css(["padding:0.25rem 1rem;", "{width:100%;color:white;font-weight:500;padding:10px 1.25rem;", "}"], Button, utils.media.mobile(_templateObject2$4()))), utils.ifProp('smallPaddingRight', styled.css(["& > *{padding-right:1.5rem;}"])), utils.customTheme('ListItem'));
|
|
3932
|
+
var ListItemDescText = styled__default.div.withConfig({
|
|
3933
|
+
displayName: "ContextMenu__ListItemDescText",
|
|
3934
|
+
componentId: "sc-13y1vvt-1"
|
|
3935
|
+
})(["font-size:11px;margin-top:0.25rem;opacity:0.6;", ""], utils.media.mobile(_templateObject3$2()));
|
|
3936
|
+
var ListItemHelpText = styled__default.span.withConfig({
|
|
3937
|
+
displayName: "ContextMenu__ListItemHelpText",
|
|
3938
|
+
componentId: "sc-13y1vvt-2"
|
|
3939
|
+
})(["opacity:0.5;"]);
|
|
3634
3940
|
var ListMenu = styled__default.ul.withConfig({
|
|
3635
3941
|
displayName: "ContextMenu__ListMenu",
|
|
3636
|
-
componentId: "sc-13y1vvt-
|
|
3942
|
+
componentId: "sc-13y1vvt-3"
|
|
3637
3943
|
})(["padding:0.5rem 0;cursor:default;overflowY:auto;text-align:left;color:inherit;user-select:none;"]);
|
|
3638
3944
|
var ContextListMenu = styled__default(ListMenu).withConfig({
|
|
3639
3945
|
displayName: "ContextMenu__ContextListMenu",
|
|
3640
|
-
componentId: "sc-13y1vvt-
|
|
3641
|
-
})(["position:absolute;z-index:999;background-color:white;box-shadow:0 2px 2px 0 rgba(0,0,0,0.14),0 3px 10px -2px rgba(0,0,0,0.15),0 0px 2px 0px rgba(0,0,0,0.2);border-radius:
|
|
3642
|
-
return props.withoutIcons && "\n ".concat(ListItem, " > * {\n padding-left: 1.5rem;\n
|
|
3643
|
-
}, utils.ifProp('sub', styled.css(["", " ", ""],
|
|
3946
|
+
componentId: "sc-13y1vvt-4"
|
|
3947
|
+
})(["position:absolute;z-index:999;background-color:white;box-shadow:0 2px 2px 0 rgba(0,0,0,0.14),0 3px 10px -2px rgba(0,0,0,0.15),0 0px 2px 0px rgba(0,0,0,0.2);border-radius:10px;margin-bottom:0.5rem;overflow:auto;max-height:100vh;", " ", " ", ""], function (props) {
|
|
3948
|
+
return props.withoutIcons && "\n ".concat(ListItem, " > * {\n padding-left: 1.5rem;\n }\n ");
|
|
3949
|
+
}, utils.ifProp('sub', styled.css(["", " ", ""], function (props) {
|
|
3950
|
+
return props.fullHeight ? '' : props.atTop ? 'margin-top: -0.5rem;' : 'margin-top: 0.5rem;';
|
|
3951
|
+
}, utils.ifProp('atRight', "\n margin-left: -4px;\n ", "\n margin-left: 4px;\n "))), utils.customTheme('ContextMenu'));
|
|
3644
3952
|
var StickyContainer = styled__default.div.withConfig({
|
|
3645
3953
|
displayName: "ContextMenu__StickyContainer",
|
|
3646
|
-
componentId: "sc-13y1vvt-
|
|
3954
|
+
componentId: "sc-13y1vvt-5"
|
|
3647
3955
|
})(["position:sticky;background:white;", " ", ""], function (props) {
|
|
3648
3956
|
return props.atBottom && "\n bottom: -0.5rem;\n padding-bottom: 0.5rem;\n margin-bottom: -0.5rem;\n ";
|
|
3649
3957
|
}, function (props) {
|
|
@@ -3651,13 +3959,13 @@ var StickyContainer = styled__default.div.withConfig({
|
|
|
3651
3959
|
});
|
|
3652
3960
|
var ListSeparator = styled__default.li.withConfig({
|
|
3653
3961
|
displayName: "ContextMenu__ListSeparator",
|
|
3654
|
-
componentId: "sc-13y1vvt-
|
|
3962
|
+
componentId: "sc-13y1vvt-6"
|
|
3655
3963
|
})(["border-bottom:1px solid rgba(0,0,0,0.1);margin-top:0.5rem;margin-bottom:0.5rem;cursor:default;height:0;", ""], utils.ifProp('lighten', styled.css(["border-color:rgba(255,255,255,0.15);"])));
|
|
3656
3964
|
var ListHeading = styled__default.li.withConfig({
|
|
3657
3965
|
displayName: "ContextMenu__ListHeading",
|
|
3658
|
-
componentId: "sc-13y1vvt-
|
|
3966
|
+
componentId: "sc-13y1vvt-7"
|
|
3659
3967
|
})(["display:flex;align-items:center;padding:.5rem 1.25rem .25rem;span{flex-shrink:0;margin-right:.5rem;color:", ";font-size:10px;text-transform:uppercase;font-weight:600;}:after{content:'';flex-grow:1;height:1px;background:", ";}"], utils.getColor('gray180'), utils.getColor('gray240'));
|
|
3660
|
-
var SubmenuArrowIcon = utils.styledExtend(Icon)(
|
|
3968
|
+
var SubmenuArrowIcon = utils.styledExtend(Icon)(_templateObject4$1());
|
|
3661
3969
|
var SimpleLi =
|
|
3662
3970
|
/*#__PURE__*/
|
|
3663
3971
|
function (_React$Component) {
|
|
@@ -3779,6 +4087,7 @@ var Li = function Li(_ref) {
|
|
|
3779
4087
|
var _ref$emitter = _ref.emitter,
|
|
3780
4088
|
emitter = _ref$emitter === void 0 ? mitt() : _ref$emitter,
|
|
3781
4089
|
index = _ref.index,
|
|
4090
|
+
keepOpen = _ref.keepOpen,
|
|
3782
4091
|
hover = _ref.hover,
|
|
3783
4092
|
layerIndex = _ref.layerIndex,
|
|
3784
4093
|
hoverCursor = _ref.hoverCursor,
|
|
@@ -3790,9 +4099,11 @@ var Li = function Li(_ref) {
|
|
|
3790
4099
|
linkTo = _ref.linkTo,
|
|
3791
4100
|
icon = _ref.icon,
|
|
3792
4101
|
label = _ref.label,
|
|
4102
|
+
descText = _ref.descText,
|
|
4103
|
+
helpText = _ref.helpText,
|
|
3793
4104
|
target = _ref.target,
|
|
3794
4105
|
href = _ref.href,
|
|
3795
|
-
rest = _objectWithoutProperties(_ref, ["emitter", "index", "hover", "layerIndex", "hoverCursor", "passTouchThrough", "children", "setCursorOnHover", "onClick", "prefixWith", "linkTo", "icon", "label", "target", "href"]);
|
|
4106
|
+
rest = _objectWithoutProperties(_ref, ["emitter", "index", "keepOpen", "hover", "layerIndex", "hoverCursor", "passTouchThrough", "children", "setCursorOnHover", "onClick", "prefixWith", "linkTo", "icon", "label", "descText", "helpText", "target", "href"]);
|
|
3796
4107
|
|
|
3797
4108
|
var nodeRef = React.useRef();
|
|
3798
4109
|
var tagRef = React.useRef();
|
|
@@ -3849,7 +4160,7 @@ var Li = function Li(_ref) {
|
|
|
3849
4160
|
};
|
|
3850
4161
|
}, []);
|
|
3851
4162
|
React.useEffect(function () {
|
|
3852
|
-
if (children) {
|
|
4163
|
+
if (children && !utils.isMobile()) {
|
|
3853
4164
|
if (hover) {
|
|
3854
4165
|
if (!subMenu.isOpen || subMenu.closing || !subPrevented.get()) {
|
|
3855
4166
|
subMenu.open();
|
|
@@ -3863,38 +4174,35 @@ var Li = function Li(_ref) {
|
|
|
3863
4174
|
}
|
|
3864
4175
|
}, [hoverCursor]);
|
|
3865
4176
|
|
|
3866
|
-
var
|
|
3867
|
-
|
|
4177
|
+
var onMouseMove = function onMouseMove(e) {
|
|
4178
|
+
if (!hover) {
|
|
4179
|
+
utils.callIfFunction(setCursorOnHover, index);
|
|
4180
|
+
}
|
|
4181
|
+
|
|
4182
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
3868
4183
|
};
|
|
3869
4184
|
|
|
3870
4185
|
var onMouseOut = function onMouseOut(e) {
|
|
3871
|
-
|
|
4186
|
+
utils.callIfFunction(setCursorOnHover, -1);
|
|
4187
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
3872
4188
|
};
|
|
3873
4189
|
|
|
3874
|
-
var
|
|
3875
|
-
if (
|
|
3876
|
-
e.
|
|
4190
|
+
var onClickHandler = function onClickHandler(e) {
|
|
4191
|
+
if (children || keepOpen) {
|
|
4192
|
+
e.stopPropagation();
|
|
3877
4193
|
}
|
|
3878
4194
|
|
|
3879
4195
|
if (children) {
|
|
3880
|
-
if (hover)
|
|
3881
|
-
|
|
3882
|
-
if (tagRef.current) {
|
|
3883
|
-
tagRef.current.click();
|
|
4196
|
+
if (hover) {
|
|
4197
|
+
subMenu.toggle();
|
|
3884
4198
|
} else {
|
|
3885
|
-
|
|
4199
|
+
onMouseMove();
|
|
3886
4200
|
}
|
|
4201
|
+
} else {
|
|
4202
|
+
utils.callIfFunction(onClick, e);
|
|
3887
4203
|
}
|
|
3888
4204
|
};
|
|
3889
4205
|
|
|
3890
|
-
var onClickHandler = function onClickHandler(e) {
|
|
3891
|
-
if (children) {
|
|
3892
|
-
e.stopPropagation();
|
|
3893
|
-
}
|
|
3894
|
-
|
|
3895
|
-
utils.callIfFunction(onClick, e);
|
|
3896
|
-
};
|
|
3897
|
-
|
|
3898
4206
|
var onCloseSub = function onCloseSub() {
|
|
3899
4207
|
return emitter.emit('openSub');
|
|
3900
4208
|
};
|
|
@@ -3912,7 +4220,7 @@ var Li = function Li(_ref) {
|
|
|
3912
4220
|
|
|
3913
4221
|
var content = React__default.createElement(React__default.Fragment, null, prefixWith, icon && React__default.createElement(Icon, {
|
|
3914
4222
|
icon: icon
|
|
3915
|
-
}), label, children && React__default.createElement(SubmenuArrowIcon, {
|
|
4223
|
+
}), label, " ", helpText && React__default.createElement(ListItemHelpText, null, "(", helpText, ")"), descText && React__default.createElement(ListItemDescText, null, descText), children && React__default.createElement(SubmenuArrowIcon, {
|
|
3916
4224
|
icon: "arrow-right"
|
|
3917
4225
|
}));
|
|
3918
4226
|
var Tag = linkTo ? Link : 'a';
|
|
@@ -3922,14 +4230,13 @@ var Li = function Li(_ref) {
|
|
|
3922
4230
|
hover: hover,
|
|
3923
4231
|
onClick: onClickHandler,
|
|
3924
4232
|
onMouseLeave: onMouseOut,
|
|
3925
|
-
|
|
3926
|
-
onTouchEnd: touchEnd
|
|
4233
|
+
onMouseMove: onMouseMove
|
|
3927
4234
|
}), rest.withButton || rest.noActions ? content : React__default.createElement(Tag, {
|
|
3928
4235
|
href: href,
|
|
3929
4236
|
target: target,
|
|
3930
4237
|
to: linkTo,
|
|
3931
4238
|
ref: tagRef,
|
|
3932
|
-
onMouseEnter:
|
|
4239
|
+
onMouseEnter: onMouseMove
|
|
3933
4240
|
}, content), subMenu.isOpen && addProps(children));
|
|
3934
4241
|
};
|
|
3935
4242
|
Li.Simple = SimpleLi;
|
|
@@ -3941,11 +4248,11 @@ var _willUseLayers$1 = core.willUseLayers(),
|
|
|
3941
4248
|
|
|
3942
4249
|
var contextMenuLayersQuantity = contextMenuLayersSize;
|
|
3943
4250
|
|
|
3944
|
-
var _willUseSharedState$
|
|
3945
|
-
_willUseSharedState2$
|
|
3946
|
-
useContextMenuSharedState = _willUseSharedState2$
|
|
4251
|
+
var _willUseSharedState$2 = core.willUseSharedState(),
|
|
4252
|
+
_willUseSharedState2$2 = _slicedToArray(_willUseSharedState$2, 1),
|
|
4253
|
+
useContextMenuSharedState = _willUseSharedState2$2[0];
|
|
3947
4254
|
|
|
3948
|
-
var ContextMenuComponent = React.forwardRef(function (_ref2,
|
|
4255
|
+
var ContextMenuComponent = React.forwardRef(function (_ref2, unesuredRef) {
|
|
3949
4256
|
var children = _ref2.children,
|
|
3950
4257
|
sub = _ref2.sub,
|
|
3951
4258
|
hoverIndex = _ref2.hoverIndex,
|
|
@@ -3957,7 +4264,10 @@ var ContextMenuComponent = React.forwardRef(function (_ref2, ref) {
|
|
|
3957
4264
|
return 0;
|
|
3958
4265
|
} : _ref2$onHover,
|
|
3959
4266
|
fill = _ref2.fill,
|
|
3960
|
-
|
|
4267
|
+
onClick = _ref2.onClick,
|
|
4268
|
+
props = _objectWithoutProperties(_ref2, ["children", "sub", "hoverIndex", "autoHover", "withoutIcons", "onClose", "onHover", "fill", "onClick"]);
|
|
4269
|
+
|
|
4270
|
+
var ref = core.useEnsureRef(unesuredRef);
|
|
3961
4271
|
|
|
3962
4272
|
var _useState = React.useState(autoHover || sub ? 0 : -1),
|
|
3963
4273
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -4057,10 +4367,34 @@ var ContextMenuComponent = React.forwardRef(function (_ref2, ref) {
|
|
|
4057
4367
|
});
|
|
4058
4368
|
};
|
|
4059
4369
|
|
|
4370
|
+
var touchStart = utils.createPressAndMoveEvent(function (e, prevPos) {
|
|
4371
|
+
// e.preventDefault()
|
|
4372
|
+
e.stopPropagation();
|
|
4373
|
+
e.target.dispatchEvent(new MouseEvent('mousemove', {
|
|
4374
|
+
bubbles: true
|
|
4375
|
+
}));
|
|
4376
|
+
var passedResistance = false;
|
|
4377
|
+
return [function (e, nextPos) {
|
|
4378
|
+
var delta = prevPos.clientY - nextPos.clientY;
|
|
4379
|
+
|
|
4380
|
+
if (Math.abs(delta) > 10) {
|
|
4381
|
+
passedResistance = true;
|
|
4382
|
+
setCursorOnHover(-1);
|
|
4383
|
+
}
|
|
4384
|
+
}, function (e, finalPos) {
|
|
4385
|
+
if (!passedResistance) {
|
|
4386
|
+
e.target.click();
|
|
4387
|
+
}
|
|
4388
|
+
}];
|
|
4389
|
+
});
|
|
4060
4390
|
return React__default.createElement(ContextListMenu, _extends({
|
|
4061
4391
|
"data-drag": false,
|
|
4062
4392
|
ref: ref,
|
|
4063
4393
|
sub: sub,
|
|
4394
|
+
onWheel: function onWheel(e) {
|
|
4395
|
+
return e.stopPropagation();
|
|
4396
|
+
},
|
|
4397
|
+
onTouchStart: touchStart,
|
|
4064
4398
|
withoutIcons: withoutIcons,
|
|
4065
4399
|
onMouseDown: utils.stopPropagation()
|
|
4066
4400
|
}, props), formatChildren(children));
|
|
@@ -4438,19 +4772,38 @@ var TransitionDiv = function TransitionDiv(_ref) {
|
|
|
4438
4772
|
var children = _ref.children,
|
|
4439
4773
|
animation = _ref.animation,
|
|
4440
4774
|
skipChromeFix = _ref.skipChromeFix,
|
|
4775
|
+
className = _ref.className,
|
|
4441
4776
|
block = _ref.block,
|
|
4442
|
-
rest = _objectWithoutProperties(_ref, ["children", "animation", "skipChromeFix", "block"]);
|
|
4777
|
+
rest = _objectWithoutProperties(_ref, ["children", "animation", "skipChromeFix", "className", "block"]);
|
|
4778
|
+
|
|
4779
|
+
var blockRef = React.useRef();
|
|
4780
|
+
|
|
4781
|
+
var overflowEffect = function overflowEffect() {
|
|
4782
|
+
if (blockRef.current) {
|
|
4783
|
+
var prevOverflow = blockRef.current.style.overflow;
|
|
4784
|
+
blockRef.current.style.overflow = 'hidden';
|
|
4785
|
+
return function () {
|
|
4786
|
+
blockRef.current.style.overflow = prevOverflow;
|
|
4787
|
+
};
|
|
4788
|
+
}
|
|
4789
|
+
};
|
|
4443
4790
|
|
|
4444
4791
|
var content = children ? React__default.createElement(FlipList, _extends({
|
|
4792
|
+
effect: overflowEffect,
|
|
4445
4793
|
skipChromeFix: skipChromeFix,
|
|
4446
4794
|
animation: animation || DEFAULT_ANIMATION
|
|
4447
4795
|
}, rest), [React__default.createElement("div", {
|
|
4796
|
+
className: block ? "" : className,
|
|
4448
4797
|
key: "first"
|
|
4449
4798
|
}, children)]) : React__default.createElement(FlipList, _extends({
|
|
4799
|
+
effect: overflowEffect,
|
|
4450
4800
|
skipChromeFix: skipChromeFix,
|
|
4451
4801
|
animation: animation || DEFAULT_ANIMATION
|
|
4452
4802
|
}, rest), []);
|
|
4453
|
-
return block ? React__default.createElement(BlockContainer$1,
|
|
4803
|
+
return block ? React__default.createElement(BlockContainer$1, {
|
|
4804
|
+
ref: blockRef,
|
|
4805
|
+
className: className
|
|
4806
|
+
}, content) : content;
|
|
4454
4807
|
};
|
|
4455
4808
|
|
|
4456
4809
|
var BlockContainer$2 = styled__default.div.withConfig({
|
|
@@ -4458,7 +4811,7 @@ var BlockContainer$2 = styled__default.div.withConfig({
|
|
|
4458
4811
|
componentId: "htfwpl-0"
|
|
4459
4812
|
})(["position:relative;"]);
|
|
4460
4813
|
|
|
4461
|
-
var _twoWayAnimation$4 = twoWayAnimation('opacity: 0;', 'opacity: 0;', 'opacity: 1;'),
|
|
4814
|
+
var _twoWayAnimation$4 = utils.twoWayAnimation('opacity: 0;', 'opacity: 0;', 'opacity: 1;'),
|
|
4462
4815
|
_twoWayAnimation2$4 = _slicedToArray(_twoWayAnimation$4, 2),
|
|
4463
4816
|
fadeIn$3 = _twoWayAnimation2$4[0],
|
|
4464
4817
|
relativeFadeout = _twoWayAnimation2$4[1];
|
|
@@ -4503,7 +4856,7 @@ var SwitchContainer = function SwitchContainer(_ref2) {
|
|
|
4503
4856
|
return React__default.createElement(BlockContainer$2, {
|
|
4504
4857
|
ref: contentRef,
|
|
4505
4858
|
className: className
|
|
4506
|
-
}, callIfFunction(children));
|
|
4859
|
+
}, utils.callIfFunction(children));
|
|
4507
4860
|
};
|
|
4508
4861
|
|
|
4509
4862
|
var TOP_TRIGGER = function TOP_TRIGGER(posInfo, refInfo) {
|
|
@@ -4546,44 +4899,66 @@ var willUseIsSticky = function willUseIsSticky() {
|
|
|
4546
4899
|
useSharedIsSticky = _willUseSharedState2[0],
|
|
4547
4900
|
setSharedIsSticky = _willUseSharedState2[2];
|
|
4548
4901
|
|
|
4549
|
-
var
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4902
|
+
var createObserver = function createObserver(root) {
|
|
4903
|
+
return window.IntersectionObserver ? new window.IntersectionObserver(function (records, observer) {
|
|
4904
|
+
var _iteratorNormalCompletion = true;
|
|
4905
|
+
var _didIteratorError = false;
|
|
4906
|
+
var _iteratorError = undefined;
|
|
4553
4907
|
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4908
|
+
try {
|
|
4909
|
+
for (var _iterator = records[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
4910
|
+
var record = _step.value;
|
|
4911
|
+
var targetInfo = record.boundingClientRect;
|
|
4912
|
+
var rootBoundsInfo = record.rootBounds;
|
|
4559
4913
|
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4914
|
+
if (!rootBoundsInfo) {
|
|
4915
|
+
return;
|
|
4916
|
+
}
|
|
4563
4917
|
|
|
4564
|
-
|
|
4565
|
-
}
|
|
4566
|
-
} catch (err) {
|
|
4567
|
-
_didIteratorError = true;
|
|
4568
|
-
_iteratorError = err;
|
|
4569
|
-
} finally {
|
|
4570
|
-
try {
|
|
4571
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4572
|
-
_iterator.return();
|
|
4918
|
+
onChange(targetInfo, rootBoundsInfo, record.target, record.isIntersecting);
|
|
4573
4919
|
}
|
|
4920
|
+
} catch (err) {
|
|
4921
|
+
_didIteratorError = true;
|
|
4922
|
+
_iteratorError = err;
|
|
4574
4923
|
} finally {
|
|
4575
|
-
|
|
4576
|
-
|
|
4924
|
+
try {
|
|
4925
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4926
|
+
_iterator.return();
|
|
4927
|
+
}
|
|
4928
|
+
} finally {
|
|
4929
|
+
if (_didIteratorError) {
|
|
4930
|
+
throw _iteratorError;
|
|
4931
|
+
}
|
|
4577
4932
|
}
|
|
4578
4933
|
}
|
|
4934
|
+
}, {
|
|
4935
|
+
root: root
|
|
4936
|
+
}) : {
|
|
4937
|
+
observe: _identity,
|
|
4938
|
+
unobserve: _identity
|
|
4939
|
+
};
|
|
4940
|
+
};
|
|
4941
|
+
|
|
4942
|
+
var observerMap = new Map();
|
|
4943
|
+
|
|
4944
|
+
var getObserver = function getObserver() {
|
|
4945
|
+
var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
4946
|
+
var result = observerMap.get(root);
|
|
4947
|
+
|
|
4948
|
+
if (result) {
|
|
4949
|
+
return result;
|
|
4579
4950
|
}
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4951
|
+
|
|
4952
|
+
var observer = createObserver(root);
|
|
4953
|
+
observerMap.set(root, observer);
|
|
4954
|
+
return observer;
|
|
4583
4955
|
};
|
|
4956
|
+
|
|
4584
4957
|
var activeObserved = [];
|
|
4585
4958
|
|
|
4586
4959
|
var resetObservers = function resetObservers() {
|
|
4960
|
+
var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
4961
|
+
var observer = getObserver(root);
|
|
4587
4962
|
activeObserved.forEach(function (observed) {
|
|
4588
4963
|
observer.unobserve(observed);
|
|
4589
4964
|
observer.observe(observed);
|
|
@@ -4594,6 +4969,8 @@ var willUseIsSticky = function willUseIsSticky() {
|
|
|
4594
4969
|
var className = _ref.className,
|
|
4595
4970
|
children = _ref.children,
|
|
4596
4971
|
bottom = _ref.bottom,
|
|
4972
|
+
root = _ref.root,
|
|
4973
|
+
intersection = _ref.intersection,
|
|
4597
4974
|
onChange = _ref.onChange;
|
|
4598
4975
|
var ensuredRef = core.useEnsureRef(ref);
|
|
4599
4976
|
|
|
@@ -4602,20 +4979,20 @@ var willUseIsSticky = function willUseIsSticky() {
|
|
|
4602
4979
|
isSticky = _useState2[0],
|
|
4603
4980
|
setIsSticky = _useState2[1];
|
|
4604
4981
|
|
|
4605
|
-
useRegister(function (posInfo, refInfo, target) {
|
|
4982
|
+
useRegister(function (posInfo, refInfo, target, isIntersecting) {
|
|
4606
4983
|
if (ensuredRef.current === target) {
|
|
4607
|
-
var value = bottom ? BOTTOM_TRIGGER(posInfo, refInfo) : TOP_TRIGGER(posInfo, refInfo);
|
|
4984
|
+
var value = intersection ? isIntersecting : bottom ? BOTTOM_TRIGGER(posInfo, refInfo) : TOP_TRIGGER(posInfo, refInfo);
|
|
4608
4985
|
|
|
4609
4986
|
if (value !== undefined) {
|
|
4610
4987
|
setIsSticky(value);
|
|
4611
|
-
callIfFunction(onChange, value);
|
|
4988
|
+
utils.callIfFunction(onChange, value);
|
|
4612
4989
|
setSharedIsSticky(value);
|
|
4613
4990
|
}
|
|
4614
4991
|
}
|
|
4615
4992
|
});
|
|
4616
4993
|
React.useEffect(function () {
|
|
4617
4994
|
setIsSticky(false);
|
|
4618
|
-
|
|
4995
|
+
getObserver(utils.callIfFunction(root)).observe(ensuredRef.current);
|
|
4619
4996
|
activeObserved = activeObserved.concat(ensuredRef.current);
|
|
4620
4997
|
return function () {
|
|
4621
4998
|
// observer.unobserve(ref.current)
|
|
@@ -4654,26 +5031,17 @@ var FormatDate = function FormatDate(_ref) {
|
|
|
4654
5031
|
});
|
|
4655
5032
|
};
|
|
4656
5033
|
|
|
4657
|
-
var BackgroundImageStyle = styled__default.div.withConfig({
|
|
4658
|
-
displayName: "Image__BackgroundImageStyle",
|
|
4659
|
-
componentId: "sjju78-0"
|
|
4660
|
-
})(["background-image:url('", "');"], function (props) {
|
|
4661
|
-
return props.image;
|
|
4662
|
-
});
|
|
4663
5034
|
var Image = React.forwardRef(function (_ref, ref) {
|
|
4664
|
-
var
|
|
4665
|
-
|
|
5035
|
+
var dom = _ref.dom,
|
|
5036
|
+
src = _ref.src,
|
|
5037
|
+
style = _ref.style,
|
|
5038
|
+
rest = _objectWithoutProperties(_ref, ["dom", "src", "style"]);
|
|
4666
5039
|
|
|
4667
|
-
var _useState = React.useState(src),
|
|
5040
|
+
var _useState = React.useState(typeof src === 'string' ? src : src && URL.createObjectURL(src)),
|
|
4668
5041
|
_useState2 = _slicedToArray(_useState, 2),
|
|
4669
5042
|
image = _useState2[0],
|
|
4670
5043
|
setImage = _useState2[1];
|
|
4671
5044
|
|
|
4672
|
-
var _useState3 = React.useState(),
|
|
4673
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
4674
|
-
tempImage = _useState4[0],
|
|
4675
|
-
setTempImage = _useState4[1];
|
|
4676
|
-
|
|
4677
5045
|
React.useEffect(function () {
|
|
4678
5046
|
if (src) {
|
|
4679
5047
|
var imageStr = typeof src === 'string' ? src : URL.createObjectURL(src);
|
|
@@ -4688,16 +5056,21 @@ var Image = React.forwardRef(function (_ref, ref) {
|
|
|
4688
5056
|
setImage("");
|
|
4689
5057
|
}
|
|
4690
5058
|
}, [src]);
|
|
4691
|
-
return React__default.createElement(
|
|
4692
|
-
|
|
5059
|
+
return dom ? React__default.createElement("img", _extends({}, rest, {
|
|
5060
|
+
src: image,
|
|
5061
|
+
ref: ref
|
|
5062
|
+
})) : React__default.createElement("div", _extends({}, rest, {
|
|
5063
|
+
style: _objectSpread({}, style, {
|
|
5064
|
+
backgroundImage: "url(\"".concat(image, "\")")
|
|
5065
|
+
}),
|
|
4693
5066
|
ref: ref
|
|
4694
5067
|
}));
|
|
4695
5068
|
});
|
|
4696
5069
|
|
|
4697
|
-
function _templateObject$
|
|
4698
|
-
var data = _taggedTemplateLiteral(["\n @supports (position: sticky) {\n top: 0;\n margin: -0.75rem;\n }\n "]);
|
|
5070
|
+
function _templateObject$6() {
|
|
5071
|
+
var data = _taggedTemplateLiteral(["\n @supports (position: sticky) {\n top: 0;\n margin-right: -0.75rem;\n }\n "]);
|
|
4699
5072
|
|
|
4700
|
-
_templateObject$
|
|
5073
|
+
_templateObject$6 = function _templateObject() {
|
|
4701
5074
|
return data;
|
|
4702
5075
|
};
|
|
4703
5076
|
|
|
@@ -4706,7 +5079,7 @@ function _templateObject$7() {
|
|
|
4706
5079
|
var DialogWithImageHeader = styled__default(Dialog).withConfig({
|
|
4707
5080
|
displayName: "DialogWithImageHeader",
|
|
4708
5081
|
componentId: "sc-1f1ry4g-0"
|
|
4709
|
-
})(["max-width:51rem;", "{background:", ";text-shadow:none;color:rgba(120,120,120,1);font-size:20px;box-shadow:rgba(0,0,0,0.2) 0px 1px 3px 0px,rgba(0,0,0,0.05) 0px 0px 0px 1px;width:36px;height:36px;line-height:36px;transition:0.1s ease-out;:hover{background-color:rgb(230,230,230);}:active{background-color:rgb(220,220,220);transition:0s ease-out;}@supports (position:sticky){position:sticky;top:-2.5rem;right:0rem;float:right;margin:-1.25rem;}", "}"], CloseIcon, utils.getColor('gray240'), utils.media.mobile(_templateObject$
|
|
5082
|
+
})(["max-width:51rem;", "{background:", ";text-shadow:none;color:rgba(120,120,120,1);font-size:20px;box-shadow:rgba(0,0,0,0.2) 0px 1px 3px 0px,rgba(0,0,0,0.05) 0px 0px 0px 1px;width:36px;height:36px;line-height:36px;transition:0.1s ease-out;:hover{background-color:rgb(230,230,230);}:active{background-color:rgb(220,220,220);transition:0s ease-out;}@supports (position:sticky){position:sticky;top:-2.5rem;right:0rem;float:right;margin-right:-1.25rem;margin-top:0.75rem;}", "}"], CloseIcon, utils.getColor('gray240'), utils.media.mobile(_templateObject$6()));
|
|
4710
5083
|
|
|
4711
5084
|
function _templateObject2$5() {
|
|
4712
5085
|
var data = _taggedTemplateLiteral(["\n min-height: 100%;\n overflow: hidden;\n "]);
|
|
@@ -4718,10 +5091,10 @@ function _templateObject2$5() {
|
|
|
4718
5091
|
return data;
|
|
4719
5092
|
}
|
|
4720
5093
|
|
|
4721
|
-
function _templateObject$
|
|
5094
|
+
function _templateObject$7() {
|
|
4722
5095
|
var data = _taggedTemplateLiteral(["\n display:block;\n position:fixed;\n top:0;\n left:0;\n bottom:0;\n z-index:1000;\n transition: 0.25s transform ease-out;\n background-color: ", ";\n box-shadow: -5px 0 20px 5px rgba(0,0,0,0.4);\n border-radius: 0;\n ", "\n "]);
|
|
4723
5096
|
|
|
4724
|
-
_templateObject$
|
|
5097
|
+
_templateObject$7 = function _templateObject() {
|
|
4725
5098
|
return data;
|
|
4726
5099
|
};
|
|
4727
5100
|
|
|
@@ -4732,7 +5105,7 @@ var SideMenu = styled__default.div.withConfig({
|
|
|
4732
5105
|
componentId: "suvg9r-0"
|
|
4733
5106
|
})(["background-color:", ";border-top-left-radius:10px;border-bottom-left-radius:10px;width:19rem;flex-shrink:0;padding:1.25rem 0;", " ", ""], utils.getColor('gray240'), function (props) {
|
|
4734
5107
|
return !props.visibleOnDesktop && 'display:none;';
|
|
4735
|
-
}, utils.media.mobile(_templateObject$
|
|
5108
|
+
}, utils.media.mobile(_templateObject$7(), utils.getColor('gray240'), function (props) {
|
|
4736
5109
|
return !props.isOpen && "\n transform: translateX(-100%);\n box-shadow: none;\n ";
|
|
4737
5110
|
}));
|
|
4738
5111
|
var DialogTabMenu = styled__default.ul.withConfig({
|
|
@@ -4871,9 +5244,11 @@ exports.ContextMenu = ContextMenu;
|
|
|
4871
5244
|
exports.ContextMenuComponent = ContextMenuComponent;
|
|
4872
5245
|
exports.DefaultArrow = DefaultArrow;
|
|
4873
5246
|
exports.DefaultConfirmDialog = DefaultConfirmDialog;
|
|
5247
|
+
exports.DefaultWarningDialog = DefaultWarningDialog;
|
|
4874
5248
|
exports.Dialog = Dialog;
|
|
4875
5249
|
exports.DialogContainer = DialogContainer;
|
|
4876
5250
|
exports.DialogContent = DialogContent;
|
|
5251
|
+
exports.DialogContentWrapper = DialogContentWrapper;
|
|
4877
5252
|
exports.DialogError = DialogError;
|
|
4878
5253
|
exports.DialogErrorContent = DialogErrorContent;
|
|
4879
5254
|
exports.DialogFooter = DialogFooter;
|
|
@@ -4901,6 +5276,7 @@ exports.ListItem = ListItem;
|
|
|
4901
5276
|
exports.ListMenu = ListMenu;
|
|
4902
5277
|
exports.ListSeparator = ListSeparator;
|
|
4903
5278
|
exports.Loading = Loading;
|
|
5279
|
+
exports.LoadingDiv = LoadingDiv;
|
|
4904
5280
|
exports.MENU_TAB = MENU_TAB;
|
|
4905
5281
|
exports.MobileBubbleDialog = MobileBubbleDialog;
|
|
4906
5282
|
exports.Modal = Modal;
|
|
@@ -4916,6 +5292,8 @@ exports.StickyContainer = StickyContainer;
|
|
|
4916
5292
|
exports.SwitchDiv = SwitchDiv;
|
|
4917
5293
|
exports.Tooltip = Tooltip;
|
|
4918
5294
|
exports.TransitionDiv = TransitionDiv;
|
|
5295
|
+
exports.WarningDialog = WarningDialog;
|
|
5296
|
+
exports.addPositioningBound = addPositioningBound;
|
|
4919
5297
|
exports.contextMenuLayersQuantity = contextMenuLayersQuantity;
|
|
4920
5298
|
exports.defaultAnimationMaker = defaultAnimationMaker;
|
|
4921
5299
|
exports.dialogFadeInDown = dialogFadeInDown;
|
|
@@ -4929,8 +5307,11 @@ exports.morph = morph;
|
|
|
4929
5307
|
exports.preventDialogPop = preventDialogPop;
|
|
4930
5308
|
exports.removeWindowScroll = removeWindowScroll;
|
|
4931
5309
|
exports.setNotification = setNotification;
|
|
5310
|
+
exports.setWarningDialog = setWarningDialog;
|
|
4932
5311
|
exports.toPosition = toPosition;
|
|
5312
|
+
exports.useDialog = useDialog;
|
|
4933
5313
|
exports.useDialogLayers = useDialogLayers;
|
|
5314
|
+
exports.useDialogWithToggle = useDialogWithToggle;
|
|
4934
5315
|
exports.useFlip = useFlip;
|
|
4935
5316
|
exports.useFlipAnimation = useFlipAnimation;
|
|
4936
5317
|
exports.useFlipEnter = useFlipEnter;
|
|
@@ -4938,6 +5319,7 @@ exports.useFlipLeave = useFlipLeave;
|
|
|
4938
5319
|
exports.useNotification = useNotification;
|
|
4939
5320
|
exports.useNotificationRef = useNotificationRef;
|
|
4940
5321
|
exports.usePositioning = usePositioning;
|
|
5322
|
+
exports.useWarningDialog = useWarningDialog;
|
|
4941
5323
|
exports.waitForPop = waitForPop;
|
|
4942
5324
|
exports.willSetNotification = willSetNotification;
|
|
4943
5325
|
exports.willUseFlip = willUseFlip;
|