@synerise/ds-tooltip 0.14.4 → 0.14.6
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/CHANGELOG.md +16 -0
- package/dist/Tooltip.d.ts +1 -2
- package/dist/Tooltip.js +35 -28
- package/dist/Tooltip.styles.d.ts +3 -3
- package/dist/Tooltip.types.d.ts +4 -4
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.14.6](https://github.com/synerise/synerise-design/compare/@synerise/ds-tooltip@0.14.5...@synerise/ds-tooltip@0.14.6) (2023-10-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-tooltip
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.14.5](https://github.com/synerise/synerise-design/compare/@synerise/ds-tooltip@0.14.4...@synerise/ds-tooltip@0.14.5) (2023-10-02)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @synerise/ds-tooltip
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.14.4](https://github.com/synerise/synerise-design/compare/@synerise/ds-tooltip@0.14.3...@synerise/ds-tooltip@0.14.4) (2023-09-26)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @synerise/ds-tooltip
|
package/dist/Tooltip.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import '@synerise/ds-core/dist/js/style';
|
|
2
2
|
import './style/index.less';
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
import { TooltipProps } from './Tooltip.types';
|
|
5
|
-
declare const Tooltip:
|
|
4
|
+
declare const Tooltip: ({ type, icon, title, status, description, tutorials, tutorialAutoplay, tutorialAutoplaySpeed, timeToHideAfterClick, offset, children, button, render, ...props }: TooltipProps) => JSX.Element;
|
|
6
5
|
export default Tooltip;
|
package/dist/Tooltip.js
CHANGED
|
@@ -7,7 +7,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
7
7
|
import '@synerise/ds-core/dist/js/style';
|
|
8
8
|
import "./style/index.css";
|
|
9
9
|
import AntdTooltip from 'antd/lib/tooltip';
|
|
10
|
-
import
|
|
10
|
+
import React, { useRef, useState, useMemo, useEffect } from 'react';
|
|
11
11
|
import { Carousel } from 'antd';
|
|
12
12
|
import { getPopupContainer } from '@synerise/ds-utils';
|
|
13
13
|
import Icon, { NotificationsM } from '@synerise/ds-icon';
|
|
@@ -51,11 +51,11 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51
51
|
render = _ref.render,
|
|
52
52
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
53
53
|
|
|
54
|
-
var
|
|
55
|
-
isVisible =
|
|
56
|
-
setIsVisible =
|
|
54
|
+
var _useState = useState(false),
|
|
55
|
+
isVisible = _useState[0],
|
|
56
|
+
setIsVisible = _useState[1];
|
|
57
57
|
|
|
58
|
-
var timeoutClickRef =
|
|
58
|
+
var timeoutClickRef = useRef(null);
|
|
59
59
|
|
|
60
60
|
var shouldRenderIcon = function shouldRenderIcon(tooltipType, tooltipIcon) {
|
|
61
61
|
if (tooltipType !== 'icon') return null;
|
|
@@ -66,9 +66,8 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
var renderButton =
|
|
69
|
+
var renderButton = useMemo(function () {
|
|
70
70
|
var buttonMode = function buttonMode() {
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
72
71
|
// @ts-ignore
|
|
73
72
|
var buttonIcon = button.buttonIcon,
|
|
74
73
|
label = button.label;
|
|
@@ -83,7 +82,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
83
82
|
onClick: button == null ? void 0 : button.onClick
|
|
84
83
|
}, button == null ? void 0 : button.buttonIcon, button == null ? void 0 : button.label)) : /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
85
84
|
}, [button]);
|
|
86
|
-
var
|
|
85
|
+
var tooltipComponent = /*#__PURE__*/React.createElement(S.TooltipComponent, {
|
|
87
86
|
tooltipType: type
|
|
88
87
|
}, /*#__PURE__*/React.createElement(S.TooltipContent, null, /*#__PURE__*/React.createElement(S.TooltipStatus, {
|
|
89
88
|
tooltipType: type
|
|
@@ -98,18 +97,16 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
98
97
|
paddingRight: 16
|
|
99
98
|
}
|
|
100
99
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, shouldRenderDescription(description, type))), type !== 'largeScrollable' && shouldRenderDescription(description, type))), renderButton);
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}, [type, title, description, status, renderButton]);
|
|
112
|
-
var renderTutorialComponent = /*#__PURE__*/React.createElement(S.TooltipComponent, {
|
|
100
|
+
var buttonComponent = /*#__PURE__*/React.createElement(S.TooltipComponent, {
|
|
101
|
+
tooltipType: type
|
|
102
|
+
}, /*#__PURE__*/React.createElement(S.TooltipContent, null, /*#__PURE__*/React.createElement(S.TooltipStatus, {
|
|
103
|
+
tooltipType: type
|
|
104
|
+
}, status), /*#__PURE__*/React.createElement(S.TooltipTitle, {
|
|
105
|
+
tooltipType: type
|
|
106
|
+
}, title), /*#__PURE__*/React.createElement(S.TooltipDescription, {
|
|
107
|
+
tooltipType: type
|
|
108
|
+
}, description)), renderButton);
|
|
109
|
+
var tutorialComponent = /*#__PURE__*/React.createElement(S.TooltipComponent, {
|
|
113
110
|
tooltipType: type
|
|
114
111
|
}, /*#__PURE__*/React.createElement(Carousel, {
|
|
115
112
|
autoplay: tutorialAutoplay,
|
|
@@ -124,16 +121,26 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
124
121
|
tooltipType: "tutorial"
|
|
125
122
|
}, tutorial.description));
|
|
126
123
|
})));
|
|
127
|
-
var
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
var component;
|
|
125
|
+
|
|
126
|
+
switch (type) {
|
|
127
|
+
case 'tutorial':
|
|
128
|
+
component = tutorialComponent;
|
|
129
|
+
break;
|
|
130
|
+
|
|
131
|
+
case 'button':
|
|
132
|
+
component = buttonComponent;
|
|
133
|
+
break;
|
|
134
|
+
|
|
135
|
+
default:
|
|
136
|
+
component = tooltipComponent;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
var overlayClassName = useMemo(function () {
|
|
133
140
|
return "ds-tooltip-offset-" + offset + " ds-tooltip-type-" + type;
|
|
134
141
|
}, [offset, type]);
|
|
135
142
|
var titleExists = Boolean(description || title || icon || (tutorials == null ? void 0 : tutorials.length));
|
|
136
|
-
|
|
143
|
+
useEffect(function () {
|
|
137
144
|
return function () {
|
|
138
145
|
timeoutClickRef.current && clearTimeout(timeoutClickRef.current);
|
|
139
146
|
};
|
|
@@ -175,7 +182,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
175
182
|
return titleExists ? /*#__PURE__*/React.createElement(AntdTooltip, _extends({
|
|
176
183
|
overlayClassName: overlayClassName,
|
|
177
184
|
autoAdjustOverflow: false,
|
|
178
|
-
title:
|
|
185
|
+
title: component,
|
|
179
186
|
align: {
|
|
180
187
|
offset: [0, 0]
|
|
181
188
|
},
|
package/dist/Tooltip.styles.d.ts
CHANGED
|
@@ -2,15 +2,15 @@ import TooltipExtendedProps, { tooltipTypes } from './Tooltip.types';
|
|
|
2
2
|
export declare const TooltipDescription: import("styled-components").StyledComponent<"div", any, TooltipExtendedProps & {
|
|
3
3
|
tooltipType: tooltipTypes;
|
|
4
4
|
}, never>;
|
|
5
|
-
export declare const TooltipTitle: import("styled-components").StyledComponent<"div", any,
|
|
5
|
+
export declare const TooltipTitle: import("styled-components").StyledComponent<"div", any, Omit<TooltipExtendedProps, "type"> & {
|
|
6
6
|
tooltipType: tooltipTypes;
|
|
7
7
|
}, never>;
|
|
8
8
|
export declare const TooltipButton: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
9
|
export declare const TooltipContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
-
export declare const TooltipStatus: import("styled-components").StyledComponent<"div", any,
|
|
10
|
+
export declare const TooltipStatus: import("styled-components").StyledComponent<"div", any, Omit<TooltipExtendedProps, "type"> & {
|
|
11
11
|
tooltipType: tooltipTypes;
|
|
12
12
|
}, never>;
|
|
13
|
-
export declare const TooltipComponent: import("styled-components").StyledComponent<"div", any,
|
|
13
|
+
export declare const TooltipComponent: import("styled-components").StyledComponent<"div", any, Omit<TooltipExtendedProps, "type"> & {
|
|
14
14
|
tooltipType: tooltipTypes;
|
|
15
15
|
}, never>;
|
|
16
16
|
export declare const TutorialItem: import("styled-components").StyledComponent<"div", any, TooltipExtendedProps, never>;
|
package/dist/Tooltip.types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { TooltipPropsWithTitle } from 'antd/lib/tooltip';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type tooltipTypes = 'default' | 'icon' | 'largeSimple' | 'largeScrollable' | 'tutorial' | 'avatar' | 'button' | 'header-label' | 'status';
|
|
4
|
+
export type descriptionType = ReactNode;
|
|
5
|
+
export type Tutorial = {
|
|
6
6
|
title: ReactNode;
|
|
7
7
|
description: ReactNode;
|
|
8
8
|
};
|
|
@@ -24,4 +24,4 @@ export default interface TooltipExtendedProps {
|
|
|
24
24
|
};
|
|
25
25
|
render?: () => ReactNode;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export type TooltipProps = Omit<TooltipPropsWithTitle, 'title'> & TooltipExtendedProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-tooltip",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.6",
|
|
4
4
|
"description": "Tooltip UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"build:js": "babel --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
22
|
"build:watch": "npm run build:js -- --watch",
|
|
23
23
|
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
|
+
"pack:ci": "npm pack --pack-destination ../../portal/storybook-static/static",
|
|
24
25
|
"prepublish": "npm run build",
|
|
25
26
|
"test": "jest",
|
|
26
27
|
"test:watch": "npm run test -- --watchAll",
|
|
@@ -32,9 +33,9 @@
|
|
|
32
33
|
],
|
|
33
34
|
"types": "dist/index.d.ts",
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@synerise/ds-button": "^0.18.
|
|
36
|
-
"@synerise/ds-icon": "^0.58.
|
|
37
|
-
"@synerise/ds-scrollbar": "^0.6.
|
|
36
|
+
"@synerise/ds-button": "^0.18.4",
|
|
37
|
+
"@synerise/ds-icon": "^0.58.4",
|
|
38
|
+
"@synerise/ds-scrollbar": "^0.6.9"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"@synerise/ds-core": "*",
|
|
@@ -43,8 +44,8 @@
|
|
|
43
44
|
"styled-components": "5.0.1"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@synerise/ds-utils": "^0.24.
|
|
47
|
+
"@synerise/ds-utils": "^0.24.18",
|
|
47
48
|
"@testing-library/react": "10.0.1"
|
|
48
49
|
},
|
|
49
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "8eb4a3e304406a8dbb9258803c48952461fc5a55"
|
|
50
51
|
}
|