@telefonica/mistica 12.5.0 → 12.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dialog.d.ts +20 -5
- package/dist/dialog.js +39 -14
- package/dist/dialog.js.flow +24 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.flow +1 -0
- package/dist/navigation-bar.js +7 -9
- package/dist/package-version.js +1 -1
- package/dist/text-field-base.js +21 -5
- package/dist/text-link.js +2 -1
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +2 -1
- package/dist/theme.js.flow +2 -0
- package/dist/tooltip.d.ts +2 -0
- package/dist/tooltip.js +234 -78
- package/dist/tooltip.js.flow +2 -0
- package/dist/touchable.d.ts +1 -0
- package/dist/touchable.js +6 -1
- package/dist/touchable.js.flow +1 -0
- package/dist-es/dialog.js +40 -15
- package/dist-es/index.js +1 -0
- package/dist-es/navigation-bar.js +7 -9
- package/dist-es/package-version.js +1 -1
- package/dist-es/text-field-base.js +23 -7
- package/dist-es/text-link.js +3 -1
- package/dist-es/theme.js +2 -1
- package/dist-es/tooltip.js +234 -78
- package/dist-es/touchable.js +6 -1
- package/package.json +2 -1
package/dist/tooltip.js
CHANGED
|
@@ -6,11 +6,14 @@ exports.default = void 0;
|
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _reactTransitionGroup = require("react-transition-group");
|
|
9
10
|
var _hooks = require("./hooks");
|
|
10
11
|
var _portal = require("./portal");
|
|
11
12
|
var _overlay = _interopRequireDefault(require("./overlay"));
|
|
13
|
+
var _text = require("./text");
|
|
12
14
|
var key = _interopRequireWildcard(require("./utils/key-codes"));
|
|
13
15
|
var _jss = require("./jss");
|
|
16
|
+
var _stack = _interopRequireDefault(require("./stack"));
|
|
14
17
|
function _interopRequireDefault(obj) {
|
|
15
18
|
return obj && obj.__esModule ? obj : {
|
|
16
19
|
default: obj
|
|
@@ -142,11 +145,16 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
142
145
|
var defaultPositionDesktop = "bottom";
|
|
143
146
|
var defaultPositionMobile = "top";
|
|
144
147
|
var arrowSize = 12;
|
|
145
|
-
var distanceToTarget =
|
|
148
|
+
var distanceToTarget = 4 + arrowSize;
|
|
146
149
|
var marginLeftRightMobile = 16;
|
|
147
150
|
var defaultWidthDesktop = 340;
|
|
148
151
|
var arrowWrapperWidth = arrowSize * 2;
|
|
149
152
|
var arrowWrapperHeight = arrowSize;
|
|
153
|
+
var transitionDurationMs = 500;
|
|
154
|
+
var animationMovement = 12;
|
|
155
|
+
var animationTiming = "cubic-bezier(0.215, 0.61, 0.355, 1)";
|
|
156
|
+
var defaultShowTooltipDelayMs = 500;
|
|
157
|
+
var noOp = function noOp() {};
|
|
150
158
|
var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
151
159
|
var shadowAlpha = theme.isDarkMode ? 1 : 0.2;
|
|
152
160
|
return {
|
|
@@ -158,7 +166,7 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
158
166
|
top: 0,
|
|
159
167
|
left: "50%",
|
|
160
168
|
transform: "translate(-50%, -50%) rotate(45deg)",
|
|
161
|
-
border: "1px solid ".concat(theme.colors.
|
|
169
|
+
border: "1px solid ".concat(theme.colors.border),
|
|
162
170
|
borderRadius: 2
|
|
163
171
|
},
|
|
164
172
|
arrowTop: {
|
|
@@ -207,42 +215,142 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
207
215
|
left: 16,
|
|
208
216
|
width: "auto",
|
|
209
217
|
boxShadow: "0 2px 4px 0 rgba(0, 0, 0, ".concat(shadowAlpha, ")"),
|
|
210
|
-
padding:
|
|
218
|
+
padding: 8,
|
|
211
219
|
backgroundColor: theme.colors.backgroundContainer,
|
|
212
|
-
zIndex:
|
|
213
|
-
border: "1px solid ".concat(theme.colors.
|
|
220
|
+
zIndex: 50,
|
|
221
|
+
border: "1px solid ".concat(theme.colors.border),
|
|
214
222
|
borderRadius: 8
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
var useAnimationStyles = (0, _jss).createUseStyles(function() {
|
|
227
|
+
return {
|
|
228
|
+
enter: {
|
|
229
|
+
transform: function transform(param) {
|
|
230
|
+
var position = param.position;
|
|
231
|
+
if (position === "bottom") {
|
|
232
|
+
return "translateY(".concat(animationMovement, "px)");
|
|
233
|
+
}
|
|
234
|
+
if (position === "top") {
|
|
235
|
+
return "translateY(calc(-100% - ".concat(animationMovement, "px))");
|
|
236
|
+
}
|
|
237
|
+
if (position === "right") {
|
|
238
|
+
return "translateX(".concat(animationMovement, "px) translateY(-50%)");
|
|
239
|
+
}
|
|
240
|
+
if (position === "left") {
|
|
241
|
+
return "translateX(-".concat(animationMovement, "px) translateY(-50%)");
|
|
242
|
+
}
|
|
243
|
+
return "translateY(-".concat(animationMovement, "px)");
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
enterActive: {
|
|
247
|
+
animationName: function animationName(param) {
|
|
248
|
+
var position = param.position;
|
|
249
|
+
if (position === "top") return "$fadeInTop";
|
|
250
|
+
if (position === "bottom") return "$fadeInBottom";
|
|
251
|
+
return "$fadeInX";
|
|
252
|
+
},
|
|
253
|
+
animationFillMode: "both",
|
|
254
|
+
animationDuration: "".concat(transitionDurationMs, "ms"),
|
|
255
|
+
animationTimingFunction: animationTiming
|
|
256
|
+
},
|
|
257
|
+
enterDone: {
|
|
258
|
+
transform: function transform(param) {
|
|
259
|
+
var position = param.position;
|
|
260
|
+
if (position === "top") return "translateY(-100%)";
|
|
261
|
+
if (position === "bottom") return "translateY(0)";
|
|
262
|
+
return "translateY(-50%)";
|
|
263
|
+
}
|
|
215
264
|
},
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
265
|
+
exit: {
|
|
266
|
+
transform: function transform(param) {
|
|
267
|
+
var position = param.position;
|
|
268
|
+
if (position === "bottom") {
|
|
269
|
+
return "translateY(0)";
|
|
270
|
+
}
|
|
271
|
+
if (position === "top") {
|
|
272
|
+
return "translateY(-100%)";
|
|
273
|
+
}
|
|
274
|
+
if (position === "right") {
|
|
275
|
+
return "translateX(0px) translateY(-50%)";
|
|
276
|
+
}
|
|
277
|
+
if (position === "left") {
|
|
278
|
+
return "translateX(0px) translateY(-50%)";
|
|
279
|
+
}
|
|
280
|
+
return "translateY(0px)";
|
|
281
|
+
},
|
|
282
|
+
opacity: 1,
|
|
283
|
+
transition: "opacity 0.3s ".concat(animationTiming)
|
|
284
|
+
},
|
|
285
|
+
exitActive: {
|
|
286
|
+
animation: "$fadeOut 0.3s ".concat(animationTiming, " both")
|
|
222
287
|
},
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
288
|
+
"@keyframes fadeInBottom": {
|
|
289
|
+
from: {
|
|
290
|
+
opacity: 0
|
|
291
|
+
},
|
|
292
|
+
"40%": {
|
|
293
|
+
opacity: 1
|
|
294
|
+
},
|
|
295
|
+
to: {
|
|
296
|
+
opacity: 1,
|
|
297
|
+
transform: "translateY(0)"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"@keyframes fadeInTop": {
|
|
301
|
+
from: {
|
|
302
|
+
opacity: 0
|
|
303
|
+
},
|
|
304
|
+
"40%": {
|
|
305
|
+
opacity: 1
|
|
306
|
+
},
|
|
307
|
+
to: {
|
|
308
|
+
opacity: 1,
|
|
309
|
+
transform: "translateY(-100%)"
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
"@keyframes fadeInX": {
|
|
313
|
+
from: {
|
|
314
|
+
opacity: 0
|
|
315
|
+
},
|
|
316
|
+
"40%": {
|
|
317
|
+
opacity: 1
|
|
318
|
+
},
|
|
319
|
+
to: {
|
|
320
|
+
opacity: 1,
|
|
321
|
+
transform: "translateX(0) translateY(-50%)"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"@keyframes fadeOut": {
|
|
325
|
+
from: {
|
|
326
|
+
opacity: 1
|
|
327
|
+
},
|
|
328
|
+
to: {
|
|
329
|
+
opacity: 0
|
|
330
|
+
}
|
|
228
331
|
}
|
|
229
332
|
};
|
|
230
333
|
});
|
|
231
334
|
var getWidthDesktop = function getWidthDesktop(customWidth) {
|
|
232
335
|
return customWidth ? customWidth : defaultWidthDesktop;
|
|
233
336
|
};
|
|
234
|
-
var EVENT_THROTTLE_TIME = process.env.NODE_ENV === "test" ? 0 : 200;
|
|
235
337
|
var Tooltip = function Tooltip(_param) {
|
|
236
|
-
var children = _param.children, description = _param.description, target = _param.target, title = _param.title, targetLabel = _param.targetLabel, rest = _objectWithoutProperties(_param, [
|
|
338
|
+
var children = _param.children, extra = _param.extra, description = _param.description, target = _param.target, title = _param.title, targetLabel = _param.targetLabel, _delay = _param.delay, delay = _delay === void 0 ? true : _delay, rest = _objectWithoutProperties(_param, [
|
|
237
339
|
"children",
|
|
340
|
+
"extra",
|
|
238
341
|
"description",
|
|
239
342
|
"target",
|
|
240
343
|
"title",
|
|
241
|
-
"targetLabel"
|
|
344
|
+
"targetLabel",
|
|
345
|
+
"delay"
|
|
242
346
|
]);
|
|
243
347
|
var ref = _slicedToArray(React.useState(false), 2), isVisible = ref[0], setIsVisible = ref[1];
|
|
244
348
|
var isTabletOrSmaller = (0, _hooks).useScreenSize().isTabletOrSmaller;
|
|
245
349
|
var ariaId = (0, _hooks).useAriaId();
|
|
350
|
+
var isPointerOver = React.useRef(false);
|
|
351
|
+
var closeTooltipTimeoutId = React.useRef(null);
|
|
352
|
+
var showTooltipTimeoutId = React.useRef(null);
|
|
353
|
+
var targetRef = React.useRef(null);
|
|
246
354
|
var targetBoundingClientRect = React.useRef({
|
|
247
355
|
top: 0,
|
|
248
356
|
right: 0,
|
|
@@ -251,10 +359,16 @@ var Tooltip = function Tooltip(_param) {
|
|
|
251
359
|
width: 0,
|
|
252
360
|
height: 0
|
|
253
361
|
});
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
362
|
+
var getPosition = function getPosition() {
|
|
363
|
+
var position = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultPositionDesktop;
|
|
364
|
+
return isTabletOrSmaller && (position === "left" || position === "right") ? defaultPositionMobile : position;
|
|
365
|
+
};
|
|
366
|
+
var position1 = getPosition(rest.position);
|
|
257
367
|
var classes = useStyles();
|
|
368
|
+
var animationClasses = useAnimationStyles({
|
|
369
|
+
position: position1
|
|
370
|
+
});
|
|
371
|
+
var isTouchableDevice = typeof window !== "undefined" ? window.matchMedia("(pointer: coarse)").matches : false;
|
|
258
372
|
var closeTooltip = function closeTooltip() {
|
|
259
373
|
if (isVisible) {
|
|
260
374
|
setIsVisible(false);
|
|
@@ -267,23 +381,16 @@ var Tooltip = function Tooltip(_param) {
|
|
|
267
381
|
};
|
|
268
382
|
});
|
|
269
383
|
var handleClickOutside = function handleClickOutside() {
|
|
270
|
-
if (Date.now() - lastChangeTime.current < EVENT_THROTTLE_TIME) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
lastChangeTime.current = Date.now();
|
|
274
384
|
setIsVisible(false);
|
|
275
385
|
};
|
|
276
|
-
var toggleVisibility = function toggleVisibility(
|
|
277
|
-
if (
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
lastChangeTime.current = Date.now();
|
|
281
|
-
targetBoundingClientRect.current = e.currentTarget.getBoundingClientRect();
|
|
386
|
+
var toggleVisibility = function toggleVisibility() {
|
|
387
|
+
if (!targetRef.current) return;
|
|
388
|
+
targetBoundingClientRect.current = targetRef.current.getBoundingClientRect();
|
|
282
389
|
setIsVisible(!isVisible);
|
|
283
390
|
};
|
|
284
|
-
var handleFocus = function handleFocus(
|
|
391
|
+
var handleFocus = function handleFocus() {
|
|
285
392
|
if (!isVisible) {
|
|
286
|
-
toggleVisibility(
|
|
393
|
+
toggleVisibility();
|
|
287
394
|
}
|
|
288
395
|
};
|
|
289
396
|
var handleKeyDown = function handleKeyDown(event) {
|
|
@@ -292,22 +399,19 @@ var Tooltip = function Tooltip(_param) {
|
|
|
292
399
|
}
|
|
293
400
|
};
|
|
294
401
|
var getContainerPosition = function getContainerPosition(position, width) {
|
|
402
|
+
if (typeof window === "undefined") {
|
|
403
|
+
return {};
|
|
404
|
+
}
|
|
295
405
|
var containerPos = {
|
|
296
406
|
right: {
|
|
297
407
|
left: targetBoundingClientRect.current.right + distanceToTarget,
|
|
298
|
-
top: window.pageYOffset + targetBoundingClientRect.current.top + targetBoundingClientRect.current.height / 2
|
|
299
|
-
transform: "translateY(-50%)",
|
|
300
|
-
WebKitTransform: "translateY(-50%)"
|
|
408
|
+
top: window.pageYOffset + targetBoundingClientRect.current.top + targetBoundingClientRect.current.height / 2
|
|
301
409
|
},
|
|
302
410
|
left: {
|
|
303
411
|
left: targetBoundingClientRect.current.left - width - distanceToTarget,
|
|
304
|
-
top: window.pageYOffset + targetBoundingClientRect.current.top + targetBoundingClientRect.current.height / 2
|
|
305
|
-
transform: "translateY(-50%)",
|
|
306
|
-
WebKitTransform: "translateY(-50%)"
|
|
412
|
+
top: window.pageYOffset + targetBoundingClientRect.current.top + targetBoundingClientRect.current.height / 2
|
|
307
413
|
},
|
|
308
414
|
top: {
|
|
309
|
-
transform: "translateY(-100%)",
|
|
310
|
-
WebKitTransform: "translateY(-100%)",
|
|
311
415
|
top: window.pageYOffset + targetBoundingClientRect.current.top - distanceToTarget,
|
|
312
416
|
left: isTabletOrSmaller ? marginLeftRightMobile : window.pageXOffset + targetBoundingClientRect.current.left + targetBoundingClientRect.current.width / 2 - width / 2
|
|
313
417
|
},
|
|
@@ -318,10 +422,6 @@ var Tooltip = function Tooltip(_param) {
|
|
|
318
422
|
};
|
|
319
423
|
return containerPos[position];
|
|
320
424
|
};
|
|
321
|
-
var getPosition = function getPosition() {
|
|
322
|
-
var position = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultPositionDesktop;
|
|
323
|
-
return isTabletOrSmaller && (position === "left" || position === "right") ? defaultPositionMobile : position;
|
|
324
|
-
};
|
|
325
425
|
var getCustomStylesForMobile = function getCustomStylesForMobile() {
|
|
326
426
|
return isTabletOrSmaller ? {
|
|
327
427
|
left: targetBoundingClientRect.current.left + targetBoundingClientRect.current.width / 2 - marginLeftRightMobile
|
|
@@ -330,7 +430,6 @@ var Tooltip = function Tooltip(_param) {
|
|
|
330
430
|
var getWidth = function getWidth() {
|
|
331
431
|
return isTabletOrSmaller ? window.innerWidth - marginLeftRightMobile * 2 : getWidthDesktop(rest.width);
|
|
332
432
|
};
|
|
333
|
-
var position1 = getPosition(rest.position);
|
|
334
433
|
var width1 = getWidth();
|
|
335
434
|
var classNameByPosition = {
|
|
336
435
|
top: classes.arrowTop,
|
|
@@ -341,8 +440,38 @@ var Tooltip = function Tooltip(_param) {
|
|
|
341
440
|
return /*#__PURE__*/ (0, _jsxRuntime).jsxs(_jsxRuntime.Fragment, {
|
|
342
441
|
children: [
|
|
343
442
|
/*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
443
|
+
ref: targetRef,
|
|
344
444
|
className: classes.wrapper,
|
|
345
|
-
|
|
445
|
+
onPointerOver: function onPointerOver() {
|
|
446
|
+
if (closeTooltipTimeoutId.current) {
|
|
447
|
+
clearTimeout(closeTooltipTimeoutId.current);
|
|
448
|
+
closeTooltipTimeoutId.current = null;
|
|
449
|
+
}
|
|
450
|
+
if (isPointerOver.current) return;
|
|
451
|
+
isPointerOver.current = true;
|
|
452
|
+
if (delay) {
|
|
453
|
+
showTooltipTimeoutId.current = setTimeout(function() {
|
|
454
|
+
showTooltipTimeoutId.current = null;
|
|
455
|
+
toggleVisibility();
|
|
456
|
+
}, defaultShowTooltipDelayMs);
|
|
457
|
+
} else {
|
|
458
|
+
toggleVisibility();
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
onPointerLeave: isTouchableDevice ? noOp : function() {
|
|
462
|
+
if (showTooltipTimeoutId.current) {
|
|
463
|
+
clearTimeout(showTooltipTimeoutId.current);
|
|
464
|
+
showTooltipTimeoutId.current = null;
|
|
465
|
+
isPointerOver.current = false;
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
closeTooltipTimeoutId.current = setTimeout(function() {
|
|
469
|
+
if (!isPointerOver.current) return;
|
|
470
|
+
closeTooltipTimeoutId.current = null;
|
|
471
|
+
isPointerOver.current = false;
|
|
472
|
+
toggleVisibility();
|
|
473
|
+
}, 100);
|
|
474
|
+
},
|
|
346
475
|
onFocus: handleFocus,
|
|
347
476
|
onKeyDown: handleKeyDown,
|
|
348
477
|
"touch-action": "auto" // Prop needed for Pointer Events Polyfill to work properly
|
|
@@ -354,40 +483,67 @@ var Tooltip = function Tooltip(_param) {
|
|
|
354
483
|
"aria-label": targetLabel,
|
|
355
484
|
children: target
|
|
356
485
|
}),
|
|
357
|
-
|
|
486
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsxs(_portal.Portal, {
|
|
358
487
|
children: [
|
|
359
|
-
/*#__PURE__*/ (0, _jsxRuntime).jsx(_overlay.default, {
|
|
488
|
+
isVisible && isTouchableDevice && /*#__PURE__*/ (0, _jsxRuntime).jsx(_overlay.default, {
|
|
360
489
|
onPress: handleClickOutside
|
|
361
490
|
}),
|
|
362
|
-
/*#__PURE__*/ (0, _jsxRuntime).
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
491
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsx(_reactTransitionGroup.CSSTransition, {
|
|
492
|
+
in: isVisible,
|
|
493
|
+
timeout: transitionDurationMs,
|
|
494
|
+
classNames: {
|
|
495
|
+
enter: animationClasses.enter,
|
|
496
|
+
enterActive: animationClasses.enterActive,
|
|
497
|
+
enterDone: animationClasses.enterDone,
|
|
498
|
+
exit: animationClasses.exit,
|
|
499
|
+
exitActive: animationClasses.exitActive
|
|
500
|
+
},
|
|
501
|
+
unmountOnExit: true,
|
|
502
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs("div", {
|
|
503
|
+
role: "tooltip",
|
|
504
|
+
id: ariaId,
|
|
505
|
+
className: classes.container,
|
|
506
|
+
style: _objectSpread({
|
|
507
|
+
width: width1
|
|
508
|
+
}, getContainerPosition(position1, width1)),
|
|
509
|
+
onPointerOver: function onPointerOver() {
|
|
510
|
+
if (closeTooltipTimeoutId.current) {
|
|
511
|
+
clearTimeout(closeTooltipTimeoutId.current);
|
|
512
|
+
closeTooltipTimeoutId.current = null;
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
onPointerLeave: isTouchableDevice ? noOp : function() {
|
|
516
|
+
closeTooltipTimeoutId.current = setTimeout(function() {
|
|
517
|
+
if (!isPointerOver.current) return;
|
|
518
|
+
closeTooltipTimeoutId.current = null;
|
|
519
|
+
isPointerOver.current = false;
|
|
520
|
+
toggleVisibility();
|
|
521
|
+
}, 100);
|
|
522
|
+
},
|
|
523
|
+
children: [
|
|
524
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
525
|
+
className: (0, _classnames).default(classes.arrowWrapper, classNameByPosition[position1]),
|
|
526
|
+
style: getCustomStylesForMobile(),
|
|
527
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
528
|
+
className: classes.arrow
|
|
386
529
|
})
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
530
|
+
}),
|
|
531
|
+
(title || description) && /*#__PURE__*/ (0, _jsxRuntime).jsxs(_stack.default, {
|
|
532
|
+
space: 4,
|
|
533
|
+
children: [
|
|
534
|
+
title && /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
|
|
535
|
+
medium: true,
|
|
536
|
+
children: title
|
|
537
|
+
}),
|
|
538
|
+
description && /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
|
|
539
|
+
regular: true,
|
|
540
|
+
children: description
|
|
541
|
+
})
|
|
542
|
+
]
|
|
543
|
+
}),
|
|
544
|
+
extra || children
|
|
545
|
+
]
|
|
546
|
+
})
|
|
391
547
|
})
|
|
392
548
|
]
|
|
393
549
|
})
|
package/dist/tooltip.js.flow
CHANGED
|
@@ -4,12 +4,14 @@ import * as React from "react";
|
|
|
4
4
|
declare type Position = "top" | "bottom" | "left" | "right";
|
|
5
5
|
declare type Props = {
|
|
6
6
|
children?: React.Node,
|
|
7
|
+
extra?: React.Node,
|
|
7
8
|
description?: string,
|
|
8
9
|
target: React.Node,
|
|
9
10
|
title?: string,
|
|
10
11
|
position?: Position,
|
|
11
12
|
width?: number,
|
|
12
13
|
targetLabel: string,
|
|
14
|
+
delay?: boolean,
|
|
13
15
|
};
|
|
14
16
|
declare var Tooltip: React.ComponentType<Props>;
|
|
15
17
|
declare export default typeof Tooltip;
|
package/dist/touchable.d.ts
CHANGED
package/dist/touchable.js
CHANGED
|
@@ -237,7 +237,12 @@ var Touchable = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
237
237
|
}));
|
|
238
238
|
}
|
|
239
239
|
if (props.onPress) {
|
|
240
|
-
|
|
240
|
+
var _as;
|
|
241
|
+
var elementType = (_as = props.as) !== null && _as !== void 0 ? _as : "button";
|
|
242
|
+
var _role;
|
|
243
|
+
var role = (_role = commonProps.role) !== null && _role !== void 0 ? _role : props.as === "a" ? "button" : undefined;
|
|
244
|
+
return /*#__PURE__*/ React.createElement(elementType, _objectSpread({}, commonProps, {
|
|
245
|
+
role: role,
|
|
241
246
|
// this "form" attribute is useful when the form's submit button
|
|
242
247
|
// is located outside the <form> element, for example if you use
|
|
243
248
|
// a ButtonFixedFooter layout inside a form with the submit
|
package/dist/touchable.js.flow
CHANGED
package/dist-es/dialog.js
CHANGED
|
@@ -137,11 +137,12 @@ import { isWebViewBridgeAvailable, nativeConfirm, nativeAlert } from "@tef-novum
|
|
|
137
137
|
import ThemeContext from "./theme-context";
|
|
138
138
|
import { useTheme, useScreenSize } from "./hooks";
|
|
139
139
|
import ButtonLayout from "./button-layout";
|
|
140
|
-
import { Text5, Text3 } from "./text";
|
|
140
|
+
import { Text5, Text4, Text3 } from "./text";
|
|
141
141
|
import { ESC } from "./utils/key-codes";
|
|
142
142
|
import Box from "./box";
|
|
143
143
|
import { isOldChrome, isRunningAcceptanceTest } from "./utils/platform";
|
|
144
144
|
import { useSetModalState } from "./modal-context-provider";
|
|
145
|
+
import { pxToRem } from "./utils/css";
|
|
145
146
|
import Stack from "./stack";
|
|
146
147
|
var animationsSupported = function(platformOverrides) {
|
|
147
148
|
return !isOldChrome(platformOverrides) && process.env.NODE_ENV !== "test" && !isRunningAcceptanceTest(platformOverrides);
|
|
@@ -233,7 +234,10 @@ var useDialogStyles = createUseStyles(function(theme) {
|
|
|
233
234
|
dialogContainer: {
|
|
234
235
|
width: "calc(100vw - 48px)",
|
|
235
236
|
margin: "auto",
|
|
236
|
-
padding:
|
|
237
|
+
padding: function(param) {
|
|
238
|
+
var isDialog = param.isDialog;
|
|
239
|
+
return isDialog ? "40px 24px 24px" : 24;
|
|
240
|
+
}
|
|
237
241
|
}
|
|
238
242
|
});
|
|
239
243
|
});
|
|
@@ -241,9 +245,8 @@ var Dialog = function(props) {
|
|
|
241
245
|
var ref = useTheme(), texts = ref.texts, colors = ref.colors;
|
|
242
246
|
var className = props.className, title = props.title, message = props.message, icon = props.icon, extra = props.extra, _cancelText = props.cancelText, cancelText = _cancelText === void 0 ? texts.dialogCancelButton : _cancelText, _acceptText = props.acceptText, acceptText = _acceptText === void 0 ? texts.dialogAcceptButton : _acceptText, handleCancel = props.onCancel, handleAccept = props.onAccept, _showCancel = props.showCancel, showCancel = _showCancel === void 0 ? false : _showCancel, _destructive = props.destructive, destructive = _destructive === void 0 ? false : _destructive;
|
|
243
247
|
var isTabletOrSmaller = useScreenSize().isTabletOrSmaller;
|
|
244
|
-
var withSecondaryButton = showCancel && !!handleCancel;
|
|
245
248
|
var classes = useDialogStyles({
|
|
246
|
-
|
|
249
|
+
isDialog: !!props.forceWeb
|
|
247
250
|
});
|
|
248
251
|
var mainButtonProps = {
|
|
249
252
|
onPress: handleAccept ? handleAccept : function() {},
|
|
@@ -257,15 +260,29 @@ var Dialog = function(props) {
|
|
|
257
260
|
children: [
|
|
258
261
|
icon && /*#__PURE__*/ _jsx(Box, {
|
|
259
262
|
paddingBottom: 24,
|
|
260
|
-
children: icon
|
|
263
|
+
children: /*#__PURE__*/ React.cloneElement(icon, {
|
|
264
|
+
size: pxToRem(isTabletOrSmaller ? 40 : 64)
|
|
265
|
+
})
|
|
261
266
|
}),
|
|
262
267
|
title && /*#__PURE__*/ _jsx(Box, {
|
|
263
268
|
paddingBottom: 16,
|
|
264
|
-
children: /*#__PURE__*/ _jsx(Text5, {
|
|
269
|
+
children: props.forceWeb ? /*#__PURE__*/ _jsx(Text5, {
|
|
270
|
+
as: "h2",
|
|
271
|
+
children: title
|
|
272
|
+
}) : /*#__PURE__*/ _jsx(Text4, {
|
|
273
|
+
regular: true,
|
|
265
274
|
as: "h2",
|
|
266
275
|
children: title
|
|
267
276
|
})
|
|
268
277
|
}),
|
|
278
|
+
props.subtitle && /*#__PURE__*/ _jsx(Box, {
|
|
279
|
+
paddingBottom: 16,
|
|
280
|
+
children: /*#__PURE__*/ _jsx(Text4, {
|
|
281
|
+
regular: true,
|
|
282
|
+
as: "h2",
|
|
283
|
+
children: props.subtitle
|
|
284
|
+
})
|
|
285
|
+
}),
|
|
269
286
|
/*#__PURE__*/ _jsx("div", {
|
|
270
287
|
className: classes.dialogContent,
|
|
271
288
|
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
@@ -273,7 +290,7 @@ var Dialog = function(props) {
|
|
|
273
290
|
children: [
|
|
274
291
|
/*#__PURE__*/ _jsx(Text3, {
|
|
275
292
|
color: colors.textSecondary,
|
|
276
|
-
|
|
293
|
+
regular: true,
|
|
277
294
|
children: message
|
|
278
295
|
}),
|
|
279
296
|
extra
|
|
@@ -283,6 +300,7 @@ var Dialog = function(props) {
|
|
|
283
300
|
/*#__PURE__*/ _jsx(Box, {
|
|
284
301
|
paddingTop: isTabletOrSmaller ? 24 : 32,
|
|
285
302
|
children: /*#__PURE__*/ _jsxs(ButtonLayout, {
|
|
303
|
+
link: props.forceWeb ? props.link : undefined,
|
|
286
304
|
children: [
|
|
287
305
|
destructive ? /*#__PURE__*/ _jsx(ButtonDanger, _objectSpread({
|
|
288
306
|
tabIndex: 1
|
|
@@ -396,10 +414,13 @@ var ModalDialog = function(props) {
|
|
|
396
414
|
]);
|
|
397
415
|
var handleClose = props.showCancel ? handleCancel : handleAccept;
|
|
398
416
|
var handleOverlayPress = React.useCallback(function(event) {
|
|
399
|
-
|
|
400
|
-
|
|
417
|
+
if (props.showClose) {
|
|
418
|
+
handleClose();
|
|
419
|
+
event.stopPropagation();
|
|
420
|
+
}
|
|
401
421
|
}, [
|
|
402
|
-
handleClose
|
|
422
|
+
handleClose,
|
|
423
|
+
props.showClose
|
|
403
424
|
]);
|
|
404
425
|
var handleKeyDown = React.useCallback(function(event) {
|
|
405
426
|
if (event.keyCode === ESC) {
|
|
@@ -473,7 +494,7 @@ var ModalDialog = function(props) {
|
|
|
473
494
|
closed: isClosing
|
|
474
495
|
}),
|
|
475
496
|
children: [
|
|
476
|
-
/*#__PURE__*/ _jsx("div", {
|
|
497
|
+
props.showClose && /*#__PURE__*/ _jsx("div", {
|
|
477
498
|
className: classes.modalCloseButtonContainer,
|
|
478
499
|
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
479
500
|
onPress: handleClose,
|
|
@@ -611,13 +632,14 @@ var DialogRoot = /*#__PURE__*/ function(_Component) {
|
|
|
611
632
|
}(React.Component);
|
|
612
633
|
export { DialogRoot as default };
|
|
613
634
|
var showDialog = function(param) {
|
|
614
|
-
var showCancel = param.showCancel, forceWeb = param.forceWeb;
|
|
635
|
+
var showCancel = param.showCancel, showClose = param.showClose, forceWeb = param.forceWeb;
|
|
615
636
|
return function(props) {
|
|
616
637
|
if (!dialogInstance) {
|
|
617
638
|
throw Error("Tried to show a dialog but the DialogRoot component was not mounted (mount <ThemeContextProvider>)");
|
|
618
639
|
}
|
|
619
640
|
dialogInstance.show(_objectSpread({
|
|
620
641
|
showCancel: showCancel,
|
|
642
|
+
showClose: showClose,
|
|
621
643
|
forceWeb: forceWeb
|
|
622
644
|
}, props));
|
|
623
645
|
};
|
|
@@ -626,17 +648,20 @@ var showDialog = function(param) {
|
|
|
626
648
|
* Shows alert dialog with supplied props
|
|
627
649
|
*/ export var alert = showDialog({
|
|
628
650
|
showCancel: false,
|
|
629
|
-
forceWeb: false
|
|
651
|
+
forceWeb: false,
|
|
652
|
+
showClose: false
|
|
630
653
|
});
|
|
631
654
|
/**
|
|
632
655
|
* Shows confirm dialog with supplied props
|
|
633
656
|
*/ export var confirm = showDialog({
|
|
634
657
|
showCancel: true,
|
|
635
|
-
forceWeb: false
|
|
658
|
+
forceWeb: false,
|
|
659
|
+
showClose: false
|
|
636
660
|
});
|
|
637
661
|
/**
|
|
638
662
|
* Shows dialog with supplied props
|
|
639
663
|
*/ export var dialog = showDialog({
|
|
640
664
|
showCancel: false,
|
|
641
|
-
forceWeb: true
|
|
665
|
+
forceWeb: true,
|
|
666
|
+
showClose: true
|
|
642
667
|
});
|
package/dist-es/index.js
CHANGED
|
@@ -90,6 +90,7 @@ export { default as IconSuccessVivo } from "./icons/icon-success-vivo";
|
|
|
90
90
|
export { SkeletonCircle, SkeletonRow, SkeletonLine, SkeletonRectangle, SkeletonText } from "./skeletons";
|
|
91
91
|
export { default as Circle } from "./circle";
|
|
92
92
|
export { useTheme, useScreenSize, useElementDimensions, useAriaId, useWindowSize, useWindowHeight, useWindowWidth, useIsInViewport } from "./hooks";
|
|
93
|
+
export { pxToRem } from "./utils/css";
|
|
93
94
|
export { TrackingConfig, useTrackingConfig } from "./utils/analytics";
|
|
94
95
|
export { useDocumentVisibility } from "./utils/document-visibility";
|
|
95
96
|
export { ThemeVariant, useIsInverseVariant } from "./theme-variant-context";
|