{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tree-select",
  "type": "registry:ui",
  "title": "Tree Select",
  "dependencies": [
    "@base-ui-next/react",
    "class-variance-authority"
  ],
  "registryDependencies": [
    "https://hamur.dev/r/react/utils.json",
    "https://hamur.dev/r/react/button.json"
  ],
  "files": [
    {
      "path": "react/tree-select.tsx",
      "content": "'use client'\n\nimport type * as React from 'react' // base-ui-next/ui tree-select@0.1.1\nimport { TreeSelect as TreeSelectPrimitive } from '@base-ui-next/react/tree-select'\nimport type { VariantProps } from 'class-variance-authority'\nimport { cn } from '@/lib/utils'\nimport { buttonVariants } from '@/components/ui/button'\n\nconst treeSelectTriggerClassName =\n  \"flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=tree-select-value]:line-clamp-1 *:data-[slot=tree-select-value]:flex *:data-[slot=tree-select-value]:items-center *:data-[slot=tree-select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\"\n\nconst treeSelectValueClassName =\n  'flex flex-1 text-left data-placeholder:text-muted-foreground'\n\n/** The Base UI icon around lucide's Chevron Down. */\nconst treeSelectIconClassName =\n  'pointer-events-none flex size-4 shrink-0 items-center justify-center text-muted-foreground'\n\nconst treeSelectClearClassName = 'text-muted-foreground'\n\nconst treeSelectBackdropClassName = 'fixed inset-0'\n\nconst treeSelectPositionerClassName = 'isolate z-50'\n\nconst treeSelectPopupClassName =\n  'relative isolate z-50 flex max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-48 origin-(--transform-origin) flex-col overflow-hidden rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95'\n\nconst treeSelectArrowClassName =\n  'size-2.5 rotate-45 bg-popover data-[side=bottom]:-top-1 data-[side=left]:-right-1 data-[side=right]:-left-1 data-[side=top]:-bottom-1'\n\nconst treeSelectInputClassName =\n  'm-1 mb-0 h-8 min-w-0 shrink-0 rounded-md border border-input/30 bg-input/30 px-2.5 text-sm outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50'\n\nconst treeSelectTreeClassName =\n  'flex max-h-72 min-h-0 w-full min-w-0 flex-col gap-px scroll-py-1 overflow-y-auto overscroll-contain p-1 text-sm outline-none'\n\nconst treeSelectItemClassName =\n  'group/tree-item flex min-w-0 flex-col gap-px outline-none data-moving:opacity-50'\n\nconst treeSelectItemContentClassName =\n  \"relative flex h-8 w-full min-w-0 cursor-default items-center gap-1.5 rounded-sm pr-2 pl-[calc((var(--tree-item-level,1)-1)*--spacing(5)+--spacing(2))] text-sm outline-hidden select-none hover:bg-muted [[role=treeitem]:focus-visible>&]:ring-2 [[role=treeitem]:focus-visible>&]:ring-ring/50 [[role=treeitem]:focus-visible>&]:ring-inset data-highlighted:bg-accent data-highlighted:text-accent-foreground data-selected:bg-primary/10 data-selected:font-medium data-selected:text-foreground data-selected:data-highlighted:bg-primary/15 data-match:font-medium data-disabled:pointer-events-none data-disabled:opacity-50 data-loading:cursor-progress data-load-error:text-destructive forced-colors:data-highlighted:outline-2 forced-colors:data-highlighted:-outline-offset-2 forced-colors:data-highlighted:outline-solid forced-colors:data-selected:outline-1 forced-colors:data-selected:-outline-offset-1 forced-colors:data-selected:outline-solid [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\"\n\nconst treeSelectItemToggleClassName =\n  'flex size-4 shrink-0 items-center justify-center text-muted-foreground data-leaf:invisible data-loading:motion-safe:animate-pulse [&>svg]:transition-[rotate] [&>svg]:duration-150 motion-reduce:[&>svg]:transition-none rtl:[&>svg]:-scale-x-100 data-expanded:[&>svg]:rotate-90 rtl:data-expanded:[&>svg]:-rotate-90'\n\nconst treeSelectItemIndicatorClassName =\n  'group/tree-item-indicator flex size-4 shrink-0 items-center justify-center text-primary [&>svg]:size-3.5 in-data-multiple:rounded-[4px] in-data-multiple:border in-data-multiple:border-input in-data-multiple:text-primary-foreground in-data-multiple:shadow-xs dark:in-data-multiple:bg-input/30 in-data-multiple:data-checked:border-primary in-data-multiple:data-checked:bg-primary in-data-multiple:data-indeterminate:border-primary in-data-multiple:data-indeterminate:bg-primary in-data-multiple:data-selected:border-primary in-data-multiple:data-selected:bg-primary'\n\nconst treeSelectItemIndicatorCheckClassName =\n  'hidden group-data-checked/tree-item-indicator:block group-data-selected/tree-item-indicator:block'\n\nconst treeSelectItemIndicatorMixedClassName =\n  'hidden group-data-indeterminate/tree-item-indicator:block'\n\nconst treeSelectItemTextClassName = 'min-w-0 flex-1 truncate'\n\nconst treeSelectGroupClassName =\n  'flex h-(--tree-group-height) flex-col gap-px overflow-hidden transition-[height] duration-150 ease-out data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none'\n\nconst treeSelectEmptyClassName = 'py-6 text-center text-sm text-muted-foreground'\n\nconst treeSelectStatusClassName = 'px-2 py-1.5 text-xs text-muted-foreground empty:hidden'\n\ntype ButtonVariants = VariantProps<typeof buttonVariants>\n\n// lucide's icons, inline and hidden from assistive technology (10 · As built, BN-309).\nfunction SvgIcon({ children, ...props }: React.ComponentProps<'svg'>) {\n  return (\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"2\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      aria-hidden=\"true\"\n      {...props}\n    >\n      {children}\n    </svg>\n  )\n}\n\n// No shadcn item: one name per Base UI part (BN-331, question 10). The app writes the popup as\n// `Portal` > `Positioner` > `Popup`, as the headless anatomy has it.\nconst TreeSelect = TreeSelectPrimitive.Root\n\n/** `select`'s trigger: its content, then the chevron as the Base UI icon. */\nfunction TreeSelectTrigger({\n  className,\n  size = 'default',\n  children,\n  ...props\n}: TreeSelectPrimitive.Trigger.Props & { size?: 'sm' | 'default' }) {\n  return (\n    <TreeSelectPrimitive.Trigger\n      data-slot=\"tree-select-trigger\"\n      data-size={size}\n      className={cn(treeSelectTriggerClassName, className)}\n      {...props}\n    >\n      {children}\n      <TreeSelectIcon />\n    </TreeSelectPrimitive.Trigger>\n  )\n}\n\nfunction TreeSelectValue({ className, ...props }: TreeSelectPrimitive.Value.Props) {\n  return (\n    <TreeSelectPrimitive.Value\n      data-slot=\"tree-select-value\"\n      className={cn(treeSelectValueClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectIcon({ className, children, ...props }: TreeSelectPrimitive.Icon.Props) {\n  return (\n    <TreeSelectPrimitive.Icon\n      data-slot=\"tree-select-icon\"\n      className={cn(treeSelectIconClassName, className)}\n      {...props}\n    >\n      {children ?? (\n        <SvgIcon>\n          <path d=\"m6 9 6 6 6-6\" />\n        </SvgIcon>\n      )}\n    </TreeSelectPrimitive.Icon>\n  )\n}\n\n/** A ghost icon button with lucide's X, named \"Clear\" as Base UI names it without content. */\nfunction TreeSelectClear({\n  className,\n  children,\n  variant = 'ghost',\n  size = 'icon-sm',\n  ...props\n}: TreeSelectPrimitive.Clear.Props & ButtonVariants) {\n  return (\n    <TreeSelectPrimitive.Clear\n      data-slot=\"tree-select-clear\"\n      aria-label={children == null ? 'Clear' : undefined}\n      className={cn(buttonVariants({ variant, size }), treeSelectClearClassName, className)}\n      {...props}\n    >\n      {children ?? (\n        <SvgIcon>\n          <path d=\"M18 6 6 18\" />\n          <path d=\"m6 6 12 12\" />\n        </SvgIcon>\n      )}\n    </TreeSelectPrimitive.Clear>\n  )\n}\n\nfunction TreeSelectPortal({ ...props }: TreeSelectPrimitive.Portal.Props) {\n  return <TreeSelectPrimitive.Portal data-slot=\"tree-select-portal\" {...props} />\n}\n\nfunction TreeSelectBackdrop({ className, ...props }: TreeSelectPrimitive.Backdrop.Props) {\n  return (\n    <TreeSelectPrimitive.Backdrop\n      data-slot=\"tree-select-backdrop\"\n      className={cn(treeSelectBackdropClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectPositioner({\n  className,\n  sideOffset = 4,\n  ...props\n}: TreeSelectPrimitive.Positioner.Props) {\n  return (\n    <TreeSelectPrimitive.Positioner\n      data-slot=\"tree-select-positioner\"\n      sideOffset={sideOffset}\n      className={cn(treeSelectPositionerClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectPopup({ className, ...props }: TreeSelectPrimitive.Popup.Props) {\n  return (\n    <TreeSelectPrimitive.Popup\n      data-slot=\"tree-select-popup\"\n      className={cn(treeSelectPopupClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectArrow({ className, ...props }: TreeSelectPrimitive.Arrow.Props) {\n  return (\n    <TreeSelectPrimitive.Arrow\n      data-slot=\"tree-select-arrow\"\n      className={cn(treeSelectArrowClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectInput({ className, ...props }: TreeSelectPrimitive.Input.Props) {\n  return (\n    <TreeSelectPrimitive.Input\n      data-slot=\"tree-select-input\"\n      className={cn(treeSelectInputClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectTree({ className, ...props }: TreeSelectPrimitive.Tree.Props) {\n  return (\n    <TreeSelectPrimitive.Tree\n      data-slot=\"tree-select-tree\"\n      className={cn(treeSelectTreeClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectItem({ className, ...props }: TreeSelectPrimitive.Item.Props) {\n  return (\n    <TreeSelectPrimitive.Item\n      data-slot=\"tree-select-item\"\n      className={cn(treeSelectItemClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectItemContent({ className, ...props }: TreeSelectPrimitive.ItemContent.Props) {\n  return (\n    <TreeSelectPrimitive.ItemContent\n      data-slot=\"tree-select-item-content\"\n      className={cn(treeSelectItemContentClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectItemToggle({\n  className,\n  children,\n  ...props\n}: TreeSelectPrimitive.ItemToggle.Props) {\n  return (\n    <TreeSelectPrimitive.ItemToggle\n      data-slot=\"tree-select-item-toggle\"\n      className={cn(treeSelectItemToggleClassName, className)}\n      {...props}\n    >\n      {children ?? (\n        <SvgIcon>\n          <path d=\"m9 18 6-6-6-6\" />\n        </SvgIcon>\n      )}\n    </TreeSelectPrimitive.ItemToggle>\n  )\n}\n\nfunction TreeSelectItemIndicator({\n  className,\n  children,\n  ...props\n}: TreeSelectPrimitive.ItemIndicator.Props) {\n  return (\n    <TreeSelectPrimitive.ItemIndicator\n      data-slot=\"tree-select-item-indicator\"\n      className={cn(treeSelectItemIndicatorClassName, className)}\n      {...props}\n    >\n      {children ?? (\n        <>\n          <SvgIcon className={treeSelectItemIndicatorCheckClassName}>\n            <path d=\"M20 6 9 17l-5-5\" />\n          </SvgIcon>\n          <SvgIcon className={treeSelectItemIndicatorMixedClassName}>\n            <path d=\"M5 12h14\" />\n          </SvgIcon>\n        </>\n      )}\n    </TreeSelectPrimitive.ItemIndicator>\n  )\n}\n\nfunction TreeSelectItemText({ className, ...props }: TreeSelectPrimitive.ItemText.Props) {\n  return (\n    <TreeSelectPrimitive.ItemText\n      data-slot=\"tree-select-item-text\"\n      className={cn(treeSelectItemTextClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectGroup({ className, ...props }: TreeSelectPrimitive.Group.Props) {\n  return (\n    <TreeSelectPrimitive.Group\n      data-slot=\"tree-select-group\"\n      className={cn(treeSelectGroupClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectEmpty({ className, ...props }: TreeSelectPrimitive.Empty.Props) {\n  return (\n    <TreeSelectPrimitive.Empty\n      data-slot=\"tree-select-empty\"\n      className={cn(treeSelectEmptyClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction TreeSelectStatus({ className, ...props }: TreeSelectPrimitive.Status.Props) {\n  return (\n    <TreeSelectPrimitive.Status\n      data-slot=\"tree-select-status\"\n      className={cn(treeSelectStatusClassName, className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  TreeSelect,\n  TreeSelectArrow,\n  TreeSelectBackdrop,\n  TreeSelectClear,\n  TreeSelectEmpty,\n  TreeSelectGroup,\n  TreeSelectIcon,\n  TreeSelectInput,\n  TreeSelectItem,\n  TreeSelectItemContent,\n  TreeSelectItemIndicator,\n  TreeSelectItemText,\n  TreeSelectItemToggle,\n  TreeSelectPopup,\n  TreeSelectPortal,\n  TreeSelectPositioner,\n  TreeSelectStatus,\n  TreeSelectTree,\n  TreeSelectTrigger,\n  TreeSelectValue,\n}\n",
      "type": "registry:ui",
      "target": "@ui/tree-select.tsx"
    }
  ],
  "meta": {
    "baseUiNext": {
      "version": "0.1.1",
      "hash": "b88427db60dfe83950da4b4db12aca83e5646d3dbfc685b5549e93a135a4988b",
      "files": {
        "@ui/tree-select.tsx": "4725bbd841cc5a82d9186f7e0e9f46d4db3f8d388f5ef0fbd0a29a337d8d2cbc"
      }
    }
  }
}
