wip: polish to shortcuts

This commit is contained in:
David Hill 2025-12-22 15:06:00 +00:00 committed by Adam
commit 3ff6ce5967
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75
6 changed files with 64 additions and 22 deletions

View file

@ -15,6 +15,7 @@ export type SelectProps<T> = Omit<ComponentProps<typeof Kobalte<T>>, "value" | "
class?: ComponentProps<"div">["class"]
classList?: ComponentProps<"div">["classList"]
children?: (item: T | undefined) => JSX.Element
placement?: "bottom-start" | "bottom-end" | "top-start" | "top-end"
}
export function Select<T>(props: SelectProps<T> & ButtonProps) {
@ -29,6 +30,7 @@ export function Select<T>(props: SelectProps<T> & ButtonProps) {
"groupBy",
"onSelect",
"children",
"placement",
])
const grouped = createMemo(() => {
const result = pipe(
@ -46,7 +48,7 @@ export function Select<T>(props: SelectProps<T> & ButtonProps) {
<Kobalte<T, { category: string; options: T[] }>
{...others}
data-component="select"
placement="bottom-start"
placement={local.placement ?? "bottom-start"}
value={local.current}
options={grouped()}
optionValue={(x) => (local.value ? local.value(x) : (x as string))}