@startlibs/components 1.0.0-alpha-7v → 1.0.0-alpha-7w
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 +799 -339
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -19,28 +19,29 @@ var _possibleConstructorReturn = _interopDefault(require('@babel/runtime/helpers
|
|
|
19
19
|
var _getPrototypeOf = _interopDefault(require('@babel/runtime/helpers/getPrototypeOf'));
|
|
20
20
|
var _inherits = _interopDefault(require('@babel/runtime/helpers/inherits'));
|
|
21
21
|
var router = require('@reach/router');
|
|
22
|
-
var _slicedToArray = _interopDefault(require('@babel/runtime/helpers/slicedToArray'));
|
|
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 ReactDOM = _interopDefault(require('react-dom'));
|
|
30
|
-
var _toConsumableArray = _interopDefault(require('@babel/runtime/helpers/toConsumableArray'));
|
|
31
30
|
var _ = _interopDefault(require('lodash/fp'));
|
|
31
|
+
var _toConsumableArray = _interopDefault(require('@babel/runtime/helpers/toConsumableArray'));
|
|
32
32
|
var _typeof = _interopDefault(require('@babel/runtime/helpers/typeof'));
|
|
33
33
|
var emotion = require('emotion');
|
|
34
|
+
var _isString = _interopDefault(require('lodash/fp/isString'));
|
|
34
35
|
var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty'));
|
|
35
|
-
var mitt = _interopDefault(require('mitt'));
|
|
36
|
-
var _debounce = _interopDefault(require('lodash/fp/debounce'));
|
|
37
36
|
var _assertThisInitialized = _interopDefault(require('@babel/runtime/helpers/assertThisInitialized'));
|
|
38
37
|
var _set = _interopDefault(require('lodash/fp/set'));
|
|
39
38
|
var _pullAt = _interopDefault(require('lodash/fp/pullAt'));
|
|
40
39
|
var _map = _interopDefault(require('lodash/fp/map'));
|
|
40
|
+
var ReactDOM = _interopDefault(require('react-dom'));
|
|
41
41
|
var reactHotLoader = require('react-hot-loader');
|
|
42
42
|
var _isFunction = _interopDefault(require('lodash/fp/isFunction'));
|
|
43
43
|
var reactIs = require('react-is');
|
|
44
|
+
var mitt = _interopDefault(require('mitt'));
|
|
44
45
|
var _without = _interopDefault(require('lodash/fp/without'));
|
|
45
46
|
|
|
46
47
|
var IconComponent =
|
|
@@ -155,7 +156,7 @@ function _templateObject2() {
|
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
function _templateObject() {
|
|
158
|
-
var data = _taggedTemplateLiteral(["\n position: absolute;\n top: 51%;\n transform: translateY(-50%);\n right: 1rem;\n"]);
|
|
159
|
+
var data = _taggedTemplateLiteral(["\n position: absolute;\n top: 51%;\n transform: translateY(-50%);\n right: 1rem;\n font-size: 12px;\n"]);
|
|
159
160
|
|
|
160
161
|
_templateObject = function _templateObject() {
|
|
161
162
|
return data;
|
|
@@ -180,6 +181,7 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
|
|
|
180
181
|
success = _ref.success,
|
|
181
182
|
alert = _ref.alert,
|
|
182
183
|
highlight = _ref.highlight,
|
|
184
|
+
light = _ref.light,
|
|
183
185
|
hover = _ref.hover,
|
|
184
186
|
white = _ref.white,
|
|
185
187
|
icon = _ref.icon,
|
|
@@ -205,7 +207,7 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
|
|
|
205
207
|
concealed = _ref.concealed,
|
|
206
208
|
concealedModule = _ref.concealedModule,
|
|
207
209
|
buttonRef = _ref.buttonRef,
|
|
208
|
-
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"]);
|
|
210
|
+
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"]);
|
|
209
211
|
|
|
210
212
|
return React__default.createElement(Wrapper, _extends({
|
|
211
213
|
ref: ref || buttonRef,
|
|
@@ -219,20 +221,22 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
|
|
|
219
221
|
}), locked && React__default.createElement(LockIcon, {
|
|
220
222
|
icon: "lock"
|
|
221
223
|
}), children, isLoading && React__default.createElement(Loading, {
|
|
222
|
-
white:
|
|
223
|
-
absolute: true
|
|
224
|
+
white: !outline || !dashed || !white,
|
|
225
|
+
absolute: true,
|
|
226
|
+
size: small && '16',
|
|
227
|
+
borderWidth: small && '3'
|
|
224
228
|
}));
|
|
225
229
|
})).withConfig({
|
|
226
230
|
displayName: "Button",
|
|
227
231
|
componentId: "qe54pl-1"
|
|
228
|
-
})(["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) {
|
|
232
|
+
})(["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) {
|
|
229
233
|
return props.rounded ? '100px' : '6px';
|
|
230
234
|
}, utils.getColor, function (props) {
|
|
231
235
|
return polished.darken(0.05, utils.getColor(props, true));
|
|
232
236
|
}, function (props) {
|
|
233
237
|
return polished.darken(0.08, utils.getColor(props, true));
|
|
234
238
|
}, function (props) {
|
|
235
|
-
return !props.noFocus && styled.css([":focus{", "}", ""], focus, function (props) {
|
|
239
|
+
return !props.noFocus && !props.isLoading && styled.css([":focus{", "}", ""], focus, function (props) {
|
|
236
240
|
return props.focused && focus;
|
|
237
241
|
});
|
|
238
242
|
}, function (props) {
|
|
@@ -245,6 +249,12 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
|
|
|
245
249
|
return props.withDropdown && styled.css(["padding-right:2.25rem;text-align:left;"]);
|
|
246
250
|
}, function (props) {
|
|
247
251
|
return props.onlyDropdown && styled.css(["", "{right:50%;transform:translate(50%,-50%);}"], DropdownIcon);
|
|
252
|
+
}, function (props) {
|
|
253
|
+
return props.light && styled.css(["background:", ";color:", ";:hover{background:", ";}:active{background:", ";}"], utils.getColor('bluishGray'), utils.getColor('gray120'), function (props) {
|
|
254
|
+
return polished.darken(0.05, utils.getColor('bluishGray')(props));
|
|
255
|
+
}, function (props) {
|
|
256
|
+
return polished.darken(0.08, utils.getColor('bluishGray')(props));
|
|
257
|
+
});
|
|
248
258
|
}, function (props) {
|
|
249
259
|
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;');
|
|
250
260
|
}, function (props) {
|
|
@@ -256,8 +266,10 @@ var Button = styled__default(React__default.forwardRef(function (_ref, ref) {
|
|
|
256
266
|
}, utils.media.mobile(_templateObject2(), function (props) {
|
|
257
267
|
return !props.small && styled.css(["padding:13px 1.5rem;font-size:13px;"]);
|
|
258
268
|
}), utils.media.max(359)(_templateObject3(), function (props) {
|
|
259
|
-
return !props.small && !props.onlyIcon && !props.onlyDropdown && styled.css(["
|
|
260
|
-
}),
|
|
269
|
+
return !props.small && !props.onlyIcon && !props.onlyDropdown && styled.css(["min-width:0;"]);
|
|
270
|
+
}), function (props) {
|
|
271
|
+
return props.fullwidth && "\n width: 100%;\n ";
|
|
272
|
+
}, utils.customTheme("Button"));
|
|
261
273
|
|
|
262
274
|
Button.a = function (props) {
|
|
263
275
|
return React__default.createElement(Button, _extends({}, props, {
|
|
@@ -390,6 +402,48 @@ var ifUndefined = function ifUndefined(v) {
|
|
|
390
402
|
|
|
391
403
|
return v !== undefined ? v : or.length === 1 ? or[0] : ifUndefined.apply(void 0, [or[0]].concat(_toConsumableArray(or.slice(1))));
|
|
392
404
|
};
|
|
405
|
+
function isMobile() {
|
|
406
|
+
var check = false;
|
|
407
|
+
|
|
408
|
+
if (typeof navigator === 'undefined') {
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
(function (a) {
|
|
413
|
+
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series([46])0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ -/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4))) check = true;
|
|
414
|
+
})(navigator.userAgent || navigator.vendor || window['opera']);
|
|
415
|
+
|
|
416
|
+
return check;
|
|
417
|
+
}
|
|
418
|
+
var normalizeTouch = function normalizeTouch(fn, endFn) {
|
|
419
|
+
return function (e) {
|
|
420
|
+
var touch = e.touches[0];
|
|
421
|
+
|
|
422
|
+
if (e.touches.length > 1 && e.type !== 'touchend') {
|
|
423
|
+
callIfFunction(endFn, e, touch);
|
|
424
|
+
} else {
|
|
425
|
+
callIfFunction(fn, e, touch);
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
var normalizeMouse = function normalizeMouse(fn, endFn) {
|
|
430
|
+
return function (e) {
|
|
431
|
+
if (e.buttons > 1 && e.type !== 'mouseup') {
|
|
432
|
+
callIfFunction(endFn, e, e);
|
|
433
|
+
} else {
|
|
434
|
+
callIfFunction(fn, e, e);
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
};
|
|
438
|
+
var normalizePress = function normalizePress(fn, endFn) {
|
|
439
|
+
return function (e) {
|
|
440
|
+
if (e.touches) {
|
|
441
|
+
normalizeTouch(fn, endFn)(e);
|
|
442
|
+
} else {
|
|
443
|
+
normalizeMouse(fn, endFn)(e);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
};
|
|
393
447
|
|
|
394
448
|
function _templateObject$1() {
|
|
395
449
|
var data = _taggedTemplateLiteral(["\n ", ""]);
|
|
@@ -406,7 +460,7 @@ var media = function media() {
|
|
|
406
460
|
}
|
|
407
461
|
|
|
408
462
|
return function () {
|
|
409
|
-
return styled.css(["@media
|
|
463
|
+
return styled.css(["@media ", "{", "}"], sizePairs.map(function (_ref4) {
|
|
410
464
|
var _ref5 = _slicedToArray(_ref4, 2),
|
|
411
465
|
size = _ref5[0],
|
|
412
466
|
type = _ref5[1];
|
|
@@ -456,6 +510,54 @@ var twoWayAnimation = function twoWayAnimation() {
|
|
|
456
510
|
var identityTranslateFrames = oneWayAnimation('transform: translateY(0);', 'transform: translateY(0);');
|
|
457
511
|
var identityOpacityFrames = oneWayAnimation('opacity: 1;', 'opacity:1;');
|
|
458
512
|
|
|
513
|
+
var disableSelect = function disableSelect(e) {
|
|
514
|
+
e.preventDefault();
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
var createPressEvent = function createPressEvent(onStart) {
|
|
518
|
+
return normalizePress(function (startEvent, info) {
|
|
519
|
+
var onEnd = onStart(startEvent, info);
|
|
520
|
+
var finish = normalizePress(function (e, info) {
|
|
521
|
+
callIfFunction(onEnd, e, info);
|
|
522
|
+
window.removeEventListener('selectstart', disableSelect);
|
|
523
|
+
window.removeEventListener('touchend', finish);
|
|
524
|
+
window.removeEventListener('mouseup', finish);
|
|
525
|
+
});
|
|
526
|
+
window.addEventListener('selectstart', disableSelect);
|
|
527
|
+
|
|
528
|
+
if (startEvent.touches) {
|
|
529
|
+
window.addEventListener('touchend', finish);
|
|
530
|
+
} else {
|
|
531
|
+
window.addEventListener("mouseup", finish);
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
};
|
|
535
|
+
var createPressAndMoveEvent = function createPressAndMoveEvent(onStart) {
|
|
536
|
+
return createPressEvent(function (startEvent, info) {
|
|
537
|
+
var _concat3 = [].concat(onStart(startEvent, info)),
|
|
538
|
+
_concat4 = _slicedToArray(_concat3, 2),
|
|
539
|
+
onMove = _concat4[0],
|
|
540
|
+
onEnd = _concat4[1];
|
|
541
|
+
|
|
542
|
+
var finish = normalizePress(function (e, info) {
|
|
543
|
+
callIfFunction(onEnd, e, info);
|
|
544
|
+
window.removeEventListener('touchmove', move);
|
|
545
|
+
window.removeEventListener('mousemove', move);
|
|
546
|
+
});
|
|
547
|
+
var move = normalizePress(onMove, finish);
|
|
548
|
+
|
|
549
|
+
if (startEvent.touches) {
|
|
550
|
+
window.addEventListener('touchmove', move, {
|
|
551
|
+
passive: false
|
|
552
|
+
});
|
|
553
|
+
} else {
|
|
554
|
+
window.addEventListener("mousemove", move);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
return finish;
|
|
558
|
+
});
|
|
559
|
+
};
|
|
560
|
+
|
|
459
561
|
function _templateObject$2() {
|
|
460
562
|
var data = _taggedTemplateLiteral(["test"]);
|
|
461
563
|
|
|
@@ -471,13 +573,39 @@ var getMargins = function getMargins(domNode) {
|
|
|
471
573
|
marginTop = _window$getComputedSt.marginTop,
|
|
472
574
|
marginLeft = _window$getComputedSt.marginLeft,
|
|
473
575
|
marginBottom = _window$getComputedSt.marginBottom,
|
|
474
|
-
marginRight = _window$getComputedSt.marginRight
|
|
576
|
+
marginRight = _window$getComputedSt.marginRight,
|
|
577
|
+
paddingTop = _window$getComputedSt.paddingTop;
|
|
475
578
|
|
|
476
579
|
return {
|
|
477
580
|
marginTop: marginTop,
|
|
478
581
|
marginLeft: marginLeft,
|
|
479
582
|
marginBottom: marginBottom,
|
|
480
|
-
marginRight: marginRight
|
|
583
|
+
marginRight: marginRight,
|
|
584
|
+
paddingTop: paddingTop
|
|
585
|
+
};
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
var getParentProperties = function getParentProperties(parentNode) {
|
|
589
|
+
if (!parentNode) return {};
|
|
590
|
+
|
|
591
|
+
var _window$getComputedSt2 = window.getComputedStyle(parentNode),
|
|
592
|
+
marginTop = _window$getComputedSt2.marginTop,
|
|
593
|
+
marginLeft = _window$getComputedSt2.marginLeft,
|
|
594
|
+
marginBottom = _window$getComputedSt2.marginBottom,
|
|
595
|
+
marginRight = _window$getComputedSt2.marginRight,
|
|
596
|
+
paddingBottom = _window$getComputedSt2.paddingBottom,
|
|
597
|
+
paddingTop = _window$getComputedSt2.paddingTop;
|
|
598
|
+
|
|
599
|
+
return {
|
|
600
|
+
parentStyle: {
|
|
601
|
+
marginTop: marginTop,
|
|
602
|
+
marginLeft: marginLeft,
|
|
603
|
+
marginBottom: marginBottom,
|
|
604
|
+
marginRight: marginRight,
|
|
605
|
+
paddingBottom: paddingBottom,
|
|
606
|
+
paddingTop: paddingTop
|
|
607
|
+
},
|
|
608
|
+
parentNode: parentNode
|
|
481
609
|
};
|
|
482
610
|
};
|
|
483
611
|
|
|
@@ -505,12 +633,11 @@ var toPosition = function toPosition(domNode) {
|
|
|
505
633
|
return _objectSpread({
|
|
506
634
|
domNode: domNode,
|
|
507
635
|
nextSibling: domNode.nextSibling,
|
|
508
|
-
parentNode: domNode.parentNode,
|
|
509
636
|
top: finalPosition ? domNode.offsetTop : top - parentRect.top,
|
|
510
637
|
left: finalPosition ? domNode.offsetLeft : left - parentRect.left,
|
|
511
638
|
height: height,
|
|
512
639
|
width: width
|
|
513
|
-
}, margins);
|
|
640
|
+
}, getParentProperties(domNode.parentNode), margins);
|
|
514
641
|
};
|
|
515
642
|
|
|
516
643
|
var sumWithPx = function sumWithPx() {
|
|
@@ -588,15 +715,15 @@ var cloneWrapper = function cloneWrapper(element) {
|
|
|
588
715
|
return tempWrapper.append(c);
|
|
589
716
|
});
|
|
590
717
|
|
|
591
|
-
var _window$
|
|
592
|
-
display = _window$
|
|
593
|
-
width = _window$
|
|
594
|
-
height = _window$
|
|
595
|
-
padding = _window$
|
|
596
|
-
borderLeftWidth = _window$
|
|
597
|
-
borderRightWidth = _window$
|
|
598
|
-
borderBottomWidth = _window$
|
|
599
|
-
borderTopWidth = _window$
|
|
718
|
+
var _window$getComputedSt3 = window.getComputedStyle(element),
|
|
719
|
+
display = _window$getComputedSt3.display,
|
|
720
|
+
width = _window$getComputedSt3.width,
|
|
721
|
+
height = _window$getComputedSt3.height,
|
|
722
|
+
padding = _window$getComputedSt3.padding,
|
|
723
|
+
borderLeftWidth = _window$getComputedSt3.borderLeftWidth,
|
|
724
|
+
borderRightWidth = _window$getComputedSt3.borderRightWidth,
|
|
725
|
+
borderBottomWidth = _window$getComputedSt3.borderBottomWidth,
|
|
726
|
+
borderTopWidth = _window$getComputedSt3.borderTopWidth;
|
|
600
727
|
|
|
601
728
|
Object.assign(tempWrapper.style, {
|
|
602
729
|
display: display,
|
|
@@ -697,6 +824,8 @@ var getClientRectAnimation = function getClientRectAnimation(oldSnap, newSnap) {
|
|
|
697
824
|
skipTransform = _ref5.skipTransform;
|
|
698
825
|
|
|
699
826
|
if (hasClientRectChanged(oldSnap, newSnap)) {
|
|
827
|
+
var _oldSnap$parentStyle, _newSnap$parentStyle, _oldSnap$parentStyle2, _newSnap$parentStyle2;
|
|
828
|
+
|
|
700
829
|
var node = newSnap.domNode;
|
|
701
830
|
var offsetLeft = node.offsetLeft,
|
|
702
831
|
offsetTop = node.offsetTop,
|
|
@@ -713,8 +842,8 @@ var getClientRectAnimation = function getClientRectAnimation(oldSnap, newSnap) {
|
|
|
713
842
|
var finalPadding = '';
|
|
714
843
|
|
|
715
844
|
if (deltaHeight > 0) {
|
|
716
|
-
var _window$
|
|
717
|
-
paddingBottom = _window$
|
|
845
|
+
var _window$getComputedSt4 = window.getComputedStyle(node),
|
|
846
|
+
paddingBottom = _window$getComputedSt4.paddingBottom;
|
|
718
847
|
|
|
719
848
|
finalPadding = 'padding-bottom:' + paddingBottom + ';';
|
|
720
849
|
heightFix = "padding-bottom: ".concat(sumWithPx(deltaHeight, paddingBottom));
|
|
@@ -722,20 +851,81 @@ var getClientRectAnimation = function getClientRectAnimation(oldSnap, newSnap) {
|
|
|
722
851
|
|
|
723
852
|
var overflowFix = scrollHeight > clientHeight || scrollWidth > clientWidth ? "overflow: hidden" : "";
|
|
724
853
|
var transform = (left !== 0 || top !== 0) && !skipTransform ? "transform: translate(".concat(left, "px,").concat(top, "px);") : '';
|
|
854
|
+
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);
|
|
855
|
+
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);
|
|
856
|
+
var oldMarginTop = (parseInt(oldSnap.marginTop) || 0) + parentPaddingTopDelta;
|
|
857
|
+
var oldMarginBottom = (parseInt(oldSnap.marginBottom) || 0) + parentPaddingBottomDelta;
|
|
725
858
|
var oldTransform = node.style.transform;
|
|
726
|
-
return [utils.oneWayAnimation("\n ".concat(transform, "\n ").concat(heightFix, "\n ").concat(overflowFix, "\n margin-top:").concat(
|
|
859
|
+
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 "))];
|
|
727
860
|
} else {
|
|
728
861
|
return [];
|
|
729
862
|
}
|
|
730
863
|
};
|
|
731
864
|
|
|
732
|
-
var
|
|
733
|
-
var
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
865
|
+
var getClientRectAnimationForSwitch = function getClientRectAnimationForSwitch(oldSnap, newSnap) {
|
|
866
|
+
var _ref6 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
867
|
+
skipTransform = _ref6.skipTransform;
|
|
868
|
+
|
|
869
|
+
if (hasClientRectChanged(oldSnap, newSnap)) {
|
|
870
|
+
var _node$parentNode, _node$parentNode2;
|
|
871
|
+
|
|
872
|
+
var node = newSnap.domNode;
|
|
873
|
+
var offsetLeft = node.offsetLeft,
|
|
874
|
+
offsetTop = node.offsetTop,
|
|
875
|
+
scrollHeight = node.scrollHeight,
|
|
876
|
+
clientHeight = node.clientHeight,
|
|
877
|
+
scrollWidth = node.scrollWidth,
|
|
878
|
+
clientWidth = node.clientWidth;
|
|
879
|
+
var scrollTop = ((_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 ? void 0 : _node$parentNode.scrollTop) || 0;
|
|
880
|
+
var scrollLeft = ((_node$parentNode2 = node.parentNode) === null || _node$parentNode2 === void 0 ? void 0 : _node$parentNode2.scrollLeft) || 0; // get margin-bottom
|
|
881
|
+
|
|
882
|
+
var prevBorder = node.style.border;
|
|
883
|
+
node.style.border = '1px solid transparent';
|
|
884
|
+
var borderHeight = node.clientHeight;
|
|
885
|
+
node.style.border = prevBorder; // get negative margin top
|
|
886
|
+
|
|
887
|
+
var prevPadding = newSnap.paddingTop;
|
|
888
|
+
var nonPaddingFixTop = newSnap.clonedNode.getBoundingClientRect().top;
|
|
889
|
+
var topWithPaddingFix = nonPaddingFixTop;
|
|
890
|
+
|
|
891
|
+
if (!parseInt(prevPadding)) {
|
|
892
|
+
node.style.paddingTop = '1px';
|
|
893
|
+
topWithPaddingFix = newSnap.clonedNode.getBoundingClientRect().top;
|
|
894
|
+
node.style.paddingTop = '';
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
var newSnapNegativeTopMarginDelta = topWithPaddingFix - nonPaddingFixTop;
|
|
898
|
+
var newSnapBottomMarginDelta = clientHeight - borderHeight;
|
|
899
|
+
var left = oldSnap.left - offsetLeft + scrollLeft;
|
|
900
|
+
var top = oldSnap.top - offsetTop + scrollTop - newSnapNegativeTopMarginDelta;
|
|
901
|
+
var deltaHeight = oldSnap.height - newSnap.height;
|
|
902
|
+
var heightFix = '';
|
|
903
|
+
var finalPadding = '';
|
|
904
|
+
|
|
905
|
+
if (deltaHeight > 0) {
|
|
906
|
+
var _window$getComputedSt5 = window.getComputedStyle(node),
|
|
907
|
+
paddingBottom = _window$getComputedSt5.paddingBottom;
|
|
908
|
+
|
|
909
|
+
finalPadding = 'padding-bottom:' + paddingBottom + ';';
|
|
910
|
+
heightFix = "padding-bottom: ".concat(sumWithPx(deltaHeight, paddingBottom), ";");
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
var overflowFix = scrollHeight > clientHeight || scrollWidth > clientWidth ? "overflow: hidden;" : "";
|
|
914
|
+
var transform = (left !== 0 || top !== 0) && !skipTransform ? "transform: translate(".concat(left, "px,").concat(top, "px);") : '';
|
|
915
|
+
var oldTransform = node.style.transform;
|
|
916
|
+
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 "))];
|
|
917
|
+
} else {
|
|
918
|
+
return [];
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
var willPlaySwitch = function willPlaySwitch(oldSnap, newSnap, _ref7) {
|
|
923
|
+
var switchIn = _ref7.switchIn,
|
|
924
|
+
switchOut = _ref7.switchOut,
|
|
925
|
+
switchAnimation = _ref7.switchAnimation,
|
|
926
|
+
timing = _ref7.timing,
|
|
927
|
+
_ref7$transformHeight = _ref7.transformHeight,
|
|
928
|
+
transformHeight = _ref7$transformHeight === void 0 ? _identity : _ref7$transformHeight;
|
|
739
929
|
var realWrapper = newSnap.domNode;
|
|
740
930
|
var newChildren = [].slice.call(realWrapper.children); // realWrapper.style.willChange = 'width,height,margin-top;'
|
|
741
931
|
|
|
@@ -752,7 +942,7 @@ var playSwitch = function playSwitch(oldSnap, newSnap, _ref6) {
|
|
|
752
942
|
// oldSnap.clonedNode.style.willChange = 'width,height,opacity'
|
|
753
943
|
|
|
754
944
|
var realWrapperRect = realWrapper.getBoundingClientRect();
|
|
755
|
-
var resizeToNew = utils.oneWayAnimation("\n overflow: hidden;\n width: ".concat(
|
|
945
|
+
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 "));
|
|
756
946
|
childMAp(newChildren, function (c) {
|
|
757
947
|
if (c.dataset && !c.dataset.noFlip) {
|
|
758
948
|
if (c.style.opacity) {
|
|
@@ -769,12 +959,14 @@ var playSwitch = function playSwitch(oldSnap, newSnap, _ref6) {
|
|
|
769
959
|
});
|
|
770
960
|
var resizeOld = oldSnap.width > newSnap.width || oldSnap.height > newSnap.height ? [resizeToNew] : [resizeToNew];
|
|
771
961
|
var resizeNew = oldSnap.width < newSnap.width || oldSnap.height < newSnap.height ? [resizeToNew] : [resizeToNew];
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
962
|
+
return function () {
|
|
963
|
+
morph(oldSnap.clonedNode, formatAnimation([].concat(switchOut || switchAnimation, resizeOld), timing), function () {
|
|
964
|
+
return oldSnap.clonedNode.remove();
|
|
965
|
+
});
|
|
966
|
+
newSnap.clonedNode.style.opacity = '0';
|
|
967
|
+
continueSwitchCallbacks.set(realWrapper, continueSwitchOnClone(realWrapper));
|
|
968
|
+
morph(newSnap.clonedNode, formatAnimation([formatAnimation(switchIn || switchAnimation, timing, !switchIn)].concat(resizeNew), timing), finishSwitchNew(newSnap.clonedNode, realWrapper));
|
|
969
|
+
};
|
|
778
970
|
};
|
|
779
971
|
|
|
780
972
|
var getDelays = function getDelays(el, animation) {
|
|
@@ -816,9 +1008,9 @@ function (_React$Component) {
|
|
|
816
1008
|
return Snapshoter;
|
|
817
1009
|
}(React__default.Component);
|
|
818
1010
|
|
|
819
|
-
var useFlip = function useFlip(
|
|
820
|
-
var on =
|
|
821
|
-
moveOn =
|
|
1011
|
+
var useFlip = function useFlip(_ref8) {
|
|
1012
|
+
var on = _ref8.on,
|
|
1013
|
+
moveOn = _ref8.moveOn;
|
|
822
1014
|
core.useHiddenFill(React__default.createElement(Snapshoter, {
|
|
823
1015
|
on: on,
|
|
824
1016
|
moveOn: moveOn,
|
|
@@ -860,16 +1052,21 @@ var willUseFlip = function willUseFlip() {
|
|
|
860
1052
|
var useEnterAnimation = function useEnterAnimation(ref) {
|
|
861
1053
|
var onEnter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultEnterAnimation;
|
|
862
1054
|
|
|
863
|
-
var
|
|
864
|
-
onEnterEnd =
|
|
865
|
-
|
|
866
|
-
timing =
|
|
1055
|
+
var _ref9 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
1056
|
+
onEnterEnd = _ref9.onEnterEnd,
|
|
1057
|
+
_ref9$timing = _ref9.timing,
|
|
1058
|
+
timing = _ref9$timing === void 0 ? defaultAnimationMaker : _ref9$timing,
|
|
1059
|
+
enterEffect = _ref9.enterEffect;
|
|
867
1060
|
|
|
868
1061
|
React.useLayoutEffect(function () {
|
|
869
1062
|
if (!morphEnabled && onEnter && ref.current) {
|
|
870
1063
|
var el = ref.current;
|
|
871
1064
|
var animation = formatAnimation(onEnter, timing);
|
|
872
|
-
|
|
1065
|
+
var endEffect = utils.callIfFunction(enterEffect, el);
|
|
1066
|
+
morph(el, animation, function () {
|
|
1067
|
+
utils.callIfFunction(onEnterEnd);
|
|
1068
|
+
utils.callIfFunction(endEffect, el);
|
|
1069
|
+
});
|
|
873
1070
|
enterChildrenCallback(timing);
|
|
874
1071
|
}
|
|
875
1072
|
}, [onEnter]);
|
|
@@ -878,16 +1075,17 @@ var willUseFlip = function willUseFlip() {
|
|
|
878
1075
|
var useLeaveAnimation = function useLeaveAnimation(ref) {
|
|
879
1076
|
var onLeave = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultEnterAnimation;
|
|
880
1077
|
|
|
881
|
-
var
|
|
882
|
-
removeRef =
|
|
883
|
-
|
|
884
|
-
timing =
|
|
885
|
-
|
|
886
|
-
nestedFlip =
|
|
887
|
-
|
|
888
|
-
events =
|
|
889
|
-
|
|
890
|
-
reverse =
|
|
1078
|
+
var _ref10 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
1079
|
+
removeRef = _ref10.ref,
|
|
1080
|
+
leaveEffect = _ref10.leaveEffect,
|
|
1081
|
+
_ref10$timing = _ref10.timing,
|
|
1082
|
+
timing = _ref10$timing === void 0 ? defaultAnimationMaker : _ref10$timing,
|
|
1083
|
+
_ref10$nestedFlip = _ref10.nestedFlip,
|
|
1084
|
+
nestedFlip = _ref10$nestedFlip === void 0 ? false : _ref10$nestedFlip,
|
|
1085
|
+
_ref10$events = _ref10.events,
|
|
1086
|
+
events = _ref10$events === void 0 ? {} : _ref10$events,
|
|
1087
|
+
_ref10$reverse = _ref10.reverse,
|
|
1088
|
+
reverse = _ref10$reverse === void 0 ? true : _ref10$reverse;
|
|
891
1089
|
|
|
892
1090
|
React.useLayoutEffect(function () {
|
|
893
1091
|
return function () {
|
|
@@ -899,6 +1097,12 @@ var willUseFlip = function willUseFlip() {
|
|
|
899
1097
|
var isNested = utils.callIfFunction(nestedFlip);
|
|
900
1098
|
var clone = isNested ? el : el.cloneNode(true);
|
|
901
1099
|
|
|
1100
|
+
utils._s.each(function (callback, type) {
|
|
1101
|
+
return clone.addEventListener(type, callback);
|
|
1102
|
+
}, events);
|
|
1103
|
+
|
|
1104
|
+
var endEffect = utils.callIfFunction(leaveEffect, clone, el);
|
|
1105
|
+
|
|
902
1106
|
if (removeRef) {
|
|
903
1107
|
removeRef.current = clone;
|
|
904
1108
|
}
|
|
@@ -906,11 +1110,7 @@ var willUseFlip = function willUseFlip() {
|
|
|
906
1110
|
if (!isNested) {
|
|
907
1111
|
el.parentNode.insertBefore(clone, el);
|
|
908
1112
|
} // sometimes the clone may need to trigger events (usual case: onmouseover to reopen the element)
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
utils._s.each(function (callback, type) {
|
|
912
|
-
return clone.addEventListener(type, callback);
|
|
913
|
-
}, events); // allow clone to be continued by another animation
|
|
1113
|
+
// allow clone to be continued by another animation
|
|
914
1114
|
|
|
915
1115
|
|
|
916
1116
|
controlElement = clone; // the animation
|
|
@@ -919,18 +1119,27 @@ var willUseFlip = function willUseFlip() {
|
|
|
919
1119
|
morph(clone, animation, function () {
|
|
920
1120
|
clone.remove();
|
|
921
1121
|
disableMorph();
|
|
1122
|
+
utils.callIfFunction(endEffect, clone, el);
|
|
922
1123
|
});
|
|
923
1124
|
}; // wait for current animation to end and then animate
|
|
924
1125
|
|
|
925
1126
|
|
|
926
1127
|
if (clone.style.animation) {
|
|
1128
|
+
var maxAnimationTime = _max((clone.style.animationDuration.split(",") || ["0.25s"]).map(function (s) {
|
|
1129
|
+
return parseFloat(s.trim() || "0.25") * (s.indexOf("m") > 0 ? 1 : 1000);
|
|
1130
|
+
}));
|
|
1131
|
+
|
|
1132
|
+
var timeoutRef = {};
|
|
1133
|
+
|
|
927
1134
|
var animationEnd = function animationEnd(e) {
|
|
928
|
-
|
|
929
|
-
e.stopImmediatePropagation();
|
|
1135
|
+
clearTimeout(timeoutRef.current || -1);
|
|
930
1136
|
clone.removeEventListener('animationend', animationEnd);
|
|
1137
|
+
clone.animationDelay = '';
|
|
1138
|
+
e === null || e === void 0 ? void 0 : e.stopImmediatePropagation();
|
|
931
1139
|
setTimeout(animate, 1);
|
|
932
1140
|
};
|
|
933
1141
|
|
|
1142
|
+
timeoutRef.current = setTimeout(animationEnd, maxAnimationTime);
|
|
934
1143
|
clone.addEventListener('animationend', animationEnd);
|
|
935
1144
|
clone.style.animationDelay = getDelays(el, clone.style.animation);
|
|
936
1145
|
} else {
|
|
@@ -944,9 +1153,9 @@ var willUseFlip = function willUseFlip() {
|
|
|
944
1153
|
var useMorphAnimation = function useMorphAnimation(ref) {
|
|
945
1154
|
var ready = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
946
1155
|
|
|
947
|
-
var
|
|
948
|
-
|
|
949
|
-
timing =
|
|
1156
|
+
var _ref11 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
1157
|
+
_ref11$timing = _ref11.timing,
|
|
1158
|
+
timing = _ref11$timing === void 0 ? defaultAnimationMaker : _ref11$timing;
|
|
950
1159
|
|
|
951
1160
|
React.useLayoutEffect(function () {
|
|
952
1161
|
if (ready && controlElement && ref.current) {
|
|
@@ -973,10 +1182,10 @@ var willUseFlip = function willUseFlip() {
|
|
|
973
1182
|
});
|
|
974
1183
|
|
|
975
1184
|
if (rectAnimation.length) {
|
|
976
|
-
|
|
1185
|
+
willPlaySwitch(oldSnap, newSnap, {
|
|
977
1186
|
switchAnimation: defaultSwitchAnimation,
|
|
978
1187
|
timing: timing
|
|
979
|
-
});
|
|
1188
|
+
})();
|
|
980
1189
|
}
|
|
981
1190
|
|
|
982
1191
|
controlElement.remove();
|
|
@@ -994,8 +1203,8 @@ var willUseFlip = function willUseFlip() {
|
|
|
994
1203
|
};
|
|
995
1204
|
|
|
996
1205
|
var useNestedEnterAnimation = function useNestedEnterAnimation(ref, onEnter) {
|
|
997
|
-
var
|
|
998
|
-
timing =
|
|
1206
|
+
var _ref12 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
1207
|
+
timing = _ref12.timing;
|
|
999
1208
|
|
|
1000
1209
|
useRegisterEnter(function (parentTiming) {
|
|
1001
1210
|
var el = ref.current;
|
|
@@ -1006,9 +1215,9 @@ var willUseFlip = function willUseFlip() {
|
|
|
1006
1215
|
};
|
|
1007
1216
|
|
|
1008
1217
|
var useNestLeaveAnimation = function useNestLeaveAnimation(ref, onLeave) {
|
|
1009
|
-
var
|
|
1010
|
-
timing =
|
|
1011
|
-
events =
|
|
1218
|
+
var _ref13 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
1219
|
+
timing = _ref13.timing,
|
|
1220
|
+
events = _ref13.events;
|
|
1012
1221
|
|
|
1013
1222
|
useRegisterLeave(function (parentTiming) {
|
|
1014
1223
|
var el = ref.current;
|
|
@@ -1023,7 +1232,9 @@ var willUseFlip = function willUseFlip() {
|
|
|
1023
1232
|
|
|
1024
1233
|
return function (ref) {
|
|
1025
1234
|
React.useLayoutEffect(function () {
|
|
1026
|
-
|
|
1235
|
+
var _ref$current;
|
|
1236
|
+
|
|
1237
|
+
if ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.dataset) {
|
|
1027
1238
|
ref.current.dataset.morphId = morphId;
|
|
1028
1239
|
}
|
|
1029
1240
|
});
|
|
@@ -1063,21 +1274,22 @@ var willUseFlipSwitch = function willUseFlipSwitch() {
|
|
|
1063
1274
|
};
|
|
1064
1275
|
|
|
1065
1276
|
return function (ref, onEnter, onLeave) {
|
|
1066
|
-
var
|
|
1067
|
-
|
|
1068
|
-
timing =
|
|
1069
|
-
|
|
1070
|
-
switchAnimation =
|
|
1071
|
-
effect =
|
|
1277
|
+
var _ref14 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
|
|
1278
|
+
_ref14$timing = _ref14.timing,
|
|
1279
|
+
timing = _ref14$timing === void 0 ? defaultAnimationMaker : _ref14$timing,
|
|
1280
|
+
_ref14$switchAnimatio = _ref14.switchAnimation,
|
|
1281
|
+
switchAnimation = _ref14$switchAnimatio === void 0 ? defaultSwitchAnimation : _ref14$switchAnimatio,
|
|
1282
|
+
effect = _ref14.effect;
|
|
1072
1283
|
|
|
1073
1284
|
React.useLayoutEffect(function () {
|
|
1074
1285
|
if (oldSnap && ref.current) {
|
|
1075
1286
|
var newSnap = getTempWrapper(ref.current, {
|
|
1076
1287
|
withMargins: true
|
|
1077
1288
|
});
|
|
1289
|
+
var switchToPlay = _identity;
|
|
1078
1290
|
|
|
1079
1291
|
if (oldSnap.clonedNode) {
|
|
1080
|
-
|
|
1292
|
+
switchToPlay = willPlaySwitch(oldSnap, newSnap, {
|
|
1081
1293
|
switchIn: utils.callIfFunction(onEnter),
|
|
1082
1294
|
switchOut: utils.callIfFunction(onLeave),
|
|
1083
1295
|
switchAnimation: utils.callIfFunction(switchAnimation),
|
|
@@ -1085,8 +1297,9 @@ var willUseFlipSwitch = function willUseFlipSwitch() {
|
|
|
1085
1297
|
});
|
|
1086
1298
|
}
|
|
1087
1299
|
|
|
1088
|
-
var animation =
|
|
1089
|
-
var endEffect = utils.callIfFunction(effect, oldSnap.clonedNode, newSnap.clonedNode);
|
|
1300
|
+
var animation = getClientRectAnimationForSwitch(oldSnap, newSnap);
|
|
1301
|
+
var endEffect = utils.callIfFunction(effect, oldSnap.clonedNode, newSnap.clonedNode, ref.current);
|
|
1302
|
+
switchToPlay();
|
|
1090
1303
|
morph(newSnap.domNode, formatAnimation(animation, timing), function () {
|
|
1091
1304
|
return utils.callIfFunction(endEffect, oldSnap.clonedNode, newSnap.clonedNode);
|
|
1092
1305
|
});
|
|
@@ -1128,7 +1341,7 @@ function _templateObject2$1() {
|
|
|
1128
1341
|
}
|
|
1129
1342
|
|
|
1130
1343
|
function _templateObject$3() {
|
|
1131
|
-
var data = _taggedTemplateLiteral(["\n padding:
|
|
1344
|
+
var data = _taggedTemplateLiteral(["\n padding: ", ";\n "]);
|
|
1132
1345
|
|
|
1133
1346
|
_templateObject$3 = function _templateObject() {
|
|
1134
1347
|
return data;
|
|
@@ -1155,7 +1368,9 @@ var DialogCenter = styled__default.div.withConfig({
|
|
|
1155
1368
|
componentId: "wendlg-2"
|
|
1156
1369
|
})(["@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) {
|
|
1157
1370
|
return props.withScroll ? "scroll" : "hidden";
|
|
1158
|
-
}, utils.media.desktop(_templateObject$3()
|
|
1371
|
+
}, utils.media.desktop(_templateObject$3(), function (props) {
|
|
1372
|
+
return props.fullscreen ? '1rem' : '3rem 0.5rem;';
|
|
1373
|
+
}), utils.media.mobile(_templateObject2$1(), function (props) {
|
|
1159
1374
|
return props.fullscreenOnMobile ? '0' : '0.5rem';
|
|
1160
1375
|
}));
|
|
1161
1376
|
var PopupSlot = styled__default(core.Slot).withConfig({
|
|
@@ -1217,10 +1432,9 @@ var removeWindowScroll = function removeWindowScroll(opening) {
|
|
|
1217
1432
|
}
|
|
1218
1433
|
}
|
|
1219
1434
|
|
|
1220
|
-
var finishReset = function finishReset(
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
window.scroll(window.scrollLeft, scrollTop);
|
|
1435
|
+
var finishReset = function finishReset(marginRight, scrollTop) {
|
|
1436
|
+
// body.style.paddingRight = marginRight + 'px'
|
|
1437
|
+
window.scroll(window.scrollLeft || window.scrollX || 0, scrollTop);
|
|
1224
1438
|
fixPosition('.navbar,.JS-fix-dialog-scroll', function (n) {
|
|
1225
1439
|
if (opening) {
|
|
1226
1440
|
var _window$getComputedSt = window.getComputedStyle(n),
|
|
@@ -1238,25 +1452,37 @@ var removeWindowScroll = function removeWindowScroll(opening) {
|
|
|
1238
1452
|
n.style.transform = null;
|
|
1239
1453
|
}
|
|
1240
1454
|
});
|
|
1241
|
-
window.
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1455
|
+
window.requestAnimationFrame(function () {
|
|
1456
|
+
return window.dispatchEvent(new CustomEvent('resize', {
|
|
1457
|
+
detail: {
|
|
1458
|
+
dialog: true
|
|
1459
|
+
}
|
|
1460
|
+
}));
|
|
1461
|
+
});
|
|
1246
1462
|
};
|
|
1247
1463
|
|
|
1248
1464
|
var body = document.body;
|
|
1249
1465
|
var bodyWidth = body.offsetWidth;
|
|
1250
|
-
var scrollTop = window.pageYOffset;
|
|
1251
1466
|
|
|
1252
1467
|
if (opening) {
|
|
1468
|
+
var scrollTop = window.pageYOffset;
|
|
1253
1469
|
body.style.overflow = 'hidden';
|
|
1254
|
-
|
|
1470
|
+
var marginRight = body.offsetWidth - bodyWidth;
|
|
1471
|
+
body.style.position = 'fixed';
|
|
1472
|
+
body.style.top = -scrollTop + "px";
|
|
1473
|
+
body.style.left = '0';
|
|
1474
|
+
body.style.right = marginRight + 'px';
|
|
1475
|
+
finishReset(marginRight, scrollTop);
|
|
1255
1476
|
} else {
|
|
1256
1477
|
// setTimeout(() => {
|
|
1478
|
+
var _scrollTop = parseInt(body.style.top);
|
|
1479
|
+
|
|
1257
1480
|
body.style.overflow = '';
|
|
1258
|
-
|
|
1259
|
-
|
|
1481
|
+
body.style.position = '';
|
|
1482
|
+
body.style.top = '';
|
|
1483
|
+
body.style.left = '';
|
|
1484
|
+
body.style.right = '';
|
|
1485
|
+
finishReset(0, -_scrollTop); // },250)
|
|
1260
1486
|
}
|
|
1261
1487
|
};
|
|
1262
1488
|
|
|
@@ -1283,13 +1509,16 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1283
1509
|
_ref$animation = _ref.animation,
|
|
1284
1510
|
animation = _ref$animation === void 0 ? dialogFadeInDown : _ref$animation,
|
|
1285
1511
|
animationTiming = _ref.animationTiming,
|
|
1512
|
+
animationLeaveEffect = _ref.animationLeaveEffect,
|
|
1513
|
+
animationEnterEffect = _ref.animationEnterEffect,
|
|
1286
1514
|
skipKeys = _ref.skipKeys,
|
|
1287
1515
|
fullscreenOnMobile = _ref.fullscreenOnMobile,
|
|
1288
1516
|
_ref$confirmChanges = _ref.confirmChanges,
|
|
1289
1517
|
confirmChanges = _ref$confirmChanges === void 0 ? true : _ref$confirmChanges,
|
|
1290
1518
|
skipDom = _ref.skipDom,
|
|
1291
1519
|
modalRef = _ref.modalRef,
|
|
1292
|
-
skipCheckFocus = _ref.skipCheckFocus
|
|
1520
|
+
skipCheckFocus = _ref.skipCheckFocus,
|
|
1521
|
+
autoComplete = _ref.autoComplete;
|
|
1293
1522
|
var dialogRef = core.useEnsureRef(forwardedRef);
|
|
1294
1523
|
var prevActiveElement = core.useRefState(document.activeElement);
|
|
1295
1524
|
var modal = core.useEnsureRef(modalRef);
|
|
@@ -1312,7 +1541,7 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1312
1541
|
}
|
|
1313
1542
|
}); // clearPreventDialogPop()
|
|
1314
1543
|
|
|
1315
|
-
if (document.body.scrollHeight
|
|
1544
|
+
if (document.body.scrollHeight === document.body.clientHeight) {
|
|
1316
1545
|
modal.current.style.overflowY = "scroll";
|
|
1317
1546
|
|
|
1318
1547
|
if (modalScroll.current) {
|
|
@@ -1328,7 +1557,7 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1328
1557
|
});
|
|
1329
1558
|
}
|
|
1330
1559
|
|
|
1331
|
-
if (document.body.scrollHeight
|
|
1560
|
+
if (document.body.scrollHeight > document.body.clientHeight) {
|
|
1332
1561
|
if (modalScroll.current) {
|
|
1333
1562
|
modalScroll.current.style.overflowY = "hidden";
|
|
1334
1563
|
}
|
|
@@ -1425,7 +1654,9 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1425
1654
|
};
|
|
1426
1655
|
|
|
1427
1656
|
var checkKey = function checkKey(e) {
|
|
1428
|
-
|
|
1657
|
+
var _e$target, _e$target$className;
|
|
1658
|
+
|
|
1659
|
+
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;
|
|
1429
1660
|
|
|
1430
1661
|
if (modal.current && e.shiftKey && e.keyCode === 9 && modal.current.querySelector('[tabindex]') === document.activeElement) {
|
|
1431
1662
|
e.preventDefault();
|
|
@@ -1483,7 +1714,7 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1483
1714
|
removeWindowScroll(true);
|
|
1484
1715
|
}
|
|
1485
1716
|
|
|
1486
|
-
if (document.body.scrollHeight
|
|
1717
|
+
if (document.body.scrollHeight === document.body.clientHeight) {
|
|
1487
1718
|
modal.current.style.overflowY = "none";
|
|
1488
1719
|
}
|
|
1489
1720
|
|
|
@@ -1491,6 +1722,8 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1491
1722
|
modalScroll.current.style.overflowY = "scroll";
|
|
1492
1723
|
}
|
|
1493
1724
|
},
|
|
1725
|
+
leaveEffect: animationLeaveEffect,
|
|
1726
|
+
enterEffect: animationEnterEffect,
|
|
1494
1727
|
timing: animationTiming
|
|
1495
1728
|
});
|
|
1496
1729
|
useFlipAnimation(modal, !skipDom && utils.identityOpacityFrames, true, {
|
|
@@ -1512,6 +1745,7 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1512
1745
|
}), React__default.createElement(ModalContainer, {
|
|
1513
1746
|
ref: modal
|
|
1514
1747
|
}, React__default.createElement(DialogCenter, {
|
|
1748
|
+
autoComplete: autoComplete,
|
|
1515
1749
|
className: "JS-has-wc",
|
|
1516
1750
|
withScroll: getSize() > 1,
|
|
1517
1751
|
fullscreenOnMobile: fullscreenOnMobile,
|
|
@@ -1525,16 +1759,20 @@ var DialogContainer = React.forwardRef(function (_ref, forwardedRef) {
|
|
|
1525
1759
|
var AnimatedModal = React__default.forwardRef(function (_ref2, ref) {
|
|
1526
1760
|
var timing = _ref2.timing,
|
|
1527
1761
|
nestedFlip = _ref2.nestedFlip,
|
|
1762
|
+
enterEffect = _ref2.enterEffect,
|
|
1763
|
+
leaveEffect = _ref2.leaveEffect,
|
|
1528
1764
|
_ref2$modalIn = _ref2.modalIn,
|
|
1529
1765
|
modalIn = _ref2$modalIn === void 0 ? dialogModalIn : _ref2$modalIn,
|
|
1530
1766
|
_ref2$modalOut = _ref2.modalOut,
|
|
1531
1767
|
modalOut = _ref2$modalOut === void 0 ? dialogModalOut : _ref2$modalOut,
|
|
1532
|
-
props = _objectWithoutProperties(_ref2, ["timing", "nestedFlip", "modalIn", "modalOut"]);
|
|
1768
|
+
props = _objectWithoutProperties(_ref2, ["timing", "nestedFlip", "enterEffect", "leaveEffect", "modalIn", "modalOut"]);
|
|
1533
1769
|
|
|
1534
1770
|
var modal = core.useEnsureRef(ref);
|
|
1535
1771
|
useFlipAnimation(modal, modalIn, modalOut, {
|
|
1536
1772
|
timing: timing,
|
|
1537
|
-
nestedFlip: nestedFlip
|
|
1773
|
+
nestedFlip: nestedFlip,
|
|
1774
|
+
leaveEffect: leaveEffect,
|
|
1775
|
+
enterEffect: enterEffect
|
|
1538
1776
|
});
|
|
1539
1777
|
return React__default.createElement(Modal, _extends({}, props, {
|
|
1540
1778
|
ref: modal
|
|
@@ -1552,7 +1790,7 @@ function _templateObject2$2() {
|
|
|
1552
1790
|
}
|
|
1553
1791
|
|
|
1554
1792
|
function _templateObject$4() {
|
|
1555
|
-
var data = _taggedTemplateLiteral(["\n
|
|
1793
|
+
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 "]);
|
|
1556
1794
|
|
|
1557
1795
|
_templateObject$4 = function _templateObject() {
|
|
1558
1796
|
return data;
|
|
@@ -1620,9 +1858,114 @@ var fixDoubledLastMarginBottom = function fixDoubledLastMarginBottom(children) {
|
|
|
1620
1858
|
return React__default.Children.map(children, processChild);
|
|
1621
1859
|
};
|
|
1622
1860
|
|
|
1623
|
-
|
|
1861
|
+
var _twoWayAnimation$1 = utils.twoWayAnimation('opacity:0;', 'opacity:1;'),
|
|
1862
|
+
_twoWayAnimation2$1 = _slicedToArray(_twoWayAnimation$1, 2),
|
|
1863
|
+
loadingEnter = _twoWayAnimation2$1[0],
|
|
1864
|
+
loadingLeave = _twoWayAnimation2$1[1];
|
|
1865
|
+
|
|
1866
|
+
var _twoWayAnimation3 = utils.twoWayAnimation('opacity:0; transform:translateY(50%)', 'opacity:1;transform:translateY(0)'),
|
|
1867
|
+
_twoWayAnimation4 = _slicedToArray(_twoWayAnimation3, 2),
|
|
1868
|
+
onEnter = _twoWayAnimation4[0],
|
|
1869
|
+
onLeave = _twoWayAnimation4[1];
|
|
1870
|
+
|
|
1871
|
+
var BlockContainer = styled__default.div.withConfig({
|
|
1872
|
+
displayName: "LoadingDiv__BlockContainer",
|
|
1873
|
+
componentId: "sc-1g7ljba-0"
|
|
1874
|
+
})(["position:relative;"]);
|
|
1875
|
+
|
|
1876
|
+
var FlipDiv = function FlipDiv(_ref) {
|
|
1877
|
+
var useAnimation = _ref.useAnimation,
|
|
1878
|
+
outerRef = _ref.outerRef,
|
|
1879
|
+
_ref$onEnter = _ref.onEnter,
|
|
1880
|
+
onEnter = _ref$onEnter === void 0 ? onEnter : _ref$onEnter,
|
|
1881
|
+
_ref$onLeave = _ref.onLeave,
|
|
1882
|
+
onLeave = _ref$onLeave === void 0 ? onLeave : _ref$onLeave,
|
|
1883
|
+
props = _objectWithoutProperties(_ref, ["useAnimation", "outerRef", "onEnter", "onLeave"]);
|
|
1884
|
+
|
|
1885
|
+
var ensuredRef = core.useEnsureRef(outerRef);
|
|
1886
|
+
useAnimation(ensuredRef, onEnter, onLeave);
|
|
1887
|
+
return React__default.createElement(BlockContainer, _extends({}, props, {
|
|
1888
|
+
ref: ensuredRef
|
|
1889
|
+
}));
|
|
1890
|
+
};
|
|
1891
|
+
|
|
1892
|
+
var PaddingDiv = styled__default.div.withConfig({
|
|
1893
|
+
displayName: "LoadingDiv__PaddingDiv",
|
|
1894
|
+
componentId: "sc-1g7ljba-1"
|
|
1895
|
+
})(["padding:", " 0;"], function (props) {
|
|
1896
|
+
return props.height;
|
|
1897
|
+
});
|
|
1898
|
+
var LoadingDiv = function LoadingDiv(_ref2) {
|
|
1899
|
+
var _ref2$defaultToSuspen = _ref2.defaultToSuspense,
|
|
1900
|
+
defaultToSuspense = _ref2$defaultToSuspen === void 0 ? true : _ref2$defaultToSuspen,
|
|
1901
|
+
fallback = _ref2.fallback,
|
|
1902
|
+
isLoading = _ref2.isLoading,
|
|
1903
|
+
className = _ref2.className,
|
|
1904
|
+
_ref2$height = _ref2.height,
|
|
1905
|
+
height = _ref2$height === void 0 ? 12 : _ref2$height,
|
|
1906
|
+
_ref2$size = _ref2.size,
|
|
1907
|
+
size = _ref2$size === void 0 ? 32 : _ref2$size,
|
|
1908
|
+
_ref2$borderWidth = _ref2.borderWidth,
|
|
1909
|
+
borderWidth = _ref2$borderWidth === void 0 ? 5 : _ref2$borderWidth,
|
|
1910
|
+
children = _ref2.children;
|
|
1911
|
+
var flipAnimation = core.useLazyConstant(willUseFlipSwitch);
|
|
1912
|
+
var loadingBlock = React__default.createElement(PaddingDiv, {
|
|
1913
|
+
height: _isString(height) ? borderWidth : height + 'rem'
|
|
1914
|
+
}, React__default.createElement(Loading, {
|
|
1915
|
+
autoFocus: true,
|
|
1916
|
+
absolute: true,
|
|
1917
|
+
size: size,
|
|
1918
|
+
borderWidth: borderWidth
|
|
1919
|
+
}));
|
|
1920
|
+
return React__default.createElement(React__default.Suspense, {
|
|
1921
|
+
fallback: React__default.createElement(FlipDiv, {
|
|
1922
|
+
key: "loading",
|
|
1923
|
+
padded: true,
|
|
1924
|
+
onEnter: loadingEnter,
|
|
1925
|
+
onLeave: loadingLeave,
|
|
1926
|
+
useAnimation: flipAnimation,
|
|
1927
|
+
className: className
|
|
1928
|
+
}, fallback, loadingBlock)
|
|
1929
|
+
}, typeof isLoading === 'boolean' || defaultToSuspense ? isLoading ? React__default.createElement(FlipDiv, {
|
|
1930
|
+
key: "loading",
|
|
1931
|
+
padded: true,
|
|
1932
|
+
onEnter: loadingEnter,
|
|
1933
|
+
onLeave: loadingLeave,
|
|
1934
|
+
useAnimation: flipAnimation,
|
|
1935
|
+
className: className
|
|
1936
|
+
}, fallback, loadingBlock) : React__default.createElement(FlipDiv, {
|
|
1937
|
+
key: "loaded",
|
|
1938
|
+
loaded: true,
|
|
1939
|
+
onEnter: loadingEnter,
|
|
1940
|
+
onLeave: loadingLeave,
|
|
1941
|
+
useAnimation: flipAnimation,
|
|
1942
|
+
className: className
|
|
1943
|
+
}, children) : children);
|
|
1944
|
+
};
|
|
1945
|
+
|
|
1946
|
+
function _templateObject8() {
|
|
1624
1947
|
var data = _taggedTemplateLiteral(["\n padding: 1.5rem 1.5rem 1.5rem;\n max-width: 100%;\n ", ";\n "]);
|
|
1625
1948
|
|
|
1949
|
+
_templateObject8 = function _templateObject8() {
|
|
1950
|
+
return data;
|
|
1951
|
+
};
|
|
1952
|
+
|
|
1953
|
+
return data;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
function _templateObject7() {
|
|
1957
|
+
var data = _taggedTemplateLiteral(["\n padding: 1.5rem 1.5rem 0;\n margin: -1.5rem;\n "]);
|
|
1958
|
+
|
|
1959
|
+
_templateObject7 = function _templateObject7() {
|
|
1960
|
+
return data;
|
|
1961
|
+
};
|
|
1962
|
+
|
|
1963
|
+
return data;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
function _templateObject6() {
|
|
1967
|
+
var data = _taggedTemplateLiteral(["\n padding: 1.5rem;\n margin: -1.5rem;\n "]);
|
|
1968
|
+
|
|
1626
1969
|
_templateObject6 = function _templateObject6() {
|
|
1627
1970
|
return data;
|
|
1628
1971
|
};
|
|
@@ -1718,117 +2061,70 @@ var DialogFooter = styled__default.div.withConfig({
|
|
|
1718
2061
|
var FooterAuxiliaryContainer = styled__default.div.withConfig({
|
|
1719
2062
|
displayName: "Dialog__FooterAuxiliaryContainer",
|
|
1720
2063
|
componentId: "gai4ey-6"
|
|
1721
|
-
})(["flex-grow:1;align-self:center;display:inline-block;padding-right:1rem;float:left;"]);
|
|
1722
|
-
|
|
1723
|
-
var _twoWayAnimation$1 = utils.twoWayAnimation('opacity:0;', 'opacity:1;'),
|
|
1724
|
-
_twoWayAnimation2$1 = _slicedToArray(_twoWayAnimation$1, 2),
|
|
1725
|
-
loadingEnter = _twoWayAnimation2$1[0],
|
|
1726
|
-
loadingLeave = _twoWayAnimation2$1[1];
|
|
1727
|
-
|
|
1728
|
-
var _twoWayAnimation3 = utils.twoWayAnimation('opacity:0; transform:translateY(50%)', 'opacity:1;transform:translateY(0)'),
|
|
1729
|
-
_twoWayAnimation4 = _slicedToArray(_twoWayAnimation3, 2),
|
|
1730
|
-
onEnter = _twoWayAnimation4[0],
|
|
1731
|
-
onLeave = _twoWayAnimation4[1];
|
|
2064
|
+
})(["flex-grow:1;align-self:center;display:inline-block;padding-right:1rem;float:left;"]); // THIS IS NEEDED FOR LOADING ANIMATION ON DialogWithImageHeader
|
|
1732
2065
|
|
|
1733
|
-
var
|
|
1734
|
-
displayName: "
|
|
2066
|
+
var DialogContentWrapper = styled__default(LoadingDiv).withConfig({
|
|
2067
|
+
displayName: "Dialog__DialogContentWrapper",
|
|
1735
2068
|
componentId: "gai4ey-7"
|
|
1736
|
-
})(["
|
|
1737
|
-
|
|
1738
|
-
|
|
2069
|
+
})(["padding:2rem;margin:-2rem;", ""], utils.media.mobile(_templateObject6()));
|
|
2070
|
+
var DialogAlwaysVisibleDiv = styled__default.div.withConfig({
|
|
2071
|
+
displayName: "Dialog__DialogAlwaysVisibleDiv",
|
|
2072
|
+
componentId: "gai4ey-8"
|
|
2073
|
+
})(["padding:2rem 2rem 0;margin:-2rem;", ""], utils.media.mobile(_templateObject7())); // END
|
|
1739
2074
|
|
|
1740
|
-
var
|
|
1741
|
-
var
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
2075
|
+
var Dialog = styled__default(React__default.forwardRef(function (_ref, outerRef) {
|
|
2076
|
+
var className = _ref.className,
|
|
2077
|
+
skipWrap = _ref.skipWrap,
|
|
2078
|
+
isLoading = _ref.isLoading,
|
|
2079
|
+
footer = _ref.footer,
|
|
2080
|
+
Content = _ref.Content,
|
|
2081
|
+
children = _ref.children,
|
|
2082
|
+
title = _ref.title,
|
|
2083
|
+
illustration = _ref.illustration,
|
|
2084
|
+
icon = _ref.icon,
|
|
2085
|
+
auxiliarActions = _ref.auxiliarActions,
|
|
2086
|
+
_ref$container = _ref.container,
|
|
2087
|
+
container = _ref$container === void 0 ? true : _ref$container,
|
|
2088
|
+
props = _objectWithoutProperties(_ref, ["className", "skipWrap", "isLoading", "footer", "Content", "children", "title", "illustration", "icon", "auxiliarActions", "container"]);
|
|
1748
2089
|
|
|
1749
|
-
var
|
|
1750
|
-
useAnimation(ensuredRef, onEnter, onLeave);
|
|
1751
|
-
return React__default.createElement(BlockContainer, _extends({}, props, {
|
|
1752
|
-
ref: ensuredRef
|
|
1753
|
-
}));
|
|
1754
|
-
};
|
|
2090
|
+
var ref = core.useEnsureRef(outerRef);
|
|
1755
2091
|
|
|
1756
|
-
var
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
title = _ref2.title,
|
|
1763
|
-
illustration = _ref2.illustration,
|
|
1764
|
-
icon = _ref2.icon,
|
|
1765
|
-
auxiliarActions = _ref2.auxiliarActions,
|
|
1766
|
-
_ref2$container = _ref2.container,
|
|
1767
|
-
container = _ref2$container === void 0 ? true : _ref2$container,
|
|
1768
|
-
props = _objectWithoutProperties(_ref2, ["className", "isLoading", "footer", "Content", "children", "title", "illustration", "icon", "auxiliarActions", "container"]);
|
|
2092
|
+
var alwaysVisible = function alwaysVisible(confirmCloseDialog) {
|
|
2093
|
+
return React__default.createElement(React__default.Fragment, null, props.closeDialog && React__default.createElement(CloseIcon, {
|
|
2094
|
+
className: "JS-dialog-close",
|
|
2095
|
+
onClick: confirmCloseDialog
|
|
2096
|
+
}), title && React__default.createElement(DialogTitle, null, utils.callIfFunction(title)));
|
|
2097
|
+
};
|
|
1769
2098
|
|
|
1770
|
-
var
|
|
1771
|
-
|
|
1772
|
-
|
|
2099
|
+
var content = React__default.createElement(React__default.Fragment, null, Content && React__default.createElement(DialogContent, {
|
|
2100
|
+
icon: icon,
|
|
2101
|
+
illustration: illustration
|
|
2102
|
+
}, utils.callIfFunction(Content)), !Content && children && React__default.createElement(DialogContent, {
|
|
1773
2103
|
icon: icon,
|
|
1774
2104
|
illustration: illustration
|
|
1775
|
-
}, utils.callIfFunction(children)), Content && children && utils.callIfFunction(children));
|
|
2105
|
+
}, 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)));
|
|
1776
2106
|
|
|
1777
2107
|
var dialog = function dialog(confirmCloseDialog) {
|
|
1778
2108
|
return React__default.createElement("div", {
|
|
1779
|
-
className: className + " JS-has-wc",
|
|
2109
|
+
className: className + " JS-has-wc JS-dialog",
|
|
1780
2110
|
ref: ref
|
|
1781
|
-
},
|
|
1782
|
-
|
|
1783
|
-
}
|
|
1784
|
-
icon: icon,
|
|
1785
|
-
illustration: illustration
|
|
1786
|
-
}, utils.callIfFunction(Content)), React__default.createElement(React__default.Suspense, {
|
|
1787
|
-
fallback: React__default.createElement(FlipDiv, {
|
|
1788
|
-
key: "loading",
|
|
1789
|
-
padded: true,
|
|
1790
|
-
onEnter: loadingEnter,
|
|
1791
|
-
onLeave: loadingLeave,
|
|
1792
|
-
useAnimation: flipAnimation,
|
|
1793
|
-
className: className
|
|
1794
|
-
}, React__default.createElement(Loading, {
|
|
1795
|
-
autoFocus: true,
|
|
1796
|
-
absolute: true,
|
|
1797
|
-
size: 40,
|
|
1798
|
-
borderWidth: 6
|
|
1799
|
-
}))
|
|
1800
|
-
}, typeof isLoading === 'boolean' ? isLoading ? React__default.createElement(FlipDiv, {
|
|
1801
|
-
key: "loading",
|
|
1802
|
-
padded: true,
|
|
1803
|
-
onEnter: loadingEnter,
|
|
1804
|
-
onLeave: loadingLeave,
|
|
1805
|
-
useAnimation: flipAnimation,
|
|
1806
|
-
className: className
|
|
1807
|
-
}, React__default.createElement(Loading, {
|
|
1808
|
-
autoFocus: true,
|
|
1809
|
-
absolute: true,
|
|
1810
|
-
size: 40,
|
|
1811
|
-
borderWidth: 6
|
|
1812
|
-
})) : React__default.createElement(FlipDiv, {
|
|
1813
|
-
key: "loaded",
|
|
1814
|
-
onEnter: loadingEnter,
|
|
1815
|
-
onLeave: loadingLeave,
|
|
1816
|
-
useAnimation: flipAnimation
|
|
1817
|
-
}, content) : content), footer && React__default.createElement(DialogFooter, null, auxiliarActions && React__default.createElement(FooterAuxiliaryContainer, null, utils.callIfFunction(auxiliarActions)), utils.callIfFunction(footer)));
|
|
2111
|
+
}, 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, {
|
|
2112
|
+
isLoading: isLoading
|
|
2113
|
+
}, content)));
|
|
1818
2114
|
};
|
|
1819
2115
|
|
|
1820
2116
|
return container ? React__default.createElement(DialogContainer, _extends({}, props, {
|
|
1821
2117
|
DialogErrorContent: DialogErrorContent,
|
|
1822
2118
|
ref: ref,
|
|
1823
2119
|
title: title
|
|
1824
|
-
}), function (
|
|
1825
|
-
var confirmCloseDialog =
|
|
2120
|
+
}), function (_ref2) {
|
|
2121
|
+
var confirmCloseDialog = _ref2.confirmCloseDialog;
|
|
1826
2122
|
return dialog(confirmCloseDialog);
|
|
1827
2123
|
}) : dialog(props.closeDialog);
|
|
1828
2124
|
})).withConfig({
|
|
1829
2125
|
displayName: "Dialog",
|
|
1830
|
-
componentId: "gai4ey-
|
|
1831
|
-
})(["@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(
|
|
2126
|
+
componentId: "gai4ey-9"
|
|
2127
|
+
})(["@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) {
|
|
1832
2128
|
return props.fullscreenOnMobile && "\n border-radius: 0;\n min-height: 100%;\n ";
|
|
1833
2129
|
}), function (props) {
|
|
1834
2130
|
return props.closeDialog && styled.css(["", "{padding-right:2rem;}"], DialogTitle);
|
|
@@ -1839,8 +2135,8 @@ var ConfirmDialog = function ConfirmDialog(props) {
|
|
|
1839
2135
|
}), props.children);
|
|
1840
2136
|
};
|
|
1841
2137
|
var DefaultConfirmDialog = function DefaultConfirmDialog(props) {
|
|
1842
|
-
return React__default.createElement(core.StartlibsConsumer, null, function (
|
|
1843
|
-
var confirmDialogLabels =
|
|
2138
|
+
return React__default.createElement(core.StartlibsConsumer, null, function (_ref3) {
|
|
2139
|
+
var confirmDialogLabels = _ref3.confirmDialogLabels;
|
|
1844
2140
|
return React__default.createElement(ConfirmDialog, {
|
|
1845
2141
|
title: confirmDialogLabels.title,
|
|
1846
2142
|
closeDialog: props.onCancel,
|
|
@@ -1859,14 +2155,14 @@ var DefaultConfirmDialog = function DefaultConfirmDialog(props) {
|
|
|
1859
2155
|
}, React__default.createElement("p", null, confirmDialogLabels.content));
|
|
1860
2156
|
});
|
|
1861
2157
|
};
|
|
1862
|
-
var DialogErrorContent = function DialogErrorContent(
|
|
1863
|
-
var closeDialog =
|
|
1864
|
-
title =
|
|
1865
|
-
return React__default.createElement(core.StartlibsConsumer, null, function (
|
|
1866
|
-
var
|
|
1867
|
-
title =
|
|
1868
|
-
content =
|
|
1869
|
-
close =
|
|
2158
|
+
var DialogErrorContent = function DialogErrorContent(_ref4) {
|
|
2159
|
+
var closeDialog = _ref4.closeDialog,
|
|
2160
|
+
title = _ref4.title;
|
|
2161
|
+
return React__default.createElement(core.StartlibsConsumer, null, function (_ref5) {
|
|
2162
|
+
var _ref5$ErrorDialog = _ref5.ErrorDialog,
|
|
2163
|
+
title = _ref5$ErrorDialog.title,
|
|
2164
|
+
content = _ref5$ErrorDialog.content,
|
|
2165
|
+
close = _ref5$ErrorDialog.close;
|
|
1870
2166
|
return React__default.createElement(Dialog, {
|
|
1871
2167
|
as: "div"
|
|
1872
2168
|
}, closeDialog && React__default.createElement(CloseIcon, {
|
|
@@ -1878,13 +2174,13 @@ var DialogErrorContent = function DialogErrorContent(_ref5) {
|
|
|
1878
2174
|
}, close)));
|
|
1879
2175
|
});
|
|
1880
2176
|
};
|
|
1881
|
-
var DialogError = function DialogError(
|
|
1882
|
-
var closeDialog =
|
|
1883
|
-
return React__default.createElement(core.StartlibsConsumer, null, function (
|
|
1884
|
-
var
|
|
1885
|
-
title =
|
|
1886
|
-
content =
|
|
1887
|
-
close =
|
|
2177
|
+
var DialogError = function DialogError(_ref6) {
|
|
2178
|
+
var closeDialog = _ref6.closeDialog;
|
|
2179
|
+
return React__default.createElement(core.StartlibsConsumer, null, function (_ref7) {
|
|
2180
|
+
var _ref7$ErrorDialog = _ref7.ErrorDialog,
|
|
2181
|
+
title = _ref7$ErrorDialog.title,
|
|
2182
|
+
content = _ref7$ErrorDialog.content,
|
|
2183
|
+
close = _ref7$ErrorDialog.close;
|
|
1888
2184
|
return React__default.createElement(Dialog, {
|
|
1889
2185
|
closeDialog: closeDialog,
|
|
1890
2186
|
title: title
|
|
@@ -1974,27 +2270,42 @@ var ARROW_KEY_POSITIONS = {
|
|
|
1974
2270
|
top: '0',
|
|
1975
2271
|
bottom: '-0'
|
|
1976
2272
|
};
|
|
2273
|
+
var POSITIONING_BOUNDS = {
|
|
2274
|
+
left: 0,
|
|
2275
|
+
top: 0,
|
|
2276
|
+
right: 0,
|
|
2277
|
+
bottom: 0
|
|
2278
|
+
};
|
|
2279
|
+
var addPositioningBound = function addPositioningBound(key, value) {
|
|
2280
|
+
POSITIONING_BOUNDS[key] += value;
|
|
2281
|
+
return function () {
|
|
2282
|
+
return POSITIONING_BOUNDS[key] -= value;
|
|
2283
|
+
};
|
|
2284
|
+
};
|
|
1977
2285
|
|
|
1978
|
-
function getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision, mapping) {
|
|
2286
|
+
function getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision, mapping, boundMargin) {
|
|
1979
2287
|
// 0 pra left ou top, 1/2 pra center, 1 pra right ou bottom
|
|
1980
2288
|
var originDiff = originSize * (mapping.indexOf(originalAlignment) / 2); // 0 pra left ou top, -1/2 pra center, -1 pra right ou bottom
|
|
1981
2289
|
|
|
1982
2290
|
var selfDiff = -(selfSize * (mapping.indexOf(selfAlignment) / 2));
|
|
1983
|
-
var
|
|
1984
|
-
var
|
|
2291
|
+
var respectingBounds = boundMargin !== false;
|
|
2292
|
+
var upperBound = respectingBounds ? POSITIONING_BOUNDS[mapping[0]] + boundMargin : Number.MIN_SAFE_INTEGER;
|
|
2293
|
+
var lowerBound = respectingBounds ? POSITIONING_BOUNDS[mapping[2]] + boundMargin : 0;
|
|
2294
|
+
var newPosition = Math.max(upperBound, origin + selfDiff + originDiff + offset);
|
|
2295
|
+
var collision = Math.max(-newPosition, newPosition + selfSize - max + lowerBound);
|
|
1985
2296
|
|
|
1986
2297
|
if (collision > 0 && onCollision !== 'none') {
|
|
1987
2298
|
if (onCollision.indexOf('flip') >= 0) {
|
|
1988
|
-
var flippedPosition = getPosition(origin, -offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision.indexOf('fit') >= 0 ? 'fit' : 'none', mapping.slice().reverse());
|
|
2299
|
+
var flippedPosition = getPosition(origin, -offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision.indexOf('fit') >= 0 ? 'fit' : 'none', mapping.slice().reverse(), boundMargin);
|
|
1989
2300
|
var flippedCollision = Math.max(-flippedPosition[0], flippedPosition[0] + selfSize - max);
|
|
1990
2301
|
|
|
1991
|
-
if (collision > 0 && flippedCollision > 0) {
|
|
1992
|
-
return getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, 'fit', mapping);
|
|
2302
|
+
if (collision > 0 && flippedCollision > 0 || flippedPosition[0] < upperBound) {
|
|
2303
|
+
return getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, 'fit', mapping, boundMargin);
|
|
1993
2304
|
}
|
|
1994
2305
|
|
|
1995
2306
|
return collision < flippedCollision ? [newPosition, 'none'] : [flippedPosition[0], flippedPosition[1] === 'fit' ? 'flipfit' : 'flip'];
|
|
1996
2307
|
} else {
|
|
1997
|
-
return newPosition <
|
|
2308
|
+
return newPosition < upperBound ? [upperBound, 'fitted'] : [Math.max(upperBound, newPosition - collision), collision !== 0 ? 'fit' : 'none'];
|
|
1998
2309
|
}
|
|
1999
2310
|
} else {
|
|
2000
2311
|
return [newPosition, 'none'];
|
|
@@ -2038,7 +2349,10 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2038
2349
|
onRight = _ref.right,
|
|
2039
2350
|
onTop = _ref.top,
|
|
2040
2351
|
_ref$keepWidth = _ref.keepWidth,
|
|
2041
|
-
keepWidth = _ref$keepWidth === void 0 ? true : _ref$keepWidth
|
|
2352
|
+
keepWidth = _ref$keepWidth === void 0 ? true : _ref$keepWidth,
|
|
2353
|
+
_ref$boundMargin = _ref.boundMargin,
|
|
2354
|
+
boundMargin = _ref$boundMargin === void 0 ? 6 : _ref$boundMargin,
|
|
2355
|
+
respectBounds = _ref.respectBounds;
|
|
2042
2356
|
var placeholder = React.useRef();
|
|
2043
2357
|
var arrowRef = core.useEnsureRef(arrowRefOpt);
|
|
2044
2358
|
|
|
@@ -2082,9 +2396,9 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2082
2396
|
|
|
2083
2397
|
var left = leftPlusBorder - parseInt(borderLeftWidth, 10);
|
|
2084
2398
|
var top = topPlusBorder - parseInt(borderTopWidth, 10);
|
|
2085
|
-
var
|
|
2086
|
-
parentOffsetWidth =
|
|
2087
|
-
parentOffsetHeight =
|
|
2399
|
+
var _placeholder$current$2 = placeholder.current.offsetParent,
|
|
2400
|
+
parentOffsetWidth = _placeholder$current$2.offsetWidth,
|
|
2401
|
+
parentOffsetHeight = _placeholder$current$2.offsetHeight;
|
|
2088
2402
|
var _element$current = element.current,
|
|
2089
2403
|
popupOffsetWidth = _element$current.offsetWidth,
|
|
2090
2404
|
popupOffsetHeight = _element$current.offsetHeight;
|
|
@@ -2123,12 +2437,12 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2123
2437
|
verticalAt = _replace$split4[0],
|
|
2124
2438
|
horizontalAt = _replace$split4[1];
|
|
2125
2439
|
|
|
2126
|
-
var _getPosition = getPosition(left, offsetX, bodyWidth, parentOffsetWidth, fill ? parentOffsetWidth : popupOffsetWidth, horizontalAt, horizontalMy, horizontalCollision, HORIZONTAL_MAPPING),
|
|
2440
|
+
var _getPosition = getPosition(left, offsetX, bodyWidth, parentOffsetWidth, fill ? parentOffsetWidth : popupOffsetWidth, horizontalAt, horizontalMy, horizontalCollision, HORIZONTAL_MAPPING, !!respectBounds && boundMargin),
|
|
2127
2441
|
_getPosition2 = _slicedToArray(_getPosition, 2),
|
|
2128
2442
|
processedLeft = _getPosition2[0],
|
|
2129
2443
|
collisionH = _getPosition2[1];
|
|
2130
2444
|
|
|
2131
|
-
var _getPosition3 = getPosition(top, offsetY, windowHeight, parentOffsetHeight, popupOffsetHeight, verticalAt, verticalMy, verticalCollision, VERTICAL_MAPPING),
|
|
2445
|
+
var _getPosition3 = getPosition(top, offsetY, windowHeight, parentOffsetHeight, popupOffsetHeight, verticalAt, verticalMy, verticalCollision, VERTICAL_MAPPING, !!respectBounds && boundMargin),
|
|
2132
2446
|
_getPosition4 = _slicedToArray(_getPosition3, 2),
|
|
2133
2447
|
processedTop = _getPosition4[0],
|
|
2134
2448
|
collisionV = _getPosition4[1];
|
|
@@ -2141,13 +2455,23 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2141
2455
|
var arrowOnVerticalSide = arrowSide === 'left' || arrowSide === 'right';
|
|
2142
2456
|
var arrowSize = arrowElement ? arrowElement.getBoundingClientRect()[arrowOnVerticalSide ? 'height' : 'width'] : ARROW_DEFAULT_SIZE * Math.sqrt(2);
|
|
2143
2457
|
|
|
2144
|
-
var
|
|
2145
|
-
|
|
2146
|
-
arrowOffset =
|
|
2147
|
-
popupArrowOffset =
|
|
2458
|
+
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),
|
|
2459
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
2460
|
+
arrowOffset = _ref3[0],
|
|
2461
|
+
popupArrowOffset = _ref3[1];
|
|
2462
|
+
|
|
2463
|
+
var maxHeight = window.innerHeight - (POSITIONING_BOUNDS.top + POSITIONING_BOUNDS.bottom) - (respectBounds ? boundMargin * 2 : 0);
|
|
2464
|
+
var maxWidth = window.innerWidth - (POSITIONING_BOUNDS.left + POSITIONING_BOUNDS.right) - (respectBounds ? boundMargin * 2 : 0);
|
|
2465
|
+
element.current.style.maxHeight = '';
|
|
2466
|
+
|
|
2467
|
+
if (parseInt(window.getComputedStyle(element.current).maxHeight) > maxHeight) {
|
|
2468
|
+
element.current.style.maxHeight = maxHeight + 'px';
|
|
2469
|
+
}
|
|
2148
2470
|
|
|
2149
2471
|
if (keepWidth) {
|
|
2150
2472
|
element.current.style.width = Math.ceil(popupCurrentWidth) + "px";
|
|
2473
|
+
} else {
|
|
2474
|
+
element.current.style.maxWidth = maxWidth + 'px';
|
|
2151
2475
|
} // console.log({processedTop,top,offsetY,scrollY})
|
|
2152
2476
|
|
|
2153
2477
|
|
|
@@ -2168,6 +2492,8 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2168
2492
|
atBottom: verticalAt === 'bottom' && !flippedV || verticalAt === 'top' && flippedV,
|
|
2169
2493
|
atLeft: horizontalAt === 'left' && !flippedH || verticalAt === 'right' && flippedH,
|
|
2170
2494
|
atRight: horizontalAt === 'right' && !flippedH || verticalAt === 'left' && flippedH,
|
|
2495
|
+
fullHeight: popupOffsetHeight > maxHeight,
|
|
2496
|
+
fullWidth: popupOffsetWidth > maxWidth,
|
|
2171
2497
|
arrowSide: arrowSide,
|
|
2172
2498
|
arrowOffset: arrowOffset,
|
|
2173
2499
|
arrowStyle: arrowStyle
|
|
@@ -2184,8 +2510,6 @@ var usePositioning = function usePositioning(element, _ref, arrowRefOpt) {
|
|
|
2184
2510
|
|
|
2185
2511
|
React.useLayoutEffect(setPosition, []);
|
|
2186
2512
|
React.useEffect(function () {
|
|
2187
|
-
var debouncedSetPosition = _debounce(100, setPosition);
|
|
2188
|
-
|
|
2189
2513
|
window.addEventListener('portalReposition', setPosition);
|
|
2190
2514
|
window.addEventListener('stepResize', setPosition);
|
|
2191
2515
|
window.addEventListener('scroll', setPosition);
|
|
@@ -2305,6 +2629,7 @@ function (_React$Component) {
|
|
|
2305
2629
|
removeAnimation = _this$props.removeAnimation,
|
|
2306
2630
|
onEndAnimation = _this$props.onEndAnimation,
|
|
2307
2631
|
onStartAnimation = _this$props.onStartAnimation,
|
|
2632
|
+
effect = _this$props.effect,
|
|
2308
2633
|
skipChromeFix = _this$props.skipChromeFix,
|
|
2309
2634
|
timing = _this$props.timing;
|
|
2310
2635
|
newSnap.children.forEach(function (newItemSnap) {
|
|
@@ -2341,8 +2666,12 @@ function (_React$Component) {
|
|
|
2341
2666
|
var rectAnimation = getClientRectAnimation(oldSnap.parent, newSnap.parent, {
|
|
2342
2667
|
skipTransform: true
|
|
2343
2668
|
});
|
|
2669
|
+
var endEffect = callIfFunction(effect, newSnap.parent.domNode, {
|
|
2670
|
+
newSnap: newSnap,
|
|
2671
|
+
oldSnap: oldSnap
|
|
2672
|
+
});
|
|
2344
2673
|
callIfFunction(onStartAnimation);
|
|
2345
|
-
morph(newSnap.parent.domNode, formatAnimation(rectAnimation, timing), onEndAnimation);
|
|
2674
|
+
morph(newSnap.parent.domNode, formatAnimation(rectAnimation, timing), endEffect || onEndAnimation);
|
|
2346
2675
|
};
|
|
2347
2676
|
|
|
2348
2677
|
_this.reinsertSnap = function (item, scrollDelta, allChildren) {
|
|
@@ -2433,6 +2762,7 @@ function (_React$Component) {
|
|
|
2433
2762
|
var newSnap = this.calculatePositionForAnimation();
|
|
2434
2763
|
|
|
2435
2764
|
if (newSnap) {
|
|
2765
|
+
// se não tiver parentNode, verficar se há uma div sendo offsetParent, body não serve
|
|
2436
2766
|
this.play(snap, newSnap);
|
|
2437
2767
|
}
|
|
2438
2768
|
}
|
|
@@ -2487,7 +2817,9 @@ var _React$createContext = React__default.createContext({}),
|
|
|
2487
2817
|
var DropPosition = styled__default.div.withConfig({
|
|
2488
2818
|
displayName: "Draggable__DropPosition",
|
|
2489
2819
|
componentId: "sc-1g7nmwq-0"
|
|
2490
|
-
})(["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;"])
|
|
2820
|
+
})(["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) {
|
|
2821
|
+
return props.rounded && "\n border-radius: 1000rem;\n ";
|
|
2822
|
+
});
|
|
2491
2823
|
var EmptyPlaceholder = styled__default.div.withConfig({
|
|
2492
2824
|
displayName: "Draggable__EmptyPlaceholder",
|
|
2493
2825
|
componentId: "sc-1g7nmwq-1"
|
|
@@ -2567,19 +2899,24 @@ function (_React$Component) {
|
|
|
2567
2899
|
isDragging = _this$props.isDragging,
|
|
2568
2900
|
droppable = _this$props.droppable,
|
|
2569
2901
|
dragIndex = _this$props.dragIndex,
|
|
2902
|
+
roundedPlaceholder = _this$props.roundedPlaceholder,
|
|
2570
2903
|
children = _this$props.children,
|
|
2571
|
-
props = _objectWithoutProperties(_this$props, ["DragTag", "as", "eventHandlers", "className", "isDragging", "droppable", "dragIndex", "children"]);
|
|
2904
|
+
props = _objectWithoutProperties(_this$props, ["DragTag", "as", "eventHandlers", "className", "isDragging", "droppable", "dragIndex", "roundedPlaceholder", "children"]);
|
|
2572
2905
|
|
|
2573
2906
|
var Wrapper = DragTag || as;
|
|
2574
2907
|
var extraClassName = (isDragging ? ' drag-drop-placeholder' : '') + ' drag-drop-item';
|
|
2575
2908
|
return typeof children === 'function' ? children(_objectSpread({
|
|
2576
2909
|
className: extraClassName
|
|
2577
2910
|
}, this.events, {
|
|
2578
|
-
children: isDragging && React__default.createElement(DropPosition,
|
|
2911
|
+
children: isDragging && React__default.createElement(DropPosition, {
|
|
2912
|
+
rounded: roundedPlaceholder
|
|
2913
|
+
})
|
|
2579
2914
|
})) : React__default.createElement(Wrapper, _extends({
|
|
2580
2915
|
className: className + extraClassName,
|
|
2581
2916
|
isDragging: isDragging
|
|
2582
|
-
}, props, this.events), children, isDragging && React__default.createElement(DropPosition,
|
|
2917
|
+
}, props, this.events), children, isDragging && React__default.createElement(DropPosition, {
|
|
2918
|
+
rounded: roundedPlaceholder
|
|
2919
|
+
}));
|
|
2583
2920
|
}
|
|
2584
2921
|
}]);
|
|
2585
2922
|
|
|
@@ -2673,6 +3010,11 @@ function (_React$Component2) {
|
|
|
2673
3010
|
}
|
|
2674
3011
|
|
|
2675
3012
|
var parent = ReactDOM.findDOMNode(_assertThisInitialized(_assertThisInitialized(_this2))).offsetParent;
|
|
3013
|
+
|
|
3014
|
+
if (!parent) {
|
|
3015
|
+
return [];
|
|
3016
|
+
}
|
|
3017
|
+
|
|
2676
3018
|
var parentRect = parent.getBoundingClientRect();
|
|
2677
3019
|
|
|
2678
3020
|
var toPosition = _this2.toPosition(parentRect, scrollXY);
|
|
@@ -2857,7 +3199,14 @@ function (_React$Component3) {
|
|
|
2857
3199
|
};
|
|
2858
3200
|
|
|
2859
3201
|
_this3.dragStart = function (draggable) {
|
|
2860
|
-
return function (
|
|
3202
|
+
return function (e, _ref4) {
|
|
3203
|
+
var pageX = _ref4.pageX,
|
|
3204
|
+
pageY = _ref4.pageY,
|
|
3205
|
+
clientX = _ref4.clientX,
|
|
3206
|
+
clientY = _ref4.clientY;
|
|
3207
|
+
_this3.dragHasEnded = false;
|
|
3208
|
+
var currentTarget = e.currentTarget;
|
|
3209
|
+
|
|
2861
3210
|
if (shouldPreventDrag(e) || _this3.props.disabled) {
|
|
2862
3211
|
return;
|
|
2863
3212
|
}
|
|
@@ -2878,7 +3227,12 @@ function (_React$Component3) {
|
|
|
2878
3227
|
if (window.navigator.vibrate) window.navigator.vibrate([65]);
|
|
2879
3228
|
|
|
2880
3229
|
if (!_this3.state.dragInfo.active) {
|
|
2881
|
-
_this3.dragMove(
|
|
3230
|
+
_this3.dragMove(e, {
|
|
3231
|
+
pageX: pageX,
|
|
3232
|
+
pageY: pageY,
|
|
3233
|
+
clientX: clientX,
|
|
3234
|
+
clientY: clientY
|
|
3235
|
+
});
|
|
2882
3236
|
}
|
|
2883
3237
|
}, holdTouchTimer);
|
|
2884
3238
|
}
|
|
@@ -3066,15 +3420,20 @@ function (_React$Component3) {
|
|
|
3066
3420
|
area: intersectionArea / area,
|
|
3067
3421
|
distance: distance
|
|
3068
3422
|
};
|
|
3069
|
-
}).reduce(function (iMax,
|
|
3070
|
-
var area =
|
|
3071
|
-
distance =
|
|
3423
|
+
}).reduce(function (iMax, _ref5, i, arr) {
|
|
3424
|
+
var area = _ref5.area,
|
|
3425
|
+
distance = _ref5.distance;
|
|
3072
3426
|
return area > arr[iMax].area || area === arr[iMax].area && distance < arr[iMax].distance ? i : iMax;
|
|
3073
3427
|
}, 0);
|
|
3074
3428
|
return centerInsideGhost[closestIndex];
|
|
3075
3429
|
};
|
|
3076
3430
|
|
|
3077
3431
|
_this3.stopMoving = function () {
|
|
3432
|
+
if (_this3.dragHasEnded) {
|
|
3433
|
+
return;
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3436
|
+
_this3.dragHasEnded = true;
|
|
3078
3437
|
var dragInfo = _this3.state.dragInfo;
|
|
3079
3438
|
var activeIndex = dragInfo.activeIndex,
|
|
3080
3439
|
startIndex = dragInfo.startIndex,
|
|
@@ -3082,6 +3441,11 @@ function (_React$Component3) {
|
|
|
3082
3441
|
activeDroppable = dragInfo.activeDroppable,
|
|
3083
3442
|
startDroppable = dragInfo.startDroppable;
|
|
3084
3443
|
|
|
3444
|
+
if (_this3.endTimeout) {
|
|
3445
|
+
clearTimeout(_this3.endTimeout);
|
|
3446
|
+
_this3.endTimeout = null;
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3085
3449
|
_this3.setState({
|
|
3086
3450
|
saving: {
|
|
3087
3451
|
list: _this3.props.list,
|
|
@@ -3089,13 +3453,15 @@ function (_React$Component3) {
|
|
|
3089
3453
|
dragInfo: _set('active', false, dragInfo)
|
|
3090
3454
|
}
|
|
3091
3455
|
}, function () {
|
|
3456
|
+
var _this3$ghost;
|
|
3457
|
+
|
|
3092
3458
|
_this3.preventScroll = false;
|
|
3093
3459
|
|
|
3094
3460
|
_this3.props.setDragRef(null);
|
|
3095
3461
|
|
|
3096
3462
|
_this3.settedDragRef = false;
|
|
3097
3463
|
|
|
3098
|
-
if (_this3.ghost.parentNode) {
|
|
3464
|
+
if ((_this3$ghost = _this3.ghost) === null || _this3$ghost === void 0 ? void 0 : _this3$ghost.parentNode) {
|
|
3099
3465
|
reenableWillChange(_this3.ghost);
|
|
3100
3466
|
|
|
3101
3467
|
_this3.ghost.parentNode.removeChild(_this3.ghost);
|
|
@@ -3122,7 +3488,11 @@ function (_React$Component3) {
|
|
|
3122
3488
|
});
|
|
3123
3489
|
};
|
|
3124
3490
|
|
|
3125
|
-
_this3.dragMove = function (
|
|
3491
|
+
_this3.dragMove = function (e, _ref6) {
|
|
3492
|
+
var pageX = _ref6.pageX,
|
|
3493
|
+
pageY = _ref6.pageY,
|
|
3494
|
+
clientX = _ref6.clientX,
|
|
3495
|
+
clientY = _ref6.clientY;
|
|
3126
3496
|
var distance = Math.sqrt(Math.pow(_this3.positions.originalX - pageX, 2) + Math.pow(_this3.positions.originalY - pageY, 2));
|
|
3127
3497
|
|
|
3128
3498
|
if (e.type === 'mousemove') {
|
|
@@ -3328,6 +3698,8 @@ function (_React$Component3) {
|
|
|
3328
3698
|
_this3.ghost.style.transform = newTransform;
|
|
3329
3699
|
|
|
3330
3700
|
_this3.ghost.addEventListener('transitionend', _this3.stopMoving);
|
|
3701
|
+
|
|
3702
|
+
_this3.endTimeout = setTimeout(_this3.stopMoving, 300);
|
|
3331
3703
|
}
|
|
3332
3704
|
} else {
|
|
3333
3705
|
_this3.stopMoving();
|
|
@@ -3345,10 +3717,10 @@ function (_React$Component3) {
|
|
|
3345
3717
|
};
|
|
3346
3718
|
|
|
3347
3719
|
_this3.mouseDown = function (draggable) {
|
|
3348
|
-
return utils.normalizeMouse(_this3.dragStart(draggable));
|
|
3720
|
+
return utils.normalizeMouse(_this3.dragStart(draggable), _this3.dragEnd);
|
|
3349
3721
|
};
|
|
3350
3722
|
|
|
3351
|
-
_this3.mouseMove = utils.normalizeMouse(_this3.dragMove);
|
|
3723
|
+
_this3.mouseMove = utils.normalizeMouse(_this3.dragMove, _this3.dragEnd);
|
|
3352
3724
|
|
|
3353
3725
|
_this3.touchStart = function (draggable) {
|
|
3354
3726
|
return utils.normalizeTouch(_this3.dragStart(draggable), _this3.dragEnd);
|
|
@@ -3589,9 +3961,19 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
3589
3961
|
}, rest), content), children);
|
|
3590
3962
|
};
|
|
3591
3963
|
|
|
3592
|
-
function
|
|
3964
|
+
function _templateObject4$1() {
|
|
3593
3965
|
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"]);
|
|
3594
3966
|
|
|
3967
|
+
_templateObject4$1 = function _templateObject4() {
|
|
3968
|
+
return data;
|
|
3969
|
+
};
|
|
3970
|
+
|
|
3971
|
+
return data;
|
|
3972
|
+
}
|
|
3973
|
+
|
|
3974
|
+
function _templateObject3$2() {
|
|
3975
|
+
var data = _taggedTemplateLiteral(["\n font-size: 12px;\n "]);
|
|
3976
|
+
|
|
3595
3977
|
_templateObject3$2 = function _templateObject3() {
|
|
3596
3978
|
return data;
|
|
3597
3979
|
};
|
|
@@ -3610,7 +3992,7 @@ function _templateObject2$4() {
|
|
|
3610
3992
|
}
|
|
3611
3993
|
|
|
3612
3994
|
function _templateObject$6() {
|
|
3613
|
-
var data = _taggedTemplateLiteral(["\n font-size:
|
|
3995
|
+
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 "]);
|
|
3614
3996
|
|
|
3615
3997
|
_templateObject$6 = function _templateObject() {
|
|
3616
3998
|
return data;
|
|
@@ -3627,24 +4009,34 @@ var popupAnimation = utils.animationTiming('0.2s ease-out');
|
|
|
3627
4009
|
var ListItem = styled__default.li.withConfig({
|
|
3628
4010
|
displayName: "ContextMenu__ListItem",
|
|
3629
4011
|
componentId: "sc-13y1vvt-0"
|
|
3630
|
-
})(["position:relative;& > *{padding:11px 3.
|
|
4012
|
+
})(["position:relative;font-size:12px;& > *{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$6(), Icon), utils.ifProp('hover', styled.css(["& > a,& > label{background:", ";color:", ";color:", ";}"], function (props) {
|
|
3631
4013
|
return polished.lighten(0.53, utils.getColor("main")(props));
|
|
3632
4014
|
}, utils.getColor('main'), function (props) {
|
|
3633
4015
|
return polished.darken(0.03, utils.getColor("main")(props));
|
|
3634
|
-
})), utils.ifProp('highlight', styled.css(["color:", ";"], utils.getColor('main'))),
|
|
4016
|
+
})), 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'));
|
|
4017
|
+
var ListItemDescText = styled__default.div.withConfig({
|
|
4018
|
+
displayName: "ContextMenu__ListItemDescText",
|
|
4019
|
+
componentId: "sc-13y1vvt-1"
|
|
4020
|
+
})(["font-size:11px;margin-top:0.25rem;opacity:0.6;", ""], utils.media.mobile(_templateObject3$2()));
|
|
4021
|
+
var ListItemHelpText = styled__default.span.withConfig({
|
|
4022
|
+
displayName: "ContextMenu__ListItemHelpText",
|
|
4023
|
+
componentId: "sc-13y1vvt-2"
|
|
4024
|
+
})(["opacity:0.5;"]);
|
|
3635
4025
|
var ListMenu = styled__default.ul.withConfig({
|
|
3636
4026
|
displayName: "ContextMenu__ListMenu",
|
|
3637
|
-
componentId: "sc-13y1vvt-
|
|
4027
|
+
componentId: "sc-13y1vvt-3"
|
|
3638
4028
|
})(["padding:0.5rem 0;cursor:default;overflowY:auto;text-align:left;color:inherit;user-select:none;"]);
|
|
3639
4029
|
var ContextListMenu = styled__default(ListMenu).withConfig({
|
|
3640
4030
|
displayName: "ContextMenu__ContextListMenu",
|
|
3641
|
-
componentId: "sc-13y1vvt-
|
|
3642
|
-
})(["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:
|
|
3643
|
-
return props.withoutIcons && "\n ".concat(ListItem, " > * {\n padding-left: 1.5rem;\n
|
|
3644
|
-
}, utils.ifProp('sub', styled.css(["", " ", ""],
|
|
4031
|
+
componentId: "sc-13y1vvt-4"
|
|
4032
|
+
})(["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) {
|
|
4033
|
+
return props.withoutIcons && "\n ".concat(ListItem, " > * {\n padding-left: 1.5rem;\n }\n ");
|
|
4034
|
+
}, utils.ifProp('sub', styled.css(["", " ", ""], function (props) {
|
|
4035
|
+
return props.fullHeight ? '' : props.atTop ? 'margin-top: -0.5rem;' : 'margin-top: 0.5rem;';
|
|
4036
|
+
}, utils.ifProp('atRight', "\n margin-left: -4px;\n ", "\n margin-left: 4px;\n "))), utils.customTheme('ContextMenu'));
|
|
3645
4037
|
var StickyContainer = styled__default.div.withConfig({
|
|
3646
4038
|
displayName: "ContextMenu__StickyContainer",
|
|
3647
|
-
componentId: "sc-13y1vvt-
|
|
4039
|
+
componentId: "sc-13y1vvt-5"
|
|
3648
4040
|
})(["position:sticky;background:white;", " ", ""], function (props) {
|
|
3649
4041
|
return props.atBottom && "\n bottom: -0.5rem;\n padding-bottom: 0.5rem;\n margin-bottom: -0.5rem;\n ";
|
|
3650
4042
|
}, function (props) {
|
|
@@ -3652,13 +4044,13 @@ var StickyContainer = styled__default.div.withConfig({
|
|
|
3652
4044
|
});
|
|
3653
4045
|
var ListSeparator = styled__default.li.withConfig({
|
|
3654
4046
|
displayName: "ContextMenu__ListSeparator",
|
|
3655
|
-
componentId: "sc-13y1vvt-
|
|
4047
|
+
componentId: "sc-13y1vvt-6"
|
|
3656
4048
|
})(["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);"])));
|
|
3657
4049
|
var ListHeading = styled__default.li.withConfig({
|
|
3658
4050
|
displayName: "ContextMenu__ListHeading",
|
|
3659
|
-
componentId: "sc-13y1vvt-
|
|
4051
|
+
componentId: "sc-13y1vvt-7"
|
|
3660
4052
|
})(["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'));
|
|
3661
|
-
var SubmenuArrowIcon = utils.styledExtend(Icon)(
|
|
4053
|
+
var SubmenuArrowIcon = utils.styledExtend(Icon)(_templateObject4$1());
|
|
3662
4054
|
var SimpleLi =
|
|
3663
4055
|
/*#__PURE__*/
|
|
3664
4056
|
function (_React$Component) {
|
|
@@ -3780,6 +4172,7 @@ var Li = function Li(_ref) {
|
|
|
3780
4172
|
var _ref$emitter = _ref.emitter,
|
|
3781
4173
|
emitter = _ref$emitter === void 0 ? mitt() : _ref$emitter,
|
|
3782
4174
|
index = _ref.index,
|
|
4175
|
+
keepOpen = _ref.keepOpen,
|
|
3783
4176
|
hover = _ref.hover,
|
|
3784
4177
|
layerIndex = _ref.layerIndex,
|
|
3785
4178
|
hoverCursor = _ref.hoverCursor,
|
|
@@ -3791,9 +4184,11 @@ var Li = function Li(_ref) {
|
|
|
3791
4184
|
linkTo = _ref.linkTo,
|
|
3792
4185
|
icon = _ref.icon,
|
|
3793
4186
|
label = _ref.label,
|
|
4187
|
+
descText = _ref.descText,
|
|
4188
|
+
helpText = _ref.helpText,
|
|
3794
4189
|
target = _ref.target,
|
|
3795
4190
|
href = _ref.href,
|
|
3796
|
-
rest = _objectWithoutProperties(_ref, ["emitter", "index", "hover", "layerIndex", "hoverCursor", "passTouchThrough", "children", "setCursorOnHover", "onClick", "prefixWith", "linkTo", "icon", "label", "target", "href"]);
|
|
4191
|
+
rest = _objectWithoutProperties(_ref, ["emitter", "index", "keepOpen", "hover", "layerIndex", "hoverCursor", "passTouchThrough", "children", "setCursorOnHover", "onClick", "prefixWith", "linkTo", "icon", "label", "descText", "helpText", "target", "href"]);
|
|
3797
4192
|
|
|
3798
4193
|
var nodeRef = React.useRef();
|
|
3799
4194
|
var tagRef = React.useRef();
|
|
@@ -3850,7 +4245,7 @@ var Li = function Li(_ref) {
|
|
|
3850
4245
|
};
|
|
3851
4246
|
}, []);
|
|
3852
4247
|
React.useEffect(function () {
|
|
3853
|
-
if (children) {
|
|
4248
|
+
if (children && !isMobile()) {
|
|
3854
4249
|
if (hover) {
|
|
3855
4250
|
if (!subMenu.isOpen || subMenu.closing || !subPrevented.get()) {
|
|
3856
4251
|
subMenu.open();
|
|
@@ -3864,38 +4259,35 @@ var Li = function Li(_ref) {
|
|
|
3864
4259
|
}
|
|
3865
4260
|
}, [hoverCursor]);
|
|
3866
4261
|
|
|
3867
|
-
var
|
|
3868
|
-
|
|
4262
|
+
var onMouseMove = function onMouseMove(e) {
|
|
4263
|
+
if (!hover) {
|
|
4264
|
+
utils.callIfFunction(setCursorOnHover, index);
|
|
4265
|
+
}
|
|
4266
|
+
|
|
4267
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
3869
4268
|
};
|
|
3870
4269
|
|
|
3871
4270
|
var onMouseOut = function onMouseOut(e) {
|
|
3872
|
-
|
|
4271
|
+
utils.callIfFunction(setCursorOnHover, -1);
|
|
4272
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
3873
4273
|
};
|
|
3874
4274
|
|
|
3875
|
-
var
|
|
3876
|
-
if (
|
|
3877
|
-
e.
|
|
4275
|
+
var onClickHandler = function onClickHandler(e) {
|
|
4276
|
+
if (children || keepOpen) {
|
|
4277
|
+
e.stopPropagation();
|
|
3878
4278
|
}
|
|
3879
4279
|
|
|
3880
4280
|
if (children) {
|
|
3881
|
-
if (hover)
|
|
3882
|
-
|
|
3883
|
-
if (tagRef.current) {
|
|
3884
|
-
tagRef.current.click();
|
|
4281
|
+
if (hover) {
|
|
4282
|
+
subMenu.toggle();
|
|
3885
4283
|
} else {
|
|
3886
|
-
|
|
4284
|
+
onMouseMove();
|
|
3887
4285
|
}
|
|
4286
|
+
} else {
|
|
4287
|
+
utils.callIfFunction(onClick, e);
|
|
3888
4288
|
}
|
|
3889
4289
|
};
|
|
3890
4290
|
|
|
3891
|
-
var onClickHandler = function onClickHandler(e) {
|
|
3892
|
-
if (children) {
|
|
3893
|
-
e.stopPropagation();
|
|
3894
|
-
}
|
|
3895
|
-
|
|
3896
|
-
utils.callIfFunction(onClick, e);
|
|
3897
|
-
};
|
|
3898
|
-
|
|
3899
4291
|
var onCloseSub = function onCloseSub() {
|
|
3900
4292
|
return emitter.emit('openSub');
|
|
3901
4293
|
};
|
|
@@ -3913,7 +4305,7 @@ var Li = function Li(_ref) {
|
|
|
3913
4305
|
|
|
3914
4306
|
var content = React__default.createElement(React__default.Fragment, null, prefixWith, icon && React__default.createElement(Icon, {
|
|
3915
4307
|
icon: icon
|
|
3916
|
-
}), label, children && React__default.createElement(SubmenuArrowIcon, {
|
|
4308
|
+
}), label, " ", helpText && React__default.createElement(ListItemHelpText, null, "(", helpText, ")"), descText && React__default.createElement(ListItemDescText, null, descText), children && React__default.createElement(SubmenuArrowIcon, {
|
|
3917
4309
|
icon: "arrow-right"
|
|
3918
4310
|
}));
|
|
3919
4311
|
var Tag = linkTo ? Link : 'a';
|
|
@@ -3923,14 +4315,13 @@ var Li = function Li(_ref) {
|
|
|
3923
4315
|
hover: hover,
|
|
3924
4316
|
onClick: onClickHandler,
|
|
3925
4317
|
onMouseLeave: onMouseOut,
|
|
3926
|
-
|
|
3927
|
-
onTouchEnd: touchEnd
|
|
4318
|
+
onMouseMove: onMouseMove
|
|
3928
4319
|
}), rest.withButton || rest.noActions ? content : React__default.createElement(Tag, {
|
|
3929
4320
|
href: href,
|
|
3930
4321
|
target: target,
|
|
3931
4322
|
to: linkTo,
|
|
3932
4323
|
ref: tagRef,
|
|
3933
|
-
onMouseEnter:
|
|
4324
|
+
onMouseEnter: onMouseMove
|
|
3934
4325
|
}, content), subMenu.isOpen && addProps(children));
|
|
3935
4326
|
};
|
|
3936
4327
|
Li.Simple = SimpleLi;
|
|
@@ -3946,7 +4337,7 @@ var _willUseSharedState$1 = core.willUseSharedState(),
|
|
|
3946
4337
|
_willUseSharedState2$1 = _slicedToArray(_willUseSharedState$1, 1),
|
|
3947
4338
|
useContextMenuSharedState = _willUseSharedState2$1[0];
|
|
3948
4339
|
|
|
3949
|
-
var ContextMenuComponent = React.forwardRef(function (_ref2,
|
|
4340
|
+
var ContextMenuComponent = React.forwardRef(function (_ref2, unesuredRef) {
|
|
3950
4341
|
var children = _ref2.children,
|
|
3951
4342
|
sub = _ref2.sub,
|
|
3952
4343
|
hoverIndex = _ref2.hoverIndex,
|
|
@@ -3958,7 +4349,10 @@ var ContextMenuComponent = React.forwardRef(function (_ref2, ref) {
|
|
|
3958
4349
|
return 0;
|
|
3959
4350
|
} : _ref2$onHover,
|
|
3960
4351
|
fill = _ref2.fill,
|
|
3961
|
-
|
|
4352
|
+
onClick = _ref2.onClick,
|
|
4353
|
+
props = _objectWithoutProperties(_ref2, ["children", "sub", "hoverIndex", "autoHover", "withoutIcons", "onClose", "onHover", "fill", "onClick"]);
|
|
4354
|
+
|
|
4355
|
+
var ref = core.useEnsureRef(unesuredRef);
|
|
3962
4356
|
|
|
3963
4357
|
var _useState = React.useState(autoHover || sub ? 0 : -1),
|
|
3964
4358
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -4058,10 +4452,34 @@ var ContextMenuComponent = React.forwardRef(function (_ref2, ref) {
|
|
|
4058
4452
|
});
|
|
4059
4453
|
};
|
|
4060
4454
|
|
|
4455
|
+
var touchStart = createPressAndMoveEvent(function (e, prevPos) {
|
|
4456
|
+
// e.preventDefault()
|
|
4457
|
+
e.stopPropagation();
|
|
4458
|
+
e.target.dispatchEvent(new MouseEvent('mousemove', {
|
|
4459
|
+
bubbles: true
|
|
4460
|
+
}));
|
|
4461
|
+
var passedResistance = false;
|
|
4462
|
+
return [function (e, nextPos) {
|
|
4463
|
+
var delta = prevPos.clientY - nextPos.clientY;
|
|
4464
|
+
|
|
4465
|
+
if (Math.abs(delta) > 10) {
|
|
4466
|
+
passedResistance = true;
|
|
4467
|
+
setCursorOnHover(-1);
|
|
4468
|
+
}
|
|
4469
|
+
}, function (e, finalPos) {
|
|
4470
|
+
if (!passedResistance) {
|
|
4471
|
+
e.target.click();
|
|
4472
|
+
}
|
|
4473
|
+
}];
|
|
4474
|
+
});
|
|
4061
4475
|
return React__default.createElement(ContextListMenu, _extends({
|
|
4062
4476
|
"data-drag": false,
|
|
4063
4477
|
ref: ref,
|
|
4064
4478
|
sub: sub,
|
|
4479
|
+
onWheel: function onWheel(e) {
|
|
4480
|
+
return e.stopPropagation();
|
|
4481
|
+
},
|
|
4482
|
+
onTouchStart: touchStart,
|
|
4065
4483
|
withoutIcons: withoutIcons,
|
|
4066
4484
|
onMouseDown: utils.stopPropagation()
|
|
4067
4485
|
}, props), formatChildren(children));
|
|
@@ -4439,19 +4857,38 @@ var TransitionDiv = function TransitionDiv(_ref) {
|
|
|
4439
4857
|
var children = _ref.children,
|
|
4440
4858
|
animation = _ref.animation,
|
|
4441
4859
|
skipChromeFix = _ref.skipChromeFix,
|
|
4860
|
+
className = _ref.className,
|
|
4442
4861
|
block = _ref.block,
|
|
4443
|
-
rest = _objectWithoutProperties(_ref, ["children", "animation", "skipChromeFix", "block"]);
|
|
4862
|
+
rest = _objectWithoutProperties(_ref, ["children", "animation", "skipChromeFix", "className", "block"]);
|
|
4863
|
+
|
|
4864
|
+
var blockRef = React.useRef();
|
|
4865
|
+
|
|
4866
|
+
var overflowEffect = function overflowEffect() {
|
|
4867
|
+
if (blockRef.current) {
|
|
4868
|
+
var prevOverflow = blockRef.current.style.overflow;
|
|
4869
|
+
blockRef.current.style.overflow = 'hidden';
|
|
4870
|
+
return function () {
|
|
4871
|
+
blockRef.current.style.overflow = prevOverflow;
|
|
4872
|
+
};
|
|
4873
|
+
}
|
|
4874
|
+
};
|
|
4444
4875
|
|
|
4445
4876
|
var content = children ? React__default.createElement(FlipList, _extends({
|
|
4877
|
+
effect: overflowEffect,
|
|
4446
4878
|
skipChromeFix: skipChromeFix,
|
|
4447
4879
|
animation: animation || DEFAULT_ANIMATION
|
|
4448
4880
|
}, rest), [React__default.createElement("div", {
|
|
4881
|
+
className: block ? "" : className,
|
|
4449
4882
|
key: "first"
|
|
4450
4883
|
}, children)]) : React__default.createElement(FlipList, _extends({
|
|
4884
|
+
effect: overflowEffect,
|
|
4451
4885
|
skipChromeFix: skipChromeFix,
|
|
4452
4886
|
animation: animation || DEFAULT_ANIMATION
|
|
4453
4887
|
}, rest), []);
|
|
4454
|
-
return block ? React__default.createElement(BlockContainer$1,
|
|
4888
|
+
return block ? React__default.createElement(BlockContainer$1, {
|
|
4889
|
+
ref: blockRef,
|
|
4890
|
+
className: className
|
|
4891
|
+
}, content) : content;
|
|
4455
4892
|
};
|
|
4456
4893
|
|
|
4457
4894
|
var BlockContainer$2 = styled__default.div.withConfig({
|
|
@@ -4547,44 +4984,66 @@ var willUseIsSticky = function willUseIsSticky() {
|
|
|
4547
4984
|
useSharedIsSticky = _willUseSharedState2[0],
|
|
4548
4985
|
setSharedIsSticky = _willUseSharedState2[2];
|
|
4549
4986
|
|
|
4550
|
-
var
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4987
|
+
var createObserver = function createObserver(root) {
|
|
4988
|
+
return window.IntersectionObserver ? new window.IntersectionObserver(function (records, observer) {
|
|
4989
|
+
var _iteratorNormalCompletion = true;
|
|
4990
|
+
var _didIteratorError = false;
|
|
4991
|
+
var _iteratorError = undefined;
|
|
4554
4992
|
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4993
|
+
try {
|
|
4994
|
+
for (var _iterator = records[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
4995
|
+
var record = _step.value;
|
|
4996
|
+
var targetInfo = record.boundingClientRect;
|
|
4997
|
+
var rootBoundsInfo = record.rootBounds;
|
|
4560
4998
|
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4999
|
+
if (!rootBoundsInfo) {
|
|
5000
|
+
return;
|
|
5001
|
+
}
|
|
4564
5002
|
|
|
4565
|
-
|
|
4566
|
-
}
|
|
4567
|
-
} catch (err) {
|
|
4568
|
-
_didIteratorError = true;
|
|
4569
|
-
_iteratorError = err;
|
|
4570
|
-
} finally {
|
|
4571
|
-
try {
|
|
4572
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4573
|
-
_iterator.return();
|
|
5003
|
+
onChange(targetInfo, rootBoundsInfo, record.target, record.isIntersecting);
|
|
4574
5004
|
}
|
|
5005
|
+
} catch (err) {
|
|
5006
|
+
_didIteratorError = true;
|
|
5007
|
+
_iteratorError = err;
|
|
4575
5008
|
} finally {
|
|
4576
|
-
|
|
4577
|
-
|
|
5009
|
+
try {
|
|
5010
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5011
|
+
_iterator.return();
|
|
5012
|
+
}
|
|
5013
|
+
} finally {
|
|
5014
|
+
if (_didIteratorError) {
|
|
5015
|
+
throw _iteratorError;
|
|
5016
|
+
}
|
|
4578
5017
|
}
|
|
4579
5018
|
}
|
|
5019
|
+
}, {
|
|
5020
|
+
root: root
|
|
5021
|
+
}) : {
|
|
5022
|
+
observe: _identity,
|
|
5023
|
+
unobserve: _identity
|
|
5024
|
+
};
|
|
5025
|
+
};
|
|
5026
|
+
|
|
5027
|
+
var observerMap = new Map();
|
|
5028
|
+
|
|
5029
|
+
var getObserver = function getObserver() {
|
|
5030
|
+
var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
5031
|
+
var result = observerMap.get(root);
|
|
5032
|
+
|
|
5033
|
+
if (result) {
|
|
5034
|
+
return result;
|
|
4580
5035
|
}
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
5036
|
+
|
|
5037
|
+
var observer = createObserver(root);
|
|
5038
|
+
observerMap.set(root, observer);
|
|
5039
|
+
return observer;
|
|
4584
5040
|
};
|
|
5041
|
+
|
|
4585
5042
|
var activeObserved = [];
|
|
4586
5043
|
|
|
4587
5044
|
var resetObservers = function resetObservers() {
|
|
5045
|
+
var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
5046
|
+
var observer = getObserver(root);
|
|
4588
5047
|
activeObserved.forEach(function (observed) {
|
|
4589
5048
|
observer.unobserve(observed);
|
|
4590
5049
|
observer.observe(observed);
|
|
@@ -4595,6 +5054,8 @@ var willUseIsSticky = function willUseIsSticky() {
|
|
|
4595
5054
|
var className = _ref.className,
|
|
4596
5055
|
children = _ref.children,
|
|
4597
5056
|
bottom = _ref.bottom,
|
|
5057
|
+
root = _ref.root,
|
|
5058
|
+
intersection = _ref.intersection,
|
|
4598
5059
|
onChange = _ref.onChange;
|
|
4599
5060
|
var ensuredRef = core.useEnsureRef(ref);
|
|
4600
5061
|
|
|
@@ -4603,9 +5064,9 @@ var willUseIsSticky = function willUseIsSticky() {
|
|
|
4603
5064
|
isSticky = _useState2[0],
|
|
4604
5065
|
setIsSticky = _useState2[1];
|
|
4605
5066
|
|
|
4606
|
-
useRegister(function (posInfo, refInfo, target) {
|
|
5067
|
+
useRegister(function (posInfo, refInfo, target, isIntersecting) {
|
|
4607
5068
|
if (ensuredRef.current === target) {
|
|
4608
|
-
var value = bottom ? BOTTOM_TRIGGER(posInfo, refInfo) : TOP_TRIGGER(posInfo, refInfo);
|
|
5069
|
+
var value = intersection ? isIntersecting : bottom ? BOTTOM_TRIGGER(posInfo, refInfo) : TOP_TRIGGER(posInfo, refInfo);
|
|
4609
5070
|
|
|
4610
5071
|
if (value !== undefined) {
|
|
4611
5072
|
setIsSticky(value);
|
|
@@ -4616,7 +5077,7 @@ var willUseIsSticky = function willUseIsSticky() {
|
|
|
4616
5077
|
});
|
|
4617
5078
|
React.useEffect(function () {
|
|
4618
5079
|
setIsSticky(false);
|
|
4619
|
-
|
|
5080
|
+
getObserver(callIfFunction(root)).observe(ensuredRef.current);
|
|
4620
5081
|
activeObserved = activeObserved.concat(ensuredRef.current);
|
|
4621
5082
|
return function () {
|
|
4622
5083
|
// observer.unobserve(ref.current)
|
|
@@ -4655,26 +5116,17 @@ var FormatDate = function FormatDate(_ref) {
|
|
|
4655
5116
|
});
|
|
4656
5117
|
};
|
|
4657
5118
|
|
|
4658
|
-
var BackgroundImageStyle = styled__default.div.withConfig({
|
|
4659
|
-
displayName: "Image__BackgroundImageStyle",
|
|
4660
|
-
componentId: "sjju78-0"
|
|
4661
|
-
})(["background-image:url('", "');"], function (props) {
|
|
4662
|
-
return props.image;
|
|
4663
|
-
});
|
|
4664
5119
|
var Image = React.forwardRef(function (_ref, ref) {
|
|
4665
|
-
var
|
|
4666
|
-
|
|
5120
|
+
var dom = _ref.dom,
|
|
5121
|
+
src = _ref.src,
|
|
5122
|
+
style = _ref.style,
|
|
5123
|
+
rest = _objectWithoutProperties(_ref, ["dom", "src", "style"]);
|
|
4667
5124
|
|
|
4668
|
-
var _useState = React.useState(src),
|
|
5125
|
+
var _useState = React.useState(typeof src === 'string' ? src : src && URL.createObjectURL(src)),
|
|
4669
5126
|
_useState2 = _slicedToArray(_useState, 2),
|
|
4670
5127
|
image = _useState2[0],
|
|
4671
5128
|
setImage = _useState2[1];
|
|
4672
5129
|
|
|
4673
|
-
var _useState3 = React.useState(),
|
|
4674
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
4675
|
-
tempImage = _useState4[0],
|
|
4676
|
-
setTempImage = _useState4[1];
|
|
4677
|
-
|
|
4678
5130
|
React.useEffect(function () {
|
|
4679
5131
|
if (src) {
|
|
4680
5132
|
var imageStr = typeof src === 'string' ? src : URL.createObjectURL(src);
|
|
@@ -4689,8 +5141,13 @@ var Image = React.forwardRef(function (_ref, ref) {
|
|
|
4689
5141
|
setImage("");
|
|
4690
5142
|
}
|
|
4691
5143
|
}, [src]);
|
|
4692
|
-
return React__default.createElement(
|
|
4693
|
-
|
|
5144
|
+
return dom ? React__default.createElement("img", _extends({}, rest, {
|
|
5145
|
+
src: image,
|
|
5146
|
+
ref: ref
|
|
5147
|
+
})) : React__default.createElement("div", _extends({}, rest, {
|
|
5148
|
+
style: _objectSpread({}, style, {
|
|
5149
|
+
backgroundImage: "url(\"".concat(image, "\")")
|
|
5150
|
+
}),
|
|
4694
5151
|
ref: ref
|
|
4695
5152
|
}));
|
|
4696
5153
|
});
|
|
@@ -4875,6 +5332,7 @@ exports.DefaultConfirmDialog = DefaultConfirmDialog;
|
|
|
4875
5332
|
exports.Dialog = Dialog;
|
|
4876
5333
|
exports.DialogContainer = DialogContainer;
|
|
4877
5334
|
exports.DialogContent = DialogContent;
|
|
5335
|
+
exports.DialogContentWrapper = DialogContentWrapper;
|
|
4878
5336
|
exports.DialogError = DialogError;
|
|
4879
5337
|
exports.DialogErrorContent = DialogErrorContent;
|
|
4880
5338
|
exports.DialogFooter = DialogFooter;
|
|
@@ -4902,6 +5360,7 @@ exports.ListItem = ListItem;
|
|
|
4902
5360
|
exports.ListMenu = ListMenu;
|
|
4903
5361
|
exports.ListSeparator = ListSeparator;
|
|
4904
5362
|
exports.Loading = Loading;
|
|
5363
|
+
exports.LoadingDiv = LoadingDiv;
|
|
4905
5364
|
exports.MENU_TAB = MENU_TAB;
|
|
4906
5365
|
exports.MobileBubbleDialog = MobileBubbleDialog;
|
|
4907
5366
|
exports.Modal = Modal;
|
|
@@ -4917,6 +5376,7 @@ exports.StickyContainer = StickyContainer;
|
|
|
4917
5376
|
exports.SwitchDiv = SwitchDiv;
|
|
4918
5377
|
exports.Tooltip = Tooltip;
|
|
4919
5378
|
exports.TransitionDiv = TransitionDiv;
|
|
5379
|
+
exports.addPositioningBound = addPositioningBound;
|
|
4920
5380
|
exports.contextMenuLayersQuantity = contextMenuLayersQuantity;
|
|
4921
5381
|
exports.defaultAnimationMaker = defaultAnimationMaker;
|
|
4922
5382
|
exports.dialogFadeInDown = dialogFadeInDown;
|