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