@synerise/ds-tooltip 0.16.3 → 1.1.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
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
+ # [1.1.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-tooltip@1.0.0...@synerise/ds-tooltip@1.1.0) (2025-03-18)
7
+
8
+
9
+ ### Features
10
+
11
+ * **button:** add support for tag in button ([32b6956](https://github.com/synerise/synerise-design/commit/32b6956d5e1f46df03abb4de8fbaf0a7d487043e))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.16.3](https://github.com/synerise/synerise-design/compare/@synerise/ds-tooltip@0.16.2...@synerise/ds-tooltip@0.16.3) (2025-03-10)
7
18
 
8
19
  **Note:** Version bump only for package @synerise/ds-tooltip
package/README.md CHANGED
@@ -16,7 +16,7 @@ Tooltip UI Component
16
16
  | align | this value will be merged into placement's config, please refer to the settings rc-tooltip | Object | - |
17
17
  | arrowPointAtCenter | Whether the arrow is pointed at the center of target, supported after `antd@1.11+` | boolean | `false` |
18
18
  | autoAdjustOverflow | Whether to adjust popup placement automatically when popup is off screen | boolean | `true` |
19
- | button | Settings of button displayed in tooltip | ButtonSettings | - |
19
+ | button | Button to display in tooltip footer | ReactNode | - |
20
20
  | defaultVisible | Whether the floating tooltip card is visible by default | boolean | `false` |
21
21
  | description | tooltip description text | ReactNode | - |
22
22
  | image | iamge to be rendered above the description | ReactNode | - |
package/dist/Tooltip.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import React from 'react';
1
2
  import '@synerise/ds-core/dist/js/style';
2
3
  import './style/index.less';
3
- import React from 'react';
4
4
  import { TooltipProps } from './Tooltip.types';
5
- declare const Tooltip: ({ type, icon, title, status, description, tutorials, tutorialAutoplay, tutorialAutoplaySpeed, timeToHideAfterClick, offset, children, button, render, image, ...props }: TooltipProps) => React.JSX.Element;
5
+ declare const Tooltip: ({ type, icon, title, shortCuts, status, description, tutorials, tutorialAutoplay, tutorialAutoplaySpeed, timeToHideAfterClick, offset, children, button, render, image, ...props }: TooltipProps) => React.JSX.Element;
6
6
  export default Tooltip;
package/dist/Tooltip.js CHANGED
@@ -1,14 +1,13 @@
1
- var _excluded = ["type", "icon", "title", "status", "description", "tutorials", "tutorialAutoplay", "tutorialAutoplaySpeed", "timeToHideAfterClick", "offset", "children", "button", "render", "image"];
1
+ var _excluded = ["type", "icon", "title", "shortCuts", "status", "description", "tutorials", "tutorialAutoplay", "tutorialAutoplaySpeed", "timeToHideAfterClick", "offset", "children", "button", "render", "image"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
+ import React, { useRef, useState, useMemo, useEffect } from 'react';
4
5
  import '@synerise/ds-core/dist/js/style';
5
6
  import "./style/index.css";
6
7
  import AntdTooltip from 'antd/lib/tooltip';
7
- import React, { useRef, useState, useMemo, useEffect } from 'react';
8
8
  import { Carousel } from 'antd';
9
9
  import { getPopupContainer } from '@synerise/ds-utils';
10
10
  import Icon, { NotificationsM } from '@synerise/ds-icon';
11
- import Button from '@synerise/ds-button';
12
11
  import { theme } from '@synerise/ds-core';
13
12
  import Scrollbar from '@synerise/ds-scrollbar';
14
13
  import * as S from './Tooltip.styles';
@@ -28,6 +27,7 @@ var Tooltip = function Tooltip(_ref) {
28
27
  type = _ref$type === void 0 ? 'default' : _ref$type,
29
28
  icon = _ref.icon,
30
29
  title = _ref.title,
30
+ shortCuts = _ref.shortCuts,
31
31
  status = _ref.status,
32
32
  description = _ref.description,
33
33
  tutorials = _ref.tutorials,
@@ -48,22 +48,6 @@ var Tooltip = function Tooltip(_ref) {
48
48
  isVisible = _useState[0],
49
49
  setIsVisible = _useState[1];
50
50
  var timeoutClickRef = useRef(null);
51
- var renderButton = useMemo(function () {
52
- var _ref2 = button || {},
53
- buttonIcon = _ref2.buttonIcon,
54
- label = _ref2.label,
55
- onClick = _ref2.onClick;
56
- var buttonMode = function buttonMode() {
57
- if (buttonIcon && label) return 'icon-label';
58
- if (buttonIcon) return 'single-icon';
59
- return 'label';
60
- };
61
- return button ? /*#__PURE__*/React.createElement(S.TooltipButton, null, /*#__PURE__*/React.createElement(Button, {
62
- type: "ghost-white",
63
- mode: buttonMode(),
64
- onClick: onClick
65
- }, buttonIcon, label)) : /*#__PURE__*/React.createElement(React.Fragment, null);
66
- }, [button]);
67
51
  var captureClick = function captureClick(event) {
68
52
  event.stopPropagation();
69
53
  };
@@ -73,7 +57,13 @@ var Tooltip = function Tooltip(_ref) {
73
57
  tooltipType: type
74
58
  }, /*#__PURE__*/React.createElement(S.TooltipContent, null, status && /*#__PURE__*/React.createElement(S.TooltipStatus, null, status), title && /*#__PURE__*/React.createElement(S.TooltipTitle, {
75
59
  tooltipType: type
76
- }, shouldRenderIcon(type, icon), /*#__PURE__*/React.createElement(S.TooltipTitleWrapper, null, title)), image && /*#__PURE__*/React.createElement(S.TooltipImage, {
60
+ }, shouldRenderIcon(type, icon), /*#__PURE__*/React.createElement(S.TooltipTitleWrapper, null, title), shortCuts && /*#__PURE__*/React.createElement(S.TooltipHint, null, Array.isArray(shortCuts) ?
61
+ // eslint-disable-next-line react/no-array-index-key
62
+ shortCuts.map(function (hint, index) {
63
+ return /*#__PURE__*/React.createElement(S.TooltipKey, {
64
+ key: "key-" + index
65
+ }, hint);
66
+ }) : /*#__PURE__*/React.createElement(S.TooltipKey, null, shortCuts))), image && /*#__PURE__*/React.createElement(S.TooltipImage, {
77
67
  extraMargin: !!finalDescription
78
68
  }, image), finalDescription && /*#__PURE__*/React.createElement(S.TooltipDescription, {
79
69
  tooltipType: type
@@ -83,7 +73,7 @@ var Tooltip = function Tooltip(_ref) {
83
73
  style: {
84
74
  paddingRight: 16
85
75
  }
86
- }, /*#__PURE__*/React.createElement(React.Fragment, null, finalDescription)) : finalDescription)), renderButton);
76
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, finalDescription)) : finalDescription)), button && /*#__PURE__*/React.createElement(S.TooltipButton, null, button));
87
77
  var tutorialComponent = /*#__PURE__*/React.createElement(S.TooltipComponent, {
88
78
  onClick: captureClick,
89
79
  tooltipType: type
@@ -6,6 +6,8 @@ export declare const TooltipTitle: import("styled-components").StyledComponent<"
6
6
  tooltipType: tooltipTypes;
7
7
  }, never>;
8
8
  export declare const TooltipTitleWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
9
+ export declare const TooltipHint: import("styled-components").StyledComponent<"div", any, {}, never>;
10
+ export declare const TooltipKey: import("styled-components").StyledComponent<"div", any, {}, never>;
9
11
  export declare const TooltipButton: import("styled-components").StyledComponent<"div", any, {}, never>;
10
12
  export declare const TooltipContent: import("styled-components").StyledComponent<"div", any, {}, never>;
11
13
  export declare const TooltipStatus: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -19,27 +19,39 @@ export var TooltipTitleWrapper = styled.div.withConfig({
19
19
  displayName: "Tooltipstyles__TooltipTitleWrapper",
20
20
  componentId: "sc-mghjny-2"
21
21
  })(["min-width:0;width:max-content;overflow-wrap:break-word;"]);
22
+ export var TooltipHint = styled.div.withConfig({
23
+ displayName: "Tooltipstyles__TooltipHint",
24
+ componentId: "sc-mghjny-3"
25
+ })(["margin-left:8px;margin-right:-4px;display:flex;gap:4px;"]);
26
+ export var TooltipKey = styled.div.withConfig({
27
+ displayName: "Tooltipstyles__TooltipKey",
28
+ componentId: "sc-mghjny-4"
29
+ })(["display:flex;flex-direction:column;justify-content:center;align-items:center;min-width:18px;height:18px;padding:0 4px;background:", ";border-bottom:1px solid ", ";box-shadow:0px 1px 8px rgba(35,41,54,0.5);border-radius:3px;"], function (props) {
30
+ return props.theme.palette['grey-700'];
31
+ }, function (props) {
32
+ return props.theme.palette['grey-500'];
33
+ });
22
34
  export var TooltipButton = styled.div.withConfig({
23
35
  displayName: "Tooltipstyles__TooltipButton",
24
- componentId: "sc-mghjny-3"
36
+ componentId: "sc-mghjny-5"
25
37
  })(["width:100%;padding:8px;background-color:rgba(56,67,80,0.9);display:flex;flex-direction:row;align-items:center;justify-content:flex-end;"]);
26
38
  export var TooltipContent = styled.div.withConfig({
27
39
  displayName: "Tooltipstyles__TooltipContent",
28
- componentId: "sc-mghjny-4"
40
+ componentId: "sc-mghjny-6"
29
41
  })(["width:100%;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:4px;"]);
30
42
  export var TooltipStatus = styled.div.withConfig({
31
43
  displayName: "Tooltipstyles__TooltipStatus",
32
- componentId: "sc-mghjny-5"
44
+ componentId: "sc-mghjny-7"
33
45
  })(["padding-bottom:2px;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;"]);
34
46
  export var TooltipImage = styled.div.withConfig({
35
47
  displayName: "Tooltipstyles__TooltipImage",
36
- componentId: "sc-mghjny-6"
48
+ componentId: "sc-mghjny-8"
37
49
  })(["display:flex;align-items:center;flex-direction:column;", " img,video{max-width:100%;}"], function (props) {
38
50
  return props.extraMargin && 'margin-bottom: 4px;';
39
51
  });
40
52
  export var TooltipComponent = styled.div.withConfig({
41
53
  displayName: "Tooltipstyles__TooltipComponent",
42
- componentId: "sc-mghjny-7"
54
+ componentId: "sc-mghjny-9"
43
55
  })(["background-color:rgba(56,67,80,0.9);min-height:24px;width:100%;border-radius:3px;color:", ";overflow:hidden;text-align:left;", "{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;", "}.ant-carousel{position:relative;width:100%;.slick-track{width:100%;}.slick-dots-bottom{position:relative;bottom:0;height:32px;padding:0 18px;display:flex;flex-direction:row;align-items:center;justify-content:flex-start;margin:0;background-color:rgba(56,67,80,0.9);li{width:8px;height:8px;border-radius:50%;background-color:rgba(56,67,80,0.9);margin:0 8px 0 0;display:flex;align-items:center;justify-content:center;button{box-sizing:content-box;background-color:", ";border:2px solid rgba(56,67,80,0.9);height:4px;width:4px;border-radius:50%;opacity:1;}}li.slick-active{button{border:2px solid ", ";background-color:", ";}}}}"], function (props) {
44
56
  return props.theme.palette['grey-200'];
45
57
  }, TooltipContent, function (props) {
@@ -72,7 +84,7 @@ export var TooltipComponent = styled.div.withConfig({
72
84
  });
73
85
  export var TutorialItem = styled.div.withConfig({
74
86
  displayName: "Tooltipstyles__TutorialItem",
75
- componentId: "sc-mghjny-8"
87
+ componentId: "sc-mghjny-10"
76
88
  })(["padding:16px;color:", ";"], function (props) {
77
89
  return props.theme.palette.white;
78
90
  });
@@ -6,11 +6,12 @@ export type Tutorial = {
6
6
  title: ReactNode;
7
7
  description: ReactNode;
8
8
  };
9
- export default interface TooltipExtendedProps {
9
+ export type TooltipExtendedProps = {
10
10
  type?: tooltipTypes;
11
11
  icon?: ReactNode;
12
12
  status?: ReactNode;
13
13
  title?: ReactNode;
14
+ shortCuts?: ReactNode | ReactNode[];
14
15
  image?: ReactNode;
15
16
  description?: descriptionType;
16
17
  tutorials?: Tutorial[];
@@ -18,11 +19,8 @@ export default interface TooltipExtendedProps {
18
19
  tutorialAutoplaySpeed?: number;
19
20
  timeToHideAfterClick?: number;
20
21
  offset?: 'default' | 'small';
21
- button?: {
22
- label?: ReactNode;
23
- buttonIcon?: ReactNode;
24
- onClick: () => void;
25
- };
22
+ button?: ReactNode;
26
23
  render?: () => ReactNode;
27
- }
24
+ };
25
+ export default TooltipExtendedProps;
28
26
  export type TooltipProps = Omit<TooltipPropsWithTitle, 'title'> & TooltipExtendedProps;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-tooltip",
3
- "version": "0.16.3",
3
+ "version": "1.1.0",
4
4
  "description": "Tooltip UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -34,10 +34,9 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@synerise/ds-button": "^0.23.4",
38
- "@synerise/ds-icon": "^0.72.1",
39
- "@synerise/ds-scrollbar": "^0.12.7",
40
- "@synerise/ds-utils": "^0.32.3"
37
+ "@synerise/ds-icon": "^1.0.1",
38
+ "@synerise/ds-scrollbar": "^1.0.1",
39
+ "@synerise/ds-utils": "^1.0.1"
41
40
  },
42
41
  "peerDependencies": {
43
42
  "@synerise/ds-core": "*",
@@ -45,5 +44,5 @@
45
44
  "react": ">=16.9.0 <= 18.3.1",
46
45
  "styled-components": "^5.3.3"
47
46
  },
48
- "gitHead": "a176b46dab123cd503247ae57022f8e808772d68"
47
+ "gitHead": "218110f61f4371bc04d793b2b976b71d14e99e76"
49
48
  }