@@ -7,6 +7,7 @@ import type {
7
7
GroupBase ,
8
8
GroupProps ,
9
9
MenuListProps ,
10
+ MenuProps ,
10
11
OptionProps ,
11
12
} from "react-select"
12
13
import { tv , type VariantProps } from "tailwind-variants"
@@ -16,11 +17,12 @@ import { cn } from "@/lib/utils/cn"
16
17
export const selectVariants = tv ( {
17
18
slots : {
18
19
container :
19
- "w-full min-h-10.5 [--border-base-width:1px] relative z-[1] [&_>_.react-select\\_\\_menu]:-z-[1] cursor-pointer" ,
20
+ "w-full min-h-10.5 [--border-base-width:1px] relative z-[1] cursor-pointer" ,
20
21
control :
21
22
"p-2 flex items-center gap-4 border-[length:var(--border-base-width)] border-current text-[color:var(--my-var)] not-[[data-expanded=true]]:focus-within:outline-3 not-[[data-expanded=true]]:focus-within:outline-primary-hover not-[[data-expanded=true]]:focus-within:outline -outline-offset-2 [&[data-expanded=true]]:bg-background-highlight [&[data-expanded=true]]:text-primary [&[data-expanded=true]]:border-primary-low-contrast hover:text-primary hover:border-primary-low-contrast" ,
22
23
indicatorIcon :
23
24
"text-sm leading-none transition-transform [*[data-expanded=true]_&]:rotate-180" ,
25
+ menu : "-z-[1] relative" ,
24
26
menuList :
25
27
"overflow-y-auto bg-background-highlight w-full max-h-80 border-x-[length:--border-base-width] border-b-[length:--border-base-width] rounded-b" ,
26
28
option :
@@ -129,6 +131,29 @@ const DropdownIndicator = <
129
131
</ div >
130
132
)
131
133
}
134
+
135
+ const Menu = <
136
+ Option ,
137
+ IsMulti extends boolean ,
138
+ Group extends GroupBase < Option > ,
139
+ > ( {
140
+ children,
141
+ innerProps,
142
+ innerRef,
143
+ } : MenuProps < Option , IsMulti , Group > ) => {
144
+ const { menu } = useSelectStyles ( )
145
+ return (
146
+ < div
147
+ ref = { innerRef }
148
+ className = { menu ( ) }
149
+ id = "react-select-menu"
150
+ { ...innerProps }
151
+ >
152
+ { children }
153
+ </ div >
154
+ )
155
+ }
156
+
132
157
const MenuList = <
133
158
Option ,
134
159
IsMulti extends boolean ,
@@ -216,6 +241,7 @@ export const components = {
216
241
// Essentially removes this component from default render
217
242
IndicatorSeparator : nullop ,
218
243
DropdownIndicator,
244
+ Menu,
219
245
MenuList,
220
246
Option,
221
247
Group,
0 commit comments