@mirohq/design-system-tooltip 4.2.0 → 4.3.0-fix-stitches-types.1
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 +3 -9
- package/dist/main.js.map +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +38 -22
- package/package.json +7 -7
package/dist/main.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
4
|
var React = require('react');
|
|
7
5
|
var designSystemUseId = require('@mirohq/design-system-use-id');
|
|
@@ -12,10 +10,6 @@ var designSystemUtils = require('@mirohq/design-system-utils');
|
|
|
12
10
|
var designSystemBaseHotkey = require('@mirohq/design-system-base-hotkey');
|
|
13
11
|
var designSystemPrimitive = require('@mirohq/design-system-primitive');
|
|
14
12
|
|
|
15
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
-
|
|
17
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
|
-
|
|
19
13
|
const StyledArrowIcon = designSystemStitches.styled(reactTooltip.Arrow, {
|
|
20
14
|
fill: "$gray-900",
|
|
21
15
|
width: "8px",
|
|
@@ -36,7 +30,7 @@ const StyledContent = designSystemStitches.styled(reactTooltip.Content, {
|
|
|
36
30
|
outline: "1px solid transparent"
|
|
37
31
|
});
|
|
38
32
|
|
|
39
|
-
const Content =
|
|
33
|
+
const Content = React.forwardRef(
|
|
40
34
|
({
|
|
41
35
|
align = "center",
|
|
42
36
|
alignOffset = 0,
|
|
@@ -111,7 +105,7 @@ Content.displayName = "Tooltip.Content";
|
|
|
111
105
|
|
|
112
106
|
const StyledTrigger = designSystemStitches.styled(reactTooltip.Trigger);
|
|
113
107
|
|
|
114
|
-
const Trigger =
|
|
108
|
+
const Trigger = React.forwardRef(({ onPress, onClick, ...restProps }, forwardRef) => {
|
|
115
109
|
const { triggerRef, id } = React.useContext(TooltipTriggerContext);
|
|
116
110
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
117
111
|
StyledTrigger,
|
|
@@ -140,7 +134,7 @@ const StyledHotkey = designSystemStitches.styled(designSystemPrimitive.Primitive
|
|
|
140
134
|
marginRight: "-$50"
|
|
141
135
|
});
|
|
142
136
|
|
|
143
|
-
const Hotkey =
|
|
137
|
+
const Hotkey = React.forwardRef(({ children, ...restProps }, forwardRef) => /* @__PURE__ */ jsxRuntime.jsx(StyledHotkey, { ...restProps, ref: forwardRef, children: /* @__PURE__ */ jsxRuntime.jsx(designSystemBaseHotkey.Hotkey, { variant: "inverted", children }) }));
|
|
144
138
|
|
|
145
139
|
const Metadata = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
146
140
|
fontSize: "12px",
|
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/partials/metadata.ts","../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: '$gray-900',\n width: '8px',\n height: '6px',\n transform: 'translateY(-1px)',\n forcedColorAdjust: 'auto',\n})\n\nexport const StyledContent = styled(RadixContent, {\n background: '$gray-900',\n color: '$gray-50',\n padding: 'calc($50 + $25) $100',\n lineHeight: '$400',\n borderRadius: '$100',\n fontSize: '14px',\n fontWeight: '400',\n fontFamily: 'inherit',\n zIndex: '$tooltip',\n outline: '1px solid transparent',\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 aria-hidden='true' />\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 = ({\n children,\n ...restProps\n}: ProviderProps): React.ReactNode => (\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 = (props: PortalProps): React.ReactNode => (\n <RadixPortal {...props} />\n)\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 marginRight: '-$50',\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 type { ComponentPropsWithRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const Metadata = styled(Primitive.div, {\n fontSize: '12px',\n color: '$gray-300',\n lineHeight: 1.4,\n display: 'block',\n})\n\nexport type MetadataProps = ComponentPropsWithRef<typeof Metadata>\n\nMetadata.displayName = 'Tooltip.Metadata'\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'\nimport { useBaseTooltipContext } from '@mirohq/design-system-base-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'\nimport { Metadata } from './partials/metadata'\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 = 300\n\nexport const TooltipTriggerContext = createContext<{\n triggerRef: React.RefObject<HTMLButtonElement>\n id?: string\n}>({\n triggerRef: { current: null },\n})\n\nexport const Tooltip: ((props: TooltipProps) => React.ReactNode) & 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 { preventNextOpeningRef } = useBaseTooltipContext()\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 (newState && preventNextOpeningRef.current) {\n preventNextOpeningRef.current = false\n return\n }\n\n if (open == null) {\n setDelayedOpen(newState)\n return\n }\n\n newState ? onOpen?.() : onClose?.()\n },\n [open, onOpen, onClose, preventNextOpeningRef, 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 Metadata: typeof Metadata\n}\n\nTooltip.Trigger = Trigger\nTooltip.Content = Content\nTooltip.Provider = Provider\nTooltip.Portal = Portal\nTooltip.Hotkey = Hotkey\nTooltip.Metadata = Metadata\n"],"names":["styled","RadixArrow","RadixContent","React","useContext","useEffect","jsxs","jsx","Trigger","mergeRefs","createContext","RadixPortal","Primitive","BaseHotkey","useRef","useId","useBaseTooltipContext","useState","useCallback","_a","RadixProvider","RadixTooltip"],"mappings":";;;;;;;;;;;;;;;;;;AAOa,MAAA,eAAA,GAAkBA,4BAAOC,kBAAY,EAAA;AAAA,EAChD,IAAM,EAAA,WAAA;AAAA,EACN,KAAO,EAAA,KAAA;AAAA,EACP,MAAQ,EAAA,KAAA;AAAA,EACR,SAAW,EAAA,kBAAA;AAAA,EACX,iBAAmB,EAAA,MAAA;AACrB,CAAC,CAAA,CAAA;AAEY,MAAA,aAAA,GAAgBD,4BAAOE,oBAAc,EAAA;AAAA,EAChD,UAAY,EAAA,WAAA;AAAA,EACZ,KAAO,EAAA,UAAA;AAAA,EACP,OAAS,EAAA,sBAAA;AAAA,EACT,UAAY,EAAA,MAAA;AAAA,EACZ,YAAc,EAAA,MAAA;AAAA,EACd,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,KAAA;AAAA,EACZ,UAAY,EAAA,SAAA;AAAA,EACZ,MAAQ,EAAA,UAAA;AAAA,EACR,OAAS,EAAA,uBAAA;AACX,CAAC,CAAA;;AC8DM,MAAM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
|
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/partials/metadata.ts","../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: '$gray-900',\n width: '8px',\n height: '6px',\n transform: 'translateY(-1px)',\n forcedColorAdjust: 'auto',\n})\n\nexport const StyledContent = styled(RadixContent, {\n background: '$gray-900',\n color: '$gray-50',\n padding: 'calc($50 + $25) $100',\n lineHeight: '$400',\n borderRadius: '$100',\n fontSize: '14px',\n fontWeight: '400',\n fontFamily: 'inherit',\n zIndex: '$tooltip',\n outline: '1px solid transparent',\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 aria-hidden='true' />\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 = ({\n children,\n ...restProps\n}: ProviderProps): React.ReactNode => (\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 = (props: PortalProps): React.ReactNode => (\n <RadixPortal {...props} />\n)\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 marginRight: '-$50',\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 type { ComponentPropsWithRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const Metadata = styled(Primitive.div, {\n fontSize: '12px',\n color: '$gray-300',\n lineHeight: 1.4,\n display: 'block',\n})\n\nexport type MetadataProps = ComponentPropsWithRef<typeof Metadata>\n\nMetadata.displayName = 'Tooltip.Metadata'\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'\nimport { useBaseTooltipContext } from '@mirohq/design-system-base-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'\nimport { Metadata } from './partials/metadata'\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 = 300\n\nexport const TooltipTriggerContext = createContext<{\n triggerRef: React.RefObject<HTMLButtonElement>\n id?: string\n}>({\n triggerRef: { current: null },\n})\n\nexport const Tooltip: ((props: TooltipProps) => React.ReactNode) & 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 { preventNextOpeningRef } = useBaseTooltipContext()\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 (newState && preventNextOpeningRef.current) {\n preventNextOpeningRef.current = false\n return\n }\n\n if (open == null) {\n setDelayedOpen(newState)\n return\n }\n\n newState ? onOpen?.() : onClose?.()\n },\n [open, onOpen, onClose, preventNextOpeningRef, 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 Metadata: typeof Metadata\n}\n\nTooltip.Trigger = Trigger\nTooltip.Content = Content\nTooltip.Provider = Provider\nTooltip.Portal = Portal\nTooltip.Hotkey = Hotkey\nTooltip.Metadata = Metadata\n"],"names":["styled","RadixArrow","RadixContent","useContext","useEffect","jsxs","jsx","Trigger","mergeRefs","createContext","RadixPortal","Primitive","BaseHotkey","useRef","useId","useBaseTooltipContext","useState","useCallback","_a","RadixProvider","RadixTooltip"],"mappings":";;;;;;;;;;;;AA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.map
CHANGED
|
@@ -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/partials/metadata.ts","../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: '$gray-900',\n width: '8px',\n height: '6px',\n transform: 'translateY(-1px)',\n forcedColorAdjust: 'auto',\n})\n\nexport const StyledContent = styled(RadixContent, {\n background: '$gray-900',\n color: '$gray-50',\n padding: 'calc($50 + $25) $100',\n lineHeight: '$400',\n borderRadius: '$100',\n fontSize: '14px',\n fontWeight: '400',\n fontFamily: 'inherit',\n zIndex: '$tooltip',\n outline: '1px solid transparent',\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 aria-hidden='true' />\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 = ({\n children,\n ...restProps\n}: ProviderProps): React.ReactNode => (\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 = (props: PortalProps): React.ReactNode => (\n <RadixPortal {...props} />\n)\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 marginRight: '-$50',\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 type { ComponentPropsWithRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const Metadata = styled(Primitive.div, {\n fontSize: '12px',\n color: '$gray-300',\n lineHeight: 1.4,\n display: 'block',\n})\n\nexport type MetadataProps = ComponentPropsWithRef<typeof Metadata>\n\nMetadata.displayName = 'Tooltip.Metadata'\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'\nimport { useBaseTooltipContext } from '@mirohq/design-system-base-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'\nimport { Metadata } from './partials/metadata'\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 = 300\n\nexport const TooltipTriggerContext = createContext<{\n triggerRef: React.RefObject<HTMLButtonElement>\n id?: string\n}>({\n triggerRef: { current: null },\n})\n\nexport const Tooltip: ((props: TooltipProps) => React.ReactNode) & 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 { preventNextOpeningRef } = useBaseTooltipContext()\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 (newState && preventNextOpeningRef.current) {\n preventNextOpeningRef.current = false\n return\n }\n\n if (open == null) {\n setDelayedOpen(newState)\n return\n }\n\n newState ? onOpen?.() : onClose?.()\n },\n [open, onOpen, onClose, preventNextOpeningRef, 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 Metadata: typeof Metadata\n}\n\nTooltip.Trigger = Trigger\nTooltip.Content = Content\nTooltip.Provider = Provider\nTooltip.Portal = Portal\nTooltip.Hotkey = Hotkey\nTooltip.Metadata = Metadata\n"],"names":["RadixArrow","RadixContent","Trigger","RadixPortal","BaseHotkey","_a","RadixProvider","RadixTooltip"],"mappings":";;;;;;;;;;AAOa,MAAA,eAAA,GAAkB,OAAOA,KAAY,EAAA;AAAA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AAM,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;AAcA,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,CAAA;AACjB,OAAA,CAAQ,QAAW,GAAA,QAAA;;;;;;;;"}
|
|
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/partials/metadata.ts","../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: '$gray-900',\n width: '8px',\n height: '6px',\n transform: 'translateY(-1px)',\n forcedColorAdjust: 'auto',\n})\n\nexport const StyledContent = styled(RadixContent, {\n background: '$gray-900',\n color: '$gray-50',\n padding: 'calc($50 + $25) $100',\n lineHeight: '$400',\n borderRadius: '$100',\n fontSize: '14px',\n fontWeight: '400',\n fontFamily: 'inherit',\n zIndex: '$tooltip',\n outline: '1px solid transparent',\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 aria-hidden='true' />\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 = ({\n children,\n ...restProps\n}: ProviderProps): React.ReactNode => (\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 = (props: PortalProps): React.ReactNode => (\n <RadixPortal {...props} />\n)\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 marginRight: '-$50',\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 type { ComponentPropsWithRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const Metadata = styled(Primitive.div, {\n fontSize: '12px',\n color: '$gray-300',\n lineHeight: 1.4,\n display: 'block',\n})\n\nexport type MetadataProps = ComponentPropsWithRef<typeof Metadata>\n\nMetadata.displayName = 'Tooltip.Metadata'\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'\nimport { useBaseTooltipContext } from '@mirohq/design-system-base-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'\nimport { Metadata } from './partials/metadata'\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 = 300\n\nexport const TooltipTriggerContext = createContext<{\n triggerRef: React.RefObject<HTMLButtonElement>\n id?: string\n}>({\n triggerRef: { current: null },\n})\n\nexport const Tooltip: ((props: TooltipProps) => React.ReactNode) & 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 { preventNextOpeningRef } = useBaseTooltipContext()\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 (newState && preventNextOpeningRef.current) {\n preventNextOpeningRef.current = false\n return\n }\n\n if (open == null) {\n setDelayedOpen(newState)\n return\n }\n\n newState ? onOpen?.() : onClose?.()\n },\n [open, onOpen, onClose, preventNextOpeningRef, 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 Metadata: typeof Metadata\n}\n\nTooltip.Trigger = Trigger\nTooltip.Content = Content\nTooltip.Provider = Provider\nTooltip.Portal = Portal\nTooltip.Hotkey = Hotkey\nTooltip.Metadata = Metadata\n"],"names":["RadixArrow","RadixContent","Trigger","RadixPortal","BaseHotkey","_a","RadixProvider","RadixTooltip"],"mappings":";;;;;;;;;;AAOO,MAAM,eAAA,GAAkB,OAAOA,KAAA,EAAY;AAAA,EAChD,IAAA,EAAM,WAAA;AAAA,EACN,KAAA,EAAO,KAAA;AAAA,EACP,MAAA,EAAQ,KAAA;AAAA,EACR,SAAA,EAAW,kBAAA;AAAA,EACX,iBAAA,EAAmB;AACrB,CAAC,CAAA;AAEM,MAAM,aAAA,GAAgB,OAAOC,SAAA,EAAc;AAAA,EAChD,UAAA,EAAY,WAAA;AAAA,EACZ,KAAA,EAAO,UAAA;AAAA,EACP,OAAA,EAAS,sBAAA;AAAA,EACT,UAAA,EAAY,MAAA;AAAA,EACZ,YAAA,EAAc,MAAA;AAAA,EACd,QAAA,EAAU,MAAA;AAAA,EACV,UAAA,EAAY,KAAA;AAAA,EACZ,UAAA,EAAY,SAAA;AAAA,EACZ,MAAA,EAAQ,UAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC,CAAA;;AC8DM,MAAM,UAAU,KAAA,CAAM,UAAA;AAAA,EAI3B,CACE;AAAA,IACE,KAAA,GAAQ,QAAA;AAAA,IACR,WAAA,GAAc,CAAA;AAAA,IACd,eAAA,GAAkB,IAAA;AAAA,IAClB,gBAAA,GAAmB,CAAA;AAAA,IACnB,QAAA;AAAA,IACA,IAAA,GAAO,KAAA;AAAA,IACP,UAAA,GAAa,CAAA;AAAA,IACb,MAAA,GAAS,SAAA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,EAAc,gBAAA;AAAA,UAEb;AAAA;AAAA;AACH;AAAA,GACF,EACF,CAAA;AAEJ;AAcA,OAAA,CAAQ,OAAA,GAAU,OAAA;AAClB,OAAA,CAAQ,OAAA,GAAU,OAAA;AAClB,OAAA,CAAQ,QAAA,GAAW,QAAA;AACnB,OAAA,CAAQ,MAAA,GAAS,MAAA;AACjB,OAAA,CAAQ,MAAA,GAAS,MAAA;AACjB,OAAA,CAAQ,QAAA,GAAW,QAAA;;;;;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import * as _stitches_react_types_styled_component from '@stitches/react/types/styled-component';
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { DOMAttributes, ComponentPropsWithRef } from 'react';
|
|
4
3
|
import * as _mirohq_design_system_stitches from '@mirohq/design-system-stitches';
|
|
5
4
|
import { StrictComponentProps } from '@mirohq/design-system-stitches';
|
|
6
5
|
import * as _radix_ui_react_tooltip from '@radix-ui/react-tooltip';
|
|
7
6
|
import { TooltipPortalProps } from '@radix-ui/react-tooltip';
|
|
8
7
|
import * as _mirohq_design_system_primitive from '@mirohq/design-system-primitive';
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
/* Utilities */
|
|
10
|
+
/* ========================================================================== */
|
|
11
|
+
|
|
12
|
+
/** Returns a string with the given prefix followed by the given values. */
|
|
13
|
+
type Prefixed<K extends string, T> = `${K}${Extract<T, boolean | number | string>}`
|
|
14
|
+
|
|
15
|
+
type TransformProps<Props, Media> = {
|
|
16
|
+
[K in keyof Props]: (
|
|
17
|
+
| Props[K]
|
|
18
|
+
| (
|
|
19
|
+
& {
|
|
20
|
+
[KMedia in Prefixed<'@', 'initial' | keyof Media>]?: Props[K]
|
|
21
|
+
}
|
|
22
|
+
& {
|
|
23
|
+
[KMedia in string]: Props[K]
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare const StyledContent: React.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<React.ForwardRefExoticComponent<_radix_ui_react_tooltip.TooltipContentProps & React.RefAttributes<HTMLDivElement>>>, never> & TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & React.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<React.ForwardRefExoticComponent<_radix_ui_react_tooltip.TooltipContentProps & React.RefAttributes<HTMLDivElement>>, {}, {}>;
|
|
11
30
|
type StyledContentProps = StrictComponentProps<typeof StyledContent>;
|
|
12
31
|
|
|
13
32
|
type PointerDownOutsideEvent = CustomEvent<{
|
|
@@ -16,15 +35,11 @@ type PointerDownOutsideEvent = CustomEvent<{
|
|
|
16
35
|
type Side = 'top' | 'right' | 'bottom' | 'left';
|
|
17
36
|
type Align = 'start' | 'center' | 'end';
|
|
18
37
|
|
|
38
|
+
type types_Align = Align;
|
|
19
39
|
type types_PointerDownOutsideEvent = PointerDownOutsideEvent;
|
|
20
40
|
type types_Side = Side;
|
|
21
|
-
type types_Align = Align;
|
|
22
41
|
declare namespace types {
|
|
23
|
-
export {
|
|
24
|
-
types_PointerDownOutsideEvent as PointerDownOutsideEvent,
|
|
25
|
-
types_Side as Side,
|
|
26
|
-
types_Align as Align,
|
|
27
|
-
};
|
|
42
|
+
export type { types_Align as Align, types_PointerDownOutsideEvent as PointerDownOutsideEvent, types_Side as Side };
|
|
28
43
|
}
|
|
29
44
|
|
|
30
45
|
interface ContentProps extends StyledContentProps {
|
|
@@ -95,9 +110,9 @@ interface ContentProps extends StyledContentProps {
|
|
|
95
110
|
*/
|
|
96
111
|
onPointerDownOutside?: (event: PointerDownOutsideEvent) => void;
|
|
97
112
|
}
|
|
98
|
-
declare const Content:
|
|
113
|
+
declare const Content: React__default.ForwardRefExoticComponent<Omit<ContentProps, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
|
|
99
114
|
|
|
100
|
-
declare const StyledTrigger:
|
|
115
|
+
declare const StyledTrigger: React.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<React.ForwardRefExoticComponent<_radix_ui_react_tooltip.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>>, never> & TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & React.RefAttributes<HTMLButtonElement>> & _mirohq_design_system_stitches.StitchesInternals<React.ForwardRefExoticComponent<_radix_ui_react_tooltip.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>, {}, {}>;
|
|
101
116
|
type StyledTriggerProps = StrictComponentProps<typeof StyledTrigger>;
|
|
102
117
|
|
|
103
118
|
interface TriggerProps extends StyledTriggerProps {
|
|
@@ -106,7 +121,7 @@ interface TriggerProps extends StyledTriggerProps {
|
|
|
106
121
|
*/
|
|
107
122
|
onPress?: DOMAttributes<HTMLElement>['onClick'];
|
|
108
123
|
}
|
|
109
|
-
declare const Trigger:
|
|
124
|
+
declare const Trigger: React__default.ForwardRefExoticComponent<Omit<TriggerProps, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
|
|
110
125
|
|
|
111
126
|
interface ProviderProps {
|
|
112
127
|
/**
|
|
@@ -124,10 +139,10 @@ interface ProviderProps {
|
|
|
124
139
|
/**
|
|
125
140
|
* The content
|
|
126
141
|
*/
|
|
127
|
-
children?:
|
|
142
|
+
children?: React__default.ReactNode;
|
|
128
143
|
}
|
|
129
144
|
declare const Provider: {
|
|
130
|
-
({ children, ...restProps }: ProviderProps):
|
|
145
|
+
({ children, ...restProps }: ProviderProps): React__default.ReactNode;
|
|
131
146
|
displayName: string;
|
|
132
147
|
};
|
|
133
148
|
|
|
@@ -143,9 +158,9 @@ interface PortalProps extends TooltipPortalProps {
|
|
|
143
158
|
*/
|
|
144
159
|
container?: HTMLElement | null;
|
|
145
160
|
}
|
|
146
|
-
declare const Portal: (props: PortalProps) =>
|
|
161
|
+
declare const Portal: (props: PortalProps) => React__default.ReactNode;
|
|
147
162
|
|
|
148
|
-
declare const StyledHotkey:
|
|
163
|
+
declare const StyledHotkey: React.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<React.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"span">>>, never> & TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & React.RefAttributes<HTMLSpanElement>> & _mirohq_design_system_stitches.StitchesInternals<React.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"span">>, {}, {}>;
|
|
149
164
|
type StyledHotkeyProps = StrictComponentProps<typeof StyledHotkey>;
|
|
150
165
|
|
|
151
166
|
interface HotkeyProps extends StyledHotkeyProps {
|
|
@@ -154,9 +169,9 @@ interface HotkeyProps extends StyledHotkeyProps {
|
|
|
154
169
|
*/
|
|
155
170
|
children: string;
|
|
156
171
|
}
|
|
157
|
-
declare const Hotkey:
|
|
172
|
+
declare const Hotkey: React__default.ForwardRefExoticComponent<Omit<HotkeyProps, "ref"> & React__default.RefAttributes<HTMLSpanElement>>;
|
|
158
173
|
|
|
159
|
-
declare const Metadata:
|
|
174
|
+
declare const Metadata: React.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<React.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, never> & TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & React.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<React.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>, {}, {}>;
|
|
160
175
|
type MetadataProps = ComponentPropsWithRef<typeof Metadata>;
|
|
161
176
|
|
|
162
177
|
interface TooltipProps {
|
|
@@ -203,11 +218,11 @@ interface TooltipProps {
|
|
|
203
218
|
/**
|
|
204
219
|
* The content
|
|
205
220
|
*/
|
|
206
|
-
children:
|
|
221
|
+
children: React__default.ReactNode;
|
|
207
222
|
}
|
|
208
223
|
declare const DEFAULT_SKIP_DELAY_DURATION = 500;
|
|
209
224
|
declare const DEFAULT_DELAY_DURATION = 300;
|
|
210
|
-
declare const Tooltip: ((props: TooltipProps) =>
|
|
225
|
+
declare const Tooltip: ((props: TooltipProps) => React__default.ReactNode) & Partials;
|
|
211
226
|
interface Partials {
|
|
212
227
|
Trigger: typeof Trigger;
|
|
213
228
|
Content: typeof Content;
|
|
@@ -217,4 +232,5 @@ interface Partials {
|
|
|
217
232
|
Metadata: typeof Metadata;
|
|
218
233
|
}
|
|
219
234
|
|
|
220
|
-
export { DEFAULT_DELAY_DURATION as TOOLTIP_DEFAULT_DELAY_DURATION, DEFAULT_SKIP_DELAY_DURATION as TOOLTIP_DEFAULT_SKIP_DELAY_DURATION, Tooltip,
|
|
235
|
+
export { DEFAULT_DELAY_DURATION as TOOLTIP_DEFAULT_DELAY_DURATION, DEFAULT_SKIP_DELAY_DURATION as TOOLTIP_DEFAULT_SKIP_DELAY_DURATION, Tooltip, types as TooltipTypes };
|
|
236
|
+
export type { ContentProps as TooltipContentProps, MetadataProps as TooltipMetadataProps, PortalProps as TooltipPortalProps, TooltipProps, ProviderProps as TooltipProviderProps, TriggerProps as TooltipTriggerProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirohq/design-system-tooltip",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0-fix-stitches-types.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Miro",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@radix-ui/react-tooltip": "^1.0.3",
|
|
31
|
-
"@mirohq/design-system-base-hotkey": "^1.1
|
|
32
|
-
"@mirohq/design-system-base-tooltip": "^1.
|
|
33
|
-
"@mirohq/design-system-primitive": "^2.
|
|
34
|
-
"@mirohq/design-system-stitches": "^3.1
|
|
35
|
-
"@mirohq/design-system-
|
|
36
|
-
"@mirohq/design-system-
|
|
31
|
+
"@mirohq/design-system-base-hotkey": "^1.2.0-fix-stitches-types.1",
|
|
32
|
+
"@mirohq/design-system-base-tooltip": "^1.2.0-fix-stitches-types.1",
|
|
33
|
+
"@mirohq/design-system-primitive": "^2.2.0-fix-stitches-types.1",
|
|
34
|
+
"@mirohq/design-system-stitches": "^3.2.0-fix-stitches-types.1",
|
|
35
|
+
"@mirohq/design-system-utils": "^1.2.1",
|
|
36
|
+
"@mirohq/design-system-use-id": "^1.1.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "rollup -c ../../../rollup.config.js",
|