@zendeskgarden/react-tooltips 9.0.0-next.2 → 9.0.0-next.4
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 +42 -35
- package/dist/index.esm.js +43 -36
- package/dist/typings/elements/Tooltip.d.ts +29 -0
- package/dist/typings/index.d.ts +3 -1
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -8,25 +8,40 @@
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
10
|
var React = require('react');
|
|
11
|
+
var styled = require('styled-components');
|
|
12
|
+
var reactTheming = require('@zendeskgarden/react-theming');
|
|
11
13
|
var reactDom$1 = require('react-dom');
|
|
12
14
|
var PropTypes = require('prop-types');
|
|
13
|
-
var styled = require('styled-components');
|
|
14
15
|
var reactMergeRefs = require('react-merge-refs');
|
|
15
16
|
var containerTooltip = require('@zendeskgarden/container-tooltip');
|
|
16
17
|
var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
17
|
-
var reactTheming = require('@zendeskgarden/react-theming');
|
|
18
18
|
var reactDom = require('@floating-ui/react-dom');
|
|
19
19
|
|
|
20
20
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
21
|
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
23
|
-
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
24
23
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
24
|
+
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
25
|
+
|
|
26
|
+
function _extends() {
|
|
27
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
28
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
29
|
+
var source = arguments[i];
|
|
30
|
+
for (var key in source) {
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
32
|
+
target[key] = source[key];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
return _extends.apply(this, arguments);
|
|
39
|
+
}
|
|
25
40
|
|
|
26
41
|
const COMPONENT_ID$2 = 'tooltip.paragraph';
|
|
27
42
|
const StyledParagraph = styled__default.default.p.attrs({
|
|
28
43
|
'data-garden-id': COMPONENT_ID$2,
|
|
29
|
-
'data-garden-version': '9.0.0-next.
|
|
44
|
+
'data-garden-version': '9.0.0-next.4'
|
|
30
45
|
}).withConfig({
|
|
31
46
|
displayName: "StyledParagraph",
|
|
32
47
|
componentId: "sc-wuqkfc-0"
|
|
@@ -38,7 +53,7 @@ StyledParagraph.defaultProps = {
|
|
|
38
53
|
const COMPONENT_ID$1 = 'tooltip.title';
|
|
39
54
|
const StyledTitle = styled__default.default.strong.attrs({
|
|
40
55
|
'data-garden-id': COMPONENT_ID$1,
|
|
41
|
-
'data-garden-version': '9.0.0-next.
|
|
56
|
+
'data-garden-version': '9.0.0-next.4'
|
|
42
57
|
}).withConfig({
|
|
43
58
|
displayName: "StyledTitle",
|
|
44
59
|
componentId: "sc-vnjcvz-0"
|
|
@@ -135,7 +150,7 @@ const colorStyles = _ref2 => {
|
|
|
135
150
|
};
|
|
136
151
|
const StyledTooltip = styled__default.default.div.attrs({
|
|
137
152
|
'data-garden-id': COMPONENT_ID,
|
|
138
|
-
'data-garden-version': '9.0.0-next.
|
|
153
|
+
'data-garden-version': '9.0.0-next.4'
|
|
139
154
|
}).withConfig({
|
|
140
155
|
displayName: "StyledTooltip",
|
|
141
156
|
componentId: "sc-gzzjq4-0"
|
|
@@ -152,6 +167,16 @@ StyledTooltipWrapper.defaultProps = {
|
|
|
152
167
|
theme: reactTheming.DEFAULT_THEME
|
|
153
168
|
};
|
|
154
169
|
|
|
170
|
+
const Paragraph = React.forwardRef((props, ref) => React__default.default.createElement(StyledParagraph, _extends({
|
|
171
|
+
ref: ref
|
|
172
|
+
}, props)));
|
|
173
|
+
Paragraph.displayName = 'Paragraph';
|
|
174
|
+
|
|
175
|
+
const Title = React.forwardRef((props, ref) => React__default.default.createElement(StyledTitle, _extends({
|
|
176
|
+
ref: ref
|
|
177
|
+
}, props)));
|
|
178
|
+
Title.displayName = 'Title';
|
|
179
|
+
|
|
155
180
|
const PLACEMENT = ['auto', ...reactTheming.PLACEMENT];
|
|
156
181
|
const SIZE = ['small', 'medium', 'large', 'extra-large'];
|
|
157
182
|
const TYPE = ['light', 'dark'];
|
|
@@ -165,7 +190,7 @@ const toSize = (size, type) => {
|
|
|
165
190
|
};
|
|
166
191
|
|
|
167
192
|
const PLACEMENT_DEFAULT = 'top';
|
|
168
|
-
const
|
|
193
|
+
const TooltipComponent = _ref => {
|
|
169
194
|
let {
|
|
170
195
|
id,
|
|
171
196
|
delayMS,
|
|
@@ -208,6 +233,10 @@ const Tooltip = _ref => {
|
|
|
208
233
|
transform
|
|
209
234
|
}
|
|
210
235
|
} = reactDom.useFloating({
|
|
236
|
+
platform: {
|
|
237
|
+
...reactDom.platform,
|
|
238
|
+
isRTL: () => theme.rtl
|
|
239
|
+
},
|
|
211
240
|
elements: {
|
|
212
241
|
reference: triggerRef?.current,
|
|
213
242
|
floating: floatingRef?.current
|
|
@@ -247,8 +276,8 @@ const Tooltip = _ref => {
|
|
|
247
276
|
[refKey]: reactMergeRefs.mergeRefs([triggerRef, Child.ref ? Child.ref : null])
|
|
248
277
|
})), appendToNode ? reactDom$1.createPortal(Node, appendToNode) : Node);
|
|
249
278
|
};
|
|
250
|
-
|
|
251
|
-
|
|
279
|
+
TooltipComponent.displayName = 'Tooltip';
|
|
280
|
+
TooltipComponent.propTypes = {
|
|
252
281
|
appendToNode: PropTypes__default.default.any,
|
|
253
282
|
hasArrow: PropTypes__default.default.bool,
|
|
254
283
|
delayMS: PropTypes__default.default.number,
|
|
@@ -261,38 +290,16 @@ Tooltip.propTypes = {
|
|
|
261
290
|
isInitialVisible: PropTypes__default.default.bool,
|
|
262
291
|
refKey: PropTypes__default.default.string
|
|
263
292
|
};
|
|
264
|
-
|
|
293
|
+
TooltipComponent.defaultProps = {
|
|
265
294
|
hasArrow: true,
|
|
266
295
|
type: 'dark',
|
|
267
296
|
placement: PLACEMENT_DEFAULT,
|
|
268
297
|
delayMS: 500,
|
|
269
298
|
refKey: 'ref'
|
|
270
299
|
};
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
275
|
-
var source = arguments[i];
|
|
276
|
-
for (var key in source) {
|
|
277
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
278
|
-
target[key] = source[key];
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return target;
|
|
283
|
-
};
|
|
284
|
-
return _extends.apply(this, arguments);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
const Paragraph = React.forwardRef((props, ref) => React__default.default.createElement(StyledParagraph, _extends({
|
|
288
|
-
ref: ref
|
|
289
|
-
}, props)));
|
|
290
|
-
Paragraph.displayName = 'Paragraph';
|
|
291
|
-
|
|
292
|
-
const Title = React.forwardRef((props, ref) => React__default.default.createElement(StyledTitle, _extends({
|
|
293
|
-
ref: ref
|
|
294
|
-
}, props)));
|
|
295
|
-
Title.displayName = 'Title';
|
|
300
|
+
const Tooltip = TooltipComponent;
|
|
301
|
+
Tooltip.Paragraph = Paragraph;
|
|
302
|
+
Tooltip.Title = Title;
|
|
296
303
|
|
|
297
304
|
exports.Paragraph = Paragraph;
|
|
298
305
|
exports.Title = Title;
|
package/dist/index.esm.js
CHANGED
|
@@ -5,20 +5,35 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React, { useContext, useRef, useEffect, cloneElement
|
|
8
|
+
import React, { forwardRef, useContext, useRef, useEffect, cloneElement } from 'react';
|
|
9
|
+
import styled, { css, ThemeContext } from 'styled-components';
|
|
10
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getLineHeight, arrowStyles, getArrowPosition, getColor, PLACEMENT as PLACEMENT$1, getFloatingPlacements } from '@zendeskgarden/react-theming';
|
|
9
11
|
import { createPortal } from 'react-dom';
|
|
10
12
|
import PropTypes from 'prop-types';
|
|
11
|
-
import styled, { css, ThemeContext } from 'styled-components';
|
|
12
13
|
import { mergeRefs } from 'react-merge-refs';
|
|
13
14
|
import { useTooltip } from '@zendeskgarden/container-tooltip';
|
|
14
15
|
import { getControlledValue, composeEventHandlers } from '@zendeskgarden/container-utilities';
|
|
15
|
-
import {
|
|
16
|
-
|
|
16
|
+
import { useFloating, platform, autoPlacement, autoUpdate } from '@floating-ui/react-dom';
|
|
17
|
+
|
|
18
|
+
function _extends() {
|
|
19
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
20
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
21
|
+
var source = arguments[i];
|
|
22
|
+
for (var key in source) {
|
|
23
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
24
|
+
target[key] = source[key];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return target;
|
|
29
|
+
};
|
|
30
|
+
return _extends.apply(this, arguments);
|
|
31
|
+
}
|
|
17
32
|
|
|
18
33
|
const COMPONENT_ID$2 = 'tooltip.paragraph';
|
|
19
34
|
const StyledParagraph = styled.p.attrs({
|
|
20
35
|
'data-garden-id': COMPONENT_ID$2,
|
|
21
|
-
'data-garden-version': '9.0.0-next.
|
|
36
|
+
'data-garden-version': '9.0.0-next.4'
|
|
22
37
|
}).withConfig({
|
|
23
38
|
displayName: "StyledParagraph",
|
|
24
39
|
componentId: "sc-wuqkfc-0"
|
|
@@ -30,7 +45,7 @@ StyledParagraph.defaultProps = {
|
|
|
30
45
|
const COMPONENT_ID$1 = 'tooltip.title';
|
|
31
46
|
const StyledTitle = styled.strong.attrs({
|
|
32
47
|
'data-garden-id': COMPONENT_ID$1,
|
|
33
|
-
'data-garden-version': '9.0.0-next.
|
|
48
|
+
'data-garden-version': '9.0.0-next.4'
|
|
34
49
|
}).withConfig({
|
|
35
50
|
displayName: "StyledTitle",
|
|
36
51
|
componentId: "sc-vnjcvz-0"
|
|
@@ -127,7 +142,7 @@ const colorStyles = _ref2 => {
|
|
|
127
142
|
};
|
|
128
143
|
const StyledTooltip = styled.div.attrs({
|
|
129
144
|
'data-garden-id': COMPONENT_ID,
|
|
130
|
-
'data-garden-version': '9.0.0-next.
|
|
145
|
+
'data-garden-version': '9.0.0-next.4'
|
|
131
146
|
}).withConfig({
|
|
132
147
|
displayName: "StyledTooltip",
|
|
133
148
|
componentId: "sc-gzzjq4-0"
|
|
@@ -144,6 +159,16 @@ StyledTooltipWrapper.defaultProps = {
|
|
|
144
159
|
theme: DEFAULT_THEME
|
|
145
160
|
};
|
|
146
161
|
|
|
162
|
+
const Paragraph = forwardRef((props, ref) => React.createElement(StyledParagraph, _extends({
|
|
163
|
+
ref: ref
|
|
164
|
+
}, props)));
|
|
165
|
+
Paragraph.displayName = 'Paragraph';
|
|
166
|
+
|
|
167
|
+
const Title = forwardRef((props, ref) => React.createElement(StyledTitle, _extends({
|
|
168
|
+
ref: ref
|
|
169
|
+
}, props)));
|
|
170
|
+
Title.displayName = 'Title';
|
|
171
|
+
|
|
147
172
|
const PLACEMENT = ['auto', ...PLACEMENT$1];
|
|
148
173
|
const SIZE = ['small', 'medium', 'large', 'extra-large'];
|
|
149
174
|
const TYPE = ['light', 'dark'];
|
|
@@ -157,7 +182,7 @@ const toSize = (size, type) => {
|
|
|
157
182
|
};
|
|
158
183
|
|
|
159
184
|
const PLACEMENT_DEFAULT = 'top';
|
|
160
|
-
const
|
|
185
|
+
const TooltipComponent = _ref => {
|
|
161
186
|
let {
|
|
162
187
|
id,
|
|
163
188
|
delayMS,
|
|
@@ -200,6 +225,10 @@ const Tooltip = _ref => {
|
|
|
200
225
|
transform
|
|
201
226
|
}
|
|
202
227
|
} = useFloating({
|
|
228
|
+
platform: {
|
|
229
|
+
...platform,
|
|
230
|
+
isRTL: () => theme.rtl
|
|
231
|
+
},
|
|
203
232
|
elements: {
|
|
204
233
|
reference: triggerRef?.current,
|
|
205
234
|
floating: floatingRef?.current
|
|
@@ -239,8 +268,8 @@ const Tooltip = _ref => {
|
|
|
239
268
|
[refKey]: mergeRefs([triggerRef, Child.ref ? Child.ref : null])
|
|
240
269
|
})), appendToNode ? createPortal(Node, appendToNode) : Node);
|
|
241
270
|
};
|
|
242
|
-
|
|
243
|
-
|
|
271
|
+
TooltipComponent.displayName = 'Tooltip';
|
|
272
|
+
TooltipComponent.propTypes = {
|
|
244
273
|
appendToNode: PropTypes.any,
|
|
245
274
|
hasArrow: PropTypes.bool,
|
|
246
275
|
delayMS: PropTypes.number,
|
|
@@ -253,37 +282,15 @@ Tooltip.propTypes = {
|
|
|
253
282
|
isInitialVisible: PropTypes.bool,
|
|
254
283
|
refKey: PropTypes.string
|
|
255
284
|
};
|
|
256
|
-
|
|
285
|
+
TooltipComponent.defaultProps = {
|
|
257
286
|
hasArrow: true,
|
|
258
287
|
type: 'dark',
|
|
259
288
|
placement: PLACEMENT_DEFAULT,
|
|
260
289
|
delayMS: 500,
|
|
261
290
|
refKey: 'ref'
|
|
262
291
|
};
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
267
|
-
var source = arguments[i];
|
|
268
|
-
for (var key in source) {
|
|
269
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
270
|
-
target[key] = source[key];
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
return target;
|
|
275
|
-
};
|
|
276
|
-
return _extends.apply(this, arguments);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
const Paragraph = forwardRef((props, ref) => React.createElement(StyledParagraph, _extends({
|
|
280
|
-
ref: ref
|
|
281
|
-
}, props)));
|
|
282
|
-
Paragraph.displayName = 'Paragraph';
|
|
283
|
-
|
|
284
|
-
const Title = forwardRef((props, ref) => React.createElement(StyledTitle, _extends({
|
|
285
|
-
ref: ref
|
|
286
|
-
}, props)));
|
|
287
|
-
Title.displayName = 'Title';
|
|
292
|
+
const Tooltip = TooltipComponent;
|
|
293
|
+
Tooltip.Paragraph = Paragraph;
|
|
294
|
+
Tooltip.Title = Title;
|
|
288
295
|
|
|
289
296
|
export { Paragraph, Title, Tooltip };
|
|
@@ -7,7 +7,33 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { ITooltipProps } from '../types';
|
|
10
|
+
import { Paragraph } from './Paragraph';
|
|
11
|
+
import { Title } from './Title';
|
|
10
12
|
export declare const PLACEMENT_DEFAULT = "top";
|
|
13
|
+
export declare const TooltipComponent: {
|
|
14
|
+
({ id, delayMS, isInitialVisible, content, refKey, placement: _placement, children, hasArrow, size, type, appendToNode, zIndex, isVisible: externalIsVisible, onFocus, onBlur, ...props }: ITooltipProps): React.JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
propTypes: {
|
|
17
|
+
appendToNode: PropTypes.Requireable<any>;
|
|
18
|
+
hasArrow: PropTypes.Requireable<boolean>;
|
|
19
|
+
delayMS: PropTypes.Requireable<number>;
|
|
20
|
+
id: PropTypes.Requireable<string>;
|
|
21
|
+
content: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
22
|
+
placement: PropTypes.Requireable<"top" | "auto" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "end" | "end-top" | "end-bottom" | "start" | "start-top" | "start-bottom">;
|
|
23
|
+
size: PropTypes.Requireable<"small" | "medium" | "large" | "extra-large">;
|
|
24
|
+
type: PropTypes.Requireable<"light" | "dark">;
|
|
25
|
+
zIndex: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
26
|
+
isInitialVisible: PropTypes.Requireable<boolean>;
|
|
27
|
+
refKey: PropTypes.Requireable<string>;
|
|
28
|
+
};
|
|
29
|
+
defaultProps: {
|
|
30
|
+
hasArrow: boolean;
|
|
31
|
+
type: string;
|
|
32
|
+
placement: string;
|
|
33
|
+
delayMS: number;
|
|
34
|
+
refKey: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
11
37
|
/**
|
|
12
38
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
13
39
|
*/
|
|
@@ -34,4 +60,7 @@ export declare const Tooltip: {
|
|
|
34
60
|
delayMS: number;
|
|
35
61
|
refKey: string;
|
|
36
62
|
};
|
|
63
|
+
} & {
|
|
64
|
+
Paragraph: typeof Paragraph;
|
|
65
|
+
Title: typeof Title;
|
|
37
66
|
};
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
/** @deprecated use `Tooltip.Paragraph` instead */
|
|
8
8
|
export { Paragraph } from './elements/Paragraph';
|
|
9
|
+
/** @deprecated use `Tooltip.Title` instead */
|
|
9
10
|
export { Title } from './elements/Title';
|
|
11
|
+
export { Tooltip } from './elements/Tooltip';
|
|
10
12
|
export type { ITooltipProps } from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-tooltips",
|
|
3
|
-
"version": "9.0.0-next.
|
|
3
|
+
"version": "9.0.0-next.4",
|
|
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>",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"styled-components": "^5.1.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@zendeskgarden/react-theming": "^9.0.0-next.
|
|
38
|
+
"@zendeskgarden/react-theming": "^9.0.0-next.4"
|
|
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": "749220247e3a22d2d502dcb3691d81e6a3d52b02"
|
|
51
51
|
}
|