glints-aries 4.1.19 → 4.1.20
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.
|
@@ -12,6 +12,7 @@ export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
12
12
|
timeout?: number;
|
|
13
13
|
/** if clickable it true, onClick will be called when tooltip is clicked */
|
|
14
14
|
onClick?: () => void;
|
|
15
|
+
tooltipClassName?: string;
|
|
15
16
|
}
|
|
16
|
-
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, ...props }: TooltipProps) => JSX.Element;
|
|
17
|
+
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, tooltipClassName, ...props }: TooltipProps) => JSX.Element;
|
|
17
18
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
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"];
|
|
3
|
+
var _excluded = ["children", "content", "preferredPosition", "zIndex", "clickable", "timeout", "onClick", "tooltipClassName"];
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { Portal } from '../Portal/Portal';
|
|
6
6
|
import { Typography } from '../Typography';
|
|
7
7
|
import { bottomPositionResolver, leftPositionResolver, rightPositionResolver, topPositionResolver } from './positionResolver';
|
|
8
8
|
import { canAlignBottom, canAlignCenter, canAlignLeft, canAlignMiddle, canAlignRight, canAlignTop, horizontalBuffer, verticalBuffer } from './positionResolverHelper';
|
|
9
9
|
import { StyledTooltip, StyledTooltipArrow, StyledTooltipContainer } from './TooltipStyle';
|
|
10
|
+
import classNames from 'classnames';
|
|
10
11
|
var topPositions = ['top-center', 'top-left', 'top-right'];
|
|
11
12
|
var bottomPositions = ['bottom-center', 'bottom-left', 'bottom-right'];
|
|
12
13
|
var rightPositions = ['right-middle', 'right-top', 'right-bottom'];
|
|
@@ -62,6 +63,7 @@ export var Tooltip = function Tooltip(_ref) {
|
|
|
62
63
|
_ref$timeout = _ref.timeout,
|
|
63
64
|
timeout = _ref$timeout === void 0 ? 0 : _ref$timeout,
|
|
64
65
|
onClick = _ref.onClick,
|
|
66
|
+
tooltipClassName = _ref.tooltipClassName,
|
|
65
67
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
66
68
|
var tooltipRef = useRef(null);
|
|
67
69
|
var elRef = useRef(null);
|
|
@@ -163,7 +165,9 @@ export var Tooltip = function Tooltip(_ref) {
|
|
|
163
165
|
onClick: handleClick
|
|
164
166
|
}, props), children), isActive && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(StyledTooltip, {
|
|
165
167
|
"data-position": position,
|
|
166
|
-
className:
|
|
168
|
+
className: classNames({
|
|
169
|
+
'closed-animation': animate
|
|
170
|
+
}, tooltipClassName),
|
|
167
171
|
ref: tooltipRef,
|
|
168
172
|
zIndex: zIndex,
|
|
169
173
|
style: {
|
|
@@ -12,6 +12,7 @@ export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
12
12
|
timeout?: number;
|
|
13
13
|
/** if clickable it true, onClick will be called when tooltip is clicked */
|
|
14
14
|
onClick?: () => void;
|
|
15
|
+
tooltipClassName?: string;
|
|
15
16
|
}
|
|
16
|
-
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, ...props }: TooltipProps) => JSX.Element;
|
|
17
|
+
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, tooltipClassName, ...props }: TooltipProps) => JSX.Element;
|
|
17
18
|
export {};
|
|
@@ -11,7 +11,8 @@ var _Typography = require("../Typography");
|
|
|
11
11
|
var _positionResolver = require("./positionResolver");
|
|
12
12
|
var _positionResolverHelper = require("./positionResolverHelper");
|
|
13
13
|
var _TooltipStyle = require("./TooltipStyle");
|
|
14
|
-
var
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
var _excluded = ["children", "content", "preferredPosition", "zIndex", "clickable", "timeout", "onClick", "tooltipClassName"];
|
|
15
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); }
|
|
16
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; }
|
|
17
18
|
var topPositions = ['top-center', 'top-left', 'top-right'];
|
|
@@ -69,6 +70,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
69
70
|
_ref$timeout = _ref.timeout,
|
|
70
71
|
timeout = _ref$timeout === void 0 ? 0 : _ref$timeout,
|
|
71
72
|
onClick = _ref.onClick,
|
|
73
|
+
tooltipClassName = _ref.tooltipClassName,
|
|
72
74
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
73
75
|
var tooltipRef = (0, _react.useRef)(null);
|
|
74
76
|
var elRef = (0, _react.useRef)(null);
|
|
@@ -170,7 +172,9 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
170
172
|
onClick: handleClick
|
|
171
173
|
}, props), children), isActive && /*#__PURE__*/_react["default"].createElement(_Portal.Portal, null, /*#__PURE__*/_react["default"].createElement(_TooltipStyle.StyledTooltip, {
|
|
172
174
|
"data-position": position,
|
|
173
|
-
className:
|
|
175
|
+
className: (0, _classnames["default"])({
|
|
176
|
+
'closed-animation': animate
|
|
177
|
+
}, tooltipClassName),
|
|
174
178
|
ref: tooltipRef,
|
|
175
179
|
zIndex: zIndex,
|
|
176
180
|
style: {
|