glints-aries 4.0.349 → 4.0.350
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const allPositions: readonly ["top-center", "top-left", "top-right", "bottom-center", "bottom-left", "bottom-right", "right-middle", "right-top", "right-bottom", "left-middle", "left-top", "left-bottom"];
|
|
3
3
|
export declare type TooltipPosition = (typeof allPositions)[number];
|
|
4
|
-
export
|
|
4
|
+
export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
preferredPosition?: TooltipPosition;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
content: React.ReactNode;
|
|
@@ -12,6 +12,6 @@ export declare type TooltipProps = {
|
|
|
12
12
|
timeout?: number;
|
|
13
13
|
/** if clickable it true, onClick will be called when tooltip is clicked */
|
|
14
14
|
onClick?: () => void;
|
|
15
|
-
}
|
|
16
|
-
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, }: TooltipProps) => JSX.Element;
|
|
15
|
+
}
|
|
16
|
+
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, ...props }: TooltipProps) => JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
+
var _excluded = ["children", "content", "preferredPosition", "zIndex", "clickable", "timeout", "onClick"];
|
|
1
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
5
|
import { Portal } from '../Portal/Portal';
|
|
3
6
|
import { Typography } from '../Typography';
|
|
@@ -58,7 +61,8 @@ export var Tooltip = function Tooltip(_ref) {
|
|
|
58
61
|
clickable = _ref$clickable === void 0 ? false : _ref$clickable,
|
|
59
62
|
_ref$timeout = _ref.timeout,
|
|
60
63
|
timeout = _ref$timeout === void 0 ? 0 : _ref$timeout,
|
|
61
|
-
onClick = _ref.onClick
|
|
64
|
+
onClick = _ref.onClick,
|
|
65
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
62
66
|
var tooltipRef = useRef(null);
|
|
63
67
|
var elRef = useRef(null);
|
|
64
68
|
var tooltipPositionsHandlerRef = useRef(null);
|
|
@@ -152,12 +156,12 @@ export var Tooltip = function Tooltip(_ref) {
|
|
|
152
156
|
}, 370); // animation is 400ms, make this slightly lower to prevent visual glitch
|
|
153
157
|
}, timeout);
|
|
154
158
|
};
|
|
155
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledTooltipContainer, {
|
|
159
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledTooltipContainer, _extends({
|
|
156
160
|
ref: elRef,
|
|
157
161
|
onMouseEnter: handleMouseEnter,
|
|
158
162
|
onMouseLeave: handleMouseLeave,
|
|
159
163
|
onClick: handleClick
|
|
160
|
-
}, children), isActive && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(StyledTooltip, {
|
|
164
|
+
}, props), children), isActive && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(StyledTooltip, {
|
|
161
165
|
"data-position": position,
|
|
162
166
|
className: animate ? 'closed-animation' : '',
|
|
163
167
|
ref: tooltipRef,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const allPositions: readonly ["top-center", "top-left", "top-right", "bottom-center", "bottom-left", "bottom-right", "right-middle", "right-top", "right-bottom", "left-middle", "left-top", "left-bottom"];
|
|
3
3
|
export declare type TooltipPosition = (typeof allPositions)[number];
|
|
4
|
-
export
|
|
4
|
+
export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
preferredPosition?: TooltipPosition;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
content: React.ReactNode;
|
|
@@ -12,6 +12,6 @@ export declare type TooltipProps = {
|
|
|
12
12
|
timeout?: number;
|
|
13
13
|
/** if clickable it true, onClick will be called when tooltip is clicked */
|
|
14
14
|
onClick?: () => void;
|
|
15
|
-
}
|
|
16
|
-
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, }: TooltipProps) => JSX.Element;
|
|
15
|
+
}
|
|
16
|
+
export declare const Tooltip: ({ children, content, preferredPosition, zIndex, clickable, timeout, onClick, ...props }: TooltipProps) => JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
exports.__esModule = true;
|
|
4
5
|
exports.Tooltip = void 0;
|
|
6
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
5
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
6
9
|
var _Portal = require("../Portal/Portal");
|
|
7
10
|
var _Typography = require("../Typography");
|
|
8
11
|
var _positionResolver = require("./positionResolver");
|
|
9
12
|
var _positionResolverHelper = require("./positionResolverHelper");
|
|
10
13
|
var _TooltipStyle = require("./TooltipStyle");
|
|
14
|
+
var _excluded = ["children", "content", "preferredPosition", "zIndex", "clickable", "timeout", "onClick"];
|
|
11
15
|
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); }
|
|
12
16
|
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; }
|
|
13
17
|
var topPositions = ['top-center', 'top-left', 'top-right'];
|
|
@@ -64,7 +68,8 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
64
68
|
clickable = _ref$clickable === void 0 ? false : _ref$clickable,
|
|
65
69
|
_ref$timeout = _ref.timeout,
|
|
66
70
|
timeout = _ref$timeout === void 0 ? 0 : _ref$timeout,
|
|
67
|
-
onClick = _ref.onClick
|
|
71
|
+
onClick = _ref.onClick,
|
|
72
|
+
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
68
73
|
var tooltipRef = (0, _react.useRef)(null);
|
|
69
74
|
var elRef = (0, _react.useRef)(null);
|
|
70
75
|
var tooltipPositionsHandlerRef = (0, _react.useRef)(null);
|
|
@@ -158,12 +163,12 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
158
163
|
}, 370); // animation is 400ms, make this slightly lower to prevent visual glitch
|
|
159
164
|
}, timeout);
|
|
160
165
|
};
|
|
161
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_TooltipStyle.StyledTooltipContainer, {
|
|
166
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_TooltipStyle.StyledTooltipContainer, (0, _extends2["default"])({
|
|
162
167
|
ref: elRef,
|
|
163
168
|
onMouseEnter: handleMouseEnter,
|
|
164
169
|
onMouseLeave: handleMouseLeave,
|
|
165
170
|
onClick: handleClick
|
|
166
|
-
}, children), isActive && /*#__PURE__*/_react["default"].createElement(_Portal.Portal, null, /*#__PURE__*/_react["default"].createElement(_TooltipStyle.StyledTooltip, {
|
|
171
|
+
}, props), children), isActive && /*#__PURE__*/_react["default"].createElement(_Portal.Portal, null, /*#__PURE__*/_react["default"].createElement(_TooltipStyle.StyledTooltip, {
|
|
167
172
|
"data-position": position,
|
|
168
173
|
className: animate ? 'closed-animation' : '',
|
|
169
174
|
ref: tooltipRef,
|