@codecademy/gamut 72.2.3-alpha.c298d6.0 → 72.2.3-alpha.ca9682.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.
@@ -16,7 +16,6 @@ export const IconButton = /*#__PURE__*/forwardRef(({
16
16
  const iconSize = iconSizeMapping[buttonSize];
17
17
  return /*#__PURE__*/_jsx(ToolTip, {
18
18
  info: tip,
19
- closeOnClick: true,
20
19
  ...tipProps,
21
20
  children: /*#__PURE__*/_jsx(IconButtonBase, {
22
21
  ...props,
@@ -1,12 +1,7 @@
1
1
  import { WithChildrenProp } from '../../utils';
2
- import { TipCenterAlignment, TipNewBaseProps } from '../shared/types';
3
- export type ToolTipProps = TipNewBaseProps & WithChildrenProp & {
2
+ import { TipBaseProps, TipCenterAlignment } from '../shared/types';
3
+ export type ToolTipProps = TipBaseProps & WithChildrenProp & {
4
4
  alignment?: TipCenterAlignment;
5
- /**
6
- * If true, the tooltip closes immediately when the trigger is clicked or activated via keyboard.
7
- * Pass `false` via `tipProps` on IconButton to opt out (e.g. copy → copied patterns).
8
- */
9
- closeOnClick?: boolean;
10
5
  /**
11
6
  * Can be used for accessibility - the same id needs to be passed to the `aria-describedby` attribute of the element that the tooltip is describing.
12
7
  */
@@ -11,7 +11,6 @@ export const FloatingTip = ({
11
11
  alignment,
12
12
  avatar,
13
13
  children,
14
- closeOnClick,
15
14
  escapeKeyPressHandler,
16
15
  inheritDims,
17
16
  info,
@@ -102,19 +101,6 @@ export const FloatingTip = ({
102
101
  const isHoverType = type === 'tool' || type === 'preview';
103
102
  const isPreviewType = type === 'preview';
104
103
  const toolOnlyEventFunc = isHoverType ? e => handleShowHideAction(e) : undefined;
105
- const handleClick = useCallback(() => {
106
- if (hoverDelayRef.current) {
107
- clearTimeout(hoverDelayRef.current);
108
- hoverDelayRef.current = undefined;
109
- }
110
- if (focusDelayRef.current) {
111
- clearTimeout(focusDelayRef.current);
112
- focusDelayRef.current = undefined;
113
- }
114
- setIsOpen(false);
115
- setIsFocused(false);
116
- }, []);
117
- const clickHandler = closeOnClick && isHoverType ? handleClick : undefined;
118
104
  const contents = isPreviewType ? /*#__PURE__*/_jsx(PreviewTipContents, {
119
105
  avatar: avatar,
120
106
  info: info,
@@ -136,7 +122,6 @@ export const FloatingTip = ({
136
122
  ref: ref,
137
123
  width: inheritDims ? 'inherit' : undefined,
138
124
  onBlur: toolOnlyEventFunc,
139
- onClick: clickHandler,
140
125
  onFocus: toolOnlyEventFunc,
141
126
  onKeyDown: escapeKeyPressHandler,
142
127
  onMouseDown: e => e.preventDefault(),
@@ -1,4 +1,3 @@
1
- import { useCallback, useState } from 'react';
2
1
  import { InfoTipContainer } from '../InfoTip/styles';
3
2
  import { PreviewTipContents, PreviewTipShadow } from '../PreviewTip/elements';
4
3
  import { ToolTipContainer } from '../ToolTip/elements';
@@ -10,7 +9,6 @@ export const InlineTip = ({
10
9
  alignment,
11
10
  avatar,
12
11
  children,
13
- closeOnClick,
14
12
  escapeKeyPressHandler,
15
13
  id,
16
14
  inheritDims,
@@ -27,12 +25,6 @@ export const InlineTip = ({
27
25
  zIndex
28
26
  }) => {
29
27
  const isHoverType = type === 'tool' || type === 'preview';
30
- const [isSuppressed, setIsSuppressed] = useState(false);
31
- const handleClick = useCallback(() => {
32
- if (closeOnClick) setIsSuppressed(true);
33
- }, [closeOnClick]);
34
- const handleBlur = useCallback(() => setIsSuppressed(false), []);
35
- const handleMouseLeave = useCallback(() => setIsSuppressed(false), []);
36
28
  const InlineTipWrapper = isHoverType ? ToolTipWrapper : InfoTipWrapper;
37
29
  const InlineTipBodyWrapper = isHoverType ? ToolTipContainer : InfoTipContainer;
38
30
  const inlineWrapperProps = isHoverType ? {} : {
@@ -47,17 +39,10 @@ export const InlineTip = ({
47
39
  type
48
40
  });
49
41
  const isHorizontalCenter = tipBodyAlignment === 'horizontalCenter';
50
- const suppressedBodyStyle = isHoverType && isSuppressed ? {
51
- opacity: 0,
52
- visibility: 'hidden',
53
- transition: 'none'
54
- } : undefined;
55
42
  const target = /*#__PURE__*/_jsx(TargetContainer, {
56
43
  height: inheritDims ? 'inherit' : undefined,
57
44
  ref: wrapperRef,
58
45
  width: inheritDims ? 'inherit' : undefined,
59
- onBlur: isHoverType ? handleBlur : undefined,
60
- onClick: isHoverType ? handleClick : undefined,
61
46
  onKeyDown: escapeKeyPressHandler,
62
47
  children: children
63
48
  });
@@ -65,7 +50,6 @@ export const InlineTip = ({
65
50
  alignment: alignment,
66
51
  zIndex: zIndex ?? 1,
67
52
  ...inlineWrapperProps,
68
- style: suppressedBodyStyle,
69
53
  children: /*#__PURE__*/_jsx(TipBody, {
70
54
  alignment: tipBodyAlignment,
71
55
  "aria-hidden": isHoverType,
@@ -94,7 +78,6 @@ export const InlineTip = ({
94
78
  });
95
79
  return /*#__PURE__*/_jsx(InlineTipWrapper, {
96
80
  ...tipWrapperProps,
97
- onMouseLeave: isHoverType ? handleMouseLeave : undefined,
98
81
  children: alignment.includes('top') ? /*#__PURE__*/_jsxs(_Fragment, {
99
82
  children: [tipBody, target]
100
83
  }) : /*#__PURE__*/_jsxs(_Fragment, {
@@ -47,7 +47,6 @@ export type TipPlacementComponentProps = Omit<TipNewBaseProps, 'placement' | 'em
47
47
  id?: string;
48
48
  isTipHidden?: boolean;
49
49
  contentRef?: React.RefObject<HTMLDivElement> | ((node: HTMLDivElement | null) => void);
50
- closeOnClick?: boolean;
51
50
  type: 'info' | 'tool' | 'preview';
52
51
  wrapperRef?: React.RefObject<HTMLDivElement>;
53
52
  zIndex?: number;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@codecademy/gamut",
3
3
  "description": "Styleguide & Component library for Codecademy",
4
- "version": "72.2.3-alpha.c298d6.0",
4
+ "version": "72.2.3-alpha.ca9682.0",
5
5
  "author": "Codecademy Engineering <dev@codecademy.com>",
6
6
  "bin": "./bin/gamut.mjs",
7
7
  "dependencies": {
8
- "@codecademy/gamut-icons": "9.57.10-alpha.c298d6.0",
9
- "@codecademy/gamut-illustrations": "0.58.16-alpha.c298d6.0",
10
- "@codecademy/gamut-patterns": "0.10.35-alpha.c298d6.0",
11
- "@codecademy/gamut-styles": "20.0.3-alpha.c298d6.0",
12
- "@codecademy/variance": "0.26.2-alpha.c298d6.0",
8
+ "@codecademy/gamut-icons": "9.57.10-alpha.ca9682.0",
9
+ "@codecademy/gamut-illustrations": "0.58.16-alpha.ca9682.0",
10
+ "@codecademy/gamut-patterns": "0.10.35-alpha.ca9682.0",
11
+ "@codecademy/gamut-styles": "20.0.3-alpha.ca9682.0",
12
+ "@codecademy/variance": "0.26.2-alpha.ca9682.0",
13
13
  "@formatjs/intl-locale": "5.3.1",
14
14
  "@react-aria/interactions": "3.25.0",
15
15
  "@types/marked": "^4.0.8",