@zendeskgarden/react-tooltips 9.0.0-next.0 → 9.0.0-next.10

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
@@ -1,84 +1,31 @@
1
1
  /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
-
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
8
7
  'use strict';
9
8
 
10
9
  var React = require('react');
11
- var reactDom = require('react-dom');
12
- var PropTypes = require('prop-types');
13
10
  var styled = require('styled-components');
11
+ var reactTheming = require('@zendeskgarden/react-theming');
12
+ var reactDom$1 = require('react-dom');
13
+ var PropTypes = require('prop-types');
14
14
  var reactMergeRefs = require('react-merge-refs');
15
15
  var containerTooltip = require('@zendeskgarden/container-tooltip');
16
16
  var containerUtilities = require('@zendeskgarden/container-utilities');
17
- var reactPopper = require('react-popper');
18
- var reactTheming = require('@zendeskgarden/react-theming');
17
+ var reactDom = require('@floating-ui/react-dom');
19
18
 
20
19
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
21
20
 
22
21
  var React__default = /*#__PURE__*/_interopDefault(React);
23
- var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
24
22
  var styled__default = /*#__PURE__*/_interopDefault(styled);
25
-
26
- function getPopperPlacement(gardenPlacement) {
27
- const gardenToPopperMapping = {
28
- auto: 'auto',
29
- top: 'top',
30
- 'top-start': 'top-start',
31
- 'top-end': 'top-end',
32
- bottom: 'bottom',
33
- 'bottom-start': 'bottom-start',
34
- 'bottom-end': 'bottom-end',
35
- end: 'right',
36
- 'end-top': 'right-start',
37
- 'end-bottom': 'right-end',
38
- start: 'left',
39
- 'start-top': 'left-start',
40
- 'start-bottom': 'left-end'
41
- };
42
- return gardenToPopperMapping[gardenPlacement];
43
- }
44
- function getRtlPopperPlacement(gardenPlacement) {
45
- const rtlPlacementMappings = {
46
- left: 'right',
47
- 'left-start': 'right-start',
48
- 'left-end': 'right-end',
49
- 'top-start': 'top-end',
50
- 'top-end': 'top-start',
51
- right: 'left',
52
- 'right-start': 'left-start',
53
- 'right-end': 'left-end',
54
- 'bottom-start': 'bottom-end',
55
- 'bottom-end': 'bottom-start'
56
- };
57
- const popperPlacement = getPopperPlacement(gardenPlacement);
58
- return rtlPlacementMappings[popperPlacement] || popperPlacement;
59
- }
60
- function getArrowPosition(popperPlacement) {
61
- const arrowPositionMappings = {
62
- top: 'bottom',
63
- 'top-start': 'bottom-left',
64
- 'top-end': 'bottom-right',
65
- right: 'left',
66
- 'right-start': 'left-top',
67
- 'right-end': 'left-bottom',
68
- bottom: 'top',
69
- 'bottom-start': 'top-left',
70
- 'bottom-end': 'top-right',
71
- left: 'right',
72
- 'left-start': 'right-top',
73
- 'left-end': 'right-bottom'
74
- };
75
- return arrowPositionMappings[popperPlacement] || 'top';
76
- }
23
+ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
77
24
 
78
25
  const COMPONENT_ID$2 = 'tooltip.paragraph';
79
26
  const StyledParagraph = styled__default.default.p.attrs({
80
27
  'data-garden-id': COMPONENT_ID$2,
81
- 'data-garden-version': '9.0.0-next.0'
28
+ 'data-garden-version': '9.0.0-next.10'
82
29
  }).withConfig({
83
30
  displayName: "StyledParagraph",
84
31
  componentId: "sc-wuqkfc-0"
@@ -90,7 +37,7 @@ StyledParagraph.defaultProps = {
90
37
  const COMPONENT_ID$1 = 'tooltip.title';
91
38
  const StyledTitle = styled__default.default.strong.attrs({
92
39
  'data-garden-id': COMPONENT_ID$1,
93
- 'data-garden-version': '9.0.0-next.0'
40
+ 'data-garden-version': '9.0.0-next.10'
94
41
  }).withConfig({
95
42
  displayName: "StyledTitle",
96
43
  componentId: "sc-vnjcvz-0"
@@ -161,7 +108,7 @@ const sizeStyles = _ref => {
161
108
  }
162
109
  }
163
110
  }
164
- return styled.css(["margin:", ";border-radius:", ";padding:", ";max-width:", ";line-height:", ";word-wrap:", ";white-space:", ";font-size:", ";overflow-wrap:", ";", ";", "{margin-top:", ";}", "{display:", ";}"], margin, borderRadius, padding, maxWidth, lineHeight, wordWrap, whiteSpace, fontSize, overflowWrap, hasArrow && reactTheming.arrowStyles(getArrowPosition(placement), {
111
+ return styled.css(["margin:", ";border-radius:", ";padding:", ";max-width:", ";line-height:", ";word-wrap:", ";white-space:", ";font-size:", ";overflow-wrap:", ";", ";", "{margin-top:", ";}", "{display:", ";}"], margin, borderRadius, padding, maxWidth, lineHeight, wordWrap, whiteSpace, fontSize, overflowWrap, hasArrow && reactTheming.arrowStyles(reactTheming.getArrowPosition(theme, placement), {
165
112
  size: arrowSize,
166
113
  inset: arrowInset
167
114
  }), StyledParagraph, paragraphMarginTop, StyledTitle, titleDisplay);
@@ -172,22 +119,22 @@ const colorStyles = _ref2 => {
172
119
  type
173
120
  } = _ref2;
174
121
  let border;
175
- let boxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, reactTheming.getColor('chromeHue', 600, theme, 0.15));
176
- let backgroundColor = reactTheming.getColor('chromeHue', 700, theme);
177
- let color = theme.colors.background;
122
+ let boxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, reactTheming.getColorV8('chromeHue', 600, theme, 0.15));
123
+ let backgroundColor = reactTheming.getColorV8('chromeHue', 700, theme);
124
+ let color = reactTheming.getColorV8('background', 600 , theme);
178
125
  let titleColor;
179
126
  if (type === 'light') {
180
- boxShadow = theme.shadows.lg(`${theme.space.base * 3}px`, `${theme.space.base * 5}px`, reactTheming.getColor('chromeHue', 600, theme, 0.15));
181
- border = `${theme.borders.sm} ${reactTheming.getColor('neutralHue', 300, theme)}`;
182
- backgroundColor = theme.colors.background;
183
- color = reactTheming.getColor('neutralHue', 700, theme);
184
- titleColor = theme.colors.foreground;
127
+ boxShadow = theme.shadows.lg(`${theme.space.base * 3}px`, `${theme.space.base * 5}px`, reactTheming.getColorV8('chromeHue', 600, theme, 0.15));
128
+ border = `${theme.borders.sm} ${reactTheming.getColorV8('neutralHue', 300, theme)}`;
129
+ backgroundColor = reactTheming.getColorV8('background', 600 , theme);
130
+ color = reactTheming.getColorV8('neutralHue', 700, theme);
131
+ titleColor = reactTheming.getColorV8('foreground', 600 , theme);
185
132
  }
186
133
  return styled.css(["border:", ";box-shadow:", ";background-color:", ";color:", ";", "{color:", ";}"], border, boxShadow, backgroundColor, color, StyledTitle, titleColor);
187
134
  };
188
135
  const StyledTooltip = styled__default.default.div.attrs({
189
136
  'data-garden-id': COMPONENT_ID,
190
- 'data-garden-version': '9.0.0-next.0'
137
+ 'data-garden-version': '9.0.0-next.10'
191
138
  }).withConfig({
192
139
  displayName: "StyledTooltip",
193
140
  componentId: "sc-gzzjq4-0"
@@ -199,26 +146,42 @@ StyledTooltip.defaultProps = {
199
146
  const StyledTooltipWrapper = styled__default.default.div.withConfig({
200
147
  displayName: "StyledTooltipWrapper",
201
148
  componentId: "sc-1b7q9q6-0"
202
- })(["transition:opacity 10ms;opacity:1;z-index:", ";&[aria-hidden='true']{visibility:hidden;opacity:0;}"], props => props.zIndex);
149
+ })(["position:absolute;top:0;left:0;transition:opacity 10ms;opacity:1;z-index:", ";&[aria-hidden='true']{visibility:hidden;opacity:0;}"], props => props.zIndex);
203
150
  StyledTooltipWrapper.defaultProps = {
204
151
  theme: reactTheming.DEFAULT_THEME
205
152
  };
206
153
 
207
- const SHARED_PLACEMENT = ['auto', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end'];
208
- const PLACEMENT = [...SHARED_PLACEMENT, 'end', 'end-top', 'end-bottom', 'start', 'start-top', 'start-bottom'];
154
+ const Paragraph = React.forwardRef((props, ref) => React__default.default.createElement(StyledParagraph, Object.assign({
155
+ ref: ref
156
+ }, props)));
157
+ Paragraph.displayName = 'Paragraph';
158
+
159
+ const Title = React.forwardRef((props, ref) => React__default.default.createElement(StyledTitle, Object.assign({
160
+ ref: ref
161
+ }, props)));
162
+ Title.displayName = 'Title';
163
+
164
+ const PLACEMENT = ['auto', ...reactTheming.PLACEMENT];
209
165
  const SIZE = ['small', 'medium', 'large', 'extra-large'];
210
166
  const TYPE = ['light', 'dark'];
211
167
 
212
- const Tooltip = _ref => {
168
+ const toSize = (size, type) => {
169
+ let retVal = size;
170
+ if (retVal === undefined) {
171
+ retVal = type === 'dark' ? 'small' : 'large';
172
+ }
173
+ return retVal;
174
+ };
175
+
176
+ const PLACEMENT_DEFAULT = 'top';
177
+ const TooltipComponent = _ref => {
213
178
  let {
214
179
  id,
215
180
  delayMS,
216
181
  isInitialVisible,
217
182
  content,
218
183
  refKey,
219
- placement,
220
- eventsEnabled,
221
- popperModifiers,
184
+ placement: _placement,
222
185
  children,
223
186
  hasArrow,
224
187
  size,
@@ -226,12 +189,13 @@ const Tooltip = _ref => {
226
189
  appendToNode,
227
190
  zIndex,
228
191
  isVisible: externalIsVisible,
229
- ...otherProps
192
+ onFocus,
193
+ onBlur,
194
+ ...props
230
195
  } = _ref;
231
- const {
232
- rtl
233
- } = React.useContext(styled.ThemeContext);
234
- const scheduleUpdateRef = React.useRef();
196
+ const theme = React.useContext(styled.ThemeContext) || reactTheming.DEFAULT_THEME;
197
+ const triggerRef = React.useRef(null);
198
+ const floatingRef = React.useRef(null);
235
199
  const {
236
200
  isVisible,
237
201
  getTooltipProps,
@@ -244,127 +208,82 @@ const Tooltip = _ref => {
244
208
  isVisible: isInitialVisible
245
209
  });
246
210
  const controlledIsVisible = containerUtilities.getControlledValue(externalIsVisible, isVisible);
247
- React.useEffect(() => {
248
- if (controlledIsVisible && scheduleUpdateRef.current) {
249
- scheduleUpdateRef.current();
211
+ const [floatingPlacement] = reactTheming.getFloatingPlacements(theme, _placement === 'auto' ? PLACEMENT_DEFAULT : _placement);
212
+ const {
213
+ refs,
214
+ placement,
215
+ update,
216
+ floatingStyles: {
217
+ transform
250
218
  }
251
- }, [controlledIsVisible, content]);
252
- const popperPlacement = rtl ? getRtlPopperPlacement(placement) : getPopperPlacement(placement);
253
- const singleChild = React__default.default.Children.only(children);
254
- const modifiers = {
255
- preventOverflow: {
256
- boundariesElement: 'window'
219
+ } = reactDom.useFloating({
220
+ platform: {
221
+ ...reactDom.platform,
222
+ isRTL: () => theme.rtl
257
223
  },
258
- ...popperModifiers
259
- };
260
- return React__default.default.createElement(reactPopper.Manager, null, React__default.default.createElement(reactPopper.Reference, null, _ref2 => {
261
- let {
262
- ref
263
- } = _ref2;
264
- return React.cloneElement(singleChild, getTriggerProps({
265
- ...singleChild.props,
266
- [refKey]: reactMergeRefs.mergeRefs([ref, singleChild.ref ? singleChild.ref : null])
267
- }));
268
- }), React__default.default.createElement(reactPopper.Popper, {
269
- placement: popperPlacement,
270
- eventsEnabled: controlledIsVisible && eventsEnabled,
271
- modifiers: modifiers
272
- }, _ref3 => {
273
- let {
274
- ref,
275
- style,
276
- scheduleUpdate,
277
- placement: currentPlacement
278
- } = _ref3;
279
- scheduleUpdateRef.current = scheduleUpdate;
280
- const {
281
- onFocus,
282
- onBlur,
283
- ...otherTooltipProps
284
- } = otherProps;
285
- let computedSize = size;
286
- if (computedSize === undefined) {
287
- if (type === 'dark') {
288
- computedSize = 'small';
289
- } else {
290
- computedSize = 'large';
291
- }
292
- }
293
- const tooltipProps = {
294
- hasArrow,
295
- placement: currentPlacement,
296
- size: computedSize,
297
- onFocus: containerUtilities.composeEventHandlers(onFocus, () => {
298
- openTooltip();
299
- }),
300
- onBlur: containerUtilities.composeEventHandlers(onBlur, () => {
301
- closeTooltip(0);
302
- }),
303
- 'aria-hidden': !controlledIsVisible,
304
- type,
305
- ...otherTooltipProps
306
- };
307
- const tooltip = React__default.default.createElement(StyledTooltipWrapper, {
308
- ref: controlledIsVisible ? ref : null,
309
- style: style,
310
- zIndex: zIndex,
311
- "aria-hidden": !controlledIsVisible
312
- }, React__default.default.createElement(StyledTooltip, getTooltipProps(tooltipProps), content));
313
- if (appendToNode) {
314
- return reactDom.createPortal(tooltip, appendToNode);
224
+ elements: {
225
+ reference: triggerRef?.current,
226
+ floating: floatingRef?.current
227
+ },
228
+ placement: floatingPlacement,
229
+ middleware: _placement === 'auto' ? [reactDom.autoPlacement()] : undefined
230
+ });
231
+ React.useEffect(() => {
232
+ let cleanup;
233
+ if (controlledIsVisible && refs.reference.current && refs.floating.current) {
234
+ cleanup = reactDom.autoUpdate(refs.reference.current, refs.floating.current, update, {
235
+ elementResize: typeof ResizeObserver === 'function'
236
+ });
315
237
  }
316
- return tooltip;
317
- }));
238
+ return () => cleanup && cleanup();
239
+ }, [controlledIsVisible, refs.reference, refs.floating, update]);
240
+ const Child = React__default.default.Children.only(children);
241
+ const Node = React__default.default.createElement(StyledTooltipWrapper, {
242
+ ref: floatingRef,
243
+ style: {
244
+ transform
245
+ },
246
+ zIndex: zIndex,
247
+ "aria-hidden": !controlledIsVisible
248
+ }, React__default.default.createElement(StyledTooltip, getTooltipProps({
249
+ hasArrow,
250
+ placement,
251
+ size: toSize(size, type),
252
+ onFocus: containerUtilities.composeEventHandlers(onFocus, openTooltip),
253
+ onBlur: containerUtilities.composeEventHandlers(onBlur, () => closeTooltip(0)),
254
+ 'aria-hidden': !controlledIsVisible,
255
+ type,
256
+ ...props
257
+ }), content));
258
+ return React__default.default.createElement(React__default.default.Fragment, null, React.cloneElement(Child, getTriggerProps({
259
+ ...Child.props,
260
+ [refKey]: reactMergeRefs.mergeRefs([triggerRef, Child.ref ? Child.ref : null])
261
+ })), appendToNode ? reactDom$1.createPortal(Node, appendToNode) : Node);
318
262
  };
319
- Tooltip.displayName = 'Tooltip';
320
- Tooltip.propTypes = {
263
+ TooltipComponent.displayName = 'Tooltip';
264
+ TooltipComponent.propTypes = {
321
265
  appendToNode: PropTypes__default.default.any,
322
266
  hasArrow: PropTypes__default.default.bool,
323
267
  delayMS: PropTypes__default.default.number,
324
- eventsEnabled: PropTypes__default.default.bool,
325
268
  id: PropTypes__default.default.string,
326
269
  content: PropTypes__default.default.node.isRequired,
327
270
  placement: PropTypes__default.default.oneOf(PLACEMENT),
328
- popperModifiers: PropTypes__default.default.any,
329
271
  size: PropTypes__default.default.oneOf(SIZE),
330
272
  type: PropTypes__default.default.oneOf(TYPE),
331
273
  zIndex: PropTypes__default.default.oneOfType([PropTypes__default.default.number, PropTypes__default.default.string]),
332
274
  isInitialVisible: PropTypes__default.default.bool,
333
275
  refKey: PropTypes__default.default.string
334
276
  };
335
- Tooltip.defaultProps = {
277
+ TooltipComponent.defaultProps = {
336
278
  hasArrow: true,
337
- eventsEnabled: true,
338
279
  type: 'dark',
339
- placement: 'top',
280
+ placement: PLACEMENT_DEFAULT,
340
281
  delayMS: 500,
341
282
  refKey: 'ref'
342
283
  };
343
-
344
- function _extends() {
345
- _extends = Object.assign ? Object.assign.bind() : function (target) {
346
- for (var i = 1; i < arguments.length; i++) {
347
- var source = arguments[i];
348
- for (var key in source) {
349
- if (Object.prototype.hasOwnProperty.call(source, key)) {
350
- target[key] = source[key];
351
- }
352
- }
353
- }
354
- return target;
355
- };
356
- return _extends.apply(this, arguments);
357
- }
358
-
359
- const Paragraph = React.forwardRef((props, ref) => React__default.default.createElement(StyledParagraph, _extends({
360
- ref: ref
361
- }, props)));
362
- Paragraph.displayName = 'Paragraph';
363
-
364
- const Title = React.forwardRef((props, ref) => React__default.default.createElement(StyledTitle, _extends({
365
- ref: ref
366
- }, props)));
367
- Title.displayName = 'Title';
284
+ const Tooltip = TooltipComponent;
285
+ Tooltip.Paragraph = Paragraph;
286
+ Tooltip.Title = Title;
368
287
 
369
288
  exports.Paragraph = Paragraph;
370
289
  exports.Title = Title;
@@ -6,6 +6,8 @@
6
6
  */
7
7
  import React from 'react';
8
8
  /**
9
+ * @deprecated use `Tooltip.Paragraph` instead
10
+ *
9
11
  * @extends HTMLAttributes<HTMLParagraphElement>
10
12
  */
11
13
  export declare const Paragraph: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
@@ -6,6 +6,8 @@
6
6
  */
7
7
  import React from 'react';
8
8
  /**
9
+ * @deprecated use `Tooltip.Title` instead
10
+ *
9
11
  * @extends HTMLAttributes<HTMLDivElement>
10
12
  */
11
13
  export declare const Title: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
@@ -7,21 +7,46 @@
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';
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
+ };
10
37
  /**
11
38
  * @extends HTMLAttributes<HTMLDivElement>
12
39
  */
13
40
  export declare const Tooltip: {
14
- ({ id, delayMS, isInitialVisible, content, refKey, placement, eventsEnabled, popperModifiers, children, hasArrow, size, type, appendToNode, zIndex, isVisible: externalIsVisible, ...otherProps }: ITooltipProps): React.JSX.Element;
41
+ ({ id, delayMS, isInitialVisible, content, refKey, placement: _placement, children, hasArrow, size, type, appendToNode, zIndex, isVisible: externalIsVisible, onFocus, onBlur, ...props }: ITooltipProps): React.JSX.Element;
15
42
  displayName: string;
16
43
  propTypes: {
17
44
  appendToNode: PropTypes.Requireable<any>;
18
45
  hasArrow: PropTypes.Requireable<boolean>;
19
46
  delayMS: PropTypes.Requireable<number>;
20
- eventsEnabled: PropTypes.Requireable<boolean>;
21
47
  id: PropTypes.Requireable<string>;
22
48
  content: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
23
- placement: PropTypes.Requireable<"auto" | "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "end" | "end-top" | "end-bottom" | "start" | "start-top" | "start-bottom">;
24
- popperModifiers: PropTypes.Requireable<any>;
49
+ placement: PropTypes.Requireable<"top" | "auto" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "end" | "end-top" | "end-bottom" | "start" | "start-top" | "start-bottom">;
25
50
  size: PropTypes.Requireable<"small" | "medium" | "large" | "extra-large">;
26
51
  type: PropTypes.Requireable<"light" | "dark">;
27
52
  zIndex: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
@@ -30,10 +55,12 @@ export declare const Tooltip: {
30
55
  };
31
56
  defaultProps: {
32
57
  hasArrow: boolean;
33
- eventsEnabled: boolean;
34
58
  type: string;
35
59
  placement: string;
36
60
  delayMS: number;
37
61
  refKey: string;
38
62
  };
63
+ } & {
64
+ Paragraph: typeof Paragraph;
65
+ Title: typeof Title;
39
66
  };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import { ITooltipProps } from '../types';
8
+ /**
9
+ * Convert to the intended tooltip size for the given type.
10
+ *
11
+ * @param {string} size Tooltip size prop value
12
+ * @param {string} type Tooltip type prop value
13
+ *
14
+ * @returns A tooltip size.
15
+ */
16
+ export declare const toSize: (size: ITooltipProps['size'], type: ITooltipProps['type']) => "small" | "medium" | "large" | "extra-large";
@@ -4,7 +4,7 @@
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
- export { Tooltip } from './elements/Tooltip';
8
7
  export { Paragraph } from './elements/Paragraph';
9
8
  export { Title } from './elements/Title';
9
+ export { Tooltip } from './elements/Tooltip';
10
10
  export type { ITooltipProps } from './types';
@@ -5,10 +5,10 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import { DefaultTheme } from 'styled-components';
8
- import { ITooltipProps, POPPER_PLACEMENT } from '../types';
8
+ import { Placement } from '@floating-ui/react-dom';
9
+ import { ITooltipProps } from '../types';
9
10
  interface IStyledTooltipProps extends Pick<ITooltipProps, 'hasArrow' | 'size' | 'zIndex'> {
10
- /** All valid [Popper.JS Placements](https://popper.js.org/popper-documentation.html#Popper.placements) */
11
- placement: (typeof POPPER_PLACEMENT)[number];
11
+ placement: Placement;
12
12
  type: NonNullable<ITooltipProps['type']>;
13
13
  }
14
14
  /**
@@ -4,15 +4,6 @@
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
- /**
8
- * This wrapper allows the StyledTooltip to retain it's relative positioning.
9
- * Without this container Popper would apply absolute positioning directly to
10
- * the StyledTooltip which impacts arrow styling.
11
- *
12
- * 1. This wrapper also includes an opacity transition. It allows Popper to
13
- * reposition the tooltip without having a visible shift. The transition
14
- * is fast enough that it should not be perceptible.
15
- */
16
7
  export declare const StyledTooltipWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
17
8
  zIndex?: string | number | undefined;
18
9
  }, never>;
@@ -5,13 +5,10 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import { HTMLAttributes, ReactElement, ReactNode } from 'react';
8
- import { Modifiers } from 'popper.js';
9
8
  export declare const PLACEMENT: readonly ["auto", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "end", "end-top", "end-bottom", "start", "start-top", "start-bottom"];
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
9
  export declare const SIZE: readonly ["small", "medium", "large", "extra-large"];
12
10
  export declare const TYPE: readonly ["light", "dark"];
13
11
  export type GardenPlacement = (typeof PLACEMENT)[number];
14
- export type PopperPlacement = (typeof POPPER_PLACEMENT)[number];
15
12
  export interface ITooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
16
13
  /** Appends the tooltip to the element provided */
17
14
  appendToNode?: Element;
@@ -19,16 +16,10 @@ export interface ITooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'con
19
16
  hasArrow?: boolean;
20
17
  /** Adds milliseconds of delay to the opening and closing of the tooltip */
21
18
  delayMS?: number;
22
- /** Allows the tooltip to reposition during browser resize events */
23
- eventsEnabled?: boolean;
24
19
  /** Defines the content of the tooltip */
25
20
  content: ReactNode;
26
- /**
27
- * Adjusts the placement of the tooltip
28
- **/
21
+ /** Adjusts the placement of the tooltip */
29
22
  placement?: GardenPlacement;
30
- /** Passes configurations to the [Popper instance](https://popper.js.org/docs/v2/modifiers/) */
31
- popperModifiers?: Modifiers;
32
23
  /** Adjusts the padding and font size */
33
24
  size?: (typeof SIZE)[number];
34
25
  /** Specifies the tooltip type */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-tooltips",
3
- "version": "9.0.0-next.0",
3
+ "version": "9.0.0-next.10",
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>",
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/zendeskgarden/react-components/issues"
11
11
  },
12
12
  "main": "dist/index.cjs.js",
13
- "module": "dist/index.esm.js",
13
+ "module": "dist/esm/index.js",
14
14
  "files": [
15
15
  "dist"
16
16
  ],
@@ -21,21 +21,21 @@
21
21
  "sideEffects": false,
22
22
  "types": "dist/typings/index.d.ts",
23
23
  "dependencies": {
24
+ "@floating-ui/react-dom": "^2.0.0",
24
25
  "@zendeskgarden/container-tooltip": "^1.0.0",
25
26
  "@zendeskgarden/container-utilities": "^2.0.0",
26
27
  "polished": "^4.0.0",
27
28
  "prop-types": "^15.5.7",
28
- "react-merge-refs": "^2.0.0",
29
- "react-popper": "^1.3.4"
29
+ "react-merge-refs": "^2.0.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "@zendeskgarden/react-theming": "^8.1.0",
32
+ "@zendeskgarden/react-theming": ">=9.0.0-next",
33
33
  "react": ">=16.8.0",
34
34
  "react-dom": ">=16.8.0",
35
- "styled-components": "^4.2.0 || ^5.0.0"
35
+ "styled-components": "^5.3.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@zendeskgarden/react-theming": "^9.0.0-next.0"
38
+ "@zendeskgarden/react-theming": "^9.0.0-next.10"
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": "7145e970afa57b024ab7d505f2220a656e430c04"
50
+ "gitHead": "818e6100aa6676af7e972198b82516d330307d60"
51
51
  }