55 forwardRef ,
66 useContext ,
77 useImperativeHandle ,
8+ useMemo ,
89 useRef ,
910} from 'react' ;
1011import { AriaTooltipProps , useTooltip } from 'react-aria' ;
@@ -29,8 +30,14 @@ export type { AriaTooltipProps };
2930const TooltipElement = tasty ( {
3031 styles : {
3132 display : 'block' ,
32- fill : '#dark.85' ,
33- color : '#white' ,
33+ fill : {
34+ '' : '#dark.85' ,
35+ light : '#white' ,
36+ } ,
37+ color : {
38+ '' : '#white' ,
39+ light : '#dark-02' ,
40+ } ,
3441 width : 'initial 36x max-content' ,
3542 radius : true ,
3643 padding : '.75x 1x' ,
@@ -41,6 +48,10 @@ const TooltipElement = tasty({
4148 '' : 'none' ,
4249 material : 'auto' ,
4350 } ,
51+ filter : {
52+ '' : false ,
53+ light : 'drop-shadow(0 0 1px rgb(var(--dark-color-rgb) / 20%)' ,
54+ } ,
4455 } ,
4556} ) ;
4657
@@ -50,7 +61,10 @@ const TooltipTipElement = tasty({
5061 width : '1px' ,
5162 height : '1px' ,
5263 border : '.5x #clear' ,
53- borderTop : '.5x solid #dark.85' ,
64+ borderTop : {
65+ '' : '.5x solid #dark.85' ,
66+ light : '.5x solid #white' ,
67+ } ,
5468 borderBottom : '0' ,
5569 top : {
5670 '' : 'initial' ,
@@ -100,6 +114,7 @@ export interface CubeTooltipProps
100114 placement ?: PlacementAxis ;
101115 isMaterial ?: boolean ;
102116 isOpen ?: boolean ;
117+ isLight ?: boolean ;
103118 onOpenChange ?: ( isOpen : boolean ) => void ;
104119 defaultOpen ?: boolean ;
105120 shouldFlip ?: boolean ;
@@ -116,6 +131,8 @@ function Tooltip(
116131 overlayProps,
117132 minOffset,
118133 minScale,
134+ isMaterial : isMaterialContext ,
135+ isLight : isLightContext ,
119136 ...tooltipProviderProps
120137 } = useContext ( TooltipContext ) ;
121138
@@ -130,7 +147,8 @@ function Tooltip(
130147 isOpen,
131148 tipStyles,
132149 showIcon,
133- isMaterial,
150+ isMaterial = isMaterialContext ,
151+ isLight = isLightContext ,
134152 ...otherProps
135153 } = props ;
136154
@@ -149,16 +167,21 @@ function Tooltip(
149167 minScale = String ( minScale ) ;
150168 }
151169
170+ const mods = useMemo ( ( ) => {
171+ return {
172+ material : isMaterial ,
173+ light : isLight ,
174+ open : isOpen ,
175+ } ;
176+ } , [ isMaterial , isOpen , isLight ] ) ;
177+
152178 return (
153179 < StyledTooltipElement
154180 { ...tooltipProps }
155181 { ...overlayProps }
156182 ref = { overlayRef }
157183 styles = { styles }
158- mods = { {
159- open : isOpen ,
160- material : isMaterial ,
161- } }
184+ mods = { mods }
162185 data-min-offset = { minOffset }
163186 data-min-scale = { minScale }
164187 data-placement = { placement }
@@ -167,6 +190,7 @@ function Tooltip(
167190 < TooltipTipElement
168191 data-placement = { placement }
169192 styles = { tipStyles }
193+ mods = { mods }
170194 { ...arrowProps }
171195 />
172196 </ StyledTooltipElement >
0 commit comments