@synerise/ds-tooltip 0.14.49 → 0.14.50

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,14 @@
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.50](https://github.com/synerise/synerise-design/compare/@synerise/ds-tooltip@0.14.49...@synerise/ds-tooltip@0.14.50) (2024-11-28)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-tooltip
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.14.49](https://github.com/synerise/synerise-design/compare/@synerise/ds-tooltip@0.14.48...@synerise/ds-tooltip@0.14.49) (2024-11-21)
7
15
 
8
16
  **Note:** Version bump only for package @synerise/ds-tooltip
@@ -1,10 +1,8 @@
1
1
  import React from 'react';
2
2
  import Tooltip from './Tooltip';
3
-
4
3
  var TooltipExample = function TooltipExample() {
5
4
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tooltip, {
6
5
  title: "lool"
7
6
  }));
8
7
  };
9
-
10
8
  export default TooltipExample;
package/dist/Tooltip.js CHANGED
@@ -1,9 +1,6 @@
1
1
  var _excluded = ["type", "icon", "title", "status", "description", "tutorials", "tutorialAutoplay", "tutorialAutoplaySpeed", "timeToHideAfterClick", "offset", "children", "button", "render"];
2
-
3
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); }
4
-
5
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; }
6
-
7
4
  import '@synerise/ds-core/dist/js/style';
8
5
  import "./style/index.css";
9
6
  import AntdTooltip from 'antd/lib/tooltip';
@@ -15,48 +12,41 @@ import Button from '@synerise/ds-button';
15
12
  import { theme } from '@synerise/ds-core';
16
13
  import Scrollbar from '@synerise/ds-scrollbar';
17
14
  import * as S from './Tooltip.styles';
18
-
19
15
  var shouldRenderDescription = function shouldRenderDescription(description, type) {
20
16
  if (type === 'default' || !description) return null;
21
17
  return description;
22
18
  };
23
-
24
19
  var shouldRenderTitle = function shouldRenderTitle(type, title) {
25
20
  return type !== 'largeSimple' ? title : null;
26
21
  };
27
-
28
22
  var shouldRenderStatus = function shouldRenderStatus(status, type) {
29
23
  if (type === 'status' || status) return status;
30
24
  return null;
31
25
  };
32
-
33
26
  var Tooltip = function Tooltip(_ref) {
34
27
  var _ref$type = _ref.type,
35
- type = _ref$type === void 0 ? 'default' : _ref$type,
36
- icon = _ref.icon,
37
- title = _ref.title,
38
- status = _ref.status,
39
- description = _ref.description,
40
- tutorials = _ref.tutorials,
41
- _ref$tutorialAutoplay = _ref.tutorialAutoplay,
42
- tutorialAutoplay = _ref$tutorialAutoplay === void 0 ? false : _ref$tutorialAutoplay,
43
- _ref$tutorialAutoplay2 = _ref.tutorialAutoplaySpeed,
44
- tutorialAutoplaySpeed = _ref$tutorialAutoplay2 === void 0 ? 5000 : _ref$tutorialAutoplay2,
45
- _ref$timeToHideAfterC = _ref.timeToHideAfterClick,
46
- timeToHideAfterClick = _ref$timeToHideAfterC === void 0 ? 0 : _ref$timeToHideAfterC,
47
- _ref$offset = _ref.offset,
48
- offset = _ref$offset === void 0 ? 'default' : _ref$offset,
49
- children = _ref.children,
50
- button = _ref.button,
51
- render = _ref.render,
52
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
53
-
28
+ type = _ref$type === void 0 ? 'default' : _ref$type,
29
+ icon = _ref.icon,
30
+ title = _ref.title,
31
+ status = _ref.status,
32
+ description = _ref.description,
33
+ tutorials = _ref.tutorials,
34
+ _ref$tutorialAutoplay = _ref.tutorialAutoplay,
35
+ tutorialAutoplay = _ref$tutorialAutoplay === void 0 ? false : _ref$tutorialAutoplay,
36
+ _ref$tutorialAutoplay2 = _ref.tutorialAutoplaySpeed,
37
+ tutorialAutoplaySpeed = _ref$tutorialAutoplay2 === void 0 ? 5000 : _ref$tutorialAutoplay2,
38
+ _ref$timeToHideAfterC = _ref.timeToHideAfterClick,
39
+ timeToHideAfterClick = _ref$timeToHideAfterC === void 0 ? 0 : _ref$timeToHideAfterC,
40
+ _ref$offset = _ref.offset,
41
+ offset = _ref$offset === void 0 ? 'default' : _ref$offset,
42
+ children = _ref.children,
43
+ button = _ref.button,
44
+ render = _ref.render,
45
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
54
46
  var _useState = useState(false),
55
- isVisible = _useState[0],
56
- setIsVisible = _useState[1];
57
-
47
+ isVisible = _useState[0],
48
+ setIsVisible = _useState[1];
58
49
  var timeoutClickRef = useRef(null);
59
-
60
50
  var shouldRenderIcon = function shouldRenderIcon(tooltipType, tooltipIcon) {
61
51
  if (tooltipType !== 'icon') return null;
62
52
  if (tooltipIcon && icon) return icon;
@@ -65,28 +55,24 @@ var Tooltip = function Tooltip(_ref) {
65
55
  color: theme.palette['orange-500']
66
56
  });
67
57
  };
68
-
69
58
  var renderButton = useMemo(function () {
70
59
  var buttonMode = function buttonMode() {
71
60
  // @ts-ignore
72
61
  var buttonIcon = button.buttonIcon,
73
- label = button.label;
62
+ label = button.label;
74
63
  if (buttonIcon && label) return 'icon-label';
75
64
  if (buttonIcon) return 'single-icon';
76
65
  return 'label';
77
66
  };
78
-
79
67
  return button ? /*#__PURE__*/React.createElement(S.TooltipButton, null, /*#__PURE__*/React.createElement(Button, {
80
68
  type: "ghost-white",
81
69
  mode: buttonMode(),
82
70
  onClick: button == null ? void 0 : button.onClick
83
71
  }, button == null ? void 0 : button.buttonIcon, button == null ? void 0 : button.label)) : /*#__PURE__*/React.createElement(React.Fragment, null);
84
72
  }, [button]);
85
-
86
73
  var captureClick = function captureClick(event) {
87
74
  event.stopPropagation();
88
75
  };
89
-
90
76
  var tooltipComponent = /*#__PURE__*/React.createElement(S.TooltipComponent, {
91
77
  onClick: captureClick,
92
78
  tooltipType: type
@@ -130,20 +116,16 @@ var Tooltip = function Tooltip(_ref) {
130
116
  }, tutorial.description));
131
117
  })));
132
118
  var component;
133
-
134
119
  switch (type) {
135
120
  case 'tutorial':
136
121
  component = tutorialComponent;
137
122
  break;
138
-
139
123
  case 'button':
140
124
  component = buttonComponent;
141
125
  break;
142
-
143
126
  default:
144
127
  component = tooltipComponent;
145
128
  }
146
-
147
129
  var overlayClassName = useMemo(function () {
148
130
  return "ds-tooltip-offset-" + offset + " ds-tooltip-type-" + type;
149
131
  }, [offset, type]);
@@ -153,7 +135,6 @@ var Tooltip = function Tooltip(_ref) {
153
135
  timeoutClickRef.current && clearTimeout(timeoutClickRef.current);
154
136
  };
155
137
  }, []);
156
-
157
138
  var handleOnClickHideDelay = function handleOnClickHideDelay(visible) {
158
139
  if (!visible) {
159
140
  timeoutClickRef.current && clearTimeout(timeoutClickRef.current);
@@ -165,16 +146,14 @@ var Tooltip = function Tooltip(_ref) {
165
146
  }, timeToHideAfterClick);
166
147
  }
167
148
  };
168
- /* eslint-disable-next-line react/destructuring-assignment */
169
-
170
149
 
150
+ /* eslint-disable-next-line react/destructuring-assignment */
171
151
  var handleHideAfterClick = props.trigger === 'click' && timeToHideAfterClick && {
172
152
  visible: isVisible,
173
153
  onVisibleChange: function onVisibleChange(visible) {
174
154
  handleOnClickHideDelay(visible);
175
155
  }
176
156
  };
177
-
178
157
  if (render !== undefined) {
179
158
  return /*#__PURE__*/React.createElement(AntdTooltip, _extends({
180
159
  overlayClassName: overlayClassName,
@@ -186,7 +165,6 @@ var Tooltip = function Tooltip(_ref) {
186
165
  getPopupContainer: getPopupContainer
187
166
  }, handleHideAfterClick, props), children);
188
167
  }
189
-
190
168
  return titleExists ? /*#__PURE__*/React.createElement(AntdTooltip, _extends({
191
169
  overlayClassName: overlayClassName,
192
170
  autoAdjustOverflow: false,
@@ -197,5 +175,4 @@ var Tooltip = function Tooltip(_ref) {
197
175
  getPopupContainer: getPopupContainer
198
176
  }, handleHideAfterClick, props), children) : /*#__PURE__*/React.createElement(React.Fragment, null, children);
199
177
  };
200
-
201
178
  export default Tooltip;
@@ -39,38 +39,27 @@ export var TooltipComponent = styled.div.withConfig({
39
39
  return props.theme.palette['grey-200'];
40
40
  }, TooltipContent, function (props) {
41
41
  var defaultPadding = css(["padding:16px;"]);
42
-
43
42
  switch (props.tooltipType) {
44
43
  case 'icon':
45
44
  return css(["padding:8px 16px 16px;"]);
46
-
47
45
  case 'largeSimple':
48
46
  return defaultPadding;
49
-
50
47
  case 'largeScrollable':
51
48
  return defaultPadding;
52
-
53
49
  case 'tutorial':
54
50
  return css(["padding:0;"]);
55
-
56
51
  case 'avatar':
57
52
  return css(["padding:8px 16px 16px;text-align:center;align-items:center;"]);
58
-
59
53
  case 'button':
60
54
  return defaultPadding;
61
-
62
55
  case 'header-label':
63
56
  return css(["padding:13px 16px 16px;"]);
64
-
65
57
  case 'status':
66
58
  return css(["padding:6px 25px 10px 21px;text-align:center;align-items:center;"]);
67
-
68
59
  case 'default':
69
60
  return css(["padding:3px 8px;"]);
70
-
71
61
  default:
72
62
  }
73
-
74
63
  return defaultPadding;
75
64
  }, function (props) {
76
65
  return props.theme.palette['grey-600'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-tooltip",
3
- "version": "0.14.49",
3
+ "version": "0.14.50",
4
4
  "description": "Tooltip UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -34,9 +34,9 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@synerise/ds-button": "^0.21.19",
38
- "@synerise/ds-icon": "^0.67.0",
39
- "@synerise/ds-scrollbar": "^0.11.19",
37
+ "@synerise/ds-button": "^0.21.20",
38
+ "@synerise/ds-icon": "^0.67.1",
39
+ "@synerise/ds-scrollbar": "^0.11.20",
40
40
  "@synerise/ds-utils": "^0.31.2"
41
41
  },
42
42
  "peerDependencies": {
@@ -45,5 +45,5 @@
45
45
  "react": ">=16.9.0 <= 17.0.2",
46
46
  "styled-components": "5.0.1"
47
47
  },
48
- "gitHead": "05f083c767e2cec3c2f91c9475aee89852a77d6c"
48
+ "gitHead": "4a56ee7ef816c22341ce704154dc7aa65b7d1dcc"
49
49
  }