2024-12-25 20:46:14 +01:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { Search } from "lucide-vue-next";
|
|
|
|
|
import {
|
2025-03-28 01:16:24 +01:00
|
|
|
ListboxFilter,
|
|
|
|
|
type ListboxFilterProps,
|
2024-12-25 20:46:14 +01:00
|
|
|
useForwardProps,
|
2025-03-28 01:16:24 +01:00
|
|
|
} from "reka-ui";
|
2025-06-26 22:39:02 +02:00
|
|
|
import { computed, type HTMLAttributes } from "vue";
|
|
|
|
|
import { cn } from "@/lib/utils";
|
2025-03-28 01:16:24 +01:00
|
|
|
import { useCommand } from ".";
|
2024-12-25 20:46:14 +01:00
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
|
inheritAttrs: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const props = defineProps<
|
2025-03-28 01:16:24 +01:00
|
|
|
ListboxFilterProps & {
|
2024-12-25 20:46:14 +01:00
|
|
|
class?: HTMLAttributes["class"];
|
|
|
|
|
}
|
|
|
|
|
>();
|
|
|
|
|
|
|
|
|
|
const delegatedProps = computed(() => {
|
|
|
|
|
const { class: _, ...delegated } = props;
|
|
|
|
|
|
|
|
|
|
return delegated;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const forwardedProps = useForwardProps(delegatedProps);
|
2025-03-28 01:16:24 +01:00
|
|
|
|
|
|
|
|
const { filterState } = useCommand();
|
2024-12-25 20:46:14 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2025-04-10 13:55:56 +02:00
|
|
|
<div
|
|
|
|
|
data-slot="command-input-wrapper"
|
|
|
|
|
class="flex h-12 items-center gap-2 border-b px-3"
|
|
|
|
|
>
|
|
|
|
|
<Search class="size-4 shrink-0 opacity-50" />
|
2025-03-28 01:16:24 +01:00
|
|
|
<ListboxFilter
|
|
|
|
|
v-bind="{ ...forwardedProps, ...$attrs }"
|
|
|
|
|
v-model="filterState.search"
|
2025-04-10 13:55:56 +02:00
|
|
|
data-slot="command-input"
|
2025-03-28 01:16:24 +01:00
|
|
|
auto-focus
|
2025-04-10 13:55:56 +02:00
|
|
|
:class="cn('placeholder:text-muted-foreground flex h-12 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50', props.class)"
|
2025-03-28 01:16:24 +01:00
|
|
|
/>
|
|
|
|
|
</div>
|
2024-12-25 20:46:14 +01:00
|
|
|
</template>
|