command-input.svelte 919 B

12345678910111213141516171819202122232425262728293031
  1. <script lang="ts">
  2. import { Command as CommandPrimitive } from "bits-ui";
  3. import { cn } from "$lib/utils.js";
  4. import * as InputGroup from "$lib/components/controls/input-group/index.js";
  5. import SearchIcon from '@lucide/svelte/icons/search';
  6. let {
  7. ref = $bindable(null),
  8. class: className,
  9. value = $bindable(""),
  10. ...restProps
  11. }: CommandPrimitive.InputProps = $props();
  12. </script>
  13. <div data-slot="command-input-wrapper" class="p-1 pb-0">
  14. <InputGroup.Root class="bg-input/30 border-input/30 h-8! rounded-lg! shadow-none! *:data-[slot=input-group-addon]:pl-2!">
  15. <CommandPrimitive.Input
  16. data-slot="command-input"
  17. class={cn(
  18. "w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
  19. className
  20. )}
  21. bind:ref
  22. {...restProps}
  23. bind:value
  24. />
  25. <InputGroup.Addon>
  26. <SearchIcon class="size-4 shrink-0 opacity-50" />
  27. </InputGroup.Addon>
  28. </InputGroup.Root>
  29. </div>