{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ds-combobox",
  "title": "Combobox UI",
  "description": "A batteries-included combobox with virtual scrolling, search, single/multi-select, groups, custom option rendering, and configurable popover positioning (side/align/offset).",
  "dependencies": [
    "@tanstack/react-virtual",
    "class-variance-authority",
    "lucide-react"
  ],
  "registryDependencies": [
    "@lema-ds/badge",
    "@lema-ds/button",
    "@lema-ds/popover",
    "@lema-ds/skeleton",
    "@lema-ds/ui-i18n",
    "@lema-ds/ds-locale-provider"
  ],
  "files": [
    {
      "path": "components/ds/ds-combobox.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { useVirtualizer } from \"@tanstack/react-virtual\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { CheckIcon, ChevronsUpDownIcon, SearchIcon, XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { UI_I18N, type UILocale } from \"@/lib/ui-i18n\"\nimport { useUILocale } from \"@/components/ui/ds-locale-provider\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"@/components/ui/popover\"\nimport { Skeleton } from \"@/components/ui/skeleton\"\n\n// ── Types ──────────────────────────────────────────────────────────────────\n\nexport type ComboboxValue = string | number\n\nexport interface ComboboxOption {\n  value: ComboboxValue\n  label: string\n  disabled?: boolean\n  group?: string\n}\n\n// ── Variants ───────────────────────────────────────────────────────────────\n\nexport const comboboxTriggerVariants = cva(\n  \"w-full min-w-0 justify-between font-normal\",\n  {\n    variants: {\n      size: {\n        sm: \"h-8 px-2.5 text-xs\",\n        md: \"h-9 text-sm\",\n        lg: \"h-10 px-4 text-base\",\n      },\n      rounded: {\n        full: \"\",\n        md: \"rounded-lg\",\n        none: \"rounded-none\",\n      },\n    },\n    defaultVariants: { size: \"md\", rounded: \"md\" },\n  }\n)\n\nconst CONTENT_ROUNDED: Record<string, string> = {\n  full: \"rounded-xl\",\n  md: \"rounded-xl\",\n  none: \"rounded-none\",\n}\n\nconst ITEM_ROUNDED: Record<string, string> = {\n  full: \"rounded-full\",\n  md: \"rounded-md\",\n  none: \"rounded-none\",\n}\n\nconst ITEM_HEIGHT: Record<string, number> = { sm: 32, md: 36, lg: 40 }\nconst ITEM_TEXT: Record<string, string> = {\n  sm: \"text-xs\",\n  md: \"text-sm\",\n  lg: \"text-base\",\n}\nconst SEARCH_HEIGHT: Record<string, string> = {\n  sm: \"h-8\",\n  md: \"h-9\",\n  lg: \"h-10\",\n}\nconst SEARCH_TEXT: Record<string, string> = {\n  sm: \"text-xs\",\n  md: \"text-sm\",\n  lg: \"text-base\",\n}\nconst HEADER_HEIGHT = 28\nconst LIST_MAX_HEIGHT = 300\nconst OVERSCAN = 6\nconst EMPTY_VALUES: ComboboxValue[] = []\n\n// ── Virtual row model ──────────────────────────────────────────────────────\n\ntype VirtualRow =\n  | { kind: \"header\"; label: string }\n  | { kind: \"option\"; option: ComboboxOption; optionIndex: number }\n\nfunction buildVirtualRows(\n  options: ComboboxOption[],\n  query: string\n): { rows: VirtualRow[]; filtered: ComboboxOption[] } {\n  const q = query.trim().toLowerCase()\n  const filtered = q\n    ? options.filter((o) => o.label.toLowerCase().includes(q))\n    : options\n\n  const hasGroups = filtered.some((o) => o.group)\n  if (!hasGroups) {\n    return {\n      filtered,\n      rows: filtered.map((option, i) => ({\n        kind: \"option\",\n        option,\n        optionIndex: i,\n      })),\n    }\n  }\n\n  const grouped = new Map<string, ComboboxOption[]>()\n  for (const opt of filtered) {\n    const key = opt.group ?? \"\"\n    if (!grouped.has(key)) grouped.set(key, [])\n    grouped.get(key)!.push(opt)\n  }\n\n  const rows: VirtualRow[] = []\n  let idx = 0\n  for (const [label, opts] of grouped) {\n    if (label) rows.push({ kind: \"header\", label })\n    for (const option of opts) {\n      rows.push({ kind: \"option\", option, optionIndex: idx++ })\n    }\n  }\n  return { rows, filtered }\n}\n\n// ── DropdownContent ────────────────────────────────────────────────────────\n// Lives inside PopoverContent — unmounts on close, so useVirtualizer is\n// always fresh on the next open (avoids stale scrollRect from ResizeObserver).\n\ninterface DropdownContentProps {\n  rows: VirtualRow[]\n  filtered: ComboboxOption[]\n  totalOptions: number\n  itemHeight: number\n  searchable: boolean\n  searchPlaceholder: string\n  query: string\n  onQueryChange: (q: string) => void\n  onKeyDown: (e: React.KeyboardEvent) => void\n  multiple: boolean\n  selectedSingle: ComboboxValue | null\n  selectedMulti: ComboboxValue[]\n  activeOptionIndex: number\n  onSelect: (opt: ComboboxOption) => void\n  onHover: (index: number) => void\n  onClearAll: () => void\n  emptyText: string\n  noOptionsText: string\n  rounded: string\n  size: string\n  i18n: (typeof UI_I18N)[UILocale][\"combobox\"]\n  renderOption?: (option: ComboboxOption, selected: boolean) => React.ReactNode\n}\n\nfunction DropdownContent({\n  rows,\n  filtered,\n  totalOptions,\n  itemHeight,\n  searchable,\n  searchPlaceholder,\n  query,\n  onQueryChange,\n  onKeyDown,\n  multiple,\n  selectedSingle,\n  selectedMulti,\n  activeOptionIndex,\n  onSelect,\n  onHover,\n  onClearAll,\n  emptyText,\n  noOptionsText,\n  rounded,\n  size,\n  i18n,\n  renderOption,\n}: DropdownContentProps) {\n  const searchRef = React.useRef<HTMLInputElement>(null)\n  const listRef = React.useRef<HTMLDivElement>(null)\n\n  const estimateSize = React.useCallback(\n    (i: number) => (rows[i]?.kind === \"header\" ? HEADER_HEIGHT : itemHeight),\n    [rows, itemHeight]\n  )\n\n  // eslint-disable-next-line react-hooks/incompatible-library\n  const virtualizer = useVirtualizer({\n    count: rows.length,\n    getScrollElement: () => listRef.current,\n    estimateSize,\n    overscan: OVERSCAN,\n    initialRect: { width: 0, height: LIST_MAX_HEIGHT },\n  })\n\n  // Focus on mount\n  React.useEffect(() => {\n    if (searchable) {\n      searchRef.current?.focus()\n    } else {\n      listRef.current?.focus()\n    }\n  }, [searchable])\n\n  // Scroll to active item\n  React.useEffect(() => {\n    if (filtered.length === 0) return\n    const clamped = Math.min(activeOptionIndex, filtered.length - 1)\n    const rowIdx = rows.findIndex(\n      (r) => r.kind === \"option\" && r.optionIndex === clamped\n    )\n    if (rowIdx >= 0) virtualizer.scrollToIndex(rowIdx, { align: \"auto\" })\n  }, [activeOptionIndex, rows, filtered.length, virtualizer])\n\n  const listHeight =\n    rows.length === 0\n      ? 0\n      : Math.min(virtualizer.getTotalSize(), LIST_MAX_HEIGHT)\n\n  return (\n    <>\n      {searchable && (\n        <div className=\"flex items-center border-b px-3\">\n          <SearchIcon className=\"mr-2 size-4 shrink-0 opacity-40\" />\n          <input\n            ref={searchRef}\n            value={query}\n            onChange={(e) => onQueryChange(e.target.value)}\n            onKeyDown={onKeyDown}\n            placeholder={searchPlaceholder}\n            data-slot=\"combobox-search\"\n            className={cn(\n              \"flex w-full bg-transparent py-3 outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed\",\n              SEARCH_HEIGHT[size],\n              SEARCH_TEXT[size]\n            )}\n            autoComplete=\"off\"\n            spellCheck={false}\n          />\n          {query && (\n            <button\n              type=\"button\"\n              onClick={() => onQueryChange(\"\")}\n              className=\"ml-1 rounded opacity-50 transition-opacity hover:opacity-100 focus:ring-1 focus:ring-ring focus:outline-none\"\n              aria-label={i18n.clearSearch}\n            >\n              <XIcon className=\"size-3.5\" />\n            </button>\n          )}\n        </div>\n      )}\n\n      {multiple && selectedMulti.length > 0 && (\n        <div className=\"flex items-center justify-between border-b px-3 py-1.5\">\n          <span className=\"text-xs text-muted-foreground\">\n            {selectedMulti.length} {i18n.selected}\n          </span>\n          <button\n            type=\"button\"\n            onClick={onClearAll}\n            className=\"text-xs text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline\"\n          >\n            {i18n.clearAll}\n          </button>\n        </div>\n      )}\n\n      <div\n        ref={listRef}\n        role=\"listbox\"\n        aria-multiselectable={multiple || undefined}\n        tabIndex={searchable ? -1 : 0}\n        onKeyDown={!searchable ? onKeyDown : undefined}\n        className=\"overflow-y-auto py-1 outline-none\"\n        style={{ height: filtered.length === 0 ? \"auto\" : listHeight }}\n      >\n        {filtered.length === 0 ? (\n          <div className=\"py-6 text-center text-sm text-muted-foreground\">\n            {totalOptions === 0 ? noOptionsText : emptyText}\n          </div>\n        ) : (\n          <div\n            style={{\n              height: virtualizer.getTotalSize(),\n              position: \"relative\",\n              width: \"100%\",\n            }}\n          >\n            {virtualizer.getVirtualItems().map((vi) => {\n              const row = rows[vi.index]\n              if (!row) return null\n\n              const itemStyle: React.CSSProperties = {\n                position: \"absolute\",\n                top: 0,\n                left: 0,\n                width: \"100%\",\n                height: vi.size,\n                transform: `translateY(${vi.start}px)`,\n              }\n\n              if (row.kind === \"header\") {\n                return (\n                  <div\n                    key={vi.key}\n                    style={itemStyle}\n                    className=\"flex items-center px-3 text-xs font-medium text-muted-foreground\"\n                  >\n                    {row.label}\n                  </div>\n                )\n              }\n\n              const { option, optionIndex } = row\n              const isSelected = multiple\n                ? selectedMulti.includes(option.value)\n                : selectedSingle === option.value\n              const isActive = activeOptionIndex === optionIndex\n\n              return (\n                <div\n                  key={vi.key}\n                  role=\"option\"\n                  aria-selected={isSelected}\n                  aria-disabled={option.disabled || undefined}\n                  data-slot=\"combobox-option\"\n                  style={itemStyle}\n                  className={cn(\n                    cn(\n                      \"flex cursor-default items-center gap-2 px-2 font-medium transition-colors select-none\",\n                      ITEM_TEXT[size]\n                    ),\n                    ITEM_ROUNDED[rounded] ?? ITEM_ROUNDED.md,\n                    isActive &&\n                      !option.disabled &&\n                      \"bg-accent text-accent-foreground\",\n                    !isActive &&\n                      !option.disabled &&\n                      \"hover:bg-accent hover:text-accent-foreground\",\n                    option.disabled && \"pointer-events-none opacity-40\"\n                  )}\n                  onClick={() => onSelect(option)}\n                  onMouseEnter={() => {\n                    if (!option.disabled) onHover(optionIndex)\n                  }}\n                >\n                  <span className=\"flex size-4 shrink-0 items-center justify-center\">\n                    {isSelected && <CheckIcon className=\"size-3.5\" />}\n                  </span>\n                  {renderOption ? (\n                    renderOption(option, isSelected)\n                  ) : (\n                    <span className=\"truncate\">{option.label}</span>\n                  )}\n                </div>\n              )\n            })}\n          </div>\n        )}\n      </div>\n    </>\n  )\n}\n\n// ── Props ──────────────────────────────────────────────────────────────────\n\ninterface ComboboxBaseProps extends VariantProps<\n  typeof comboboxTriggerVariants\n> {\n  options: ComboboxOption[]\n  placeholder?: string\n  searchPlaceholder?: string\n  emptyText?: string\n  noOptionsText?: string\n  loading?: boolean\n  disabled?: boolean\n  clearable?: boolean\n  searchable?: boolean\n  maxWidth?: string | number\n  style?: React.CSSProperties\n  className?: string\n  locale?: UILocale\n  renderOption?: (option: ComboboxOption, selected: boolean) => React.ReactNode\n  \"aria-label\"?: string\n  \"aria-labelledby\"?: string\n  /** Popover positioning — side where the dropdown opens */\n  side?: \"top\" | \"right\" | \"bottom\" | \"left\"\n  /** Popover alignment relative to the trigger */\n  align?: \"start\" | \"center\" | \"end\"\n  /** Distance in px between trigger and popover */\n  sideOffset?: number\n  /** Offset along the alignment axis in px */\n  alignOffset?: number\n}\n\ninterface ComboboxSingleProps extends ComboboxBaseProps {\n  multiple?: false\n  value?: ComboboxValue | null\n  defaultValue?: ComboboxValue | null\n  onChange?: (value: ComboboxValue | null) => void\n}\n\ninterface ComboboxMultipleProps extends ComboboxBaseProps {\n  multiple: true\n  value?: ComboboxValue[]\n  defaultValue?: ComboboxValue[]\n  onChange?: (values: ComboboxValue[]) => void\n  maxDisplayed?: number\n}\n\nexport type ComboboxProps = ComboboxSingleProps | ComboboxMultipleProps\n\n// ── Combobox ─────────────────────────────────────────────────────────────\n\nexport const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(\n  (props, ref) => {\n    const {\n      options,\n      size = \"md\",\n      rounded = \"md\",\n      loading = false,\n      disabled = false,\n      clearable = true,\n      searchable = true,\n      maxWidth,\n      style,\n      className,\n      locale: localeProp,\n      renderOption,\n      \"aria-label\": ariaLabel,\n      \"aria-labelledby\": ariaLabelledBy,\n      side,\n      align = \"start\",\n      sideOffset = 4,\n      alignOffset,\n    } = props\n\n    const locale = useUILocale(localeProp)\n    const i18n = UI_I18N[locale].combobox\n\n    const placeholder = props.placeholder ?? i18n.placeholder\n    const searchPlaceholder = props.searchPlaceholder ?? i18n.searchPlaceholder\n    const emptyText = props.emptyText ?? i18n.noResults\n    const noOptionsText = props.noOptionsText ?? i18n.noOptions\n\n    const multiple = \"multiple\" in props && props.multiple === true\n\n    // ── Controlled / uncontrolled ─────────────────────────────────────────\n\n    const isControlled =\n      \"value\" in props && props.value !== undefined && props.value !== null\n\n    const [internalSingle, setInternalSingle] =\n      React.useState<ComboboxValue | null>(() =>\n        !multiple && !isControlled\n          ? ((props as ComboboxSingleProps).defaultValue ?? null)\n          : null\n      )\n\n    const [internalMulti, setInternalMulti] = React.useState<ComboboxValue[]>(\n      () =>\n        multiple && !isControlled\n          ? ((props as ComboboxMultipleProps).defaultValue ?? [])\n          : []\n    )\n\n    const selectedSingle: ComboboxValue | null = multiple\n      ? null\n      : isControlled\n        ? ((props as ComboboxSingleProps).value ?? null)\n        : internalSingle\n\n    const selectedMulti: ComboboxValue[] = multiple\n      ? isControlled\n        ? ((props as ComboboxMultipleProps).value ?? EMPTY_VALUES)\n        : internalMulti\n      : EMPTY_VALUES\n\n    // ── Dropdown state ────────────────────────────────────────────────────\n\n    const [open, setOpen] = React.useState(false)\n    const [query, setQuery] = React.useState(\"\")\n    const [activeOptionIndex, setActiveOptionIndex] = React.useState(0)\n\n    const itemHeight = ITEM_HEIGHT[size ?? \"md\"] ?? 36\n\n    const { rows, filtered } = React.useMemo(\n      () => buildVirtualRows(options, query),\n      [options, query]\n    )\n\n    // Reset query on close; on open, jump to the currently selected option\n    const handleOpenChange = React.useCallback(\n      (next: boolean) => {\n        if (!next) {\n          setQuery(\"\")\n          setActiveOptionIndex(0)\n        } else {\n          let startIndex = 0\n          const targetValue = !multiple\n            ? selectedSingle\n            : (selectedMulti[0] ?? null)\n          if (targetValue !== null) {\n            const optRow = rows.find(\n              (r): r is Extract<VirtualRow, { kind: \"option\" }> =>\n                r.kind === \"option\" && r.option.value === targetValue\n            )\n            if (optRow) startIndex = optRow.optionIndex\n          }\n          setActiveOptionIndex(startIndex)\n        }\n        setOpen(next)\n      },\n      [multiple, rows, selectedSingle, selectedMulti]\n    )\n\n    const handleQueryChange = React.useCallback((q: string) => {\n      setQuery(q)\n      setActiveOptionIndex(0)\n    }, [])\n\n    // ── Select handlers ───────────────────────────────────────────────────\n\n    const selectOption = React.useCallback(\n      (opt: ComboboxOption) => {\n        if (opt.disabled) return\n        if (multiple) {\n          const next = selectedMulti.includes(opt.value)\n            ? selectedMulti.filter((v) => v !== opt.value)\n            : [...selectedMulti, opt.value]\n          if (!isControlled) setInternalMulti(next)\n          ;(props as ComboboxMultipleProps).onChange?.(next)\n        } else {\n          const next = selectedSingle === opt.value ? null : opt.value\n          if (!isControlled) setInternalSingle(next)\n          ;(props as ComboboxSingleProps).onChange?.(next)\n          setOpen(false)\n        }\n      },\n      // eslint-disable-next-line react-hooks/exhaustive-deps\n      [multiple, selectedMulti, selectedSingle, isControlled]\n    )\n\n    const clearAll = React.useCallback(() => {\n      if (multiple) {\n        if (!isControlled) setInternalMulti([])\n        ;(props as ComboboxMultipleProps).onChange?.([])\n      } else {\n        if (!isControlled) setInternalSingle(null)\n        ;(props as ComboboxSingleProps).onChange?.(null)\n      }\n      // eslint-disable-next-line react-hooks/exhaustive-deps\n    }, [multiple, isControlled])\n\n    // ── Keyboard navigation ───────────────────────────────────────────────\n\n    const handleKeyDown = React.useCallback(\n      (e: React.KeyboardEvent) => {\n        switch (e.key) {\n          case \"ArrowDown\":\n            e.preventDefault()\n            setActiveOptionIndex((i) => Math.min(i + 1, filtered.length - 1))\n            break\n          case \"ArrowUp\":\n            e.preventDefault()\n            setActiveOptionIndex((i) => Math.max(i - 1, 0))\n            break\n          case \"Enter\": {\n            e.preventDefault()\n            const opt = filtered[activeOptionIndex]\n            if (opt) selectOption(opt)\n            break\n          }\n          case \"Escape\":\n            e.preventDefault()\n            setOpen(false)\n            break\n          case \"Tab\":\n            setOpen(false)\n            break\n        }\n      },\n      [filtered, activeOptionIndex, selectOption]\n    )\n\n    // ── Trigger display ───────────────────────────────────────────────────\n\n    const selectedLabel = React.useMemo(\n      () =>\n        selectedSingle !== null\n          ? (options.find((o) => o.value === selectedSingle)?.label ?? null)\n          : null,\n      [selectedSingle, options]\n    )\n\n    const maxDisplayed = multiple\n      ? ((props as ComboboxMultipleProps).maxDisplayed ?? 3)\n      : 0\n\n    const visibleValues = selectedMulti.slice(0, maxDisplayed)\n    const hiddenCount = selectedMulti.length - visibleValues.length\n\n    const visibleLabels = React.useMemo(\n      () =>\n        selectedMulti\n          .slice(0, maxDisplayed)\n          .map((v) => options.find((o) => o.value === v)?.label ?? String(v)),\n      [selectedMulti, maxDisplayed, options]\n    )\n\n    const hasValue = multiple\n      ? selectedMulti.length > 0\n      : selectedSingle !== null\n\n    // ── Render ────────────────────────────────────────────────────────────\n\n    if (loading) {\n      return (\n        <div\n          className=\"relative w-full min-w-0\"\n          style={{ maxWidth, ...style }}\n          data-slot=\"combobox\"\n        >\n          <Skeleton\n            className={cn(\n              \"w-full\",\n              size === \"sm\" ? \"h-8\" : size === \"lg\" ? \"h-10\" : \"h-9\",\n              rounded === \"full\"\n                ? \"rounded-full\"\n                : rounded === \"none\"\n                  ? \"rounded-none\"\n                  : \"rounded-lg\",\n              className\n            )}\n          />\n        </div>\n      )\n    }\n\n    return (\n      <div\n        className=\"relative w-full min-w-0\"\n        style={{ maxWidth, ...style }}\n        data-slot=\"combobox\"\n      >\n        <Popover open={open} onOpenChange={handleOpenChange}>\n          <PopoverTrigger asChild>\n            <Button\n              ref={ref}\n              variant=\"outline\"\n              role=\"combobox\"\n              aria-expanded={open}\n              aria-haspopup=\"listbox\"\n              aria-label={ariaLabel || placeholder}\n              aria-labelledby={ariaLabelledBy}\n              disabled={disabled}\n              data-slot=\"combobox-trigger\"\n              className={cn(\n                comboboxTriggerVariants({ size, rounded }),\n                clearable && hasValue && \"pr-14\",\n                className\n              )}\n            >\n              <span className=\"flex min-w-0 flex-1 flex-wrap items-center gap-1 overflow-hidden\">\n                {multiple ? (\n                  hasValue ? (\n                    <>\n                      {visibleLabels.map((label, i) => (\n                        <Badge\n                          key={visibleValues[i]}\n                          variant=\"secondary\"\n                          data-slot=\"combobox-selected\"\n                          className=\"max-w-[120px] truncate\"\n                        >\n                          {label}\n                        </Badge>\n                      ))}\n                      {hiddenCount > 0 && (\n                        <Badge variant=\"secondary\">+{hiddenCount}</Badge>\n                      )}\n                    </>\n                  ) : (\n                    <span className=\"truncate text-muted-foreground\">\n                      {placeholder}\n                    </span>\n                  )\n                ) : selectedLabel ? (\n                  <span className=\"truncate\">{selectedLabel}</span>\n                ) : (\n                  <span className=\"truncate text-muted-foreground\">\n                    {placeholder}\n                  </span>\n                )}\n              </span>\n              <ChevronsUpDownIcon className=\"ml-1 size-4 shrink-0 opacity-50\" />\n            </Button>\n          </PopoverTrigger>\n\n          <PopoverContent\n            side={side}\n            align={align}\n            sideOffset={sideOffset}\n            alignOffset={alignOffset}\n            data-slot=\"combobox-content\"\n            className={cn(\n              \"overflow-hidden p-0\",\n              CONTENT_ROUNDED[rounded ?? \"md\"]\n            )}\n            style={{\n              width: \"var(--radix-popover-trigger-width)\",\n              minWidth: \"180px\",\n            }}\n            onOpenAutoFocus={(e) => e.preventDefault()}\n          >\n            <DropdownContent\n              rows={rows}\n              filtered={filtered}\n              totalOptions={options.length}\n              itemHeight={itemHeight}\n              searchable={searchable}\n              searchPlaceholder={searchPlaceholder}\n              query={query}\n              onQueryChange={handleQueryChange}\n              onKeyDown={handleKeyDown}\n              multiple={multiple}\n              selectedSingle={selectedSingle}\n              selectedMulti={selectedMulti}\n              activeOptionIndex={activeOptionIndex}\n              onSelect={selectOption}\n              onHover={setActiveOptionIndex}\n              onClearAll={clearAll}\n              emptyText={emptyText}\n              noOptionsText={noOptionsText}\n              rounded={rounded ?? \"md\"}\n              size={size ?? \"md\"}\n              i18n={i18n}\n              renderOption={renderOption}\n            />\n          </PopoverContent>\n        </Popover>\n\n        {clearable && hasValue && (\n          <button\n            type=\"button\"\n            aria-label={i18n.clearSelection}\n            tabIndex={-1}\n            data-slot=\"combobox-clear\"\n            className={cn(\n              \"absolute top-1/2 flex size-5 -translate-y-1/2 items-center justify-center rounded-full opacity-40 transition-opacity hover:opacity-100 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline\",\n              size === \"sm\" ? \"right-7\" : size === \"lg\" ? \"right-9\" : \"right-8\"\n            )}\n            onClick={(e) => {\n              e.stopPropagation()\n              clearAll()\n            }}\n          >\n            <XIcon className=\"size-3.5\" />\n          </button>\n        )}\n      </div>\n    )\n  }\n)\n\nCombobox.displayName = \"Combobox\"\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}
