Skip to content

Commit 69c64f3

Browse files
committed
put back focus: classes on Select
1 parent ef9148c commit 69c64f3

File tree

4 files changed

+112
-94
lines changed

4 files changed

+112
-94
lines changed

src/theme/select-menu.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ export default (options: Required<ModuleOptions>) => {
88
input: 'border-b border-default',
99
focusScope: 'flex flex-col min-h-0',
1010
content: (content: string) => [content, 'origin-(--reka-combobox-content-transform-origin) w-(--reka-combobox-trigger-width)']
11-
}
11+
},
12+
compoundVariants: (prev: Record<string, any>[]) => prev.map(item => ({
13+
...item,
14+
class: typeof item.class === 'string' ? replaceFocus(item.class) : item.class
15+
}))
1216
}, select(options))
1317
}
18+
19+
function replaceFocus(str: string): string {
20+
return str
21+
.replace(/focus:/g, 'focus-visible:')
22+
}

src/theme/select.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ export default (options: Required<ModuleOptions>) => {
8181
empty: 'p-2 text-base'
8282
}
8383
}
84-
}
84+
},
85+
compoundVariants: (prev: Record<string, any>[]) => prev.map(item => ({
86+
...item,
87+
class: typeof item.class === 'string' ? replaceFocus(item.class) : item.class
88+
}))
8589
}, input(options))
8690
}
91+
92+
function replaceFocus(str: string): string {
93+
return str
94+
.replace(/focus-visible:/g, 'focus:')
95+
}

0 commit comments

Comments
 (0)