@zendeskgarden/react-tooltips 8.62.1 → 8.63.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/dist/index.cjs.js
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
10
|
var React = require('react');
|
|
13
11
|
var reactDom = require('react-dom');
|
|
14
12
|
var PropTypes = require('prop-types');
|
|
@@ -19,12 +17,12 @@ var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
|
19
17
|
var reactPopper = require('react-popper');
|
|
20
18
|
var reactTheming = require('@zendeskgarden/react-theming');
|
|
21
19
|
|
|
22
|
-
function
|
|
20
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
21
|
|
|
24
|
-
var React__default = /*#__PURE__*/
|
|
25
|
-
var PropTypes__default = /*#__PURE__*/
|
|
26
|
-
var styled__default = /*#__PURE__*/
|
|
27
|
-
var mergeRefs__default = /*#__PURE__*/
|
|
22
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
23
|
+
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
24
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
25
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefault(mergeRefs);
|
|
28
26
|
|
|
29
27
|
function getPopperPlacement(gardenPlacement) {
|
|
30
28
|
const gardenToPopperMapping = {
|
|
@@ -79,9 +77,9 @@ function getArrowPosition(popperPlacement) {
|
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
const COMPONENT_ID$2 = 'tooltip.paragraph';
|
|
82
|
-
const StyledParagraph = styled__default
|
|
80
|
+
const StyledParagraph = styled__default.default.p.attrs({
|
|
83
81
|
'data-garden-id': COMPONENT_ID$2,
|
|
84
|
-
'data-garden-version': '8.
|
|
82
|
+
'data-garden-version': '8.63.0'
|
|
85
83
|
}).withConfig({
|
|
86
84
|
displayName: "StyledParagraph",
|
|
87
85
|
componentId: "sc-wuqkfc-0"
|
|
@@ -91,9 +89,9 @@ StyledParagraph.defaultProps = {
|
|
|
91
89
|
};
|
|
92
90
|
|
|
93
91
|
const COMPONENT_ID$1 = 'tooltip.title';
|
|
94
|
-
const StyledTitle = styled__default
|
|
92
|
+
const StyledTitle = styled__default.default.strong.attrs({
|
|
95
93
|
'data-garden-id': COMPONENT_ID$1,
|
|
96
|
-
'data-garden-version': '8.
|
|
94
|
+
'data-garden-version': '8.63.0'
|
|
97
95
|
}).withConfig({
|
|
98
96
|
displayName: "StyledTitle",
|
|
99
97
|
componentId: "sc-vnjcvz-0"
|
|
@@ -188,9 +186,9 @@ const colorStyles = _ref2 => {
|
|
|
188
186
|
}
|
|
189
187
|
return styled.css(["border:", ";box-shadow:", ";background-color:", ";color:", ";", "{color:", ";}"], border, boxShadow, backgroundColor, color, StyledTitle, titleColor);
|
|
190
188
|
};
|
|
191
|
-
const StyledTooltip = styled__default
|
|
189
|
+
const StyledTooltip = styled__default.default.div.attrs({
|
|
192
190
|
'data-garden-id': COMPONENT_ID,
|
|
193
|
-
'data-garden-version': '8.
|
|
191
|
+
'data-garden-version': '8.63.0'
|
|
194
192
|
}).withConfig({
|
|
195
193
|
displayName: "StyledTooltip",
|
|
196
194
|
componentId: "sc-gzzjq4-0"
|
|
@@ -199,7 +197,7 @@ StyledTooltip.defaultProps = {
|
|
|
199
197
|
theme: reactTheming.DEFAULT_THEME
|
|
200
198
|
};
|
|
201
199
|
|
|
202
|
-
const StyledTooltipWrapper = styled__default
|
|
200
|
+
const StyledTooltipWrapper = styled__default.default.div.withConfig({
|
|
203
201
|
displayName: "StyledTooltipWrapper",
|
|
204
202
|
componentId: "sc-1b7q9q6-0"
|
|
205
203
|
})(["transition:opacity 10ms;opacity:1;z-index:", ";&[aria-hidden='true']{visibility:hidden;opacity:0;}"], props => props.zIndex);
|
|
@@ -231,7 +229,9 @@ const Tooltip = _ref => {
|
|
|
231
229
|
isVisible: externalIsVisible,
|
|
232
230
|
...otherProps
|
|
233
231
|
} = _ref;
|
|
234
|
-
const
|
|
232
|
+
const {
|
|
233
|
+
rtl
|
|
234
|
+
} = React.useContext(styled.ThemeContext);
|
|
235
235
|
const scheduleUpdateRef = React.useRef();
|
|
236
236
|
const {
|
|
237
237
|
isVisible,
|
|
@@ -250,23 +250,23 @@ const Tooltip = _ref => {
|
|
|
250
250
|
scheduleUpdateRef.current();
|
|
251
251
|
}
|
|
252
252
|
}, [controlledIsVisible, content]);
|
|
253
|
-
const popperPlacement =
|
|
254
|
-
const singleChild = React__default
|
|
253
|
+
const popperPlacement = rtl ? getRtlPopperPlacement(placement) : getPopperPlacement(placement);
|
|
254
|
+
const singleChild = React__default.default.Children.only(children);
|
|
255
255
|
const modifiers = {
|
|
256
256
|
preventOverflow: {
|
|
257
257
|
boundariesElement: 'window'
|
|
258
258
|
},
|
|
259
259
|
...popperModifiers
|
|
260
260
|
};
|
|
261
|
-
return React__default
|
|
261
|
+
return React__default.default.createElement(reactPopper.Manager, null, React__default.default.createElement(reactPopper.Reference, null, _ref2 => {
|
|
262
262
|
let {
|
|
263
263
|
ref
|
|
264
264
|
} = _ref2;
|
|
265
265
|
return React.cloneElement(singleChild, getTriggerProps({
|
|
266
266
|
...singleChild.props,
|
|
267
|
-
[refKey]: mergeRefs__default
|
|
267
|
+
[refKey]: mergeRefs__default.default([ref, singleChild.ref ? singleChild.ref : null])
|
|
268
268
|
}));
|
|
269
|
-
}), React__default
|
|
269
|
+
}), React__default.default.createElement(reactPopper.Popper, {
|
|
270
270
|
placement: popperPlacement,
|
|
271
271
|
eventsEnabled: controlledIsVisible && eventsEnabled,
|
|
272
272
|
modifiers: modifiers
|
|
@@ -305,12 +305,12 @@ const Tooltip = _ref => {
|
|
|
305
305
|
type,
|
|
306
306
|
...otherTooltipProps
|
|
307
307
|
};
|
|
308
|
-
const tooltip = React__default
|
|
308
|
+
const tooltip = React__default.default.createElement(StyledTooltipWrapper, {
|
|
309
309
|
ref: controlledIsVisible ? ref : null,
|
|
310
310
|
style: style,
|
|
311
311
|
zIndex: zIndex,
|
|
312
312
|
"aria-hidden": !controlledIsVisible
|
|
313
|
-
}, React__default
|
|
313
|
+
}, React__default.default.createElement(StyledTooltip, getTooltipProps(tooltipProps), content));
|
|
314
314
|
if (appendToNode) {
|
|
315
315
|
return reactDom.createPortal(tooltip, appendToNode);
|
|
316
316
|
}
|
|
@@ -319,19 +319,19 @@ const Tooltip = _ref => {
|
|
|
319
319
|
};
|
|
320
320
|
Tooltip.displayName = 'Tooltip';
|
|
321
321
|
Tooltip.propTypes = {
|
|
322
|
-
appendToNode: PropTypes__default
|
|
323
|
-
hasArrow: PropTypes__default
|
|
324
|
-
delayMS: PropTypes__default
|
|
325
|
-
eventsEnabled: PropTypes__default
|
|
326
|
-
id: PropTypes__default
|
|
327
|
-
content: PropTypes__default
|
|
328
|
-
placement: PropTypes__default
|
|
329
|
-
popperModifiers: PropTypes__default
|
|
330
|
-
size: PropTypes__default
|
|
331
|
-
type: PropTypes__default
|
|
332
|
-
zIndex: PropTypes__default
|
|
333
|
-
isInitialVisible: PropTypes__default
|
|
334
|
-
refKey: PropTypes__default
|
|
322
|
+
appendToNode: PropTypes__default.default.any,
|
|
323
|
+
hasArrow: PropTypes__default.default.bool,
|
|
324
|
+
delayMS: PropTypes__default.default.number,
|
|
325
|
+
eventsEnabled: PropTypes__default.default.bool,
|
|
326
|
+
id: PropTypes__default.default.string,
|
|
327
|
+
content: PropTypes__default.default.node.isRequired,
|
|
328
|
+
placement: PropTypes__default.default.oneOf(PLACEMENT),
|
|
329
|
+
popperModifiers: PropTypes__default.default.any,
|
|
330
|
+
size: PropTypes__default.default.oneOf(SIZE),
|
|
331
|
+
type: PropTypes__default.default.oneOf(TYPE),
|
|
332
|
+
zIndex: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
|
|
333
|
+
isInitialVisible: PropTypes__default.default.bool,
|
|
334
|
+
refKey: PropTypes__default.default.string
|
|
335
335
|
};
|
|
336
336
|
Tooltip.defaultProps = {
|
|
337
337
|
hasArrow: true,
|
|
@@ -357,12 +357,12 @@ function _extends() {
|
|
|
357
357
|
return _extends.apply(this, arguments);
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
const Paragraph = React.forwardRef((props, ref) => React__default
|
|
360
|
+
const Paragraph = React.forwardRef((props, ref) => React__default.default.createElement(StyledParagraph, _extends({
|
|
361
361
|
ref: ref
|
|
362
362
|
}, props)));
|
|
363
363
|
Paragraph.displayName = 'Paragraph';
|
|
364
364
|
|
|
365
|
-
const Title = React.forwardRef((props, ref) => React__default
|
|
365
|
+
const Title = React.forwardRef((props, ref) => React__default.default.createElement(StyledTitle, _extends({
|
|
366
366
|
ref: ref
|
|
367
367
|
}, props)));
|
|
368
368
|
Title.displayName = 'Title';
|
package/dist/index.esm.js
CHANGED
|
@@ -70,7 +70,7 @@ function getArrowPosition(popperPlacement) {
|
|
|
70
70
|
const COMPONENT_ID$2 = 'tooltip.paragraph';
|
|
71
71
|
const StyledParagraph = styled.p.attrs({
|
|
72
72
|
'data-garden-id': COMPONENT_ID$2,
|
|
73
|
-
'data-garden-version': '8.
|
|
73
|
+
'data-garden-version': '8.63.0'
|
|
74
74
|
}).withConfig({
|
|
75
75
|
displayName: "StyledParagraph",
|
|
76
76
|
componentId: "sc-wuqkfc-0"
|
|
@@ -82,7 +82,7 @@ StyledParagraph.defaultProps = {
|
|
|
82
82
|
const COMPONENT_ID$1 = 'tooltip.title';
|
|
83
83
|
const StyledTitle = styled.strong.attrs({
|
|
84
84
|
'data-garden-id': COMPONENT_ID$1,
|
|
85
|
-
'data-garden-version': '8.
|
|
85
|
+
'data-garden-version': '8.63.0'
|
|
86
86
|
}).withConfig({
|
|
87
87
|
displayName: "StyledTitle",
|
|
88
88
|
componentId: "sc-vnjcvz-0"
|
|
@@ -179,7 +179,7 @@ const colorStyles = _ref2 => {
|
|
|
179
179
|
};
|
|
180
180
|
const StyledTooltip = styled.div.attrs({
|
|
181
181
|
'data-garden-id': COMPONENT_ID,
|
|
182
|
-
'data-garden-version': '8.
|
|
182
|
+
'data-garden-version': '8.63.0'
|
|
183
183
|
}).withConfig({
|
|
184
184
|
displayName: "StyledTooltip",
|
|
185
185
|
componentId: "sc-gzzjq4-0"
|
|
@@ -220,7 +220,9 @@ const Tooltip = _ref => {
|
|
|
220
220
|
isVisible: externalIsVisible,
|
|
221
221
|
...otherProps
|
|
222
222
|
} = _ref;
|
|
223
|
-
const
|
|
223
|
+
const {
|
|
224
|
+
rtl
|
|
225
|
+
} = useContext(ThemeContext);
|
|
224
226
|
const scheduleUpdateRef = useRef();
|
|
225
227
|
const {
|
|
226
228
|
isVisible,
|
|
@@ -239,7 +241,7 @@ const Tooltip = _ref => {
|
|
|
239
241
|
scheduleUpdateRef.current();
|
|
240
242
|
}
|
|
241
243
|
}, [controlledIsVisible, content]);
|
|
242
|
-
const popperPlacement =
|
|
244
|
+
const popperPlacement = rtl ? getRtlPopperPlacement(placement) : getPopperPlacement(placement);
|
|
243
245
|
const singleChild = React.Children.only(children);
|
|
244
246
|
const modifiers = {
|
|
245
247
|
preventOverflow: {
|
|
@@ -8,7 +8,7 @@ import { DefaultTheme } from 'styled-components';
|
|
|
8
8
|
import { ITooltipProps, POPPER_PLACEMENT } from '../types';
|
|
9
9
|
interface IStyledTooltipProps extends Pick<ITooltipProps, 'hasArrow' | 'size' | 'zIndex'> {
|
|
10
10
|
/** All valid [Popper.JS Placements](https://popper.js.org/popper-documentation.html#Popper.placements) */
|
|
11
|
-
placement: typeof POPPER_PLACEMENT[number];
|
|
11
|
+
placement: (typeof POPPER_PLACEMENT)[number];
|
|
12
12
|
type: NonNullable<ITooltipProps['type']>;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -10,8 +10,8 @@ export declare const PLACEMENT: readonly ["auto", "top", "top-start", "top-end",
|
|
|
10
10
|
export declare const POPPER_PLACEMENT: readonly ["auto", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "right", "right-start", "right-end", "left", "left-start", "left-end"];
|
|
11
11
|
export declare const SIZE: readonly ["small", "medium", "large", "extra-large"];
|
|
12
12
|
export declare const TYPE: readonly ["light", "dark"];
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export type GardenPlacement = (typeof PLACEMENT)[number];
|
|
14
|
+
export type PopperPlacement = (typeof POPPER_PLACEMENT)[number];
|
|
15
15
|
export interface ITooltipProps extends HTMLAttributes<HTMLDivElement> {
|
|
16
16
|
/** Appends the tooltip to the element provided */
|
|
17
17
|
appendToNode?: Element;
|
|
@@ -30,9 +30,9 @@ export interface ITooltipProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
30
30
|
/** Passes configurations to the [Popper instance](https://popper.js.org/docs/v2/modifiers/) */
|
|
31
31
|
popperModifiers?: Modifiers;
|
|
32
32
|
/** Adjusts the padding and font size */
|
|
33
|
-
size?: typeof SIZE[number];
|
|
33
|
+
size?: (typeof SIZE)[number];
|
|
34
34
|
/** Specifies the tooltip type */
|
|
35
|
-
type?: typeof TYPE[number];
|
|
35
|
+
type?: (typeof TYPE)[number];
|
|
36
36
|
/** Sets the `z-index` of the tooltip */
|
|
37
37
|
zIndex?: number | string;
|
|
38
38
|
/** Displays the tooltip on initial render */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-tooltips",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.63.0",
|
|
4
4
|
"description": "Collection of components and render prop containers relating to Tooltips in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"types": "dist/typings/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@zendeskgarden/container-tooltip": "^1.0.0",
|
|
25
|
-
"@zendeskgarden/container-utilities": "^0.
|
|
25
|
+
"@zendeskgarden/container-utilities": "^1.0.0",
|
|
26
26
|
"polished": "^4.0.0",
|
|
27
27
|
"prop-types": "^15.5.7",
|
|
28
28
|
"react-merge-refs": "^1.1.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@zendeskgarden/react-theming": "^8.
|
|
38
|
+
"@zendeskgarden/react-theming": "^8.63.0"
|
|
39
39
|
},
|
|
40
40
|
"keywords": [
|
|
41
41
|
"components",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"zendeskgarden:src": "src/index.ts",
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "4b8715305a769881b143c7195c5b31e687422926"
|
|
51
51
|
}
|