@mirohq/design-system-tooltip 3.3.26 → 3.3.27-tooltip.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/main.js CHANGED
@@ -4,10 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
- var designSystemUseId = require('@mirohq/design-system-use-id');
8
7
  var reactTooltip = require('@radix-ui/react-tooltip');
9
8
  var designSystemStitches = require('@mirohq/design-system-stitches');
10
9
  var designSystemUtils = require('@mirohq/design-system-utils');
10
+ var interactions = require('@react-aria/interactions');
11
+ var utils = require('@react-aria/utils');
11
12
  var designSystemBaseHotkey = require('@mirohq/design-system-base-hotkey');
12
13
  var designSystemPrimitive = require('@mirohq/design-system-primitive');
13
14
 
@@ -110,13 +111,29 @@ Content.displayName = "Tooltip.Content";
110
111
  const StyledTrigger = designSystemStitches.styled(reactTooltip.Trigger);
111
112
 
112
113
  const Trigger = React__default["default"].forwardRef(({ onPress, onClick, ...restProps }, forwardRef) => {
113
- const { triggerRef, id } = React.useContext(TooltipTriggerContext);
114
+ const { triggerRef, hoveredRef, focusedRef } = React.useContext(
115
+ TooltipTriggerContext
116
+ );
117
+ const { hoverProps } = interactions.useHover({
118
+ onHoverStart: () => {
119
+ hoveredRef.current = true;
120
+ },
121
+ onHoverEnd: () => {
122
+ hoveredRef.current = false;
123
+ }
124
+ });
114
125
  return /* @__PURE__ */ jsxRuntime.jsx(
115
126
  StyledTrigger,
116
127
  {
117
- ...restProps,
128
+ ...utils.mergeProps(restProps, hoverProps, {
129
+ onFocus: () => {
130
+ focusedRef.current = true;
131
+ },
132
+ onBlur: () => {
133
+ focusedRef.current = false;
134
+ }
135
+ }),
118
136
  onClick: onPress != null ? onPress : onClick,
119
- "data-tooltip-trigger": id,
120
137
  ref: designSystemUtils.mergeRefs([triggerRef, forwardRef])
121
138
  }
122
139
  );
@@ -145,7 +162,9 @@ let shouldSkipDelay = false;
145
162
  const DEFAULT_SKIP_DELAY_DURATION = 500;
146
163
  const DEFAULT_DELAY_DURATION = 200;
147
164
  const TooltipTriggerContext = React.createContext({
148
- triggerRef: { current: null }
165
+ triggerRef: { current: null },
166
+ hoveredRef: { current: false },
167
+ focusedRef: { current: false }
149
168
  });
150
169
  const Tooltip = ({
151
170
  defaultOpen = false,
@@ -162,14 +181,15 @@ const Tooltip = ({
162
181
  const context = useTooltipContext();
163
182
  const isMounted = React.useRef(false);
164
183
  const _skipDelayDuration = (_a = skipDelayDuration != null ? skipDelayDuration : context.skipDelayDuration) != null ? _a : DEFAULT_SKIP_DELAY_DURATION;
165
- const triggerId = designSystemUseId.useId();
184
+ const triggerRef = React.useRef(null);
185
+ const hoveredRef = React.useRef(false);
186
+ const focusedRef = React.useRef(false);
166
187
  const [openState, setOpenState] = React.useState(defaultOpen);
167
188
  const setDelayedOpen = React.useCallback(
168
189
  (newOpenState) => {
169
190
  var _a2;
170
191
  clearTimeout(delayTimer);
171
192
  clearTimeout(skipDelayTimer);
172
- const triggerSelector = '[data-tooltip-trigger="'.concat(triggerId, '"]');
173
193
  if (!newOpenState) {
174
194
  skipDelayTimer = setTimeout(() => {
175
195
  shouldSkipDelay = false;
@@ -178,12 +198,12 @@ const Tooltip = ({
178
198
  onClose == null ? void 0 : onClose();
179
199
  return;
180
200
  }
181
- if (shouldSkipDelay || document.querySelector("".concat(triggerSelector, ":focus")) != null) {
201
+ if (shouldSkipDelay || focusedRef.current) {
182
202
  setOpenState(newOpenState);
183
203
  return;
184
204
  }
185
205
  delayTimer = setTimeout(() => {
186
- if (document.querySelector("".concat(triggerSelector, ":hover")) == null && process.env.NODE_ENV !== "test") {
206
+ if (!hoveredRef.current && process.env.NODE_ENV !== "test") {
187
207
  return;
188
208
  }
189
209
  shouldSkipDelay = _skipDelayDuration !== 0;
@@ -193,14 +213,7 @@ const Tooltip = ({
193
213
  }
194
214
  }, (_a2 = delayDuration != null ? delayDuration : context.delayDuration) != null ? _a2 : DEFAULT_DELAY_DURATION);
195
215
  },
196
- [
197
- delayDuration,
198
- context.delayDuration,
199
- _skipDelayDuration,
200
- onClose,
201
- onOpen,
202
- triggerId
203
- ]
216
+ [delayDuration, context.delayDuration, _skipDelayDuration, onClose, onOpen]
204
217
  );
205
218
  const handleOpenChange = React.useCallback(
206
219
  (newState) => {
@@ -228,13 +241,13 @@ const Tooltip = ({
228
241
  isMounted.current = false;
229
242
  };
230
243
  }, []);
231
- const triggerRef = React.useRef(null);
232
244
  return /* @__PURE__ */ jsxRuntime.jsx(reactTooltip.Provider, { delayDuration: 0, skipDelayDuration: 0, children: /* @__PURE__ */ jsxRuntime.jsx(
233
245
  TooltipTriggerContext.Provider,
234
246
  {
235
247
  value: {
236
- id: triggerId,
237
- triggerRef
248
+ triggerRef,
249
+ hoveredRef,
250
+ focusedRef
238
251
  },
239
252
  children: /* @__PURE__ */ jsxRuntime.jsx(
240
253
  reactTooltip.Root,
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sources":["../src/partials/content.styled.tsx","../src/partials/content.tsx","../src/partials/trigger.styled.tsx","../src/partials/trigger.tsx","../src/partials/provider.tsx","../src/partials/portal.tsx","../src/partials/hotkey.styled.tsx","../src/partials/hotkey.tsx","../src/tooltip.tsx"],"sourcesContent":["import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport {\n Content as RadixContent,\n Arrow as RadixArrow,\n} from '@radix-ui/react-tooltip'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledArrowIcon = styled(RadixArrow, {\n fill: '$black',\n height: '5px',\n transform: 'translateY(-1px)',\n width: '15px',\n})\n\nexport const StyledContent = styled(RadixContent, {\n backgroundColor: '$black',\n borderRadius: '$50',\n color: '$white',\n fontSize: '14px',\n fontWeight: '400',\n lineHeight: '20px',\n fontFamily: 'inherit',\n padding: '$150',\n zIndex: '$tooltip',\n})\n\nexport type StyledContentProps = StrictComponentProps<typeof StyledContent>\n","import type { ElementRef } from 'react'\nimport React, { useContext, useEffect } from 'react'\n\nimport { StyledContent, StyledArrowIcon } from './content.styled'\nimport type { StyledContentProps } from './content.styled'\nimport type { PointerDownOutsideEvent, Side, Align } from '../types'\nimport { TooltipTriggerContext } from '../tooltip'\n\nexport interface ContentProps extends StyledContentProps {\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n * @default 'center'\n */\n align?: Align\n\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: number\n\n /**\n * The distance in pixels from the trigger.\n * @default 5\n */\n sideOffset?: number\n\n /** The preferred side of the trigger to render against when open.\n * Will be reversed when collisions occur and avoidCollisions is enabled.\n * @default 'top'\n */\n side?: Side\n\n /**\n * When true, overrides the side and align preferences to prevent collisions\n * with window edges.\n * @default true\n */\n avoidCollisions?: boolean\n\n /**\n * The distance in pixels from window edges where collision detection should\n * occur.\n * @default 0\n */\n collisionPadding?: number\n\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries. It inherits from Tooltip.Portal.\n */\n forceMount?: true\n\n /**\n * The element used as the collision boundary. By default this is the\n * viewport, though you can provide additional element(s) to be included in\n * this check.\n */\n collisionBoundary?: Element | null\n\n /**\n * The sticky behavior on the align axis. \"partial\" will keep the content in\n * the boundary as long as the trigger is at least partially in the boundary\n * whilst \"always\" will keep the content in the boundary regardless.\n * @default 'partial'\n */\n sticky?: 'partial' | 'always'\n\n /**\n * Whether to hide the content when the trigger becomes fully occluded.\n * @default true (false in test environment)\n */\n hideWhenDetached?: boolean\n\n /**\n * Event handler called when the escape key is down. It can be prevented by\n * calling event.preventDefault.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n\n /**\n * Event handler called when a pointer event occurs outside the bounds of the\n * component. It can be prevented by calling event.preventDefault.\n */\n onPointerDownOutside?: (event: PointerDownOutsideEvent) => void\n}\n\nexport const Content = React.forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(\n (\n {\n align = 'center',\n alignOffset = 0,\n avoidCollisions = true,\n collisionPadding = 0,\n children,\n side = 'top',\n sideOffset = 5,\n sticky = 'partial',\n hideWhenDetached = process.env.NODE_ENV !== 'test',\n ...restProps\n },\n forwardRef\n ) => {\n const { triggerRef } = useContext(TooltipTriggerContext)\n\n const removeDuplicateAriaDescription = (element: Element): void => {\n const ariaDescribedBy: string | null =\n element.getAttribute('aria-describedby')\n\n if (ariaDescribedBy !== null) {\n const ariaDescription: string | null | undefined =\n document.getElementById(ariaDescribedBy)?.textContent\n\n const areAriaLabelAndAriaDescriptionEqual =\n ariaDescription?.trim() ===\n element?.getAttribute('aria-label')?.trim()\n\n if (areAriaLabelAndAriaDescriptionEqual) {\n element.removeAttribute('aria-describedby')\n }\n }\n }\n useEffect((): (() => void) => {\n const element = triggerRef.current\n\n if (element != null) {\n const handleMutation = (mutationsList: MutationRecord[]): void => {\n for (const mutation of mutationsList) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'aria-describedby'\n ) {\n removeDuplicateAriaDescription(element)\n }\n }\n }\n\n const observer = new MutationObserver(handleMutation)\n\n observer.observe(element, {\n attributes: true,\n })\n\n return () => {\n observer.disconnect()\n }\n }\n\n return () => {}\n }, [triggerRef])\n\n useEffect(() => {\n if (triggerRef.current === null) return\n removeDuplicateAriaDescription(triggerRef.current)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return (\n <StyledContent\n {...restProps}\n ref={forwardRef}\n align={align}\n alignOffset={alignOffset}\n avoidCollisions={avoidCollisions}\n collisionPadding={collisionPadding}\n hideWhenDetached={hideWhenDetached}\n side={side}\n sideOffset={sideOffset}\n sticky={sticky}\n >\n {children}\n <StyledArrowIcon />\n </StyledContent>\n )\n }\n)\n\nContent.displayName = 'Tooltip.Content'\n","import { styled } from '@mirohq/design-system-stitches'\nimport { Trigger } from '@radix-ui/react-tooltip'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledTrigger = styled(Trigger)\n\nexport type StyledTriggerProps = StrictComponentProps<typeof StyledTrigger>\n","import React, { useContext } from 'react'\nimport type { ElementRef, DOMAttributes } from 'react'\nimport { mergeRefs } from '@mirohq/design-system-utils'\n\nimport { StyledTrigger } from './trigger.styled'\nimport type { StyledTriggerProps } from './trigger.styled'\nimport { TooltipTriggerContext } from '../tooltip'\n\nexport interface TriggerProps extends StyledTriggerProps {\n /**\n * temporary the same as onClick, later will be added touch events support\n */\n onPress?: DOMAttributes<HTMLElement>['onClick']\n}\n\nexport const Trigger = React.forwardRef<\n ElementRef<typeof StyledTrigger>,\n TriggerProps\n>(({ onPress, onClick, ...restProps }, forwardRef) => {\n const { triggerRef, id } = useContext(TooltipTriggerContext)\n return (\n <StyledTrigger\n {...restProps}\n onClick={onPress ?? onClick}\n data-tooltip-trigger={id}\n ref={mergeRefs([triggerRef, forwardRef])}\n />\n )\n})\n\nTrigger.displayName = 'Tooltip.Trigger'\n","import React, { createContext, useContext } from 'react'\n\nexport interface ProviderProps {\n /**\n * The duration from when the mouse enters a tooltip trigger until\n * the tooltip opens.\n */\n delayDuration?: number\n\n /**\n * How much time a user has to enter another trigger without incurring\n * a delay again.\n * When set to `0`, when hovering between triggers there wont be delay duration.\n * @default 500\n */\n skipDelayDuration?: number\n\n /**\n * The content\n */\n children?: React.ReactNode\n}\n\nexport const ProviderContext = createContext<ProviderProps>({} as any)\n\nexport const Provider: React.FC<ProviderProps> = ({\n children,\n ...restProps\n}) => (\n <ProviderContext.Provider value={restProps}>\n {children}\n </ProviderContext.Provider>\n)\n\nProvider.displayName = 'Tooltip.Provider'\n\nexport const useTooltipContext = (): ProviderProps =>\n useContext(ProviderContext)\n","import React from 'react'\nimport type { TooltipPortalProps } from '@radix-ui/react-tooltip'\nimport { Portal as RadixPortal } from '@radix-ui/react-tooltip'\n\nexport interface PortalProps extends TooltipPortalProps {\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries. If used on this part, it will be\n * inherited by Tooltip.Content.\n */\n forceMount?: true\n\n /**\n * Specify a container element to portal the content into.\n */\n container?: HTMLElement | null\n}\n\nexport const Portal: React.FC<PortalProps> = props => <RadixPortal {...props} />\n","import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const StyledHotkey = styled(Primitive.span, {\n marginLeft: '$100',\n})\n\nexport type StyledHotkeyProps = StrictComponentProps<typeof StyledHotkey>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Hotkey as BaseHotkey } from '@mirohq/design-system-base-hotkey'\n\nimport type { StyledHotkeyProps } from './hotkey.styled'\nimport { StyledHotkey } from './hotkey.styled'\n\nexport interface HotkeyProps extends StyledHotkeyProps {\n /**\n * The content.\n */\n children: string\n}\n\nexport const Hotkey = React.forwardRef<\n ElementRef<typeof StyledHotkey>,\n HotkeyProps\n>(({ children, ...restProps }, forwardRef) => (\n <StyledHotkey {...restProps} ref={forwardRef}>\n <BaseHotkey variant='inverted'>{children}</BaseHotkey>\n </StyledHotkey>\n))\n","import React, {\n useState,\n useCallback,\n useEffect,\n useRef,\n createContext,\n} from 'react'\nimport { useId } from '@mirohq/design-system-use-id'\nimport {\n Provider as RadixProvider,\n Root as RadixTooltip,\n} from '@radix-ui/react-tooltip'\n\nimport { Content } from './partials/content'\nimport { Trigger } from './partials/trigger'\nimport { Provider, useTooltipContext } from './partials/provider'\nimport { Portal } from './partials/portal'\nimport { Hotkey } from './partials/hotkey'\n\nexport interface TooltipProps {\n /**\n * The open state of the tooltip when it is initially rendered. Use when you\n * do not need to control its open state.\n */\n defaultOpen?: boolean\n\n /**\n * The current state of the tooltip.\n */\n open?: boolean\n\n /**\n * Event handler called when the tooltip opens.\n */\n onOpen?: () => void\n\n /**\n * Event handler called when the tooltip closes.\n */\n onClose?: () => void\n\n /**\n * Overrides the duration given to the `Provider` to customize the open delay\n * for a specific tooltip.\n * @default 200\n */\n delayDuration?: number\n\n /**\n * How much time a user has to enter another trigger without incurring\n * a delay again.\n * @default 500\n */\n skipDelayDuration?: number\n\n /**\n * Clears the delayDuration and skipDelayDuration timeouts when the component\n * is unmounted. This flag is `true` by default when using NODE_ENV=test.\n * @default false\n */\n clearDelaysOnUnmount?: boolean\n\n /**\n * Closes the tooltip as soon as the pointer leaves the trigger making it\n * impossible to hover the content.\n */\n disableHoverableContent?: boolean\n\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nlet delayTimer: ReturnType<typeof setTimeout> | undefined\nlet skipDelayTimer: ReturnType<typeof setTimeout> | undefined\nlet shouldSkipDelay = false\n\nexport const DEFAULT_SKIP_DELAY_DURATION = 500\nexport const DEFAULT_DELAY_DURATION = 200\n\nexport const TooltipTriggerContext = createContext<{\n triggerRef: React.RefObject<HTMLButtonElement>\n id?: string\n}>({\n triggerRef: { current: null },\n})\n\nexport const Tooltip: React.FC<TooltipProps> & Partials = ({\n defaultOpen = false,\n open,\n onOpen,\n onClose,\n skipDelayDuration,\n delayDuration,\n disableHoverableContent,\n clearDelaysOnUnmount = process.env.NODE_ENV === 'test',\n children,\n}) => {\n const context = useTooltipContext()\n const isMounted = useRef(false)\n const _skipDelayDuration =\n skipDelayDuration ??\n context.skipDelayDuration ??\n DEFAULT_SKIP_DELAY_DURATION\n\n const triggerId = useId()\n\n const [openState, setOpenState] = useState(defaultOpen)\n const setDelayedOpen = useCallback(\n (newOpenState: boolean) => {\n clearTimeout(delayTimer)\n clearTimeout(skipDelayTimer)\n\n const triggerSelector = `[data-tooltip-trigger=\"${triggerId}\"]`\n\n if (!newOpenState) {\n skipDelayTimer = setTimeout(() => {\n shouldSkipDelay = false\n }, _skipDelayDuration)\n setOpenState(false)\n onClose?.()\n return\n }\n\n if (\n shouldSkipDelay ||\n document.querySelector(`${triggerSelector}:focus`) != null\n ) {\n setOpenState(newOpenState)\n return\n }\n\n delayTimer = setTimeout(() => {\n // ignore it if the the user quickly hover the trigger and leave before the timeout\n // (unfortunately JSDOM seems not to support :hover selector)\n if (\n document.querySelector(`${triggerSelector}:hover`) == null &&\n process.env.NODE_ENV !== 'test'\n ) {\n return\n }\n\n /* when skipDelayDuration is 0 no skip delay should happen. */\n shouldSkipDelay = _skipDelayDuration !== 0\n\n if (isMounted.current) {\n setOpenState(true)\n onOpen?.()\n }\n }, delayDuration ?? context.delayDuration ?? DEFAULT_DELAY_DURATION)\n },\n [\n delayDuration,\n context.delayDuration,\n _skipDelayDuration,\n onClose,\n onOpen,\n triggerId,\n ]\n )\n\n const handleOpenChange = useCallback(\n (newState: boolean) => {\n if (open == null) {\n setDelayedOpen(newState)\n return\n }\n\n newState ? onOpen?.() : onClose?.()\n },\n [open, onOpen, onClose, setDelayedOpen]\n )\n\n useEffect(\n () => () => {\n if (clearDelaysOnUnmount) {\n clearTimeout(delayTimer)\n clearTimeout(skipDelayTimer)\n shouldSkipDelay = false\n }\n },\n [clearDelaysOnUnmount]\n )\n\n useEffect(() => {\n isMounted.current = true\n return () => {\n isMounted.current = false\n }\n }, [])\n\n const triggerRef = useRef<HTMLButtonElement>(null)\n\n return (\n <RadixProvider delayDuration={0} skipDelayDuration={0}>\n <TooltipTriggerContext.Provider\n value={{\n id: triggerId,\n triggerRef,\n }}\n >\n <RadixTooltip\n disableHoverableContent={disableHoverableContent}\n open={open ?? openState}\n delayDuration={0} // we control it manually\n onOpenChange={handleOpenChange}\n >\n {children}\n </RadixTooltip>\n </TooltipTriggerContext.Provider>\n </RadixProvider>\n )\n}\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Trigger: typeof Trigger\n Content: typeof Content\n Provider: typeof Provider\n Portal: typeof Portal\n Hotkey: typeof Hotkey\n}\n\nTooltip.Trigger = Trigger\nTooltip.Content = Content\nTooltip.Provider = Provider\nTooltip.Portal = Portal\nTooltip.Hotkey = Hotkey\n"],"names":["styled","RadixArrow","RadixContent","React","useContext","useEffect","jsxs","Trigger","jsx","mergeRefs","createContext","RadixPortal","Primitive","BaseHotkey","use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;AACjB,OAAA,CAAQ,MAAS,GAAA,MAAA;;;;;;;;;;;"}
1
+ {"version":3,"file":"main.js","sources":["../src/partials/content.styled.tsx","../src/partials/content.tsx","../src/partials/trigger.styled.tsx","../src/partials/trigger.tsx","../src/partials/provider.tsx","../src/partials/portal.tsx","../src/partials/hotkey.styled.tsx","../src/partials/hotkey.tsx","../src/tooltip.tsx"],"sourcesContent":["import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport {\n Content as RadixContent,\n Arrow as RadixArrow,\n} from '@radix-ui/react-tooltip'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledArrowIcon = styled(RadixArrow, {\n fill: '$black',\n height: '5px',\n transform: 'translateY(-1px)',\n width: '15px',\n})\n\nexport const StyledContent = styled(RadixContent, {\n backgroundColor: '$black',\n borderRadius: '$50',\n color: '$white',\n fontSize: '14px',\n fontWeight: '400',\n lineHeight: '20px',\n fontFamily: 'inherit',\n padding: '$150',\n zIndex: '$tooltip',\n})\n\nexport type StyledContentProps = StrictComponentProps<typeof StyledContent>\n","import type { ElementRef } from 'react'\nimport React, { useContext, useEffect } from 'react'\n\nimport { StyledContent, StyledArrowIcon } from './content.styled'\nimport type { StyledContentProps } from './content.styled'\nimport type { PointerDownOutsideEvent, Side, Align } from '../types'\nimport { TooltipTriggerContext } from '../tooltip'\n\nexport interface ContentProps extends StyledContentProps {\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n * @default 'center'\n */\n align?: Align\n\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: number\n\n /**\n * The distance in pixels from the trigger.\n * @default 5\n */\n sideOffset?: number\n\n /** The preferred side of the trigger to render against when open.\n * Will be reversed when collisions occur and avoidCollisions is enabled.\n * @default 'top'\n */\n side?: Side\n\n /**\n * When true, overrides the side and align preferences to prevent collisions\n * with window edges.\n * @default true\n */\n avoidCollisions?: boolean\n\n /**\n * The distance in pixels from window edges where collision detection should\n * occur.\n * @default 0\n */\n collisionPadding?: number\n\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries. It inherits from Tooltip.Portal.\n */\n forceMount?: true\n\n /**\n * The element used as the collision boundary. By default this is the\n * viewport, though you can provide additional element(s) to be included in\n * this check.\n */\n collisionBoundary?: Element | null\n\n /**\n * The sticky behavior on the align axis. \"partial\" will keep the content in\n * the boundary as long as the trigger is at least partially in the boundary\n * whilst \"always\" will keep the content in the boundary regardless.\n * @default 'partial'\n */\n sticky?: 'partial' | 'always'\n\n /**\n * Whether to hide the content when the trigger becomes fully occluded.\n * @default true (false in test environment)\n */\n hideWhenDetached?: boolean\n\n /**\n * Event handler called when the escape key is down. It can be prevented by\n * calling event.preventDefault.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n\n /**\n * Event handler called when a pointer event occurs outside the bounds of the\n * component. It can be prevented by calling event.preventDefault.\n */\n onPointerDownOutside?: (event: PointerDownOutsideEvent) => void\n}\n\nexport const Content = React.forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(\n (\n {\n align = 'center',\n alignOffset = 0,\n avoidCollisions = true,\n collisionPadding = 0,\n children,\n side = 'top',\n sideOffset = 5,\n sticky = 'partial',\n hideWhenDetached = process.env.NODE_ENV !== 'test',\n ...restProps\n },\n forwardRef\n ) => {\n const { triggerRef } = useContext(TooltipTriggerContext)\n\n const removeDuplicateAriaDescription = (element: Element): void => {\n const ariaDescribedBy: string | null =\n element.getAttribute('aria-describedby')\n\n if (ariaDescribedBy !== null) {\n const ariaDescription: string | null | undefined =\n document.getElementById(ariaDescribedBy)?.textContent\n\n const areAriaLabelAndAriaDescriptionEqual =\n ariaDescription?.trim() ===\n element?.getAttribute('aria-label')?.trim()\n\n if (areAriaLabelAndAriaDescriptionEqual) {\n element.removeAttribute('aria-describedby')\n }\n }\n }\n useEffect((): (() => void) => {\n const element = triggerRef.current\n\n if (element != null) {\n const handleMutation = (mutationsList: MutationRecord[]): void => {\n for (const mutation of mutationsList) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'aria-describedby'\n ) {\n removeDuplicateAriaDescription(element)\n }\n }\n }\n\n const observer = new MutationObserver(handleMutation)\n\n observer.observe(element, {\n attributes: true,\n })\n\n return () => {\n observer.disconnect()\n }\n }\n\n return () => {}\n }, [triggerRef])\n\n useEffect(() => {\n if (triggerRef.current === null) return\n removeDuplicateAriaDescription(triggerRef.current)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return (\n <StyledContent\n {...restProps}\n ref={forwardRef}\n align={align}\n alignOffset={alignOffset}\n avoidCollisions={avoidCollisions}\n collisionPadding={collisionPadding}\n hideWhenDetached={hideWhenDetached}\n side={side}\n sideOffset={sideOffset}\n sticky={sticky}\n >\n {children}\n <StyledArrowIcon />\n </StyledContent>\n )\n }\n)\n\nContent.displayName = 'Tooltip.Content'\n","import { styled } from '@mirohq/design-system-stitches'\nimport { Trigger } from '@radix-ui/react-tooltip'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledTrigger = styled(Trigger)\n\nexport type StyledTriggerProps = StrictComponentProps<typeof StyledTrigger>\n","import React, { useContext } from 'react'\nimport type { ElementRef, DOMAttributes } from 'react'\nimport { mergeRefs } from '@mirohq/design-system-utils'\nimport { useHover } from '@react-aria/interactions'\nimport { mergeProps } from '@react-aria/utils'\n\nimport { StyledTrigger } from './trigger.styled'\nimport type { StyledTriggerProps } from './trigger.styled'\nimport { TooltipTriggerContext } from '../tooltip'\n\nexport interface TriggerProps extends StyledTriggerProps {\n /**\n * temporary the same as onClick, later will be added touch events support\n */\n onPress?: DOMAttributes<HTMLElement>['onClick']\n}\n\nexport const Trigger = React.forwardRef<\n ElementRef<typeof StyledTrigger>,\n TriggerProps\n>(({ onPress, onClick, ...restProps }, forwardRef) => {\n const { triggerRef, hoveredRef, focusedRef } = useContext(\n TooltipTriggerContext\n )\n\n const { hoverProps } = useHover({\n onHoverStart: () => {\n hoveredRef.current = true\n },\n onHoverEnd: () => {\n hoveredRef.current = false\n },\n })\n\n return (\n <StyledTrigger\n {...mergeProps(restProps, hoverProps, {\n onFocus: () => {\n focusedRef.current = true\n },\n onBlur: () => {\n focusedRef.current = false\n },\n })}\n onClick={onPress ?? onClick}\n ref={mergeRefs([triggerRef, forwardRef])}\n />\n )\n})\n\nTrigger.displayName = 'Tooltip.Trigger'\n","import React, { createContext, useContext } from 'react'\n\nexport interface ProviderProps {\n /**\n * The duration from when the mouse enters a tooltip trigger until\n * the tooltip opens.\n */\n delayDuration?: number\n\n /**\n * How much time a user has to enter another trigger without incurring\n * a delay again.\n * When set to `0`, when hovering between triggers there wont be delay duration.\n * @default 500\n */\n skipDelayDuration?: number\n\n /**\n * The content\n */\n children?: React.ReactNode\n}\n\nexport const ProviderContext = createContext<ProviderProps>({} as any)\n\nexport const Provider: React.FC<ProviderProps> = ({\n children,\n ...restProps\n}) => (\n <ProviderContext.Provider value={restProps}>\n {children}\n </ProviderContext.Provider>\n)\n\nProvider.displayName = 'Tooltip.Provider'\n\nexport const useTooltipContext = (): ProviderProps =>\n useContext(ProviderContext)\n","import React from 'react'\nimport type { TooltipPortalProps } from '@radix-ui/react-tooltip'\nimport { Portal as RadixPortal } from '@radix-ui/react-tooltip'\n\nexport interface PortalProps extends TooltipPortalProps {\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries. If used on this part, it will be\n * inherited by Tooltip.Content.\n */\n forceMount?: true\n\n /**\n * Specify a container element to portal the content into.\n */\n container?: HTMLElement | null\n}\n\nexport const Portal: React.FC<PortalProps> = props => <RadixPortal {...props} />\n","import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const StyledHotkey = styled(Primitive.span, {\n marginLeft: '$100',\n})\n\nexport type StyledHotkeyProps = StrictComponentProps<typeof StyledHotkey>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Hotkey as BaseHotkey } from '@mirohq/design-system-base-hotkey'\n\nimport type { StyledHotkeyProps } from './hotkey.styled'\nimport { StyledHotkey } from './hotkey.styled'\n\nexport interface HotkeyProps extends StyledHotkeyProps {\n /**\n * The content.\n */\n children: string\n}\n\nexport const Hotkey = React.forwardRef<\n ElementRef<typeof StyledHotkey>,\n HotkeyProps\n>(({ children, ...restProps }, forwardRef) => (\n <StyledHotkey {...restProps} ref={forwardRef}>\n <BaseHotkey variant='inverted'>{children}</BaseHotkey>\n </StyledHotkey>\n))\n","import React, {\n useState,\n useCallback,\n useEffect,\n useRef,\n createContext,\n} from 'react'\nimport {\n Provider as RadixProvider,\n Root as RadixTooltip,\n} from '@radix-ui/react-tooltip'\n\nimport { Content } from './partials/content'\nimport { Trigger } from './partials/trigger'\nimport { Provider, useTooltipContext } from './partials/provider'\nimport { Portal } from './partials/portal'\nimport { Hotkey } from './partials/hotkey'\n\nexport interface TooltipProps {\n /**\n * The open state of the tooltip when it is initially rendered. Use when you\n * do not need to control its open state.\n */\n defaultOpen?: boolean\n\n /**\n * The current state of the tooltip.\n */\n open?: boolean\n\n /**\n * Event handler called when the tooltip opens.\n */\n onOpen?: () => void\n\n /**\n * Event handler called when the tooltip closes.\n */\n onClose?: () => void\n\n /**\n * Overrides the duration given to the `Provider` to customize the open delay\n * for a specific tooltip.\n * @default 200\n */\n delayDuration?: number\n\n /**\n * How much time a user has to enter another trigger without incurring\n * a delay again.\n * @default 500\n */\n skipDelayDuration?: number\n\n /**\n * Clears the delayDuration and skipDelayDuration timeouts when the component\n * is unmounted. This flag is `true` by default when using NODE_ENV=test.\n * @default false\n */\n clearDelaysOnUnmount?: boolean\n\n /**\n * Closes the tooltip as soon as the pointer leaves the trigger making it\n * impossible to hover the content.\n */\n disableHoverableContent?: boolean\n\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nlet delayTimer: ReturnType<typeof setTimeout> | undefined\nlet skipDelayTimer: ReturnType<typeof setTimeout> | undefined\nlet shouldSkipDelay = false\n\nexport const DEFAULT_SKIP_DELAY_DURATION = 500\nexport const DEFAULT_DELAY_DURATION = 200\n\nexport const TooltipTriggerContext = createContext<{\n triggerRef: React.RefObject<HTMLButtonElement>\n hoveredRef: React.MutableRefObject<boolean>\n focusedRef: React.MutableRefObject<boolean>\n}>({\n triggerRef: { current: null },\n hoveredRef: { current: false },\n focusedRef: { current: false },\n})\n\nexport const Tooltip: React.FC<TooltipProps> & Partials = ({\n defaultOpen = false,\n open,\n onOpen,\n onClose,\n skipDelayDuration,\n delayDuration,\n disableHoverableContent,\n clearDelaysOnUnmount = process.env.NODE_ENV === 'test',\n children,\n}) => {\n const context = useTooltipContext()\n const isMounted = useRef(false)\n const _skipDelayDuration =\n skipDelayDuration ??\n context.skipDelayDuration ??\n DEFAULT_SKIP_DELAY_DURATION\n\n const triggerRef = useRef<HTMLButtonElement>(null)\n const hoveredRef = useRef<boolean>(false)\n const focusedRef = useRef<boolean>(false)\n\n const [openState, setOpenState] = useState(defaultOpen)\n const setDelayedOpen = useCallback(\n (newOpenState: boolean) => {\n clearTimeout(delayTimer)\n clearTimeout(skipDelayTimer)\n\n if (!newOpenState) {\n skipDelayTimer = setTimeout(() => {\n shouldSkipDelay = false\n }, _skipDelayDuration)\n setOpenState(false)\n onClose?.()\n return\n }\n\n if (shouldSkipDelay || focusedRef.current) {\n setOpenState(newOpenState)\n return\n }\n\n delayTimer = setTimeout(() => {\n // ignore it if the user quickly hover the trigger and leave before the timeout\n if (!hoveredRef.current && process.env.NODE_ENV !== 'test') {\n return\n }\n\n /* when skipDelayDuration is 0 no skip delay should happen. */\n shouldSkipDelay = _skipDelayDuration !== 0\n\n if (isMounted.current) {\n setOpenState(true)\n onOpen?.()\n }\n }, delayDuration ?? context.delayDuration ?? DEFAULT_DELAY_DURATION)\n },\n [delayDuration, context.delayDuration, _skipDelayDuration, onClose, onOpen]\n )\n\n const handleOpenChange = useCallback(\n (newState: boolean) => {\n if (open == null) {\n setDelayedOpen(newState)\n return\n }\n\n newState ? onOpen?.() : onClose?.()\n },\n [open, onOpen, onClose, setDelayedOpen]\n )\n\n useEffect(\n () => () => {\n if (clearDelaysOnUnmount) {\n clearTimeout(delayTimer)\n clearTimeout(skipDelayTimer)\n shouldSkipDelay = false\n }\n },\n [clearDelaysOnUnmount]\n )\n\n useEffect(() => {\n isMounted.current = true\n return () => {\n isMounted.current = false\n }\n }, [])\n\n return (\n <RadixProvider delayDuration={0} skipDelayDuration={0}>\n <TooltipTriggerContext.Provider\n value={{\n triggerRef,\n hoveredRef,\n focusedRef,\n }}\n >\n <RadixTooltip\n disableHoverableContent={disableHoverableContent}\n open={open ?? openState}\n delayDuration={0} // we control it manually\n onOpenChange={handleOpenChange}\n >\n {children}\n </RadixTooltip>\n </TooltipTriggerContext.Provider>\n </RadixProvider>\n )\n}\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Trigger: typeof Trigger\n Content: typeof Content\n Provider: typeof Provider\n Portal: typeof Portal\n Hotkey: typeof Hotkey\n}\n\nTooltip.Trigger = Trigger\nTooltip.Content = Content\nTooltip.Provider = Provider\nTooltip.Portal = Portal\nTooltip.Hotkey = Hotkey\n"],"names":["styled","RadixArrow","RadixContent","React","useContext","useEffect","jsxs","Trigger","useHover","jsx","mergeProps","mergeRefs","createContext","RadixPortal","Primitive","BaseHotkey","useRef","useState","useCallback","_a","RadixProvider","RadixTooltip"],"mappings":";;;;;;;;;;;;;;;;;;AAOa,MAAA,eAAA,GAAkBA,4BAAOC,kBAAY,EAAA;AAAA,EAChD,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA,KAAA;AAAA,EACR,SAAW,EAAA,kBAAA;AAAA,EACX,KAAO,EAAA,MAAA;AACT,CAAC,CAAA,CAAA;AAEY,MAAA,aAAA,GAAgBD,4BAAOE,oBAAc,EAAA;AAAA,EAChD,eAAiB,EAAA,QAAA;AAAA,EACjB,YAAc,EAAA,KAAA;AAAA,EACd,KAAO,EAAA,QAAA;AAAA,EACP,QAAU,EAAA,MA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AA;;;;;;;;;;;"}
package/dist/module.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import React, { useContext, useEffect, createContext, useRef, useState, useCallback } from 'react';
3
- import { useId } from '@mirohq/design-system-use-id';
4
3
  import { Arrow, Content as Content$1, Trigger as Trigger$1, Portal as Portal$1, Provider as Provider$1, Root } from '@radix-ui/react-tooltip';
5
4
  import { styled } from '@mirohq/design-system-stitches';
6
5
  import { mergeRefs } from '@mirohq/design-system-utils';
6
+ import { useHover } from '@react-aria/interactions';
7
+ import { mergeProps } from '@react-aria/utils';
7
8
  import { Hotkey as Hotkey$1 } from '@mirohq/design-system-base-hotkey';
8
9
  import { Primitive } from '@mirohq/design-system-primitive';
9
10
 
@@ -102,13 +103,29 @@ Content.displayName = "Tooltip.Content";
102
103
  const StyledTrigger = styled(Trigger$1);
103
104
 
104
105
  const Trigger = React.forwardRef(({ onPress, onClick, ...restProps }, forwardRef) => {
105
- const { triggerRef, id } = useContext(TooltipTriggerContext);
106
+ const { triggerRef, hoveredRef, focusedRef } = useContext(
107
+ TooltipTriggerContext
108
+ );
109
+ const { hoverProps } = useHover({
110
+ onHoverStart: () => {
111
+ hoveredRef.current = true;
112
+ },
113
+ onHoverEnd: () => {
114
+ hoveredRef.current = false;
115
+ }
116
+ });
106
117
  return /* @__PURE__ */ jsx(
107
118
  StyledTrigger,
108
119
  {
109
- ...restProps,
120
+ ...mergeProps(restProps, hoverProps, {
121
+ onFocus: () => {
122
+ focusedRef.current = true;
123
+ },
124
+ onBlur: () => {
125
+ focusedRef.current = false;
126
+ }
127
+ }),
110
128
  onClick: onPress != null ? onPress : onClick,
111
- "data-tooltip-trigger": id,
112
129
  ref: mergeRefs([triggerRef, forwardRef])
113
130
  }
114
131
  );
@@ -137,7 +154,9 @@ let shouldSkipDelay = false;
137
154
  const DEFAULT_SKIP_DELAY_DURATION = 500;
138
155
  const DEFAULT_DELAY_DURATION = 200;
139
156
  const TooltipTriggerContext = createContext({
140
- triggerRef: { current: null }
157
+ triggerRef: { current: null },
158
+ hoveredRef: { current: false },
159
+ focusedRef: { current: false }
141
160
  });
142
161
  const Tooltip = ({
143
162
  defaultOpen = false,
@@ -154,14 +173,15 @@ const Tooltip = ({
154
173
  const context = useTooltipContext();
155
174
  const isMounted = useRef(false);
156
175
  const _skipDelayDuration = (_a = skipDelayDuration != null ? skipDelayDuration : context.skipDelayDuration) != null ? _a : DEFAULT_SKIP_DELAY_DURATION;
157
- const triggerId = useId();
176
+ const triggerRef = useRef(null);
177
+ const hoveredRef = useRef(false);
178
+ const focusedRef = useRef(false);
158
179
  const [openState, setOpenState] = useState(defaultOpen);
159
180
  const setDelayedOpen = useCallback(
160
181
  (newOpenState) => {
161
182
  var _a2;
162
183
  clearTimeout(delayTimer);
163
184
  clearTimeout(skipDelayTimer);
164
- const triggerSelector = '[data-tooltip-trigger="'.concat(triggerId, '"]');
165
185
  if (!newOpenState) {
166
186
  skipDelayTimer = setTimeout(() => {
167
187
  shouldSkipDelay = false;
@@ -170,12 +190,12 @@ const Tooltip = ({
170
190
  onClose == null ? void 0 : onClose();
171
191
  return;
172
192
  }
173
- if (shouldSkipDelay || document.querySelector("".concat(triggerSelector, ":focus")) != null) {
193
+ if (shouldSkipDelay || focusedRef.current) {
174
194
  setOpenState(newOpenState);
175
195
  return;
176
196
  }
177
197
  delayTimer = setTimeout(() => {
178
- if (document.querySelector("".concat(triggerSelector, ":hover")) == null && process.env.NODE_ENV !== "test") {
198
+ if (!hoveredRef.current && process.env.NODE_ENV !== "test") {
179
199
  return;
180
200
  }
181
201
  shouldSkipDelay = _skipDelayDuration !== 0;
@@ -185,14 +205,7 @@ const Tooltip = ({
185
205
  }
186
206
  }, (_a2 = delayDuration != null ? delayDuration : context.delayDuration) != null ? _a2 : DEFAULT_DELAY_DURATION);
187
207
  },
188
- [
189
- delayDuration,
190
- context.delayDuration,
191
- _skipDelayDuration,
192
- onClose,
193
- onOpen,
194
- triggerId
195
- ]
208
+ [delayDuration, context.delayDuration, _skipDelayDuration, onClose, onOpen]
196
209
  );
197
210
  const handleOpenChange = useCallback(
198
211
  (newState) => {
@@ -220,13 +233,13 @@ const Tooltip = ({
220
233
  isMounted.current = false;
221
234
  };
222
235
  }, []);
223
- const triggerRef = useRef(null);
224
236
  return /* @__PURE__ */ jsx(Provider$1, { delayDuration: 0, skipDelayDuration: 0, children: /* @__PURE__ */ jsx(
225
237
  TooltipTriggerContext.Provider,
226
238
  {
227
239
  value: {
228
- id: triggerId,
229
- triggerRef
240
+ triggerRef,
241
+ hoveredRef,
242
+ focusedRef
230
243
  },
231
244
  children: /* @__PURE__ */ jsx(
232
245
  Root,
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../src/partials/content.styled.tsx","../src/partials/content.tsx","../src/partials/trigger.styled.tsx","../src/partials/trigger.tsx","../src/partials/provider.tsx","../src/partials/portal.tsx","../src/partials/hotkey.styled.tsx","../src/partials/hotkey.tsx","../src/tooltip.tsx"],"sourcesContent":["import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport {\n Content as RadixContent,\n Arrow as RadixArrow,\n} from '@radix-ui/react-tooltip'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledArrowIcon = styled(RadixArrow, {\n fill: '$black',\n height: '5px',\n transform: 'translateY(-1px)',\n width: '15px',\n})\n\nexport const StyledContent = styled(RadixContent, {\n backgroundColor: '$black',\n borderRadius: '$50',\n color: '$white',\n fontSize: '14px',\n fontWeight: '400',\n lineHeight: '20px',\n fontFamily: 'inherit',\n padding: '$150',\n zIndex: '$tooltip',\n})\n\nexport type StyledContentProps = StrictComponentProps<typeof StyledContent>\n","import type { ElementRef } from 'react'\nimport React, { useContext, useEffect } from 'react'\n\nimport { StyledContent, StyledArrowIcon } from './content.styled'\nimport type { StyledContentProps } from './content.styled'\nimport type { PointerDownOutsideEvent, Side, Align } from '../types'\nimport { TooltipTriggerContext } from '../tooltip'\n\nexport interface ContentProps extends StyledContentProps {\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n * @default 'center'\n */\n align?: Align\n\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: number\n\n /**\n * The distance in pixels from the trigger.\n * @default 5\n */\n sideOffset?: number\n\n /** The preferred side of the trigger to render against when open.\n * Will be reversed when collisions occur and avoidCollisions is enabled.\n * @default 'top'\n */\n side?: Side\n\n /**\n * When true, overrides the side and align preferences to prevent collisions\n * with window edges.\n * @default true\n */\n avoidCollisions?: boolean\n\n /**\n * The distance in pixels from window edges where collision detection should\n * occur.\n * @default 0\n */\n collisionPadding?: number\n\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries. It inherits from Tooltip.Portal.\n */\n forceMount?: true\n\n /**\n * The element used as the collision boundary. By default this is the\n * viewport, though you can provide additional element(s) to be included in\n * this check.\n */\n collisionBoundary?: Element | null\n\n /**\n * The sticky behavior on the align axis. \"partial\" will keep the content in\n * the boundary as long as the trigger is at least partially in the boundary\n * whilst \"always\" will keep the content in the boundary regardless.\n * @default 'partial'\n */\n sticky?: 'partial' | 'always'\n\n /**\n * Whether to hide the content when the trigger becomes fully occluded.\n * @default true (false in test environment)\n */\n hideWhenDetached?: boolean\n\n /**\n * Event handler called when the escape key is down. It can be prevented by\n * calling event.preventDefault.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n\n /**\n * Event handler called when a pointer event occurs outside the bounds of the\n * component. It can be prevented by calling event.preventDefault.\n */\n onPointerDownOutside?: (event: PointerDownOutsideEvent) => void\n}\n\nexport const Content = React.forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(\n (\n {\n align = 'center',\n alignOffset = 0,\n avoidCollisions = true,\n collisionPadding = 0,\n children,\n side = 'top',\n sideOffset = 5,\n sticky = 'partial',\n hideWhenDetached = process.env.NODE_ENV !== 'test',\n ...restProps\n },\n forwardRef\n ) => {\n const { triggerRef } = useContext(TooltipTriggerContext)\n\n const removeDuplicateAriaDescription = (element: Element): void => {\n const ariaDescribedBy: string | null =\n element.getAttribute('aria-describedby')\n\n if (ariaDescribedBy !== null) {\n const ariaDescription: string | null | undefined =\n document.getElementById(ariaDescribedBy)?.textContent\n\n const areAriaLabelAndAriaDescriptionEqual =\n ariaDescription?.trim() ===\n element?.getAttribute('aria-label')?.trim()\n\n if (areAriaLabelAndAriaDescriptionEqual) {\n element.removeAttribute('aria-describedby')\n }\n }\n }\n useEffect((): (() => void) => {\n const element = triggerRef.current\n\n if (element != null) {\n const handleMutation = (mutationsList: MutationRecord[]): void => {\n for (const mutation of mutationsList) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'aria-describedby'\n ) {\n removeDuplicateAriaDescription(element)\n }\n }\n }\n\n const observer = new MutationObserver(handleMutation)\n\n observer.observe(element, {\n attributes: true,\n })\n\n return () => {\n observer.disconnect()\n }\n }\n\n return () => {}\n }, [triggerRef])\n\n useEffect(() => {\n if (triggerRef.current === null) return\n removeDuplicateAriaDescription(triggerRef.current)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return (\n <StyledContent\n {...restProps}\n ref={forwardRef}\n align={align}\n alignOffset={alignOffset}\n avoidCollisions={avoidCollisions}\n collisionPadding={collisionPadding}\n hideWhenDetached={hideWhenDetached}\n side={side}\n sideOffset={sideOffset}\n sticky={sticky}\n >\n {children}\n <StyledArrowIcon />\n </StyledContent>\n )\n }\n)\n\nContent.displayName = 'Tooltip.Content'\n","import { styled } from '@mirohq/design-system-stitches'\nimport { Trigger } from '@radix-ui/react-tooltip'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledTrigger = styled(Trigger)\n\nexport type StyledTriggerProps = StrictComponentProps<typeof StyledTrigger>\n","import React, { useContext } from 'react'\nimport type { ElementRef, DOMAttributes } from 'react'\nimport { mergeRefs } from '@mirohq/design-system-utils'\n\nimport { StyledTrigger } from './trigger.styled'\nimport type { StyledTriggerProps } from './trigger.styled'\nimport { TooltipTriggerContext } from '../tooltip'\n\nexport interface TriggerProps extends StyledTriggerProps {\n /**\n * temporary the same as onClick, later will be added touch events support\n */\n onPress?: DOMAttributes<HTMLElement>['onClick']\n}\n\nexport const Trigger = React.forwardRef<\n ElementRef<typeof StyledTrigger>,\n TriggerProps\n>(({ onPress, onClick, ...restProps }, forwardRef) => {\n const { triggerRef, id } = useContext(TooltipTriggerContext)\n return (\n <StyledTrigger\n {...restProps}\n onClick={onPress ?? onClick}\n data-tooltip-trigger={id}\n ref={mergeRefs([triggerRef, forwardRef])}\n />\n )\n})\n\nTrigger.displayName = 'Tooltip.Trigger'\n","import React, { createContext, useContext } from 'react'\n\nexport interface ProviderProps {\n /**\n * The duration from when the mouse enters a tooltip trigger until\n * the tooltip opens.\n */\n delayDuration?: number\n\n /**\n * How much time a user has to enter another trigger without incurring\n * a delay again.\n * When set to `0`, when hovering between triggers there wont be delay duration.\n * @default 500\n */\n skipDelayDuration?: number\n\n /**\n * The content\n */\n children?: React.ReactNode\n}\n\nexport const ProviderContext = createContext<ProviderProps>({} as any)\n\nexport const Provider: React.FC<ProviderProps> = ({\n children,\n ...restProps\n}) => (\n <ProviderContext.Provider value={restProps}>\n {children}\n </ProviderContext.Provider>\n)\n\nProvider.displayName = 'Tooltip.Provider'\n\nexport const useTooltipContext = (): ProviderProps =>\n useContext(ProviderContext)\n","import React from 'react'\nimport type { TooltipPortalProps } from '@radix-ui/react-tooltip'\nimport { Portal as RadixPortal } from '@radix-ui/react-tooltip'\n\nexport interface PortalProps extends TooltipPortalProps {\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries. If used on this part, it will be\n * inherited by Tooltip.Content.\n */\n forceMount?: true\n\n /**\n * Specify a container element to portal the content into.\n */\n container?: HTMLElement | null\n}\n\nexport const Portal: React.FC<PortalProps> = props => <RadixPortal {...props} />\n","import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const StyledHotkey = styled(Primitive.span, {\n marginLeft: '$100',\n})\n\nexport type StyledHotkeyProps = StrictComponentProps<typeof StyledHotkey>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Hotkey as BaseHotkey } from '@mirohq/design-system-base-hotkey'\n\nimport type { StyledHotkeyProps } from './hotkey.styled'\nimport { StyledHotkey } from './hotkey.styled'\n\nexport interface HotkeyProps extends StyledHotkeyProps {\n /**\n * The content.\n */\n children: string\n}\n\nexport const Hotkey = React.forwardRef<\n ElementRef<typeof StyledHotkey>,\n HotkeyProps\n>(({ children, ...restProps }, forwardRef) => (\n <StyledHotkey {...restProps} ref={forwardRef}>\n <BaseHotkey variant='inverted'>{children}</BaseHotkey>\n </StyledHotkey>\n))\n","import React, {\n useState,\n useCallback,\n useEffect,\n useRef,\n createContext,\n} from 'react'\nimport { useId } from '@mirohq/design-system-use-id'\nimport {\n Provider as RadixProvider,\n Root as RadixTooltip,\n} from '@radix-ui/react-tooltip'\n\nimport { Content } from './partials/content'\nimport { Trigger } from './partials/trigger'\nimport { Provider, useTooltipContext } from './partials/provider'\nimport { Portal } from './partials/portal'\nimport { Hotkey } from './partials/hotkey'\n\nexport interface TooltipProps {\n /**\n * The open state of the tooltip when it is initially rendered. Use when you\n * do not need to control its open state.\n */\n defaultOpen?: boolean\n\n /**\n * The current state of the tooltip.\n */\n open?: boolean\n\n /**\n * Event handler called when the tooltip opens.\n */\n onOpen?: () => void\n\n /**\n * Event handler called when the tooltip closes.\n */\n onClose?: () => void\n\n /**\n * Overrides the duration given to the `Provider` to customize the open delay\n * for a specific tooltip.\n * @default 200\n */\n delayDuration?: number\n\n /**\n * How much time a user has to enter another trigger without incurring\n * a delay again.\n * @default 500\n */\n skipDelayDuration?: number\n\n /**\n * Clears the delayDuration and skipDelayDuration timeouts when the component\n * is unmounted. This flag is `true` by default when using NODE_ENV=test.\n * @default false\n */\n clearDelaysOnUnmount?: boolean\n\n /**\n * Closes the tooltip as soon as the pointer leaves the trigger making it\n * impossible to hover the content.\n */\n disableHoverableContent?: boolean\n\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nlet delayTimer: ReturnType<typeof setTimeout> | undefined\nlet skipDelayTimer: ReturnType<typeof setTimeout> | undefined\nlet shouldSkipDelay = false\n\nexport const DEFAULT_SKIP_DELAY_DURATION = 500\nexport const DEFAULT_DELAY_DURATION = 200\n\nexport const TooltipTriggerContext = createContext<{\n triggerRef: React.RefObject<HTMLButtonElement>\n id?: string\n}>({\n triggerRef: { current: null },\n})\n\nexport const Tooltip: React.FC<TooltipProps> & Partials = ({\n defaultOpen = false,\n open,\n onOpen,\n onClose,\n skipDelayDuration,\n delayDuration,\n disableHoverableContent,\n clearDelaysOnUnmount = process.env.NODE_ENV === 'test',\n children,\n}) => {\n const context = useTooltipContext()\n const isMounted = useRef(false)\n const _skipDelayDuration =\n skipDelayDuration ??\n context.skipDelayDuration ??\n DEFAULT_SKIP_DELAY_DURATION\n\n const triggerId = useId()\n\n const [openState, setOpenState] = useState(defaultOpen)\n const setDelayedOpen = useCallback(\n (newOpenState: boolean) => {\n clearTimeout(delayTimer)\n clearTimeout(skipDelayTimer)\n\n const triggerSelector = `[data-tooltip-trigger=\"${triggerId}\"]`\n\n if (!newOpenState) {\n skipDelayTimer = setTimeout(() => {\n shouldSkipDelay = false\n }, _skipDelayDuration)\n setOpenState(false)\n onClose?.()\n return\n }\n\n if (\n shouldSkipDelay ||\n document.querySelector(`${triggerSelector}:focus`) != null\n ) {\n setOpenState(newOpenState)\n return\n }\n\n delayTimer = setTimeout(() => {\n // ignore it if the the user quickly hover the trigger and leave before the timeout\n // (unfortunately JSDOM seems not to support :hover selector)\n if (\n document.querySelector(`${triggerSelector}:hover`) == null &&\n process.env.NODE_ENV !== 'test'\n ) {\n return\n }\n\n /* when skipDelayDuration is 0 no skip delay should happen. */\n shouldSkipDelay = _skipDelayDuration !== 0\n\n if (isMounted.current) {\n setOpenState(true)\n onOpen?.()\n }\n }, delayDuration ?? context.delayDuration ?? DEFAULT_DELAY_DURATION)\n },\n [\n delayDuration,\n context.delayDuration,\n _skipDelayDuration,\n onClose,\n onOpen,\n triggerId,\n ]\n )\n\n const handleOpenChange = useCallback(\n (newState: boolean) => {\n if (open == null) {\n setDelayedOpen(newState)\n return\n }\n\n newState ? onOpen?.() : onClose?.()\n },\n [open, onOpen, onClose, setDelayedOpen]\n )\n\n useEffect(\n () => () => {\n if (clearDelaysOnUnmount) {\n clearTimeout(delayTimer)\n clearTimeout(skipDelayTimer)\n shouldSkipDelay = false\n }\n },\n [clearDelaysOnUnmount]\n )\n\n useEffect(() => {\n isMounted.current = true\n return () => {\n isMounted.current = false\n }\n }, [])\n\n const triggerRef = useRef<HTMLButtonElement>(null)\n\n return (\n <RadixProvider delayDuration={0} skipDelayDuration={0}>\n <TooltipTriggerContext.Provider\n value={{\n id: triggerId,\n triggerRef,\n }}\n >\n <RadixTooltip\n disableHoverableContent={disableHoverableContent}\n open={open ?? openState}\n delayDuration={0} // we control it manually\n onOpenChange={handleOpenChange}\n >\n {children}\n </RadixTooltip>\n </TooltipTriggerContext.Provider>\n </RadixProvider>\n )\n}\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Trigger: typeof Trigger\n Content: typeof Content\n Provider: typeof Provider\n Portal: typeof Portal\n Hotkey: typeof Hotkey\n}\n\nTooltip.Trigger = Trigger\nTooltip.Content = Content\nTooltip.Provider = Provider\nTooltip.Portal = Portal\nTooltip.Hotkey = Hotkey\n"],"names":["RadixArrow","RadixContent","Trigger","RadixPortal","BaseHotkey","_a","RadixProvider","RadixTooltip"],"mappings":";;;;;;;;;AAOa,MAAA,eAAA,GAAkB,OAAOA,KAAY,EAAA;AAAA,EAChD,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA,KAAA;AAAA,EACR,SAAW,EAAA,kBAAA;AAAA,EACX,KAAO,EAAA,MAAA;AACT,CAAC,CAAA,CAAA;AAEY,MAAA,aAAA,GAAgB,OAAO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AAA,OAAO,MAAM;AACX,MAAA,SAAA,CAAU,OAAU,GAAA,KAAA,CAAA;AAAA,KACtB,CAAA;AAAA,GACF,EAAG,EAAE,CAAA,CAAA;AAEL,EAAM,MAAA,UAAA,GAAa,OAA0B,IAAI,CAAA,CAAA;AAEjD,EAAA,uBACG,GAAA,CAAAC,UAAA,EAAA,EAAc,aAAe,EAAA,CAAA,EAAG,mBAAmB,CAClD,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,qBAAsB,CAAA,QAAA;AAAA,IAAtB;AAAA,MACC,KAAO,EAAA;AAAA,QACL,EAAI,EAAA,SAAA;AAAA,QACJ,UAAA;AAAA,OACF;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAACC,IAAA;AAAA,QAAA;AAAA,UACC,uBAAA;AAAA,UACA,MAAM,IAAQ,IAAA,IAAA,GAAA,IAAA,GAAA,SAAA;AAAA,UACd,aAAe,EAAA,CAAA;AAAA,UACf,YAAc,EAAA,gBAAA;AAAA,UAEb,QAAA;AAAA,SAAA;AAAA,OACH;AAAA,KAAA;AAAA,GAEJ,EAAA,CAAA,CAAA;AAEJ,EAAA;AAaA,OAAA,CAAQ,OAAU,GAAA,OAAA,CAAA;AAClB,OAAA,CAAQ,OAAU,GAAA,OAAA,CAAA;AAClB,OAAA,CAAQ,QAAW,GAAA,QAAA,CAAA;AACnB,OAAA,CAAQ,MAAS,GAAA,MAAA,CAAA;AACjB,OAAA,CAAQ,MAAS,GAAA,MAAA;;;;;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../src/partials/content.styled.tsx","../src/partials/content.tsx","../src/partials/trigger.styled.tsx","../src/partials/trigger.tsx","../src/partials/provider.tsx","../src/partials/portal.tsx","../src/partials/hotkey.styled.tsx","../src/partials/hotkey.tsx","../src/tooltip.tsx"],"sourcesContent":["import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport {\n Content as RadixContent,\n Arrow as RadixArrow,\n} from '@radix-ui/react-tooltip'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledArrowIcon = styled(RadixArrow, {\n fill: '$black',\n height: '5px',\n transform: 'translateY(-1px)',\n width: '15px',\n})\n\nexport const StyledContent = styled(RadixContent, {\n backgroundColor: '$black',\n borderRadius: '$50',\n color: '$white',\n fontSize: '14px',\n fontWeight: '400',\n lineHeight: '20px',\n fontFamily: 'inherit',\n padding: '$150',\n zIndex: '$tooltip',\n})\n\nexport type StyledContentProps = StrictComponentProps<typeof StyledContent>\n","import type { ElementRef } from 'react'\nimport React, { useContext, useEffect } from 'react'\n\nimport { StyledContent, StyledArrowIcon } from './content.styled'\nimport type { StyledContentProps } from './content.styled'\nimport type { PointerDownOutsideEvent, Side, Align } from '../types'\nimport { TooltipTriggerContext } from '../tooltip'\n\nexport interface ContentProps extends StyledContentProps {\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n * @default 'center'\n */\n align?: Align\n\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: number\n\n /**\n * The distance in pixels from the trigger.\n * @default 5\n */\n sideOffset?: number\n\n /** The preferred side of the trigger to render against when open.\n * Will be reversed when collisions occur and avoidCollisions is enabled.\n * @default 'top'\n */\n side?: Side\n\n /**\n * When true, overrides the side and align preferences to prevent collisions\n * with window edges.\n * @default true\n */\n avoidCollisions?: boolean\n\n /**\n * The distance in pixels from window edges where collision detection should\n * occur.\n * @default 0\n */\n collisionPadding?: number\n\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries. It inherits from Tooltip.Portal.\n */\n forceMount?: true\n\n /**\n * The element used as the collision boundary. By default this is the\n * viewport, though you can provide additional element(s) to be included in\n * this check.\n */\n collisionBoundary?: Element | null\n\n /**\n * The sticky behavior on the align axis. \"partial\" will keep the content in\n * the boundary as long as the trigger is at least partially in the boundary\n * whilst \"always\" will keep the content in the boundary regardless.\n * @default 'partial'\n */\n sticky?: 'partial' | 'always'\n\n /**\n * Whether to hide the content when the trigger becomes fully occluded.\n * @default true (false in test environment)\n */\n hideWhenDetached?: boolean\n\n /**\n * Event handler called when the escape key is down. It can be prevented by\n * calling event.preventDefault.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n\n /**\n * Event handler called when a pointer event occurs outside the bounds of the\n * component. It can be prevented by calling event.preventDefault.\n */\n onPointerDownOutside?: (event: PointerDownOutsideEvent) => void\n}\n\nexport const Content = React.forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(\n (\n {\n align = 'center',\n alignOffset = 0,\n avoidCollisions = true,\n collisionPadding = 0,\n children,\n side = 'top',\n sideOffset = 5,\n sticky = 'partial',\n hideWhenDetached = process.env.NODE_ENV !== 'test',\n ...restProps\n },\n forwardRef\n ) => {\n const { triggerRef } = useContext(TooltipTriggerContext)\n\n const removeDuplicateAriaDescription = (element: Element): void => {\n const ariaDescribedBy: string | null =\n element.getAttribute('aria-describedby')\n\n if (ariaDescribedBy !== null) {\n const ariaDescription: string | null | undefined =\n document.getElementById(ariaDescribedBy)?.textContent\n\n const areAriaLabelAndAriaDescriptionEqual =\n ariaDescription?.trim() ===\n element?.getAttribute('aria-label')?.trim()\n\n if (areAriaLabelAndAriaDescriptionEqual) {\n element.removeAttribute('aria-describedby')\n }\n }\n }\n useEffect((): (() => void) => {\n const element = triggerRef.current\n\n if (element != null) {\n const handleMutation = (mutationsList: MutationRecord[]): void => {\n for (const mutation of mutationsList) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'aria-describedby'\n ) {\n removeDuplicateAriaDescription(element)\n }\n }\n }\n\n const observer = new MutationObserver(handleMutation)\n\n observer.observe(element, {\n attributes: true,\n })\n\n return () => {\n observer.disconnect()\n }\n }\n\n return () => {}\n }, [triggerRef])\n\n useEffect(() => {\n if (triggerRef.current === null) return\n removeDuplicateAriaDescription(triggerRef.current)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return (\n <StyledContent\n {...restProps}\n ref={forwardRef}\n align={align}\n alignOffset={alignOffset}\n avoidCollisions={avoidCollisions}\n collisionPadding={collisionPadding}\n hideWhenDetached={hideWhenDetached}\n side={side}\n sideOffset={sideOffset}\n sticky={sticky}\n >\n {children}\n <StyledArrowIcon />\n </StyledContent>\n )\n }\n)\n\nContent.displayName = 'Tooltip.Content'\n","import { styled } from '@mirohq/design-system-stitches'\nimport { Trigger } from '@radix-ui/react-tooltip'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nexport const StyledTrigger = styled(Trigger)\n\nexport type StyledTriggerProps = StrictComponentProps<typeof StyledTrigger>\n","import React, { useContext } from 'react'\nimport type { ElementRef, DOMAttributes } from 'react'\nimport { mergeRefs } from '@mirohq/design-system-utils'\nimport { useHover } from '@react-aria/interactions'\nimport { mergeProps } from '@react-aria/utils'\n\nimport { StyledTrigger } from './trigger.styled'\nimport type { StyledTriggerProps } from './trigger.styled'\nimport { TooltipTriggerContext } from '../tooltip'\n\nexport interface TriggerProps extends StyledTriggerProps {\n /**\n * temporary the same as onClick, later will be added touch events support\n */\n onPress?: DOMAttributes<HTMLElement>['onClick']\n}\n\nexport const Trigger = React.forwardRef<\n ElementRef<typeof StyledTrigger>,\n TriggerProps\n>(({ onPress, onClick, ...restProps }, forwardRef) => {\n const { triggerRef, hoveredRef, focusedRef } = useContext(\n TooltipTriggerContext\n )\n\n const { hoverProps } = useHover({\n onHoverStart: () => {\n hoveredRef.current = true\n },\n onHoverEnd: () => {\n hoveredRef.current = false\n },\n })\n\n return (\n <StyledTrigger\n {...mergeProps(restProps, hoverProps, {\n onFocus: () => {\n focusedRef.current = true\n },\n onBlur: () => {\n focusedRef.current = false\n },\n })}\n onClick={onPress ?? onClick}\n ref={mergeRefs([triggerRef, forwardRef])}\n />\n )\n})\n\nTrigger.displayName = 'Tooltip.Trigger'\n","import React, { createContext, useContext } from 'react'\n\nexport interface ProviderProps {\n /**\n * The duration from when the mouse enters a tooltip trigger until\n * the tooltip opens.\n */\n delayDuration?: number\n\n /**\n * How much time a user has to enter another trigger without incurring\n * a delay again.\n * When set to `0`, when hovering between triggers there wont be delay duration.\n * @default 500\n */\n skipDelayDuration?: number\n\n /**\n * The content\n */\n children?: React.ReactNode\n}\n\nexport const ProviderContext = createContext<ProviderProps>({} as any)\n\nexport const Provider: React.FC<ProviderProps> = ({\n children,\n ...restProps\n}) => (\n <ProviderContext.Provider value={restProps}>\n {children}\n </ProviderContext.Provider>\n)\n\nProvider.displayName = 'Tooltip.Provider'\n\nexport const useTooltipContext = (): ProviderProps =>\n useContext(ProviderContext)\n","import React from 'react'\nimport type { TooltipPortalProps } from '@radix-ui/react-tooltip'\nimport { Portal as RadixPortal } from '@radix-ui/react-tooltip'\n\nexport interface PortalProps extends TooltipPortalProps {\n /**\n * Used to force mounting when more control is needed. Useful when controlling\n * animation with React animation libraries. If used on this part, it will be\n * inherited by Tooltip.Content.\n */\n forceMount?: true\n\n /**\n * Specify a container element to portal the content into.\n */\n container?: HTMLElement | null\n}\n\nexport const Portal: React.FC<PortalProps> = props => <RadixPortal {...props} />\n","import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const StyledHotkey = styled(Primitive.span, {\n marginLeft: '$100',\n})\n\nexport type StyledHotkeyProps = StrictComponentProps<typeof StyledHotkey>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Hotkey as BaseHotkey } from '@mirohq/design-system-base-hotkey'\n\nimport type { StyledHotkeyProps } from './hotkey.styled'\nimport { StyledHotkey } from './hotkey.styled'\n\nexport interface HotkeyProps extends StyledHotkeyProps {\n /**\n * The content.\n */\n children: string\n}\n\nexport const Hotkey = React.forwardRef<\n ElementRef<typeof StyledHotkey>,\n HotkeyProps\n>(({ children, ...restProps }, forwardRef) => (\n <StyledHotkey {...restProps} ref={forwardRef}>\n <BaseHotkey variant='inverted'>{children}</BaseHotkey>\n </StyledHotkey>\n))\n","import React, {\n useState,\n useCallback,\n useEffect,\n useRef,\n createContext,\n} from 'react'\nimport {\n Provider as RadixProvider,\n Root as RadixTooltip,\n} from '@radix-ui/react-tooltip'\n\nimport { Content } from './partials/content'\nimport { Trigger } from './partials/trigger'\nimport { Provider, useTooltipContext } from './partials/provider'\nimport { Portal } from './partials/portal'\nimport { Hotkey } from './partials/hotkey'\n\nexport interface TooltipProps {\n /**\n * The open state of the tooltip when it is initially rendered. Use when you\n * do not need to control its open state.\n */\n defaultOpen?: boolean\n\n /**\n * The current state of the tooltip.\n */\n open?: boolean\n\n /**\n * Event handler called when the tooltip opens.\n */\n onOpen?: () => void\n\n /**\n * Event handler called when the tooltip closes.\n */\n onClose?: () => void\n\n /**\n * Overrides the duration given to the `Provider` to customize the open delay\n * for a specific tooltip.\n * @default 200\n */\n delayDuration?: number\n\n /**\n * How much time a user has to enter another trigger without incurring\n * a delay again.\n * @default 500\n */\n skipDelayDuration?: number\n\n /**\n * Clears the delayDuration and skipDelayDuration timeouts when the component\n * is unmounted. This flag is `true` by default when using NODE_ENV=test.\n * @default false\n */\n clearDelaysOnUnmount?: boolean\n\n /**\n * Closes the tooltip as soon as the pointer leaves the trigger making it\n * impossible to hover the content.\n */\n disableHoverableContent?: boolean\n\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nlet delayTimer: ReturnType<typeof setTimeout> | undefined\nlet skipDelayTimer: ReturnType<typeof setTimeout> | undefined\nlet shouldSkipDelay = false\n\nexport const DEFAULT_SKIP_DELAY_DURATION = 500\nexport const DEFAULT_DELAY_DURATION = 200\n\nexport const TooltipTriggerContext = createContext<{\n triggerRef: React.RefObject<HTMLButtonElement>\n hoveredRef: React.MutableRefObject<boolean>\n focusedRef: React.MutableRefObject<boolean>\n}>({\n triggerRef: { current: null },\n hoveredRef: { current: false },\n focusedRef: { current: false },\n})\n\nexport const Tooltip: React.FC<TooltipProps> & Partials = ({\n defaultOpen = false,\n open,\n onOpen,\n onClose,\n skipDelayDuration,\n delayDuration,\n disableHoverableContent,\n clearDelaysOnUnmount = process.env.NODE_ENV === 'test',\n children,\n}) => {\n const context = useTooltipContext()\n const isMounted = useRef(false)\n const _skipDelayDuration =\n skipDelayDuration ??\n context.skipDelayDuration ??\n DEFAULT_SKIP_DELAY_DURATION\n\n const triggerRef = useRef<HTMLButtonElement>(null)\n const hoveredRef = useRef<boolean>(false)\n const focusedRef = useRef<boolean>(false)\n\n const [openState, setOpenState] = useState(defaultOpen)\n const setDelayedOpen = useCallback(\n (newOpenState: boolean) => {\n clearTimeout(delayTimer)\n clearTimeout(skipDelayTimer)\n\n if (!newOpenState) {\n skipDelayTimer = setTimeout(() => {\n shouldSkipDelay = false\n }, _skipDelayDuration)\n setOpenState(false)\n onClose?.()\n return\n }\n\n if (shouldSkipDelay || focusedRef.current) {\n setOpenState(newOpenState)\n return\n }\n\n delayTimer = setTimeout(() => {\n // ignore it if the user quickly hover the trigger and leave before the timeout\n if (!hoveredRef.current && process.env.NODE_ENV !== 'test') {\n return\n }\n\n /* when skipDelayDuration is 0 no skip delay should happen. */\n shouldSkipDelay = _skipDelayDuration !== 0\n\n if (isMounted.current) {\n setOpenState(true)\n onOpen?.()\n }\n }, delayDuration ?? context.delayDuration ?? DEFAULT_DELAY_DURATION)\n },\n [delayDuration, context.delayDuration, _skipDelayDuration, onClose, onOpen]\n )\n\n const handleOpenChange = useCallback(\n (newState: boolean) => {\n if (open == null) {\n setDelayedOpen(newState)\n return\n }\n\n newState ? onOpen?.() : onClose?.()\n },\n [open, onOpen, onClose, setDelayedOpen]\n )\n\n useEffect(\n () => () => {\n if (clearDelaysOnUnmount) {\n clearTimeout(delayTimer)\n clearTimeout(skipDelayTimer)\n shouldSkipDelay = false\n }\n },\n [clearDelaysOnUnmount]\n )\n\n useEffect(() => {\n isMounted.current = true\n return () => {\n isMounted.current = false\n }\n }, [])\n\n return (\n <RadixProvider delayDuration={0} skipDelayDuration={0}>\n <TooltipTriggerContext.Provider\n value={{\n triggerRef,\n hoveredRef,\n focusedRef,\n }}\n >\n <RadixTooltip\n disableHoverableContent={disableHoverableContent}\n open={open ?? openState}\n delayDuration={0} // we control it manually\n onOpenChange={handleOpenChange}\n >\n {children}\n </RadixTooltip>\n </TooltipTriggerContext.Provider>\n </RadixProvider>\n )\n}\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Trigger: typeof Trigger\n Content: typeof Content\n Provider: typeof Provider\n Portal: typeof Portal\n Hotkey: typeof Hotkey\n}\n\nTooltip.Trigger = Trigger\nTooltip.Content = Content\nTooltip.Provider = Provider\nTooltip.Portal = Portal\nTooltip.Hotkey = Hotkey\n"],"names":["RadixArrow","RadixContent","Trigger","RadixPortal","BaseHotkey","_a","RadixProvider","RadixTooltip"],"mappings":";;;;;;;;;;AAOa,MAAA,eAAA,GAAkB,OAAOA,KAAY,EAAA;AAAA,EAChD,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA,KAAA;AAAA,EACR,SAAW,EAAA,kBAAA;AAAA,EACX,KAAO,EAAA,MAAA;AACT,CAAC,CAAA,CAAA;AAEY,MAAA,aAAA,GAAgB,OAAOC,SAAc,EAAA;AAAA,EAChD,eAAiB,EAAA,QAAA;AAAA,EACjB,YAAc,EAAA,KAAA;AAAA,EACd,KAAO,EAAA,QAAA;AAAA,EACP,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,KAAA;AAAA,EACZ,UAAY,EAAA,MAAA;AAAA,EACZ,UAAY,EAAA,SAAA;AAAA,EACZ,OAAS,EAAA,MAAA;AAAA,EACT,MAAQ,EAAA,UAAA;AACV,CAAC,CAAA;;ACgEM,MAAM,UAAU,KAAM,CAAA,UAAA;AAAA,EAI3B,CACE;AAAA,IACE,KAAQ,GAAA,QAAA;AAAA,IACR,WAAc,GAAA,CAAA;AAAA,IACd,eAAkB,GAAA,IAAA;AAAA,IAClB,gBAAmB,GAAA,CAAA;AAAA,IACnB,QAAA;AAAA,IACA,IAAO,GAAA,KAAA;AAAA,IACP,UAAa,GAAA,CAAA;AAAA,IACb,MAAS,GAAA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,CAAAC,UAAA,EAAA,EAAc,aAAe,EAAA,CAAA,EAAG,mBAAmB,CAClD,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,qBAAsB,CAAA,QAAA;AAAA,IAAtB;AAAA,MACC,KAAO,EAAA;AAAA,QACL,UAAA;AAAA,QACA,UAAA;AAAA,QACA,UAAA;AAAA,OACF;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAACC,IAAA;AAAA,QAAA;AAAA,UACC,uBAAA;AAAA,UACA,MAAM,IAAQ,IAAA,IAAA,GAAA,IAAA,GAAA,SAAA;AAAA,UACd,aAAe,EAAA,CAAA;AAAA,UACf,YAAc,EAAA,gBAAA;AAAA,UAEb,QAAA;AAAA,SAAA;AAAA,OACH;AAAA,KAAA;AAAA,GAEJ,EAAA,CAAA,CAAA;AAEJ,EAAA;AAaA,OAAA,CAAQ,OAAU,GAAA,OAAA,CAAA;AAClB,OAAA,CAAQ,OAAU,GAAA,OAAA,CAAA;AAClB,OAAA,CAAQ,QAAW,GAAA,QAAA,CAAA;AACnB,OAAA,CAAQ,MAAS,GAAA,MAAA,CAAA;AACjB,OAAA,CAAQ,MAAS,GAAA,MAAA;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirohq/design-system-tooltip",
3
- "version": "3.3.26",
3
+ "version": "3.3.27-tooltip.0",
4
4
  "description": "",
5
5
  "author": "Miro",
6
6
  "source": "src/index.ts",
@@ -28,11 +28,12 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@radix-ui/react-tooltip": "^1.0.3",
31
- "@mirohq/design-system-primitive": "^1.1.2",
31
+ "@react-aria/interactions": "^3.13.0",
32
+ "@react-aria/utils": "^3.13.0",
32
33
  "@mirohq/design-system-base-hotkey": "^0.1.19",
33
- "@mirohq/design-system-stitches": "^2.6.18",
34
- "@mirohq/design-system-use-id": "^0.1.2",
35
- "@mirohq/design-system-utils": "^0.15.4"
34
+ "@mirohq/design-system-utils": "^0.15.4",
35
+ "@mirohq/design-system-primitive": "^1.1.2",
36
+ "@mirohq/design-system-stitches": "^2.6.18"
36
37
  },
37
38
  "scripts": {
38
39
  "build": "rollup -c ../../../rollup.config.js",