@economic/taco 2.50.0 → 2.50.1-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +8 -5
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/taco.cjs.development.js +187 -185
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +8 -8
@@ -1,5 +1,5 @@
|
|
1
1
|
import { forwardRef, createElement } from 'react';
|
2
|
-
import cn
|
2
|
+
import cn from 'clsx';
|
3
3
|
import { Root, Trigger, Portal, Content, Arrow } from '@radix-ui/react-tooltip';
|
4
4
|
|
5
5
|
const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
@@ -20,16 +20,19 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
20
20
|
asChild: true,
|
21
21
|
ref: ref
|
22
22
|
}, children), /*#__PURE__*/createElement(Portal, null, /*#__PURE__*/createElement(Content, Object.assign({}, otherProps, {
|
23
|
+
asChild: true,
|
24
|
+
className: className,
|
23
25
|
side: placement,
|
24
|
-
sideOffset: 3
|
25
|
-
|
26
|
+
sideOffset: 3
|
27
|
+
}), /*#__PURE__*/createElement("div", {
|
28
|
+
className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded bg-blue-900 px-2 py-1 text-xs text-white print:hidden",
|
26
29
|
"data-taco": "tooltip",
|
27
30
|
style: {
|
28
31
|
transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
|
29
32
|
}
|
30
|
-
}
|
33
|
+
}, /*#__PURE__*/createElement(Arrow, {
|
31
34
|
className: "-mt-px fill-blue-900 stroke-blue-900"
|
32
|
-
}))));
|
35
|
+
}), title))));
|
33
36
|
});
|
34
37
|
|
35
38
|
export { Tooltip };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport cn
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport cn from 'clsx';\n\nexport type TooltipProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Use this value to hide tooltip conditionally */\n hide?: boolean;\n /** Text displayed in the tooltip */\n title: string | JSX.Element;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, hide = false, ...otherProps } = props;\n const className = cn('break-words', otherProps.className);\n\n if (hide) {\n return children;\n }\n\n return (\n <TooltipPrimitive.Root delayDuration={250}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content {...otherProps} asChild className={className} side={placement} sideOffset={3}>\n <div\n className=\"xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded bg-blue-900 px-2 py-1 text-xs text-white print:hidden\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}>\n <TooltipPrimitive.Arrow className=\"-mt-px fill-blue-900 stroke-blue-900\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","hide","otherProps","className","cn","TooltipPrimitive","delayDuration","asChild","side","sideOffset","style","transformOrigin"],"mappings":";;;;MAkBaA,OAAO,gBAAGC,UAAgB,CAAC,SAASD,OAAOA,CAACE,KAAmB,EAAEC,GAA2B;EACrG,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,SAAS;IAAEC,IAAI,GAAG,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EACzE,MAAMO,SAAS,GAAGC,EAAE,CAAC,aAAa,EAAEF,UAAU,CAACC,SAAS,CAAC;EAEzD,IAAIF,IAAI,EAAE;IACN,OAAOF,QAAQ;;EAGnB,oBACIJ,cAACU,IAAqB;IAACC,aAAa,EAAE;kBAClCX,cAACU,OAAwB;IAACE,OAAO;IAACV,GAAG,EAAEA;KAClCE,QAAQ,CACc,eAC3BJ,cAACU,MAAuB,qBACpBV,cAACU,OAAwB,oBAAKH,UAAU;IAAEK,OAAO;IAACJ,SAAS,EAAEA,SAAS;IAAEK,IAAI,EAAER,SAAS;IAAES,UAAU,EAAE;mBACjGd;IACIQ,SAAS,EAAC,8IAA8I;iBAC9I,SAAS;IACnBO,KAAK,EAAE;MACHC,eAAe,EAAE;;kBAErBhB,cAACU,KAAsB;IAACF,SAAS,EAAC;IAAyC,EAC1EL,KAAK,CACJ,CACiB,CACL,CACN;AAEhC,CAAC;;;;"}
|