glints-aries 4.1.80 → 4.1.81
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/es/@next/Menu/MenuStyle.d.ts +1 -1
- package/es/@next/Skeleton/components/SkeletonText/SkeletonText.test.d.ts +1 -0
- package/es/@next/Skeleton/components/SkeletonText/SkeletonTextStyle.js +13 -13
- package/es/@next/Tooltip/Tooltip.d.ts +3 -1
- package/es/@next/Tooltip/Tooltip.js +24 -2
- package/es/@next/Tooltip/Tooltip.test.d.ts +1 -0
- package/es/@next/Typography/TypographyStyles.js +13 -13
- package/es/Display/Tooltip/Tooltip.d.ts +2 -0
- package/es/Display/Tooltip/Tooltip.js +29 -4
- package/lib/@next/Menu/MenuStyle.d.ts +1 -1
- package/lib/@next/Skeleton/components/SkeletonText/SkeletonText.test.d.ts +1 -0
- package/lib/@next/Skeleton/components/SkeletonText/SkeletonTextStyle.js +13 -13
- package/lib/@next/Tooltip/Tooltip.d.ts +3 -1
- package/lib/@next/Tooltip/Tooltip.js +24 -2
- package/lib/@next/Tooltip/Tooltip.test.d.ts +1 -0
- package/lib/@next/Typography/TypographyStyles.js +13 -13
- package/lib/Display/Tooltip/Tooltip.d.ts +2 -0
- package/lib/Display/Tooltip/Tooltip.js +28 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MenuProps } from './Menu';
|
|
3
3
|
export declare const StyledMenu: import("styled-components").StyledComponent<"ul", any, MenuProps, never>;
|
|
4
|
-
export declare const StyledTooltip: import("styled-components").StyledComponent<({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, tooltipClassName, ...props }: import("../Tooltip/Tooltip").TooltipProps) => JSX.Element, any, {
|
|
4
|
+
export declare const StyledTooltip: import("styled-components").StyledComponent<({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, tooltipClassName, hoverOpenDelay, ...props }: import("../Tooltip/Tooltip").TooltipProps) => JSX.Element, any, {
|
|
5
5
|
zIndex: 500;
|
|
6
6
|
}, "zIndex">;
|
|
7
7
|
export declare const TitleContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'jest-styled-components';
|
|
@@ -3,19 +3,19 @@ import styled, { css } from 'styled-components';
|
|
|
3
3
|
import * as Breakpoints from '../../../utilities/breakpoints';
|
|
4
4
|
import { space4 } from '../../../utilities/spacing';
|
|
5
5
|
import { SkeletonShimmer } from '../../SkeletonStyle';
|
|
6
|
-
var headline1 = css(["height:
|
|
7
|
-
var headline2 = css(["height:
|
|
8
|
-
var headline3 = css(["height:
|
|
9
|
-
var headline4 = css(["height:
|
|
10
|
-
var headline5 = css(["height:
|
|
11
|
-
var headline6 = css(["height:
|
|
12
|
-
var subtitle1 = css(["height:
|
|
13
|
-
var subtitle2 = css(["height:
|
|
14
|
-
var body1 = css(["height:
|
|
15
|
-
var body2 = css(["height:
|
|
16
|
-
var button = css(["height:
|
|
17
|
-
var caption = css(["height:
|
|
18
|
-
var overline = css(["height:
|
|
6
|
+
var headline1 = css(["height:45px;@media (max-width:", "){height:35px;}"], Breakpoints.large);
|
|
7
|
+
var headline2 = css(["height:40px;@media (max-width:", "){height:30px;}"], Breakpoints.large);
|
|
8
|
+
var headline3 = css(["height:36.4px;@media (max-width:", "){height:28.6px;}"], Breakpoints.large);
|
|
9
|
+
var headline4 = css(["height:31.2px;@media (max-width:", "){height:26px;}"], Breakpoints.large);
|
|
10
|
+
var headline5 = css(["height:28px;@media (max-width:", "){height:25.2px;}"], Breakpoints.large);
|
|
11
|
+
var headline6 = css(["height:25.2px;@media (max-width:", "){height:22.4px;}"], Breakpoints.large);
|
|
12
|
+
var subtitle1 = css(["height:24px;"]);
|
|
13
|
+
var subtitle2 = css(["height:19.5px;@media (max-width:", "){height:18px;}"], Breakpoints.large);
|
|
14
|
+
var body1 = css(["height:21px;"]);
|
|
15
|
+
var body2 = css(["height:21px;@media (max-width:", "){height:19.6px;}"], Breakpoints.large);
|
|
16
|
+
var button = css(["height:21px;@media (max-width:", "){height:19.6px;}"], Breakpoints.large);
|
|
17
|
+
var caption = css(["height:16.8px;"]);
|
|
18
|
+
var overline = css(["height:15.4px;"]);
|
|
19
19
|
var variantHeightMapping = (_variantHeightMapping = {}, _variantHeightMapping['headline1'] = headline1, _variantHeightMapping['headline2'] = headline2, _variantHeightMapping['headline3'] = headline3, _variantHeightMapping['headline4'] = headline4, _variantHeightMapping['headline5'] = headline5, _variantHeightMapping['headline6'] = headline6, _variantHeightMapping['subtitle1'] = subtitle1, _variantHeightMapping['subtitle2'] = subtitle2, _variantHeightMapping['body1'] = body1, _variantHeightMapping['body2'] = body2, _variantHeightMapping['button'] = button, _variantHeightMapping['caption'] = caption, _variantHeightMapping['overline'] = overline, _variantHeightMapping);
|
|
20
20
|
export var StyledSkeletonText = styled.li.withConfig({
|
|
21
21
|
displayName: "SkeletonTextStyle__StyledSkeletonText",
|
|
@@ -13,6 +13,8 @@ export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
13
13
|
/** if clickable it true, onClick will be called when tooltip is clicked */
|
|
14
14
|
onClick?: () => void;
|
|
15
15
|
tooltipClassName?: string;
|
|
16
|
+
/** delay before showing a hover-triggered tooltip */
|
|
17
|
+
hoverOpenDelay?: number;
|
|
16
18
|
}
|
|
17
|
-
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, tooltipClassName, ...props }: TooltipProps) => JSX.Element;
|
|
19
|
+
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, tooltipClassName, hoverOpenDelay, ...props }: TooltipProps) => JSX.Element;
|
|
18
20
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["children", "content", "preferredPosition", "zIndex", "clickable", "timeout", "onClick", "tooltipClassName"];
|
|
3
|
+
var _excluded = ["children", "content", "preferredPosition", "zIndex", "clickable", "timeout", "onClick", "tooltipClassName", "hoverOpenDelay"];
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { Portal } from '../Portal/Portal';
|
|
6
6
|
import { Typography } from '../Typography';
|
|
@@ -64,6 +64,8 @@ export var Tooltip = function Tooltip(_ref) {
|
|
|
64
64
|
timeout = _ref$timeout === void 0 ? 0 : _ref$timeout,
|
|
65
65
|
onClick = _ref.onClick,
|
|
66
66
|
tooltipClassName = _ref.tooltipClassName,
|
|
67
|
+
_ref$hoverOpenDelay = _ref.hoverOpenDelay,
|
|
68
|
+
hoverOpenDelay = _ref$hoverOpenDelay === void 0 ? 300 : _ref$hoverOpenDelay,
|
|
67
69
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
68
70
|
var tooltipRef = useRef(null);
|
|
69
71
|
var elRef = useRef(null);
|
|
@@ -123,11 +125,25 @@ export var Tooltip = function Tooltip(_ref) {
|
|
|
123
125
|
as: "div",
|
|
124
126
|
variant: "subtitle2"
|
|
125
127
|
}, content) : content;
|
|
128
|
+
var hoverTimeoutRef = useRef(null);
|
|
126
129
|
var handleMouseEnter = function handleMouseEnter() {
|
|
127
|
-
if (
|
|
130
|
+
if (clickable || hoverTimeoutRef.current) return;
|
|
131
|
+
if (hoverOpenDelay <= 0) {
|
|
132
|
+
setIsActive(true);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
hoverTimeoutRef.current = setTimeout(function () {
|
|
136
|
+
hoverTimeoutRef.current = null;
|
|
137
|
+
setIsActive(true);
|
|
138
|
+
}, hoverOpenDelay);
|
|
128
139
|
};
|
|
129
140
|
var handleMouseLeave = function handleMouseLeave() {
|
|
130
141
|
if (!clickable) {
|
|
142
|
+
if (hoverTimeoutRef.current) {
|
|
143
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
144
|
+
hoverTimeoutRef.current = null;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
131
147
|
setIsActive(false);
|
|
132
148
|
handleAnimation();
|
|
133
149
|
}
|
|
@@ -142,6 +158,12 @@ export var Tooltip = function Tooltip(_ref) {
|
|
|
142
158
|
var _useState4 = useState(false),
|
|
143
159
|
animate = _useState4[0],
|
|
144
160
|
setAnimate = _useState4[1];
|
|
161
|
+
useEffect(function () {
|
|
162
|
+
return function () {
|
|
163
|
+
if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current);
|
|
164
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
165
|
+
};
|
|
166
|
+
}, []);
|
|
145
167
|
var handleAnimation = function handleAnimation() {
|
|
146
168
|
// if you click during the tooltip's lifespan, it should reset the timeout
|
|
147
169
|
if (timeoutRef.current) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
@@ -2,19 +2,19 @@ var _variantCssMapping;
|
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import * as Breakpoints from '../utilities/breakpoints';
|
|
4
4
|
import { NotoSans, Poppins } from '../utilities/fonts';
|
|
5
|
-
export var headline1 = css(["font-family:", ",sans-serif;font-weight:700;font-size:
|
|
6
|
-
export var headline2 = css(["font-family:", ",sans-serif;font-weight:700;font-size:
|
|
7
|
-
export var headline3 = css(["font-family:", ",sans-serif;font-weight:700;font-size:
|
|
8
|
-
export var headline4 = css(["font-family:", ",sans-serif;font-weight:700;font-size:
|
|
9
|
-
export var headline5 = css(["font-weight:700;font-size:
|
|
10
|
-
export var headline6 = css(["font-family:", ",sans-serif;font-weight:600;font-size:
|
|
11
|
-
export var subtitle1 = css(["font-family:", ",sans-serif;font-weight:600;font-size:
|
|
12
|
-
export var subtitle2 = css(["font-family:", ",sans-serif;font-weight:400;font-size:
|
|
13
|
-
export var body1 = css(["font-family:", ",sans-serif;font-weight:400;font-size:
|
|
14
|
-
export var body2 = css(["font-family:", ",sans-serif;font-weight:600;font-size:
|
|
15
|
-
export var button = css(["font-family:", ",sans-serif;font-weight:
|
|
16
|
-
export var caption = css(["font-family:", ",sans-serif;font-weight:600;font-size:
|
|
17
|
-
export var overline = css(["font-family:", ",sans-serif;font-weight:500;font-size:
|
|
5
|
+
export var headline1 = css(["font-family:", ",sans-serif;font-weight:700;font-size:36px;line-height:125%;letter-spacing:0;@media (max-width:", "){font-size:28px;}"], Poppins, Breakpoints.large);
|
|
6
|
+
export var headline2 = css(["font-family:", ",sans-serif;font-weight:700;font-size:32px;line-height:125%;letter-spacing:0;@media (max-width:", "){font-weight:600;font-size:24px;line-height:125%;}"], Poppins, Breakpoints.large);
|
|
7
|
+
export var headline3 = css(["font-family:", ",sans-serif;font-weight:700;font-size:28px;line-height:130%;letter-spacing:0;@media (max-width:", "){font-weight:600;font-size:22px;line-height:130%;}"], Poppins, Breakpoints.large);
|
|
8
|
+
export var headline4 = css(["font-family:", ",sans-serif;font-weight:700;font-size:24px;line-height:130%;letter-spacing:0;@media (max-width:", "){font-weight:600;font-size:20px;line-height:130%;}"], Poppins, Breakpoints.large);
|
|
9
|
+
export var headline5 = css(["font-weight:700;font-size:20px;line-height:140%;letter-spacing:0;@media (max-width:", "){font-weight:600;font-size:18px;}"], Breakpoints.large);
|
|
10
|
+
export var headline6 = css(["font-family:", ",sans-serif;font-weight:600;font-size:18px;line-height:140%;letter-spacing:0;@media (max-width:", "){font-weight:700;font-size:16px;letter-spacing:0.15px;}"], NotoSans, Breakpoints.large);
|
|
11
|
+
export var subtitle1 = css(["font-family:", ",sans-serif;font-weight:600;font-size:16px;line-height:150%;letter-spacing:0.15px;@media (max-width:", "){font-size:16px;}"], NotoSans, Breakpoints.large);
|
|
12
|
+
export var subtitle2 = css(["font-family:", ",sans-serif;font-weight:400;font-size:13px;line-height:150%;letter-spacing:0.25px;@media (max-width:", "){font-size:12px;letter-spacing:0;}"], NotoSans, Breakpoints.large);
|
|
13
|
+
export var body1 = css(["font-family:", ",sans-serif;font-weight:400;font-size:14px;line-height:150%;letter-spacing:0px;@media (max-width:", "){font-size:14px;}"], NotoSans, Breakpoints.large);
|
|
14
|
+
export var body2 = css(["font-family:", ",sans-serif;font-weight:600;font-size:14px;line-height:150%;letter-spacing:0.25px;@media (max-width:", "){font-size:14px;line-height:140%;letter-spacing:0;}"], NotoSans, Breakpoints.large);
|
|
15
|
+
export var button = css(["font-family:", ",sans-serif;font-weight:600;font-size:14px;line-height:150%;letter-spacing:0.75px;@media (max-width:", "){line-height:140%;letter-spacing:0.25px;}"], NotoSans, Breakpoints.large);
|
|
16
|
+
export var caption = css(["font-family:", ",sans-serif;font-weight:600;font-size:12px;line-height:140%;letter-spacing:0.25px;@media (max-width:", "){font-size:12px;letter-spacing:0px;}"], NotoSans, Breakpoints.large);
|
|
17
|
+
export var overline = css(["font-family:", ",sans-serif;font-weight:500;font-size:11px;line-height:140%;letter-spacing:1.5px;@media (max-width:", "){font-size:11px;letter-spacing:0.2px;}"], NotoSans, Breakpoints.large);
|
|
18
18
|
export var variantCssMapping = (_variantCssMapping = {}, _variantCssMapping['headline1'] = headline1, _variantCssMapping['headline2'] = headline2, _variantCssMapping['headline3'] = headline3, _variantCssMapping['headline4'] = headline4, _variantCssMapping['headline5'] = headline5, _variantCssMapping['headline6'] = headline6, _variantCssMapping['subtitle1'] = subtitle1, _variantCssMapping['subtitle2'] = subtitle2, _variantCssMapping['body1'] = body1, _variantCssMapping['body2'] = body2, _variantCssMapping['button'] = button, _variantCssMapping['caption'] = caption, _variantCssMapping['overline'] = overline, _variantCssMapping);
|
|
19
19
|
export var StyledTypography = styled.p.withConfig({
|
|
20
20
|
displayName: "TypographyStyles__StyledTypography",
|
|
@@ -9,6 +9,8 @@ export declare type Position = 'top' | 'right' | 'bottom' | 'left';
|
|
|
9
9
|
interface BaseProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
10
10
|
classes?: Classes;
|
|
11
11
|
position?: Position;
|
|
12
|
+
/** delay before showing the tooltip on hover */
|
|
13
|
+
hoverOpenDelay?: number;
|
|
12
14
|
}
|
|
13
15
|
export interface StringTooltip extends BaseProps {
|
|
14
16
|
text: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["classes", "children", "text", "textAsString", "position"];
|
|
4
|
-
import React, { useRef, useState, useCallback } from 'react';
|
|
3
|
+
var _excluded = ["classes", "children", "text", "textAsString", "position", "hoverOpenDelay"];
|
|
4
|
+
import React, { useEffect, useRef, useState, useCallback } from 'react';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { TooltipContainer, TooltipContent, TooltipMessage } from './TooltipStyle';
|
|
7
7
|
export var Tooltip = function Tooltip(_ref) {
|
|
@@ -12,8 +12,11 @@ export var Tooltip = function Tooltip(_ref) {
|
|
|
12
12
|
textAsString = _ref.textAsString,
|
|
13
13
|
_ref$position = _ref.position,
|
|
14
14
|
position = _ref$position === void 0 ? 'top' : _ref$position,
|
|
15
|
+
_ref$hoverOpenDelay = _ref.hoverOpenDelay,
|
|
16
|
+
hoverOpenDelay = _ref$hoverOpenDelay === void 0 ? 300 : _ref$hoverOpenDelay,
|
|
15
17
|
defaultProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
16
18
|
var contentRef = useRef(null);
|
|
19
|
+
var hoverTimeoutRef = useRef(null);
|
|
17
20
|
var _useState = useState(false),
|
|
18
21
|
isShow = _useState[0],
|
|
19
22
|
setIsShow = _useState[1];
|
|
@@ -23,6 +26,25 @@ export var Tooltip = function Tooltip(_ref) {
|
|
|
23
26
|
var hideTooltip = function hideTooltip() {
|
|
24
27
|
return setIsShow(false);
|
|
25
28
|
};
|
|
29
|
+
var clearHoverTimeout = function clearHoverTimeout() {
|
|
30
|
+
if (!hoverTimeoutRef.current) return;
|
|
31
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
32
|
+
hoverTimeoutRef.current = null;
|
|
33
|
+
};
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
return clearHoverTimeout;
|
|
36
|
+
}, []);
|
|
37
|
+
var showTooltipAfterDelay = function showTooltipAfterDelay() {
|
|
38
|
+
if (hoverTimeoutRef.current || isShow) return;
|
|
39
|
+
if (hoverOpenDelay <= 0) {
|
|
40
|
+
showTooltip();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
hoverTimeoutRef.current = setTimeout(function () {
|
|
44
|
+
hoverTimeoutRef.current = null;
|
|
45
|
+
showTooltip();
|
|
46
|
+
}, hoverOpenDelay);
|
|
47
|
+
};
|
|
26
48
|
var hideTooltipIfTouchOutside = useCallback(function (event) {
|
|
27
49
|
var hasTouchedOutsideOfTooltipContent = contentRef.current && !contentRef.current.contains(event.target);
|
|
28
50
|
if (hasTouchedOutsideOfTooltipContent) {
|
|
@@ -47,8 +69,11 @@ export var Tooltip = function Tooltip(_ref) {
|
|
|
47
69
|
// On mobile, it shows the tooltip on touch and hides the tooltip when the touch is released
|
|
48
70
|
,
|
|
49
71
|
onTouchStart: handleTouchStart,
|
|
50
|
-
onMouseOver:
|
|
51
|
-
onMouseLeave:
|
|
72
|
+
onMouseOver: showTooltipAfterDelay,
|
|
73
|
+
onMouseLeave: function onMouseLeave() {
|
|
74
|
+
clearHoverTimeout();
|
|
75
|
+
hideTooltip();
|
|
76
|
+
}
|
|
52
77
|
}, defaultProps), isShow && /*#__PURE__*/React.createElement(TooltipContent, {
|
|
53
78
|
ref: contentRef,
|
|
54
79
|
className: classNames('aries-tooltip-content', classes.content),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MenuProps } from './Menu';
|
|
3
3
|
export declare const StyledMenu: import("styled-components").StyledComponent<"ul", any, MenuProps, never>;
|
|
4
|
-
export declare const StyledTooltip: import("styled-components").StyledComponent<({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, tooltipClassName, ...props }: import("../Tooltip/Tooltip").TooltipProps) => JSX.Element, any, {
|
|
4
|
+
export declare const StyledTooltip: import("styled-components").StyledComponent<({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, tooltipClassName, hoverOpenDelay, ...props }: import("../Tooltip/Tooltip").TooltipProps) => JSX.Element, any, {
|
|
5
5
|
zIndex: 500;
|
|
6
6
|
}, "zIndex">;
|
|
7
7
|
export declare const TitleContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'jest-styled-components';
|
|
@@ -9,19 +9,19 @@ var _SkeletonStyle = require("../../SkeletonStyle");
|
|
|
9
9
|
var _variantHeightMapping;
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
-
var headline1 = (0, _styledComponents.css)(["height:
|
|
13
|
-
var headline2 = (0, _styledComponents.css)(["height:
|
|
14
|
-
var headline3 = (0, _styledComponents.css)(["height:
|
|
15
|
-
var headline4 = (0, _styledComponents.css)(["height:
|
|
16
|
-
var headline5 = (0, _styledComponents.css)(["height:
|
|
17
|
-
var headline6 = (0, _styledComponents.css)(["height:
|
|
18
|
-
var subtitle1 = (0, _styledComponents.css)(["height:
|
|
19
|
-
var subtitle2 = (0, _styledComponents.css)(["height:
|
|
20
|
-
var body1 = (0, _styledComponents.css)(["height:
|
|
21
|
-
var body2 = (0, _styledComponents.css)(["height:
|
|
22
|
-
var button = (0, _styledComponents.css)(["height:
|
|
23
|
-
var caption = (0, _styledComponents.css)(["height:
|
|
24
|
-
var overline = (0, _styledComponents.css)(["height:
|
|
12
|
+
var headline1 = (0, _styledComponents.css)(["height:45px;@media (max-width:", "){height:35px;}"], Breakpoints.large);
|
|
13
|
+
var headline2 = (0, _styledComponents.css)(["height:40px;@media (max-width:", "){height:30px;}"], Breakpoints.large);
|
|
14
|
+
var headline3 = (0, _styledComponents.css)(["height:36.4px;@media (max-width:", "){height:28.6px;}"], Breakpoints.large);
|
|
15
|
+
var headline4 = (0, _styledComponents.css)(["height:31.2px;@media (max-width:", "){height:26px;}"], Breakpoints.large);
|
|
16
|
+
var headline5 = (0, _styledComponents.css)(["height:28px;@media (max-width:", "){height:25.2px;}"], Breakpoints.large);
|
|
17
|
+
var headline6 = (0, _styledComponents.css)(["height:25.2px;@media (max-width:", "){height:22.4px;}"], Breakpoints.large);
|
|
18
|
+
var subtitle1 = (0, _styledComponents.css)(["height:24px;"]);
|
|
19
|
+
var subtitle2 = (0, _styledComponents.css)(["height:19.5px;@media (max-width:", "){height:18px;}"], Breakpoints.large);
|
|
20
|
+
var body1 = (0, _styledComponents.css)(["height:21px;"]);
|
|
21
|
+
var body2 = (0, _styledComponents.css)(["height:21px;@media (max-width:", "){height:19.6px;}"], Breakpoints.large);
|
|
22
|
+
var button = (0, _styledComponents.css)(["height:21px;@media (max-width:", "){height:19.6px;}"], Breakpoints.large);
|
|
23
|
+
var caption = (0, _styledComponents.css)(["height:16.8px;"]);
|
|
24
|
+
var overline = (0, _styledComponents.css)(["height:15.4px;"]);
|
|
25
25
|
var variantHeightMapping = (_variantHeightMapping = {}, _variantHeightMapping['headline1'] = headline1, _variantHeightMapping['headline2'] = headline2, _variantHeightMapping['headline3'] = headline3, _variantHeightMapping['headline4'] = headline4, _variantHeightMapping['headline5'] = headline5, _variantHeightMapping['headline6'] = headline6, _variantHeightMapping['subtitle1'] = subtitle1, _variantHeightMapping['subtitle2'] = subtitle2, _variantHeightMapping['body1'] = body1, _variantHeightMapping['body2'] = body2, _variantHeightMapping['button'] = button, _variantHeightMapping['caption'] = caption, _variantHeightMapping['overline'] = overline, _variantHeightMapping);
|
|
26
26
|
var StyledSkeletonText = _styledComponents["default"].li.withConfig({
|
|
27
27
|
displayName: "SkeletonTextStyle__StyledSkeletonText",
|
|
@@ -13,6 +13,8 @@ export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
13
13
|
/** if clickable it true, onClick will be called when tooltip is clicked */
|
|
14
14
|
onClick?: () => void;
|
|
15
15
|
tooltipClassName?: string;
|
|
16
|
+
/** delay before showing a hover-triggered tooltip */
|
|
17
|
+
hoverOpenDelay?: number;
|
|
16
18
|
}
|
|
17
|
-
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, tooltipClassName, ...props }: TooltipProps) => JSX.Element;
|
|
19
|
+
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, tooltipClassName, hoverOpenDelay, ...props }: TooltipProps) => JSX.Element;
|
|
18
20
|
export {};
|
|
@@ -12,7 +12,7 @@ var _positionResolver = require("./positionResolver");
|
|
|
12
12
|
var _positionResolverHelper = require("./positionResolverHelper");
|
|
13
13
|
var _TooltipStyle = require("./TooltipStyle");
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
var _excluded = ["children", "content", "preferredPosition", "zIndex", "clickable", "timeout", "onClick", "tooltipClassName"];
|
|
15
|
+
var _excluded = ["children", "content", "preferredPosition", "zIndex", "clickable", "timeout", "onClick", "tooltipClassName", "hoverOpenDelay"];
|
|
16
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
18
|
var topPositions = ['top-center', 'top-left', 'top-right'];
|
|
@@ -71,6 +71,8 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
71
71
|
timeout = _ref$timeout === void 0 ? 0 : _ref$timeout,
|
|
72
72
|
onClick = _ref.onClick,
|
|
73
73
|
tooltipClassName = _ref.tooltipClassName,
|
|
74
|
+
_ref$hoverOpenDelay = _ref.hoverOpenDelay,
|
|
75
|
+
hoverOpenDelay = _ref$hoverOpenDelay === void 0 ? 300 : _ref$hoverOpenDelay,
|
|
74
76
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
75
77
|
var tooltipRef = (0, _react.useRef)(null);
|
|
76
78
|
var elRef = (0, _react.useRef)(null);
|
|
@@ -130,11 +132,25 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
130
132
|
as: "div",
|
|
131
133
|
variant: "subtitle2"
|
|
132
134
|
}, content) : content;
|
|
135
|
+
var hoverTimeoutRef = (0, _react.useRef)(null);
|
|
133
136
|
var handleMouseEnter = function handleMouseEnter() {
|
|
134
|
-
if (
|
|
137
|
+
if (clickable || hoverTimeoutRef.current) return;
|
|
138
|
+
if (hoverOpenDelay <= 0) {
|
|
139
|
+
setIsActive(true);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
hoverTimeoutRef.current = setTimeout(function () {
|
|
143
|
+
hoverTimeoutRef.current = null;
|
|
144
|
+
setIsActive(true);
|
|
145
|
+
}, hoverOpenDelay);
|
|
135
146
|
};
|
|
136
147
|
var handleMouseLeave = function handleMouseLeave() {
|
|
137
148
|
if (!clickable) {
|
|
149
|
+
if (hoverTimeoutRef.current) {
|
|
150
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
151
|
+
hoverTimeoutRef.current = null;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
138
154
|
setIsActive(false);
|
|
139
155
|
handleAnimation();
|
|
140
156
|
}
|
|
@@ -149,6 +165,12 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
149
165
|
var _useState4 = (0, _react.useState)(false),
|
|
150
166
|
animate = _useState4[0],
|
|
151
167
|
setAnimate = _useState4[1];
|
|
168
|
+
(0, _react.useEffect)(function () {
|
|
169
|
+
return function () {
|
|
170
|
+
if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current);
|
|
171
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
172
|
+
};
|
|
173
|
+
}, []);
|
|
152
174
|
var handleAnimation = function handleAnimation() {
|
|
153
175
|
// if you click during the tooltip's lifespan, it should reset the timeout
|
|
154
176
|
if (timeoutRef.current) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
@@ -8,31 +8,31 @@ var _fonts = require("../utilities/fonts");
|
|
|
8
8
|
var _variantCssMapping;
|
|
9
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
var headline1 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:700;font-size:
|
|
11
|
+
var headline1 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:700;font-size:36px;line-height:125%;letter-spacing:0;@media (max-width:", "){font-size:28px;}"], _fonts.Poppins, Breakpoints.large);
|
|
12
12
|
exports.headline1 = headline1;
|
|
13
|
-
var headline2 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:700;font-size:
|
|
13
|
+
var headline2 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:700;font-size:32px;line-height:125%;letter-spacing:0;@media (max-width:", "){font-weight:600;font-size:24px;line-height:125%;}"], _fonts.Poppins, Breakpoints.large);
|
|
14
14
|
exports.headline2 = headline2;
|
|
15
|
-
var headline3 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:700;font-size:
|
|
15
|
+
var headline3 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:700;font-size:28px;line-height:130%;letter-spacing:0;@media (max-width:", "){font-weight:600;font-size:22px;line-height:130%;}"], _fonts.Poppins, Breakpoints.large);
|
|
16
16
|
exports.headline3 = headline3;
|
|
17
|
-
var headline4 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:700;font-size:
|
|
17
|
+
var headline4 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:700;font-size:24px;line-height:130%;letter-spacing:0;@media (max-width:", "){font-weight:600;font-size:20px;line-height:130%;}"], _fonts.Poppins, Breakpoints.large);
|
|
18
18
|
exports.headline4 = headline4;
|
|
19
|
-
var headline5 = (0, _styledComponents.css)(["font-weight:700;font-size:
|
|
19
|
+
var headline5 = (0, _styledComponents.css)(["font-weight:700;font-size:20px;line-height:140%;letter-spacing:0;@media (max-width:", "){font-weight:600;font-size:18px;}"], Breakpoints.large);
|
|
20
20
|
exports.headline5 = headline5;
|
|
21
|
-
var headline6 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:600;font-size:
|
|
21
|
+
var headline6 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:600;font-size:18px;line-height:140%;letter-spacing:0;@media (max-width:", "){font-weight:700;font-size:16px;letter-spacing:0.15px;}"], _fonts.NotoSans, Breakpoints.large);
|
|
22
22
|
exports.headline6 = headline6;
|
|
23
|
-
var subtitle1 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:600;font-size:
|
|
23
|
+
var subtitle1 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:600;font-size:16px;line-height:150%;letter-spacing:0.15px;@media (max-width:", "){font-size:16px;}"], _fonts.NotoSans, Breakpoints.large);
|
|
24
24
|
exports.subtitle1 = subtitle1;
|
|
25
|
-
var subtitle2 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:400;font-size:
|
|
25
|
+
var subtitle2 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:400;font-size:13px;line-height:150%;letter-spacing:0.25px;@media (max-width:", "){font-size:12px;letter-spacing:0;}"], _fonts.NotoSans, Breakpoints.large);
|
|
26
26
|
exports.subtitle2 = subtitle2;
|
|
27
|
-
var body1 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:400;font-size:
|
|
27
|
+
var body1 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:400;font-size:14px;line-height:150%;letter-spacing:0px;@media (max-width:", "){font-size:14px;}"], _fonts.NotoSans, Breakpoints.large);
|
|
28
28
|
exports.body1 = body1;
|
|
29
|
-
var body2 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:600;font-size:
|
|
29
|
+
var body2 = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:600;font-size:14px;line-height:150%;letter-spacing:0.25px;@media (max-width:", "){font-size:14px;line-height:140%;letter-spacing:0;}"], _fonts.NotoSans, Breakpoints.large);
|
|
30
30
|
exports.body2 = body2;
|
|
31
|
-
var button = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:
|
|
31
|
+
var button = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:600;font-size:14px;line-height:150%;letter-spacing:0.75px;@media (max-width:", "){line-height:140%;letter-spacing:0.25px;}"], _fonts.NotoSans, Breakpoints.large);
|
|
32
32
|
exports.button = button;
|
|
33
|
-
var caption = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:600;font-size:
|
|
33
|
+
var caption = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:600;font-size:12px;line-height:140%;letter-spacing:0.25px;@media (max-width:", "){font-size:12px;letter-spacing:0px;}"], _fonts.NotoSans, Breakpoints.large);
|
|
34
34
|
exports.caption = caption;
|
|
35
|
-
var overline = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:500;font-size:
|
|
35
|
+
var overline = (0, _styledComponents.css)(["font-family:", ",sans-serif;font-weight:500;font-size:11px;line-height:140%;letter-spacing:1.5px;@media (max-width:", "){font-size:11px;letter-spacing:0.2px;}"], _fonts.NotoSans, Breakpoints.large);
|
|
36
36
|
exports.overline = overline;
|
|
37
37
|
var variantCssMapping = (_variantCssMapping = {}, _variantCssMapping['headline1'] = headline1, _variantCssMapping['headline2'] = headline2, _variantCssMapping['headline3'] = headline3, _variantCssMapping['headline4'] = headline4, _variantCssMapping['headline5'] = headline5, _variantCssMapping['headline6'] = headline6, _variantCssMapping['subtitle1'] = subtitle1, _variantCssMapping['subtitle2'] = subtitle2, _variantCssMapping['body1'] = body1, _variantCssMapping['body2'] = body2, _variantCssMapping['button'] = button, _variantCssMapping['caption'] = caption, _variantCssMapping['overline'] = overline, _variantCssMapping);
|
|
38
38
|
exports.variantCssMapping = variantCssMapping;
|
|
@@ -9,6 +9,8 @@ export declare type Position = 'top' | 'right' | 'bottom' | 'left';
|
|
|
9
9
|
interface BaseProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
10
10
|
classes?: Classes;
|
|
11
11
|
position?: Position;
|
|
12
|
+
/** delay before showing the tooltip on hover */
|
|
13
|
+
hoverOpenDelay?: number;
|
|
12
14
|
}
|
|
13
15
|
export interface StringTooltip extends BaseProps {
|
|
14
16
|
text: string;
|
|
@@ -8,7 +8,7 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _TooltipStyle = require("./TooltipStyle");
|
|
11
|
-
var _excluded = ["classes", "children", "text", "textAsString", "position"];
|
|
11
|
+
var _excluded = ["classes", "children", "text", "textAsString", "position", "hoverOpenDelay"];
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
14
|
var Tooltip = function Tooltip(_ref) {
|
|
@@ -19,8 +19,11 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
19
19
|
textAsString = _ref.textAsString,
|
|
20
20
|
_ref$position = _ref.position,
|
|
21
21
|
position = _ref$position === void 0 ? 'top' : _ref$position,
|
|
22
|
+
_ref$hoverOpenDelay = _ref.hoverOpenDelay,
|
|
23
|
+
hoverOpenDelay = _ref$hoverOpenDelay === void 0 ? 300 : _ref$hoverOpenDelay,
|
|
22
24
|
defaultProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
23
25
|
var contentRef = (0, _react.useRef)(null);
|
|
26
|
+
var hoverTimeoutRef = (0, _react.useRef)(null);
|
|
24
27
|
var _useState = (0, _react.useState)(false),
|
|
25
28
|
isShow = _useState[0],
|
|
26
29
|
setIsShow = _useState[1];
|
|
@@ -30,6 +33,25 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
30
33
|
var hideTooltip = function hideTooltip() {
|
|
31
34
|
return setIsShow(false);
|
|
32
35
|
};
|
|
36
|
+
var clearHoverTimeout = function clearHoverTimeout() {
|
|
37
|
+
if (!hoverTimeoutRef.current) return;
|
|
38
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
39
|
+
hoverTimeoutRef.current = null;
|
|
40
|
+
};
|
|
41
|
+
(0, _react.useEffect)(function () {
|
|
42
|
+
return clearHoverTimeout;
|
|
43
|
+
}, []);
|
|
44
|
+
var showTooltipAfterDelay = function showTooltipAfterDelay() {
|
|
45
|
+
if (hoverTimeoutRef.current || isShow) return;
|
|
46
|
+
if (hoverOpenDelay <= 0) {
|
|
47
|
+
showTooltip();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
hoverTimeoutRef.current = setTimeout(function () {
|
|
51
|
+
hoverTimeoutRef.current = null;
|
|
52
|
+
showTooltip();
|
|
53
|
+
}, hoverOpenDelay);
|
|
54
|
+
};
|
|
33
55
|
var hideTooltipIfTouchOutside = (0, _react.useCallback)(function (event) {
|
|
34
56
|
var hasTouchedOutsideOfTooltipContent = contentRef.current && !contentRef.current.contains(event.target);
|
|
35
57
|
if (hasTouchedOutsideOfTooltipContent) {
|
|
@@ -54,8 +76,11 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
54
76
|
// On mobile, it shows the tooltip on touch and hides the tooltip when the touch is released
|
|
55
77
|
,
|
|
56
78
|
onTouchStart: handleTouchStart,
|
|
57
|
-
onMouseOver:
|
|
58
|
-
onMouseLeave:
|
|
79
|
+
onMouseOver: showTooltipAfterDelay,
|
|
80
|
+
onMouseLeave: function onMouseLeave() {
|
|
81
|
+
clearHoverTimeout();
|
|
82
|
+
hideTooltip();
|
|
83
|
+
}
|
|
59
84
|
}, defaultProps), isShow && /*#__PURE__*/_react["default"].createElement(_TooltipStyle.TooltipContent, {
|
|
60
85
|
ref: contentRef,
|
|
61
86
|
className: (0, _classnames["default"])('aries-tooltip-content', classes.content),
|