Skip to content

Commit 2815853

Browse files
committed
feat: z-indexed tooltips
1 parent a4fbcca commit 2815853

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

src/components/Select.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import React, {
2727
useImperativeHandle,
2828
useLayoutEffect,
2929
useRef,
30-
useState,
30+
useState
3131
} from 'react'
3232
import { PP, PR } from '../types/PolymorphicElementProps'
3333
import { Timeout } from '../types/Timeout'
@@ -327,23 +327,25 @@ export const Select = forwardRefWithGenerics(
327327
? theme.color.background.card.main
328328
: undefined
329329
}
330-
style={{
331-
...(disableEllipsis
332-
? {}
333-
: {
334-
textOverflow: 'ellipsis',
335-
overflow: 'hidden',
336-
whiteSpace: 'nowrap',
337-
}),
338-
...(ListItemProps?.style || {}),
339-
fontWeight: i === selectedIndex ? 'bold' : 'normal',
340-
}}
341330
ref={(node) => {
342331
listRef.current[i] = node
343332
listContentRef.current[i] =
344333
typeof item === 'string' ? item : item.value
345334
}}
346335
{...getItemProps({
336+
...ListItemProps,
337+
style: {
338+
...(disableEllipsis
339+
? {}
340+
: {
341+
textOverflow: 'ellipsis',
342+
overflow: 'hidden',
343+
whiteSpace: 'nowrap',
344+
}),
345+
...(ListItemProps?.style || {}),
346+
fontWeight:
347+
i === selectedIndex ? 'bold' : 'normal',
348+
},
347349
onTouchStart() {
348350
allowSelectRef.current = true
349351
allowMouseUpRef.current = false
@@ -374,7 +376,6 @@ export const Select = forwardRefWithGenerics(
374376
})
375377
},
376378
})}
377-
{...ListItemProps}
378379
>
379380
{render(item)}
380381
</ListItem>

src/components/Tooltip.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export type TooltipProps = {
7373
activateOnHover?: boolean
7474
activateOnClick?: boolean
7575
noThemeChange?: boolean
76+
zIndex?: number
7677
} & (
7778
| {
7879
noDefaultStyles: false
@@ -131,6 +132,7 @@ export const Tooltip: React.FC<TooltipProps> = (props) => {
131132
activateOnHover = true,
132133
activateOnClick = false,
133134
noThemeChange = false,
135+
zIndex,
134136
...cardProps
135137
} = props
136138
const [isOpen, setIsOpen] = useState(false)
@@ -200,14 +202,16 @@ export const Tooltip: React.FC<TooltipProps> = (props) => {
200202
<RenderComponent
201203
ref={refs.setFloating}
202204
{...getFloatingProps({
205+
...(cardProps || {}),
203206
style: {
207+
...('style' in cardProps ? cardProps.style || {} : {}),
204208
position: strategy,
205209
top: y || 0,
206210
left: x || 0,
207211
pointerEvents: interactive ? 'auto' : 'none',
212+
zIndex,
208213
},
209214
})}
210-
{...cardProps}
211215
transition={{ duration: 0.2, ease: 'easeInOut' }}
212216
initial={{ opacity: 0, scale: 0.9 }}
213217
animate={{ opacity: 1, scale: 1 }}

0 commit comments

Comments
 (0)