UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

44 lines 1.11 kB
import { isValidElement } from 'react'; import clsx from 'clsx'; export function injectTooltipSemantic(params) { params.tabIndex = '0'; params.className = clsx("dnb-tooltip__wrapper dnb-tab-focus", params.className); return params; } export const defaultProps = { size: 'default', placement: 'top', arrow: 'center', fixedPosition: false, noAnimation: false, showDelay: 300, hideDelay: 500, triggerOffset: 16 }; export function getTargetElement(target) { if (typeof document !== 'undefined') { return typeof target === 'string' ? typeof document !== 'undefined' && document.querySelector(target) : target; } return undefined; } export function getPropsFromTooltipProp(localProps) { const { tooltip } = localProps; if (!tooltip) { return null; } if (isValidElement(tooltip)) { const type = tooltip.type; if (type !== null && type !== void 0 && type.isTooltipComponent) { return tooltip.props; } } return { children: tooltip }; } export const isTouch = type => { return /touch/i.test(type); }; //# sourceMappingURL=TooltipHelpers.js.map