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