@jamsrui/tooltip 0.0.12 → 0.0.13

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.
@@ -0,0 +1 @@
1
+ import{radiusVariant as t,tv as o}from"@jamsrui/utils";var a=o({slots:{content:"bg-surface inline-flex px-3 py-1 text-sm font-medium text-foreground",arrow:"fill-background-secondary"},variants:{radius:t("content")},defaultVariants:{radius:"md"}});export{a};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-JHUW52HO.mjs";import{a as t}from"./chunk-DTYTFK7D.mjs";import{FloatingDelayGroup as x}from"@floating-ui/react";import{jsx as i}from"react/jsx-runtime";var s=o=>{let{children:p}=o,r=e(o);return i(t,{value:r,children:p})};export{s as a,x as b};
@@ -0,0 +1 @@
1
+ import{createContext as o,use as e}from"react";var p=o(null),n=()=>{let t=e(p);if(!t)throw new Error("useTooltipContext must be used within a TooltipContext.Provider");return t};export{p as a,n as b};
@@ -0,0 +1 @@
1
+ import{b as r}from"./chunk-DTYTFK7D.mjs";import{FloatingArrow as n}from"@floating-ui/react";import{jsx as p}from"react/jsx-runtime";var w=o=>{let{getArrowProps:t,isOpen:e}=r();return e?p(n,{...t(o),...o}):null};export{w as a};
@@ -0,0 +1 @@
1
+ import{b as t}from"./chunk-DTYTFK7D.mjs";import{useRenderElement as p}from"@jamsrui/hooks";var l=e=>{let{isOpen:o,getContentProps:n}=t(),r=p("div",{props:[n(e)]});return o?r:null};export{l as a};
@@ -0,0 +1 @@
1
+ import{a as h}from"./chunk-47EFJXRD.mjs";import{useCallback as c,useMemo as N,useState as j}from"react";import{arrow as k,autoUpdate as H,flip as I,offset as M,safePolygon as W,shift as U,useDelayGroup as q,useDismiss as z,useFloating as B,useFocus as J,useHover as K,useInteractions as L,useRole as Q}from"@floating-ui/react";import{useControlledState as X}from"@jamsrui/hooks";var oe=w=>{let{delay:r,offset:C=4,placement:O="top",radius:D,defaultOpen:F,isOpen:T,onOpenChange:A,disabled:f=!1,...Y}=w,[p,x]=X({defaultProp:F,onChange:A,prop:T}),[m,G]=j(null),i=!!m,S=i?7:0,{refs:n,floatingStyles:u,context:e}=B({open:p,onOpenChange:x,placement:O,whileElementsMounted:H,middleware:[M(C+S),I({fallbackAxisSideDirection:"start"}),U(),k({element:m})]}),{delay:o}=q(e),t=400,s=100;typeof r=="number"?(t=r,s=r):typeof r=="object"&&(t=r.open??t,s=r.close??s),typeof o=="number"&&o>0?(t=o,s=o):typeof o=="object"&&(t=o.open??t,s=o.close??s);let v=K(e,{move:!1,handleClose:W({blockPointerEvents:!0}),delay:{close:s,open:t}}),E=J(e),R=z(e),V=Q(e,{role:"tooltip"}),{getReferenceProps:d,getFloatingProps:y}=L([v,E,R,V]),l=h({radius:D}),P=c(a=>({...a,className:l.content(),style:u,ref:n.setFloating,...y()}),[u,y,n.setFloating,l]),g=c(a=>({tipRadius:4,...a,context:e,ref:G,className:l.arrow({className:a.className})}),[e,l]),b=c(()=>({...d({ref:n.setReference})}),[d,n.setReference]);return N(()=>({getContentProps:P,getArrowProps:g,isOpen:p,showArrow:i,getTriggerProps:b,isDisabled:f}),[P,g,p,i,b,f])};export{oe as a};
@@ -0,0 +1 @@
1
+ import{b as r}from"./chunk-DTYTFK7D.mjs";import{cloneElement as p}from"react";import{Fragment as l,jsx as c}from"react/jsx-runtime";var T=o=>{let{children:e}=o,{getTriggerProps:t,isDisabled:i}=r();if(i)return e;let n=p(e,t());return c(l,{children:n})};export{T as a};
package/dist/index.d.mts CHANGED
@@ -1,9 +1,33 @@
1
- export { Tooltip } from './tooltip.mjs';
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { Tooltip as Tooltip$1 } from './tooltip.mjs';
4
+ import { TooltipArrow } from './tooltip-arrow.mjs';
5
+ import { TooltipContent } from './tooltip-content.mjs';
6
+ import { TooltipTrigger } from './tooltip-trigger.mjs';
2
7
  export { TooltipConfig, useTooltipConfig } from './tooltip-config.mjs';
8
+ import { FloatingDelayGroup } from '@floating-ui/react';
3
9
  export { FloatingDelayGroup as TooltipGroup } from '@floating-ui/react';
4
- import 'react/jsx-runtime';
5
10
  import './use-tooltip.mjs';
6
- import 'react';
7
11
  import '@jamsrui/utils';
8
12
  import './styles.mjs';
9
13
  import '@jamsrui/core';
14
+
15
+ declare const Tooltip: ((props: Tooltip$1.Props) => react_jsx_runtime.JSX.Element) & {
16
+ Root: (props: Tooltip$1.Props) => react_jsx_runtime.JSX.Element;
17
+ Arrow: (props: TooltipArrow.Props) => react_jsx_runtime.JSX.Element | null;
18
+ Content: (props: TooltipContent.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
19
+ Trigger: (props: TooltipTrigger.Props) => react_jsx_runtime.JSX.Element;
20
+ Group: typeof FloatingDelayGroup;
21
+ };
22
+ declare namespace Tooltip {
23
+ interface Props extends Tooltip$1.Props {
24
+ }
25
+ interface Arrow extends TooltipArrow.Props {
26
+ }
27
+ interface Content extends TooltipContent.Props {
28
+ }
29
+ interface Trigger extends TooltipTrigger.Props {
30
+ }
31
+ }
32
+
33
+ export { Tooltip };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- "use client";import{a as p,b as t}from"./chunk-C2D5NMEG.mjs";import{a as o}from"./chunk-5G2K5ACL.mjs";import"./chunk-W4XHOOE2.mjs";import"./chunk-WKDVTYCD.mjs";import{FloatingDelayGroup as f}from"@floating-ui/react";export{o as Tooltip,p as TooltipConfig,f as TooltipGroup,t as useTooltipConfig};
1
+ import{a as r}from"./chunk-GWBVOOXK.mjs";import{a as i,b as n}from"./chunk-C2D5NMEG.mjs";import{a as e}from"./chunk-HHCN7FQG.mjs";import{a as p}from"./chunk-UAC7SK5Q.mjs";import{a as o,b as t}from"./chunk-67HMOO7F.mjs";import"./chunk-JHUW52HO.mjs";import"./chunk-47EFJXRD.mjs";import"./chunk-DTYTFK7D.mjs";var x=Object.assign(o,{Root:o,Arrow:r,Content:e,Trigger:p,Group:t});export{x as Tooltip,i as TooltipConfig,t as TooltipGroup,n as useTooltipConfig};
package/dist/styles.d.mts CHANGED
@@ -13,7 +13,7 @@ declare const tooltipVariants: _jamsrui_utils.TVReturnType<{
13
13
  none: {};
14
14
  };
15
15
  }, {
16
- root: string;
16
+ content: string;
17
17
  arrow: string;
18
18
  }, undefined, {
19
19
  radius: {
@@ -27,7 +27,7 @@ declare const tooltipVariants: _jamsrui_utils.TVReturnType<{
27
27
  none: {};
28
28
  };
29
29
  }, {
30
- root: string;
30
+ content: string;
31
31
  arrow: string;
32
32
  }, _jamsrui_utils.TVReturnType<{
33
33
  radius: {
@@ -41,7 +41,7 @@ declare const tooltipVariants: _jamsrui_utils.TVReturnType<{
41
41
  none: {};
42
42
  };
43
43
  }, {
44
- root: string;
44
+ content: string;
45
45
  arrow: string;
46
46
  }, undefined, unknown, unknown, undefined>>;
47
47
  type TooltipVariants = VariantProps<typeof tooltipVariants>;
package/dist/styles.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-WKDVTYCD.mjs";export{a as tooltipVariants};
1
+ import{a}from"./chunk-47EFJXRD.mjs";export{a as tooltipVariants};
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { FloatingArrowProps } from '@floating-ui/react';
3
+
4
+ declare const TooltipArrow: (props: TooltipArrow.Props) => react_jsx_runtime.JSX.Element | null;
5
+ declare namespace TooltipArrow {
6
+ interface Props extends Omit<FloatingArrowProps, "context"> {
7
+ }
8
+ }
9
+
10
+ export { TooltipArrow };
@@ -0,0 +1 @@
1
+ "use client";import{a}from"./chunk-GWBVOOXK.mjs";import"./chunk-DTYTFK7D.mjs";export{a as TooltipArrow};
@@ -1,11 +1,12 @@
1
- import { Tooltip } from './tooltip.mjs';
2
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { GlobalConfigProps } from '@jamsrui/core';
4
- import '@floating-ui/react';
3
+ import { Tooltip } from './tooltip.mjs';
5
4
  import './use-tooltip.mjs';
6
- import 'react';
5
+ import '@floating-ui/react';
7
6
  import '@jamsrui/utils';
7
+ import 'react';
8
8
  import './styles.mjs';
9
+ import './tooltip-content.mjs';
9
10
 
10
11
  declare const useTooltipConfig: () => TooltipConfig.Props;
11
12
  declare const TooltipConfig: (props: Omit<Partial<TooltipConfig.Props>, "children"> & {
@@ -1 +1 @@
1
- import{a,b}from"./chunk-C2D5NMEG.mjs";export{a as TooltipConfig,b as useTooltipConfig};
1
+ "use client";import{a,b}from"./chunk-C2D5NMEG.mjs";export{a as TooltipConfig,b as useTooltipConfig};
@@ -0,0 +1,10 @@
1
+ import * as react from 'react';
2
+ import { PropsWithChildren } from 'react';
3
+
4
+ declare const TooltipContent: (props: TooltipContent.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
5
+ declare namespace TooltipContent {
6
+ interface Props extends PropsWithChildren {
7
+ }
8
+ }
9
+
10
+ export { TooltipContent };
@@ -0,0 +1 @@
1
+ "use client";import{a}from"./chunk-HHCN7FQG.mjs";import"./chunk-DTYTFK7D.mjs";export{a as TooltipContent};
@@ -0,0 +1,15 @@
1
+ import * as react from 'react';
2
+ import { useTooltip } from './use-tooltip.mjs';
3
+ import '@floating-ui/react';
4
+ import '@jamsrui/utils';
5
+ import './styles.mjs';
6
+ import './tooltip-content.mjs';
7
+
8
+ declare const useTooltipContext: () => TooltipContext.Props;
9
+ declare const TooltipContext: react.Context<TooltipContext.Props | null>;
10
+ declare namespace TooltipContext {
11
+ interface Props extends ReturnType<typeof useTooltip> {
12
+ }
13
+ }
14
+
15
+ export { TooltipContext, useTooltipContext };
@@ -0,0 +1 @@
1
+ "use client";import{a,b}from"./chunk-DTYTFK7D.mjs";export{a as TooltipContext,b as useTooltipContext};
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare const TooltipTrigger: (props: TooltipTrigger.Props) => react_jsx_runtime.JSX.Element;
4
+ declare namespace TooltipTrigger {
5
+ interface Props {
6
+ children: React.ReactElement;
7
+ }
8
+ }
9
+
10
+ export { TooltipTrigger };
@@ -0,0 +1 @@
1
+ "use client";import{a}from"./chunk-UAC7SK5Q.mjs";import"./chunk-DTYTFK7D.mjs";export{a as TooltipTrigger};
@@ -1,9 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { useTooltip } from './use-tooltip.mjs';
3
- import 'react';
4
- import '@floating-ui/react';
3
+ export { FloatingDelayGroup as TooltipGroup } from '@floating-ui/react';
5
4
  import '@jamsrui/utils';
5
+ import 'react';
6
6
  import './styles.mjs';
7
+ import './tooltip-content.mjs';
7
8
 
8
9
  declare const Tooltip: (props: Tooltip.Props) => react_jsx_runtime.JSX.Element;
9
10
  declare namespace Tooltip {
package/dist/tooltip.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-5G2K5ACL.mjs";import"./chunk-W4XHOOE2.mjs";import"./chunk-WKDVTYCD.mjs";export{a as Tooltip};
1
+ "use client";import{a,b}from"./chunk-67HMOO7F.mjs";import"./chunk-JHUW52HO.mjs";import"./chunk-47EFJXRD.mjs";import"./chunk-DTYTFK7D.mjs";export{a as Tooltip,b as TooltipGroup};
@@ -1,28 +1,25 @@
1
- import * as react from 'react';
2
- import { ReactElement } from 'react';
3
1
  import { FloatingArrowProps, Placement, Delay } from '@floating-ui/react';
4
- import { PropGetter, UIProps, SlotsToClassNames } from '@jamsrui/utils';
5
- import { TooltipVariants, TooltipSlots } from './styles.mjs';
2
+ import { PropGetter } from '@jamsrui/utils';
3
+ import { PropsWithChildren } from 'react';
4
+ import { TooltipVariants } from './styles.mjs';
5
+ import { TooltipContent } from './tooltip-content.mjs';
6
6
 
7
7
  declare const useTooltip: (props: useTooltip.Props) => {
8
- getRootProps: PropGetter<UIProps<"div">>;
9
- getArrowProps: () => FloatingArrowProps;
8
+ getContentProps: PropGetter<TooltipContent.Props>;
9
+ getArrowProps: (props: Partial<FloatingArrowProps>) => FloatingArrowProps;
10
10
  isOpen: boolean;
11
- children: ReactElement<unknown, string | react.JSXElementConstructor<any>>;
12
- title: string;
13
11
  showArrow: boolean;
12
+ getTriggerProps: () => {
13
+ [x: string]: unknown;
14
+ };
15
+ isDisabled: boolean;
14
16
  };
15
17
  declare namespace useTooltip {
16
- interface Props extends TooltipVariants {
17
- title: string;
18
+ interface Props extends PropsWithChildren, TooltipVariants {
18
19
  placement?: Placement;
19
- isDisabled?: boolean;
20
+ disabled?: boolean;
20
21
  offset?: number;
21
- showArrow?: boolean;
22
22
  delay?: Delay;
23
- className?: string;
24
- classNames?: SlotsToClassNames<TooltipSlots>;
25
- children: ReactElement<unknown>;
26
23
  isOpen?: boolean;
27
24
  onOpenChange?: (open: boolean) => void;
28
25
  defaultOpen?: boolean;
@@ -1 +1 @@
1
- import{a}from"./chunk-W4XHOOE2.mjs";import"./chunk-WKDVTYCD.mjs";export{a as useTooltip};
1
+ import{a}from"./chunk-JHUW52HO.mjs";import"./chunk-47EFJXRD.mjs";export{a as useTooltip};
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@jamsrui/tooltip",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "peerDependencies": {
5
5
  "react": ">=19"
6
6
  },
7
7
  "dependencies": {
8
8
  "@floating-ui/react": ">=0.27",
9
- "@jamsrui/hooks": "^0.0.12",
10
- "@jamsrui/core": "^0.0.10",
11
- "@jamsrui/utils": "^0.0.12"
9
+ "@jamsrui/hooks": "^0.0.13",
10
+ "@jamsrui/core": "^0.0.11",
11
+ "@jamsrui/utils": "^0.0.13"
12
12
  },
13
13
  "exports": {
14
14
  ".": {
@@ -1 +0,0 @@
1
- import{a as t}from"./chunk-W4XHOOE2.mjs";import{useMemo as P}from"react";import{FloatingArrow as f,FloatingPortal as g}from"@floating-ui/react";import{useRenderElement as u}from"@jamsrui/hooks";import{Fragment as n,jsx as p,jsxs as i}from"react/jsx-runtime";var A=s=>{let{children:l,getArrowProps:o,getRootProps:m,isOpen:c,title:r,showArrow:e}=t(s),d=P(()=>i(n,{children:[!!e&&p(f,{...o()}),r]}),[o,e,r]),a=u("div",{props:[m({}),{children:d}]});return i(n,{children:[l,!!c&&p(g,{children:a})]})};export{A as a};
@@ -1 +0,0 @@
1
- import{a as h}from"./chunk-WKDVTYCD.mjs";import{cloneElement as j,useCallback as C,useMemo as U,useRef as H}from"react";import{arrow as M,autoUpdate as q,flip as z,offset as B,safePolygon as J,shift as K,useDelayGroup as L,useDismiss as Q,useFloating as W,useFocus as X,useHover as Y,useInteractions as Z,useRole as _}from"@floating-ui/react";import{useControlledState as $}from"@jamsrui/hooks";import{cn as N}from"@jamsrui/utils";var re=O=>{let{title:f,isDisabled:u=!1,delay:l,offset:D=4,placement:S="top",radius:T,showArrow:r=!1,className:n,classNames:a,children:p,defaultOpen:R,isOpen:F,onOpenChange:v}=O,[c,x]=$({defaultProp:R,onChange:v,prop:F}),d=H(null),A=r?7:0,{refs:m,floatingStyles:y,context:e}=W({open:c,onOpenChange:x,placement:S,whileElementsMounted:q,middleware:[B(D+A),z({fallbackAxisSideDirection:"start"}),K(),r?M({element:d}):null]}),{delay:o}=L(e),t=400,s=100;typeof l=="number"?(t=l,s=l):typeof l=="object"&&(t=l.open??t,s=l.close??s),typeof o=="number"&&o>0?(t=o,s=o):typeof o=="object"&&(t=o.open??t,s=o.close??s);let E=Y(e,{move:!1,handleClose:J({blockPointerEvents:!0}),delay:{close:s,open:t}}),G=X(e),V=Q(e),k=_(e,{role:"tooltip"}),{getReferenceProps:I,getFloatingProps:g}=Z([E,G,V,k]),i=h({radius:T}),P=j(p,I({ref:m.setReference})),w=C(()=>({className:i.root({className:N(a?.root,n)}),style:y,ref:m.setFloating,...g()}),[n,a?.root,y,g,m.setFloating,i]),b=C(()=>({context:e,ref:d,className:i.arrow({className:N(a?.arrow,n)})}),[n,a?.arrow,e,i]);return U(()=>({getRootProps:w,getArrowProps:b,isOpen:c,children:u?p:P,title:f,showArrow:r}),[p,b,w,u,c,r,f,P])};export{re as a};
@@ -1 +0,0 @@
1
- import{radiusVariant as t,tv as o}from"@jamsrui/utils";var a=o({slots:{root:"bg-surface inline-flex px-3 py-1 text-sm font-medium text-foreground",arrow:"fill-background-secondary"},variants:{radius:t("root")},defaultVariants:{radius:"md"}});export{a};