@jamsrui/tooltip 0.0.13 → 0.0.14

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/index.mjs CHANGED
@@ -1 +1 @@
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};
1
+ import{TooltipGroup as t,Tooltip as o}from"./tooltip.mjs";import{TooltipArrow as r}from"./tooltip-arrow.mjs";import{TooltipContent as e}from"./tooltip-content.mjs";import{TooltipTrigger as p}from"./tooltip-trigger.mjs";import{TooltipConfig as g,useTooltipConfig as m}from"./tooltip-config.mjs";import{TooltipGroup as c}from"./tooltip.mjs";const s=Object.assign(o,{Root:o,Arrow:r,Content:e,Trigger:p,Group:t});export{s as Tooltip,g as TooltipConfig,c as TooltipGroup,m as useTooltipConfig};
package/dist/styles.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-47EFJXRD.mjs";export{a as tooltipVariants};
1
+ import{radiusVariant as t,tv as o}from"@jamsrui/utils";const 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 as tooltipVariants};
@@ -1 +1 @@
1
- "use client";import{a}from"./chunk-GWBVOOXK.mjs";import"./chunk-DTYTFK7D.mjs";export{a as TooltipArrow};
1
+ "use client";import{jsx as p}from"react/jsx-runtime";import{FloatingArrow as e}from"@floating-ui/react";import{useTooltipContext as n}from"./tooltip-context.mjs";const w=o=>{const{getArrowProps:r,isOpen:t}=n();return t?p(e,{...r(o),...o}):null};export{w as TooltipArrow};
@@ -1 +1 @@
1
- "use client";import{a,b}from"./chunk-C2D5NMEG.mjs";export{a as TooltipConfig,b as useTooltipConfig};
1
+ "use client";import{createConfigContext as o}from"@jamsrui/utils";const[p,i]=o({displayName:"TooltipConfigContext"});export{p as TooltipConfig,i as useTooltipConfig};
@@ -1 +1 @@
1
- "use client";import{a}from"./chunk-HHCN7FQG.mjs";import"./chunk-DTYTFK7D.mjs";export{a as TooltipContent};
1
+ "use client";import{useRenderElement as r}from"@jamsrui/hooks";import{useTooltipContext as p}from"./tooltip-context.mjs";const l=t=>{const{isOpen:e,getContentProps:o}=p(),n=r("div",{props:[o(t)]});return e?n:null};export{l as TooltipContent};
@@ -1 +1 @@
1
- "use client";import{a,b}from"./chunk-DTYTFK7D.mjs";export{a as TooltipContext,b as useTooltipContext};
1
+ "use client";import{createContext as o,use as e}from"react";const p=o(null),n=()=>{const t=e(p);if(!t)throw new Error("useTooltipContext must be used within a TooltipContext.Provider");return t};export{p as TooltipContext,n as useTooltipContext};
@@ -1 +1 @@
1
- "use client";import{a}from"./chunk-UAC7SK5Q.mjs";import"./chunk-DTYTFK7D.mjs";export{a as TooltipTrigger};
1
+ "use client";import{Fragment as l,jsx as c}from"react/jsx-runtime";import{cloneElement as n}from"react";import{useTooltipContext as p}from"./tooltip-context.mjs";const T=r=>{const{children:e}=r,{getTriggerProps:o,isDisabled:t}=p();if(t)return e;const i=n(e,o());return c(l,{children:i})};export{T as TooltipTrigger};
package/dist/tooltip.mjs CHANGED
@@ -1 +1 @@
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
+ "use client";import{jsx as i}from"react/jsx-runtime";import{TooltipContext as p}from"./tooltip-context.mjs";import{useTooltip as r}from"./use-tooltip.mjs";const s=o=>{const{children:t}=o,e=r(o);return i(p,{value:e,children:t})};import{FloatingDelayGroup as x}from"@floating-ui/react";export{s as Tooltip,x as TooltipGroup};
@@ -1 +1 @@
1
- import{a}from"./chunk-JHUW52HO.mjs";import"./chunk-47EFJXRD.mjs";export{a as useTooltip};
1
+ import{useCallback as c,useMemo as V,useState as N}from"react";import{arrow as j,autoUpdate as k,flip as H,offset as I,safePolygon as M,shift as W,useDelayGroup as U,useDismiss as q,useFloating as z,useFocus as B,useHover as J,useInteractions as K,useRole as L}from"@floating-ui/react";import{useControlledState as Q}from"@jamsrui/hooks";import{tooltipVariants as X}from"./styles.mjs";const oe=h=>{const{delay:r,offset:w=4,placement:C="top",radius:O,defaultOpen:D,isOpen:F,onOpenChange:T,disabled:f=!1,...Y}=h,[p,A]=Q({defaultProp:D,onChange:T,prop:F}),[m,x]=N(null),i=!!m,G=i?7:0,{refs:n,floatingStyles:u,context:e}=z({open:p,onOpenChange:A,placement:C,whileElementsMounted:k,middleware:[I(w+G),H({fallbackAxisSideDirection:"start"}),W(),j({element:m})]}),{delay:o}=U(e);let 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);const S=J(e,{move:!1,handleClose:M({blockPointerEvents:!0}),delay:{close:s,open:t}}),v=B(e),E=q(e),R=L(e,{role:"tooltip"}),{getReferenceProps:d,getFloatingProps:y}=K([S,v,E,R]),l=X({radius:O}),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:x,className:l.arrow({className:a.className})}),[e,l]),b=c(()=>({...d({ref:n.setReference})}),[d,n.setReference]);return V(()=>({getContentProps:P,getArrowProps:g,isOpen:p,showArrow:i,getTriggerProps:b,isDisabled:f}),[P,g,p,i,b,f])};export{oe as useTooltip};
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@jamsrui/tooltip",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "peerDependencies": {
5
5
  "react": ">=19"
6
6
  },
7
7
  "dependencies": {
8
8
  "@floating-ui/react": ">=0.27",
9
- "@jamsrui/hooks": "^0.0.13",
10
- "@jamsrui/core": "^0.0.11",
11
- "@jamsrui/utils": "^0.0.13"
9
+ "@jamsrui/hooks": "^0.0.14",
10
+ "@jamsrui/utils": "^0.0.14",
11
+ "@jamsrui/core": "^0.0.12"
12
12
  },
13
13
  "exports": {
14
14
  ".": {
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
1
- import{createConfigContext as o}from"@jamsrui/utils";var[p,i]=o({displayName:"TooltipConfigContext"});export{p as a,i as b};
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
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};