{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "select",
  "type": "registry:ui",
  "title": "Select",
  "description": "Pick one value from a short list.",
  "categories": [
    "forms"
  ],
  "dependencies": [
    "@base-ui/react@1.9.0",
    "@hugeicons/core-free-icons@4.4.0",
    "@hugeicons/react@1.1.10"
  ],
  "registryDependencies": [
    "https://sprout.tulipfarm.ai/r/sprout-base.json",
    "https://sprout.tulipfarm.ai/r/field.json"
  ],
  "files": [
    {
      "path": "registry/sprout/components/ui/select.tsx",
      "type": "registry:ui",
      "target": "components/ui/select.tsx",
      "content": "'use client';\n\nimport { Select as SelectPrimitive } from '@base-ui/react/select';\nimport { CheckIcon } from '@/lib/sprout/icons/check-icon';\nimport { ChevronDownIcon } from '@/lib/sprout/icons/chevron-down-icon';\nimport { ChevronUpIcon } from '@/lib/sprout/icons/chevron-up-icon';\nimport { cn, stateClassName } from '@/lib/sprout/classes';\nimport { useFieldControl } from '@/components/ui/field';\n\nexport const selectTriggerSizeNames = ['md', 'sm', 'lg'] as const;\nexport const selectTriggerWidthNames = ['fit', 'full'] as const;\n\nexport type SelectTriggerSize = (typeof selectTriggerSizeNames)[number];\nexport type SelectTriggerWidth = (typeof selectTriggerWidthNames)[number];\n\nexport type SelectProps<Value = unknown, Multiple extends boolean | undefined = false> = SelectPrimitive.Root.Props<\n  Value,\n  Multiple\n>;\n\nexport const Select = SelectPrimitive.Root;\n\nexport type SelectGroupProps = SelectPrimitive.Group.Props;\n\nexport function SelectGroup({ className, ...props }: SelectGroupProps) {\n  return (\n    <SelectPrimitive.Group\n      data-slot=\"select-group\"\n      {...props}\n      className={stateClassName<SelectPrimitive.Group.State>('sprout-select-group', className)}\n    />\n  );\n}\n\nexport type SelectValueProps = SelectPrimitive.Value.Props;\n\nexport function SelectValue({ className, ...props }: SelectValueProps) {\n  return (\n    <SelectPrimitive.Value\n      data-slot=\"select-value\"\n      {...props}\n      className={stateClassName<SelectPrimitive.Value.State>('sprout-select-value', className)}\n    />\n  );\n}\n\nexport interface SelectTriggerProps extends SelectPrimitive.Trigger.Props {\n  size?: SelectTriggerSize;\n  width?: SelectTriggerWidth;\n}\n\nexport function SelectTrigger({ className, size = 'md', width = 'fit', children, ...rest }: SelectTriggerProps) {\n  const props = useFieldControl(rest);\n  return (\n    <SelectPrimitive.Trigger\n      data-slot=\"select-trigger\"\n      data-size={size}\n      data-width={width}\n      {...props}\n      className={stateClassName<SelectPrimitive.Trigger.State>(\n        cn('sprout-select-trigger', `sprout-select-trigger-${size}`, `sprout-select-trigger-${width}`),\n        className,\n      )}\n    >\n      {children}\n      <SelectPrimitive.Icon className=\"sprout-select-icon\">\n        <ChevronDownIcon aria-hidden=\"true\" />\n      </SelectPrimitive.Icon>\n    </SelectPrimitive.Trigger>\n  );\n}\n\ntype PositionerProps = Pick<\n  SelectPrimitive.Positioner.Props,\n  | 'align'\n  | 'alignOffset'\n  | 'side'\n  | 'sideOffset'\n  | 'alignItemWithTrigger'\n  | 'collisionPadding'\n  | 'collisionAvoidance'\n  | 'sticky'\n  | 'positionMethod'\n>;\n\nexport interface SelectContentProps extends SelectPrimitive.Popup.Props, PositionerProps {\n  container?: SelectPrimitive.Portal.Props['container'];\n}\n\nexport function SelectContent({\n  side = 'bottom',\n  sideOffset = 4,\n  align = 'center',\n  alignOffset = 0,\n  alignItemWithTrigger = true,\n  collisionPadding = 8,\n  collisionAvoidance,\n  sticky,\n  positionMethod,\n  container,\n  className,\n  children,\n  ...props\n}: SelectContentProps) {\n  return (\n    <SelectPrimitive.Portal container={container}>\n      <SelectPrimitive.Positioner\n        className=\"sprout-select-positioner\"\n        side={side}\n        sideOffset={sideOffset}\n        align={align}\n        alignOffset={alignOffset}\n        alignItemWithTrigger={alignItemWithTrigger}\n        collisionPadding={collisionPadding}\n        collisionAvoidance={collisionAvoidance}\n        sticky={sticky}\n        positionMethod={positionMethod}\n      >\n        <SelectPrimitive.Popup\n          data-slot=\"select-content\"\n          data-align-trigger={alignItemWithTrigger}\n          {...props}\n          className={stateClassName<SelectPrimitive.Popup.State>('sprout-select-content', className)}\n        >\n          <SelectScrollUpButton />\n          <SelectPrimitive.List className=\"sprout-select-list\">{children}</SelectPrimitive.List>\n          <SelectScrollDownButton />\n        </SelectPrimitive.Popup>\n      </SelectPrimitive.Positioner>\n    </SelectPrimitive.Portal>\n  );\n}\n\nexport type SelectLabelProps = SelectPrimitive.GroupLabel.Props;\n\nexport function SelectLabel({ className, ...props }: SelectLabelProps) {\n  return (\n    <SelectPrimitive.GroupLabel\n      data-slot=\"select-label\"\n      {...props}\n      className={stateClassName<SelectPrimitive.GroupLabel.State>('sprout-select-label', className)}\n    />\n  );\n}\n\nexport type SelectItemProps = SelectPrimitive.Item.Props;\n\nexport function SelectItem({ className, children, ...props }: SelectItemProps) {\n  return (\n    <SelectPrimitive.Item\n      data-slot=\"select-item\"\n      {...props}\n      className={stateClassName<SelectPrimitive.Item.State>('sprout-select-item', className)}\n    >\n      <SelectPrimitive.ItemText className=\"sprout-select-item-text\">{children}</SelectPrimitive.ItemText>\n      <SelectPrimitive.ItemIndicator className=\"sprout-select-item-indicator\">\n        <CheckIcon aria-hidden=\"true\" />\n      </SelectPrimitive.ItemIndicator>\n    </SelectPrimitive.Item>\n  );\n}\n\nexport type SelectSeparatorProps = SelectPrimitive.Separator.Props;\n\nexport function SelectSeparator({ className, ...props }: SelectSeparatorProps) {\n  return (\n    <SelectPrimitive.Separator\n      data-slot=\"select-separator\"\n      {...props}\n      className={stateClassName<SelectPrimitive.Separator.State>('sprout-select-separator', className)}\n    />\n  );\n}\n\nexport type SelectScrollUpButtonProps = SelectPrimitive.ScrollUpArrow.Props;\n\nexport function SelectScrollUpButton({ className, ...props }: SelectScrollUpButtonProps) {\n  return (\n    <SelectPrimitive.ScrollUpArrow\n      data-slot=\"select-scroll-up-button\"\n      {...props}\n      className={stateClassName<SelectPrimitive.ScrollUpArrow.State>(\n        'sprout-select-scroll-button sprout-select-scroll-up',\n        className,\n      )}\n    >\n      <ChevronUpIcon aria-hidden=\"true\" />\n    </SelectPrimitive.ScrollUpArrow>\n  );\n}\n\nexport type SelectScrollDownButtonProps = SelectPrimitive.ScrollDownArrow.Props;\n\nexport function SelectScrollDownButton({ className, ...props }: SelectScrollDownButtonProps) {\n  return (\n    <SelectPrimitive.ScrollDownArrow\n      data-slot=\"select-scroll-down-button\"\n      {...props}\n      className={stateClassName<SelectPrimitive.ScrollDownArrow.State>(\n        'sprout-select-scroll-button sprout-select-scroll-down',\n        className,\n      )}\n    >\n      <ChevronDownIcon aria-hidden=\"true\" />\n    </SelectPrimitive.ScrollDownArrow>\n  );\n}\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/check-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/check-icon.tsx",
      "content": "import { Tick02Icon as glyph } from '@hugeicons/core-free-icons';\nimport { createIcon } from '@/lib/sprout/icons/create-icon';\n\nexport const CheckIcon = /* @__PURE__ */ createIcon(glyph, 'CheckIcon');\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/chevron-down-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/chevron-down-icon.tsx",
      "content": "import { ArrowDown01Icon as glyph } from '@hugeicons/core-free-icons';\nimport { createIcon } from '@/lib/sprout/icons/create-icon';\n\nexport const ChevronDownIcon = /* @__PURE__ */ createIcon(glyph, 'ChevronDownIcon');\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/chevron-up-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/chevron-up-icon.tsx",
      "content": "import { ArrowUp01Icon as glyph } from '@hugeicons/core-free-icons';\nimport { createIcon } from '@/lib/sprout/icons/create-icon';\n\nexport const ChevronUpIcon = /* @__PURE__ */ createIcon(glyph, 'ChevronUpIcon');\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/create-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/create-icon.tsx",
      "content": "import { HugeiconsIcon, type IconSvgElement } from '@hugeicons/react';\nimport type { ReactElement, Ref, SVGProps } from 'react';\n\nexport const iconSizes = {\n  xs: 12,\n  sm: 14,\n  md: 16,\n  lg: 18,\n  xl: 20,\n  '2xl': 24,\n} as const;\n\nexport type IconSize = keyof typeof iconSizes;\n\nexport const iconStrokeWidth = 1.5;\n\nexport type IconProps = Omit<SVGProps<SVGSVGElement>, 'ref'> & {\n  size?: IconSize | number;\n  ref?: Ref<SVGSVGElement>;\n};\n\nexport type IconComponent = (props: IconProps) => ReactElement;\n\nexport function createIcon(glyph: IconSvgElement, name: string): IconComponent {\n  const Icon = ({ size = '2xl', strokeWidth = iconStrokeWidth, ...props }: IconProps) => (\n    <HugeiconsIcon\n      icon={glyph}\n      size={typeof size === 'number' ? size : iconSizes[size]}\n      strokeWidth={Number(strokeWidth)}\n      {...props}\n    />\n  );\n  Icon.displayName = name;\n  return Icon;\n}\n"
    }
  ],
  "css": {
    "@layer components": {
      ".sprout-select-trigger": {
        "--sprout-select-icon": "1rem",
        "box-sizing": "border-box",
        "min-width": "0",
        "max-width": "100%",
        "height": "var(--sprout-control-height)",
        "border": "1px solid var(--sprout-input)",
        "border-radius": "var(--sprout-radius-control)",
        "background": "var(--sprout-surface)",
        "color": "var(--sprout-text)",
        "box-shadow": "var(--sprout-shadow-control)",
        "font-family": "inherit",
        "font-size": "var(--sprout-text-sm)",
        "text-align": "start",
        "white-space": "nowrap",
        "cursor": "pointer",
        "user-select": "none",
        "-webkit-tap-highlight-color": "transparent",
        "outline": "none",
        "justify-content": "space-between",
        "align-items": "center",
        "gap": "6px",
        "padding": "0 8px 0 10px",
        "font-weight": "400",
        "line-height": "20px",
        "display": "inline-flex"
      },
      "@media (hover: hover)": {
        ".sprout-select-trigger:hover": {
          "border-color": "var(--sprout-border)"
        }
      },
      ".sprout-select-trigger[data-popup-open]": {
        "border-color": "var(--sprout-border)",
        "background": "var(--sprout-hover)"
      },
      ".sprout-select-trigger:focus-visible": {
        "outline": "var(--sprout-focus-width) solid var(--sprout-focus-ring)",
        "outline-offset": "0"
      },
      ".sprout-select-trigger[data-placeholder]": {
        "color": "var(--sprout-muted)"
      },
      ".sprout-select-trigger:disabled, .sprout-select-trigger[data-disabled]": {
        "opacity": ".5",
        "cursor": "not-allowed",
        "pointer-events": "none"
      },
      ".sprout-select-trigger[aria-busy=\"true\"]": {
        "cursor": "progress"
      },
      ".sprout-select-trigger[aria-invalid=\"true\"], .sprout-select-trigger[data-invalid]": {
        "border-color": "var(--sprout-danger)"
      },
      ".sprout-select-trigger[aria-invalid=\"true\"]:focus-visible, .sprout-select-trigger[data-invalid]:focus-visible": {
        "outline-color": "var(--sprout-danger)"
      },
      ".sprout-select-trigger svg": {
        "pointer-events": "none",
        "flex-shrink": "0"
      },
      ".sprout-select-trigger svg:not([class*=\"size-\"])": {
        "width": "var(--sprout-select-icon)",
        "height": "var(--sprout-select-icon)"
      },
      ".sprout-select-trigger-sm": {
        "--sprout-select-icon": ".875rem",
        "height": "calc(var(--sprout-control-height) - 4px)",
        "border-radius": "min(var(--sprout-radius-control), 12px)",
        "font-size": "var(--sprout-text-xs)",
        "gap": "4px",
        "padding": "0 6px 0 8px",
        "line-height": "16px"
      },
      ".sprout-select-trigger-lg": {
        "height": "calc(var(--sprout-control-height) + 4px)",
        "padding": "0 10px 0 12px"
      },
      ".sprout-select-trigger-fit": {
        "width": "fit-content"
      },
      ".sprout-select-trigger-full": {
        "width": "100%"
      },
      ".sprout-select-value": {
        "text-overflow": "ellipsis",
        "white-space": "nowrap",
        "flex": "auto",
        "align-items": "center",
        "gap": "8px",
        "min-width": "0",
        "display": "flex",
        "overflow": "hidden"
      },
      ".sprout-select-value > *": {
        "min-width": "0"
      },
      ".sprout-select-icon": {
        "color": "var(--sprout-muted)",
        "flex-shrink": "0",
        "display": "flex"
      },
      ".sprout-select-positioner": {
        "z-index": "50",
        "isolation": "isolate",
        "outline": "none"
      },
      ".sprout-select-content": {
        "box-sizing": "border-box",
        "width": "var(--anchor-width)",
        "min-width": "9rem",
        "max-width": "var(--available-width)",
        "max-height": "var(--available-height)",
        "overscroll-behavior": "contain",
        "border": "1px solid var(--sprout-line)",
        "border-radius": "var(--sprout-radius-panel)",
        "background": "var(--sprout-popover)",
        "color": "var(--sprout-text)",
        "box-shadow": "var(--sprout-shadow-overlay)",
        "font-family": "var(--sprout-font)",
        "font-size": "var(--sprout-text-sm)",
        "scrollbar-width": "thin",
        "transform-origin": "var(--transform-origin)",
        "outline": "none",
        "line-height": "1.25rem",
        "position": "relative",
        "overflow": "hidden auto"
      },
      ".sprout-select-list": {
        "outline": "none",
        "padding": "4px"
      },
      ".sprout-select-group": {
        "scroll-margin-block": "4px"
      },
      ".sprout-select-label": {
        "color": "var(--sprout-muted)",
        "font-size": "var(--sprout-text-xs)",
        "overflow-wrap": "break-word",
        "padding": "4px 6px",
        "font-weight": "500",
        "line-height": "1rem"
      },
      ".sprout-select-item": {
        "box-sizing": "border-box",
        "min-width": "0",
        "min-height": "calc(var(--sprout-control-height) - 4px)",
        "border-radius": "var(--sprout-radius-control)",
        "color": "var(--sprout-text)",
        "text-align": "start",
        "cursor": "pointer",
        "user-select": "none",
        "-webkit-tap-highlight-color": "transparent",
        "outline": "none",
        "align-items": "center",
        "gap": "6px",
        "padding": "4px 32px 4px 6px",
        "scroll-margin-block": "4px",
        "display": "flex",
        "position": "relative"
      },
      ".sprout-select-item[data-highlighted]": {
        "background": "var(--sprout-hover)"
      },
      ".sprout-select-item[data-selected]": {
        "font-weight": "500"
      },
      ".sprout-select-item[data-disabled]": {
        "opacity": ".5",
        "cursor": "not-allowed"
      },
      ".sprout-select-item svg": {
        "pointer-events": "none",
        "flex-shrink": "0"
      },
      ".sprout-select-item svg:not([class*=\"size-\"])": {
        "width": "16px",
        "height": "16px"
      },
      ".sprout-select-item-text": {
        "overflow-wrap": "anywhere",
        "white-space": "normal",
        "flex": "auto",
        "align-items": "center",
        "gap": "6px",
        "min-width": "0",
        "display": "flex"
      },
      ".sprout-select-item-text > svg": {
        "color": "var(--sprout-muted)"
      },
      ".sprout-select-item-indicator": {
        "pointer-events": "none",
        "justify-content": "center",
        "align-items": "center",
        "display": "flex",
        "position": "absolute",
        "inset-inline-end": "8px"
      },
      ".sprout-select-separator": {
        "background": "var(--sprout-line)",
        "pointer-events": "none",
        "height": "1px",
        "margin": "4px -4px"
      },
      ".sprout-select-scroll-button": {
        "z-index": "1",
        "background": "var(--sprout-surface)",
        "width": "100%",
        "height": "24px",
        "color": "var(--sprout-muted)",
        "cursor": "default",
        "justify-content": "center",
        "align-items": "center",
        "display": "flex"
      },
      ".sprout-select-scroll-up": {
        "border-radius": "var(--sprout-radius-panel) var(--sprout-radius-panel) 0 0",
        "top": "0"
      },
      ".sprout-select-scroll-down": {
        "border-radius": "0 0 var(--sprout-radius-panel) var(--sprout-radius-panel)",
        "bottom": "0"
      },
      ".sprout-select-scroll-button svg": {
        "width": "14px",
        "height": "14px"
      },
      "@media (pointer: coarse)": {
        ".sprout-select-trigger, .sprout-select-item": {
          "min-height": "2.75rem"
        }
      },
      "@media (forced-colors: active)": {
        ".sprout-select-item[data-highlighted]": {
          "outline-offset": "-1px",
          "outline": "2px solid highlight"
        }
      },
      "@media (prefers-reduced-motion: no-preference)": {
        ".sprout-select-trigger": {
          "transition": "background-color var(--sprout-motion-fast) ease-out,\n        border-color var(--sprout-motion-fast) ease-out,\n        opacity var(--sprout-motion-fast) ease-out"
        },
        ".sprout-select-content": {
          "transition": "opacity var(--sprout-motion-fast) var(--sprout-motion-ease),\n        scale var(--sprout-motion-fast) var(--sprout-motion-ease)"
        },
        ".sprout-select-content[data-starting-style], .sprout-select-content[data-ending-style]": {
          "opacity": "0",
          "scale": ".96"
        },
        ".sprout-select-content[data-side=\"none\"][data-starting-style], .sprout-select-content[data-side=\"none\"][data-ending-style]": {
          "scale": "1"
        },
        ".sprout-select-item": {
          "transition": "background-color var(--sprout-motion-fast) ease-out"
        }
      }
    }
  },
  "docs": "Docs and examples: https://sprout.tulipfarm.ai/components/select/",
  "meta": {
    "source": "packages/sprout/src/components/select.tsx"
  }
}
