{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "multi-select",
  "type": "registry:ui",
  "title": "MultiSelect",
  "description": "A flexible multi-select dropdown built on Radix UI DropdownMenu.",
  "dependencies": [
    "@radix-ui/react-checkbox@^1.3.3",
    "@radix-ui/react-dropdown-menu@^2.1.16",
    "@remixicon/react@^4.9.0",
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "https://wideset.co/r/checkbox.json",
    "https://wideset.co/r/dropdown-menu.json",
    "https://wideset.co/r/icon-button.json",
    "https://wideset.co/r/list-item.json",
    "https://wideset.co/r/motion.json",
    "https://wideset.co/r/search.json",
    "https://wideset.co/r/select.json",
    "https://wideset.co/r/styles.json",
    "https://wideset.co/r/tag.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/components/multi-select/MultiSelect.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/multi-select/MultiSelect.tsx",
      "content": "'use client';\n\nimport { RiCloseLine } from '@remixicon/react';\nimport {\n  Children,\n  type ComponentRef,\n  forwardRef,\n  isValidElement,\n  type KeyboardEvent,\n  type MouseEvent,\n  useCallback,\n  useMemo,\n  useRef,\n  useState,\n} from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport { IconButton } from '../button/IconButton';\nimport { DropdownMenu } from '../dropdown/DropdownMenu';\nimport { Search } from '../search/Search';\nimport { Select } from '../select/Select';\nimport { SelectContext } from '../select/Select.context';\nimport {\n  selectClearButtonIconVariants,\n  selectClearButtonVariants,\n  selectValueRightPaddingVariants,\n} from '../select/Select.variants';\nimport { SelectContent } from '../select/SelectContent';\nimport { SelectTrigger } from '../select/SelectTrigger';\nimport type {\n  MultiSelectContentProps,\n  MultiSelectGroupProps,\n  MultiSelectLabelProps,\n  MultiSelectProps,\n  MultiSelectSeparatorProps,\n  MultiSelectTriggerProps,\n} from './MultiSelect.types';\nimport { multiSelectTriggerVariants } from './MultiSelect.variants';\nimport { MultiSelectOption } from './MultiSelectOption';\nimport { MultiSelectValue } from './MultiSelectValue';\n\nconst SELECT_ALL_VALUE = 'wideset_multi_select_all' as const;\n\nexport const MultiSelect = ({\n  options = [],\n  className,\n  id,\n  name,\n  placeholder,\n  hideArrow,\n  size,\n  preset,\n  variant = 'primary',\n  children,\n  value,\n  defaultValue,\n  onValueChange,\n  disabled,\n  clearable,\n  onClear,\n  maxVisibleTags,\n  multiValuesLabel,\n  portalContainer,\n  open,\n  defaultOpen,\n  onOpenChange,\n  modal,\n  hasSelectAll = false,\n  hasSearch = false,\n  noResultsLabel = 'No results found',\n  selectAllLabel = 'Select all',\n  deselectAllLabel = 'Deselect all',\n  clearSelectionAriaLabel = 'Clear selection',\n  defaultMotion,\n  ...triggerProps\n}: MultiSelectProps) => {\n  const motion = useDefaultMotion(defaultMotion);\n  const isControlled = value !== undefined;\n  const isOpenControlled = open !== undefined;\n\n  const [internalValue, setInternalValue] = useState<string[]>(defaultValue ?? []);\n  const [internalOpen, setInternalOpen] = useState<boolean>(defaultOpen ?? false);\n  const [searchQuery, setSearchQuery] = useState('');\n\n  const filteredOptions = useMemo(\n    () => options.filter((o) => o.label.toLowerCase().includes(searchQuery.toLowerCase())),\n    [options, searchQuery],\n  );\n\n  const searchInputRef = useRef<HTMLInputElement | null>(null);\n  const triggerRef = useRef<HTMLButtonElement>(null);\n\n  const searchRef = useCallback((input: HTMLInputElement | null) => {\n    searchInputRef.current = input;\n    input?.focus();\n  }, []);\n\n  const selectedValues = isControlled ? value : internalValue;\n  const currentOpen = isOpenControlled ? open : internalOpen;\n\n  const optionsMap = useMemo(\n    () =>\n      options.reduce<Record<string, (typeof options)[number]>>(\n        (acc, option) => ({\n          ...acc,\n          [option.value]: option,\n        }),\n        {},\n      ),\n    [options],\n  );\n\n  const selectedOptions = useMemo(\n    () =>\n      selectedValues.map((selectedValue) => {\n        const option = optionsMap[selectedValue];\n        return {\n          value: selectedValue,\n          label: option?.label ?? selectedValue,\n        };\n      }),\n    [selectedValues, optionsMap],\n  );\n\n  const hasValue = selectedOptions.length > 0;\n  const tagsGrow = maxVisibleTags === undefined;\n  const areTagsVisible = hasValue && (tagsGrow || selectedOptions.length <= maxVisibleTags);\n  const hasClearButton = clearable && hasValue && !disabled;\n\n  const setSelected = (newValues: string[]) => {\n    if (!isControlled) {\n      setInternalValue(newValues);\n    }\n    onValueChange?.(newValues);\n  };\n\n  const handleItemSelect = (optionValue: string, isSelected: boolean) => {\n    if (isSelected) {\n      setSelected(selectedValues.filter((valueItem) => valueItem !== optionValue));\n      return;\n    }\n\n    setSelected([...selectedValues, optionValue]);\n  };\n\n  const handleOpenChange = (nextOpen: boolean) => {\n    if (disabled) {\n      if (!isOpenControlled) {\n        setInternalOpen(false);\n      }\n      onOpenChange?.(false);\n      return;\n    }\n\n    if (!nextOpen) {\n      setSearchQuery('');\n    }\n\n    if (!isOpenControlled) {\n      setInternalOpen(nextOpen);\n    }\n    onOpenChange?.(nextOpen);\n  };\n\n  const handleClearClick = (event: MouseEvent<HTMLButtonElement>) => {\n    event.preventDefault();\n    event.stopPropagation();\n    setSelected([]);\n    onOpenChange?.(false);\n    onClear?.();\n    triggerRef.current?.focus();\n  };\n\n  const selectableFilteredOptions = useMemo(\n    () => (hasSelectAll ? filteredOptions.filter((o) => !o.disabled) : []),\n    [filteredOptions, hasSelectAll],\n  );\n\n  const allFilteredSelected =\n    selectableFilteredOptions.length > 0 &&\n    selectableFilteredOptions.every((o) => selectedValues.includes(o.value));\n  const someFilteredSelected = selectableFilteredOptions.some((o) =>\n    selectedValues.includes(o.value),\n  );\n\n  const handleSelectAllChange = () => {\n    if (allFilteredSelected) {\n      const filteredSet = new Set(selectableFilteredOptions.map((o) => o.value));\n      setSelected(selectedValues.filter((v) => !filteredSet.has(v)));\n    } else {\n      setSelected([\n        ...new Set([...selectedValues, ...selectableFilteredOptions.map((o) => o.value)]),\n      ]);\n    }\n  };\n\n  const handleFilterChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n    setSearchQuery(e.target.value);\n  };\n\n  const handleSearchClear = () => {\n    setSearchQuery('');\n  };\n\n  const handleSearchKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n    if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n      event.preventDefault();\n      const menu = event.currentTarget.closest('[role=\"menu\"]');\n      const items = Array.from(\n        menu?.querySelectorAll<HTMLElement>(\n          '[role=\"menuitemcheckbox\"]:not([aria-disabled=\"true\"])',\n        ) ?? [],\n      );\n      if (items.length === 0) return;\n      (event.key === 'ArrowDown' ? items[0] : items[items.length - 1]).focus();\n      return;\n    }\n    event.stopPropagation();\n  };\n\n  const handleContentKeyDown = (event: React.KeyboardEvent) => {\n    if (\n      hasSearch &&\n      event.shiftKey &&\n      event.key === 'Tab' &&\n      event.target !== searchInputRef.current\n    ) {\n      event.preventDefault();\n      searchInputRef.current?.focus();\n      return;\n    }\n\n    if (hasSearch && event.key === 'ArrowUp' && event.target !== searchInputRef.current) {\n      const items = Array.from(\n        (event.currentTarget as HTMLElement).querySelectorAll<HTMLElement>(\n          '[role=\"menuitemcheckbox\"]:not([aria-disabled=\"true\"])',\n        ),\n      );\n      if (items.length > 0 && event.target === items[0]) {\n        event.preventDefault();\n        searchInputRef.current?.focus();\n      }\n    }\n  };\n\n  const handleValueRemove = (optionValue: string) => {\n    setSelected(selectedValues.filter((valueItem) => valueItem !== optionValue));\n  };\n\n  const handleTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n    triggerProps.onKeyDown?.(event);\n    if (event.defaultPrevented || event.key !== 'Backspace') return;\n    if (disabled || !areTagsVisible) return;\n\n    event.preventDefault();\n    handleValueRemove(selectedValues[selectedValues.length - 1]);\n  };\n\n  const isComposable = Children.toArray(children).some(\n    (child) =>\n      isValidElement(child) &&\n      (child.type === MultiSelectTrigger ||\n        child.type === MultiSelectContent ||\n        child.type === DropdownMenu.Trigger ||\n        child.type === SelectContent),\n  );\n\n  return (\n    <SelectContext.Provider value={{ motion }}>\n      {isComposable ? (\n        <DropdownMenu open={currentOpen} onOpenChange={handleOpenChange} modal={modal}>\n          {children}\n        </DropdownMenu>\n      ) : (\n        <div data-slot=\"multi-select\" className=\"flex w-full items-center\">\n          <DropdownMenu open={currentOpen} onOpenChange={handleOpenChange} modal={modal}>\n            <DropdownMenu.Trigger asChild>\n              <SelectTrigger\n                ref={triggerRef}\n                data-slot=\"multi-select-trigger\"\n                id={id}\n                name={name}\n                type=\"button\"\n                disabled={disabled}\n                className={cn(multiSelectTriggerVariants({ size, tagsGrow }), className)}\n                size={size}\n                preset={preset}\n                variant={variant}\n                hideArrow={hideArrow}\n                shouldUsePrimitive={false}\n                {...triggerProps}\n                onKeyDown={handleTriggerKeyDown}\n                data-disabled={disabled}\n              >\n                <div\n                  className={cn(\n                    'gap-ws-2 flex min-w-0 flex-1 items-center',\n                    tagsGrow ? 'flex-wrap' : 'overflow-hidden',\n                    tagsGrow &&\n                      (size === 'sm'\n                        ? 'min-h-ws-11'\n                        : size === 'lg'\n                          ? 'min-h-ws-13'\n                          : 'min-h-ws-12'),\n                    hasClearButton && selectValueRightPaddingVariants({ size }),\n                  )}\n                >\n                  <MultiSelectValue\n                    hasValue={hasValue}\n                    placeholder={placeholder}\n                    areTagsVisible={areTagsVisible}\n                    selectedOptions={selectedOptions}\n                    size={size}\n                    hasClearButton={hasClearButton}\n                    multiValuesLabel={multiValuesLabel}\n                    onRemoveValue={handleValueRemove}\n                    wrap={tagsGrow}\n                  />\n                </div>\n              </SelectTrigger>\n            </DropdownMenu.Trigger>\n\n            <SelectContent\n              data-slot=\"multi-select-content\"\n              shouldUsePrimitive={false}\n              portalContainer={portalContainer}\n              align=\"start\"\n              sideOffset={4}\n              className=\"p-ws-3\"\n              onKeyDown={handleContentKeyDown}\n            >\n              {hasSearch && (\n                <>\n                  <Search\n                    ref={searchRef}\n                    className=\"m-ws-5 w-auto shrink-0\"\n                    value={searchQuery}\n                    onChange={handleFilterChange}\n                    onClear={handleSearchClear}\n                    onKeyDown={handleSearchKeyDown}\n                    defaultMotion={motion}\n                  />\n                  <Select.Separator\n                    data-slot=\"multi-select-separator\"\n                    className=\"-mx-ws-3 shrink-0\"\n                  />\n                </>\n              )}\n              {hasSelectAll && (\n                <>\n                  <MultiSelectOption\n                    key={SELECT_ALL_VALUE}\n                    option={{\n                      value: SELECT_ALL_VALUE,\n                      label: allFilteredSelected ? deselectAllLabel : selectAllLabel,\n                    }}\n                    indeterminateState={\n                      !someFilteredSelected ? false : allFilteredSelected ? true : 'indeterminate'\n                    }\n                    isDisabled={false}\n                    onSelect={handleSelectAllChange}\n                  />\n                  <Select.Separator\n                    data-slot=\"multi-select-separator\"\n                    className=\"-mx-ws-3 shrink-0\"\n                  />\n                </>\n              )}\n              {filteredOptions.length > 0 &&\n                filteredOptions.map((option) => {\n                  const isSelected = selectedValues.includes(option.value);\n                  const isOptionDisabled = Boolean(disabled || option.disabled);\n                  return (\n                    <MultiSelectOption\n                      key={option.value}\n                      option={option}\n                      isSelected={isSelected}\n                      isDisabled={isOptionDisabled}\n                      onSelect={() => handleItemSelect(option.value, isSelected)}\n                    />\n                  );\n                })}\n              {!filteredOptions.length && hasSearch && searchQuery.trim() && (\n                <p\n                  role=\"status\"\n                  className=\"typography-label-sm text-ws-dynamic-secondary-default px-ws-7 py-ws-5\"\n                >\n                  {noResultsLabel}\n                </p>\n              )}\n            </SelectContent>\n          </DropdownMenu>\n\n          {hasClearButton && (\n            <IconButton\n              onClick={handleClearClick}\n              aria-label={clearSelectionAriaLabel}\n              icon={RiCloseLine}\n              preset=\"ghost\"\n              variant=\"secondary\"\n              defaultMotion={motion}\n              className={selectClearButtonVariants({\n                size,\n                hideArrow,\n              })}\n              iconClassName={selectClearButtonIconVariants({ size })}\n            />\n          )}\n        </div>\n      )}\n    </SelectContext.Provider>\n  );\n};\n\nMultiSelect.displayName = 'MultiSelect';\n\nexport const MultiSelectTrigger = forwardRef<\n  ComponentRef<typeof DropdownMenu.Trigger>,\n  MultiSelectTriggerProps\n>((props, ref) => <DropdownMenu.Trigger ref={ref} data-slot=\"multi-select-trigger\" {...props} />);\nMultiSelectTrigger.displayName = 'MultiSelect.Trigger';\nMultiSelect.Trigger = MultiSelectTrigger;\nexport const MultiSelectContent = forwardRef<\n  ComponentRef<typeof SelectContent>,\n  MultiSelectContentProps\n>((props, ref) => <SelectContent ref={ref} data-slot=\"multi-select-content\" {...props} />);\nMultiSelectContent.displayName = 'MultiSelect.Content';\nMultiSelect.Content = MultiSelectContent;\nMultiSelect.Value = MultiSelectValue;\nMultiSelect.Option = MultiSelectOption;\nexport const MultiSelectGroup = forwardRef<\n  ComponentRef<typeof DropdownMenu.Group>,\n  MultiSelectGroupProps\n>((props, ref) => <DropdownMenu.Group ref={ref} data-slot=\"multi-select-group\" {...props} />);\nMultiSelectGroup.displayName = 'MultiSelect.Group';\nMultiSelect.Group = MultiSelectGroup;\nexport const MultiSelectLabel = forwardRef<\n  ComponentRef<typeof DropdownMenu.Label>,\n  MultiSelectLabelProps\n>((props, ref) => <DropdownMenu.Label ref={ref} data-slot=\"multi-select-label\" {...props} />);\nMultiSelectLabel.displayName = 'MultiSelect.Label';\nMultiSelect.Label = MultiSelectLabel;\nexport const MultiSelectSeparator = forwardRef<\n  ComponentRef<typeof DropdownMenu.Separator>,\n  MultiSelectSeparatorProps\n>((props, ref) => (\n  <DropdownMenu.Separator ref={ref} data-slot=\"multi-select-separator\" {...props} />\n));\nMultiSelectSeparator.displayName = 'MultiSelect.Separator';\nMultiSelect.Separator = MultiSelectSeparator;\n"
    },
    {
      "path": "src/components/multi-select/MultiSelect.types.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/multi-select/MultiSelect.types.ts",
      "content": "import type { CheckedState } from '@radix-ui/react-checkbox';\nimport type * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport type { VariantProps } from 'class-variance-authority';\nimport type * as React from 'react';\n\nimport type { MotionProps } from '@/lib/wideset/motion/Motion.types';\nimport type {\n  DropdownMenuGroupProps,\n  DropdownMenuLabelProps,\n  DropdownMenuSeparatorProps,\n  DropdownMenuTriggerProps,\n} from '../dropdown/DropdownMenu.types';\nimport type { ListItemProps } from '../list-item/ListItem.types';\nimport type { SelectContentProps } from '../select/Select.types';\nimport type { selectTriggerVariants } from '../select/Select.variants';\n\ntype MultiSelectSize = VariantProps<typeof selectTriggerVariants>['size'];\ntype MultiSelectPreset = VariantProps<typeof selectTriggerVariants>['preset'];\ntype MultiSelectVariant = VariantProps<typeof selectTriggerVariants>['variant'];\n\nexport type MultiSelectOptionType<T extends Record<string, unknown> = Record<string, unknown>> = {\n  /** Unique identifier used as the option's value. */\n  value: string;\n  /** Display text shown in the dropdown list and as a tag once selected. */\n  label: string;\n  /** Whether this option is disabled and unselectable. */\n  disabled?: boolean;\n  /** Optional element (icon, avatar, or text) rendered before the label. */\n  prefix?: React.ReactNode;\n  /** Color variant for the option row. `danger` renders red text for destructive choices. */\n  variant?: ListItemProps['variant'];\n} & T;\n\n/** A selection control for multiple options. */\nexport type MultiSelectProps = {\n  /** Sub-components for composable usage (`MultiSelect.Trigger`, `MultiSelect.Content`, `MultiSelect.Option`, etc.). Use instead of `options` when you need full rendering control. */\n  children?: React.ReactNode;\n  /** Array of options to display in the dropdown. Each item requires `value` and `label`. */\n  options?: MultiSelectOptionType[];\n  /** Controlled selected values. Each element must match an option's `value`. Use with `onValueChange`. */\n  value?: string[];\n  /** Initial selected values for uncontrolled usage. */\n  defaultValue?: string[];\n  /** Called when the selection changes. Receives the updated array of selected values. */\n  onValueChange?: (value: string[]) => void;\n  /** Disables the trigger and all options. */\n  disabled?: boolean;\n  /** Whether to show a clear button when at least one value is selected. */\n  clearable?: boolean;\n  /** Called when the clear button is clicked. */\n  onClear?: () => void;\n  /**\n   * Controls how selected values are displayed in the trigger:\n   * - **`undefined` (default)** — all tags are always shown; the trigger grows in height to fit them.\n   * - **`0`** — always shows the aggregated summary label (e.g. `\"3 values selected\"`), never individual tags.\n   * - **`>= 1`** — shows individual tags while the count is within this limit; collapses to the summary label once exceeded.\n   */\n  maxVisibleTags?: number;\n  /** Label used in the aggregated summary text, e.g. setting `\"countries\"` produces `\"3 countries\"`. Defaults to `\"value selected\"` / `\"values selected\"` (pluralized automatically) when omitted. */\n  multiValuesLabel?: string;\n  /** DOM node to portal the dropdown content into. Defaults to `document.body`. */\n  portalContainer?: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>['container'];\n  /** Controls the height, padding, and typography size of the trigger and tags. */\n  size?: MultiSelectSize;\n  /** Visual style preset. `border` adds a visible border and background; `ghost` uses a transparent background. */\n  preset?: MultiSelectPreset;\n  /** Color variant. `danger` applies error styling for form validation feedback. */\n  variant?: MultiSelectVariant;\n  /** Whether to hide the dropdown arrow icon on the right side of the trigger. */\n  hideArrow?: boolean;\n  /** Placeholder text shown in the trigger when no option is selected. */\n  placeholder?: string;\n  /** HTML `id` attribute for the trigger element, useful for form label association. */\n  id?: string;\n  /** HTML `name` attribute forwarded for form submission. */\n  name?: string;\n  /** Additional CSS classes applied to the trigger element. */\n  className?: string;\n  /** Whether to show a \"Select all\" / \"Deselect all\" option at the top of the dropdown. When used with `hasSearch`, applies only to the currently visible (filtered) options. */\n  hasSelectAll?: boolean;\n  /** Whether to show a search input at the top of the dropdown that filters options by label. */\n  hasSearch?: boolean;\n  /** Label shown when `hasSearch` is enabled and the search query matches no options. Pass a translated string for internationalization. Defaults to `\"No results found\"`. */\n  noResultsLabel?: string;\n  /** Label for the \"select all\" toggle when no options (or some) are selected. Defaults to `'Select all'`. */\n  selectAllLabel?: string;\n  /** Label for the \"select all\" toggle when all options are selected. Defaults to `'Deselect all'`. */\n  deselectAllLabel?: string;\n  /** Accessible label for the clear-selection button. Defaults to `'Clear selection'`. */\n  clearSelectionAriaLabel?: string;\n  /** Controlled open state of the dropdown. Use with `onOpenChange` to manage open/close externally. */\n  open?: boolean;\n  /** Initial open state for uncontrolled usage. */\n  defaultOpen?: boolean;\n  /** Called when the dropdown opens or closes. */\n  onOpenChange?: (open: boolean) => void;\n  /** Whether the dropdown should be modal, blocking interaction with the rest of the page when open. */\n  modal?: boolean;\n} & MotionProps &\n  Omit<\n    React.ComponentPropsWithoutRef<'button'>,\n    'onChange' | 'value' | 'defaultValue' | 'disabled' | 'onClear' | 'name' | 'id'\n  >;\n\n/** The rendered selected values and their labels. */\nexport type MultiSelectValueProps = {\n  /** Whether any values are currently selected. */\n  hasValue: boolean;\n  /** Placeholder text shown when no values are selected. */\n  placeholder?: string;\n  /** Whether individual tags should be rendered (true when selection count is within `maxVisibleTags`). */\n  areTagsVisible: boolean;\n  /** Currently selected options with their labels for display. */\n  selectedOptions: {\n    /** Value identifying the selected option. */\n    value: string;\n    /** Label displayed for the selected option. */\n    label: string;\n  }[];\n  /** Size inherited from the parent MultiSelect. */\n  size: MultiSelectProps['size'];\n  /** Whether the clear button is currently visible, used to add right padding to avoid overlap. */\n  hasClearButton?: boolean;\n  /** Label used in the aggregated summary text. */\n  multiValuesLabel?: string;\n  /** Called when a tag's remove button is activated. */\n  onRemoveValue: (value: string) => void;\n  /** When true, tags wrap to multiple lines and the trigger grows in height. */\n  wrap?: boolean;\n} & MotionProps;\n\n/** A selectable option within the dropdown. */\nexport type MultiSelectOptionProps = {\n  /** The option data to render. */\n  option: MultiSelectOptionType;\n  /** Whether the option is disabled and uninteractable. */\n  isDisabled: boolean;\n  /** Called when the option is selected or deselected. */\n  onSelect: () => void;\n} & MotionProps &\n  (\n    | {\n        /** Whether this option is selected. */\n        isSelected: boolean;\n      }\n    | {\n        /** Checked state displayed for an option containing partially selected children. */\n        indeterminateState: CheckedState;\n      }\n  );\n\n/** `MultiSelect.Trigger` is `DropdownMenu.Trigger`; same props. */\nexport type MultiSelectTriggerProps = DropdownMenuTriggerProps;\n\n/** `MultiSelect.Content` is `Select.Content`; same props. */\nexport type MultiSelectContentProps = SelectContentProps;\n\n/** `MultiSelect.Group` is `DropdownMenu.Group`; same props. */\nexport type MultiSelectGroupProps = DropdownMenuGroupProps;\n\n/** `MultiSelect.Label` is `DropdownMenu.Label`; same props. */\nexport type MultiSelectLabelProps = DropdownMenuLabelProps;\n\n/** `MultiSelect.Separator` is `DropdownMenu.Separator`; same props. */\nexport type MultiSelectSeparatorProps = DropdownMenuSeparatorProps;\n"
    },
    {
      "path": "src/components/multi-select/MultiSelect.variants.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/multi-select/MultiSelect.variants.ts",
      "content": "import { cva } from 'class-variance-authority';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { hoverTintMotion, pressMotion } from '@/lib/wideset/motion/recipes';\n\nexport const multiSelectTriggerVariants = cva('', {\n  variants: {\n    // No pl-* override: the left inset comes from SelectTrigger's own px\n    // (12/16/16px) — Figma insets the multi-select content exactly like the\n    // plain Select's.\n    size: {\n      sm: 'py-ws-3',\n      md: 'py-ws-5',\n      lg: 'py-ws-5',\n    },\n    tagsGrow: {\n      true: 'h-auto max-h-none overflow-visible',\n      false: '',\n    },\n  },\n  compoundVariants: [\n    { size: 'sm', tagsGrow: false, class: 'h-ws-14' },\n    { size: 'md', tagsGrow: false, class: 'h-ws-16' },\n    { size: 'lg', tagsGrow: false, class: 'h-ws-18' },\n    { size: 'sm', tagsGrow: true, class: 'min-h-ws-14' },\n    { size: 'md', tagsGrow: true, class: 'min-h-ws-16' },\n    { size: 'lg', tagsGrow: true, class: 'min-h-ws-18' },\n  ],\n  defaultVariants: {\n    size: 'md',\n    tagsGrow: false,\n  },\n});\n\nexport const multiSelectTagRemoveMotionVariants = cva('', {\n  variants: {\n    enabled: { true: cn(hoverTintMotion, pressMotion), false: '' },\n  },\n  defaultVariants: { enabled: true },\n});\n"
    },
    {
      "path": "src/components/multi-select/MultiSelectOption.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/multi-select/MultiSelectOption.tsx",
      "content": "'use client';\n\nimport type { ComponentProps } from 'react';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport { Checkbox } from '../checkbox/Checkbox';\nimport { DropdownMenu } from '../dropdown/DropdownMenu';\nimport { ListItem } from '../list-item/ListItem';\nimport { useSelectContext } from '../select/Select.context';\nimport { SelectOption } from '../select/SelectOption';\nimport type { MultiSelectOptionProps } from './MultiSelect.types';\n\nexport const MultiSelectOption = ({\n  option,\n  isDisabled,\n  onSelect,\n  defaultMotion,\n  ...rest\n}: MultiSelectOptionProps) => {\n  const { motion: selectMotion } = useSelectContext();\n  const motion = useDefaultMotion(defaultMotion ?? selectMotion);\n  const checkedState = 'indeterminateState' in rest ? rest.indeterminateState : rest.isSelected;\n\n  const handleSelect: NonNullable<ComponentProps<typeof DropdownMenu.CheckboxItem>['onSelect']> = (\n    event,\n  ) => {\n    event.preventDefault();\n\n    if (isDisabled) {\n      return;\n    }\n\n    onSelect();\n  };\n\n  return (\n    <DropdownMenu.CheckboxItem\n      checked={checkedState}\n      disabled={isDisabled}\n      onSelect={handleSelect}\n      textValue={option.label}\n      asChild\n    >\n      <SelectOption\n        data-slot=\"multi-select-option\"\n        shouldUsePrimitive={false}\n        disabled={isDisabled}\n        variant={option.variant}\n        shouldDisplayCheckmark={false}\n        defaultMotion={motion}\n      >\n        <ListItem.Prefix>\n          <Checkbox\n            checked={checkedState}\n            disabled={isDisabled}\n            className=\"pointer-events-none\"\n            tabIndex={-1}\n            defaultMotion={motion}\n          />\n        </ListItem.Prefix>\n        {option.prefix && <ListItem.Prefix>{option.prefix}</ListItem.Prefix>}\n        <ListItem.Label>{option.label}</ListItem.Label>\n      </SelectOption>\n    </DropdownMenu.CheckboxItem>\n  );\n};\n\nMultiSelectOption.displayName = 'MultiSelect.Option';\n"
    },
    {
      "path": "src/components/multi-select/MultiSelectValue.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/multi-select/MultiSelectValue.tsx",
      "content": "'use client';\n\nimport { RiCloseLine } from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport { useSelectContext } from '../select/Select.context';\nimport { Tag } from '../tag/Tag';\nimport { iconButtonIconVariants, iconButtonVariants } from '../tag/Tag.variants';\nimport type { MultiSelectValueProps } from './MultiSelect.types';\nimport { multiSelectTagRemoveMotionVariants } from './MultiSelect.variants';\n\nexport const MultiSelectValue = ({\n  hasValue,\n  placeholder,\n  areTagsVisible,\n  selectedOptions,\n  size,\n  hasClearButton,\n  multiValuesLabel,\n  onRemoveValue,\n  wrap,\n  defaultMotion,\n}: MultiSelectValueProps) => {\n  const { motion: selectMotion } = useSelectContext();\n  const motion = useDefaultMotion(defaultMotion ?? selectMotion);\n\n  if (!hasValue) {\n    return (\n      <span data-slot=\"multi-select-value\" className=\"text-ws-static-subtle truncate\">\n        {placeholder}\n      </span>\n    );\n  }\n\n  const handleRemovePointerDown = (event: React.SyntheticEvent<HTMLElement>) => {\n    event.preventDefault();\n    event.stopPropagation();\n  };\n\n  const handleRemoveClick = (optionValue: string) => {\n    onRemoveValue(optionValue);\n  };\n\n  if (areTagsVisible) {\n    return (\n      <div\n        data-slot=\"multi-select-value\"\n        className={cn(\n          'flex min-w-0 flex-1 items-center',\n          wrap ? 'flex-wrap' : 'overflow-hidden',\n          size === 'lg' ? 'gap-[0.375rem]' : 'gap-ws-3',\n        )}\n      >\n        {selectedOptions.map((option) => (\n          <Tag key={option.value} size={size} color=\"secondary\" preset=\"filled\">\n            {option.label}\n            <span\n              aria-hidden=\"true\"\n              onClick={() => handleRemoveClick(option.value)}\n              onPointerDown={handleRemovePointerDown}\n              onMouseDown={handleRemovePointerDown}\n              className={cn(\n                'inline-flex cursor-pointer items-center justify-center rounded-full',\n                iconButtonVariants({ size }),\n                multiSelectTagRemoveMotionVariants({ enabled: motion }),\n              )}\n            >\n              <RiCloseLine\n                aria-hidden=\"true\"\n                focusable=\"false\"\n                className={cn(iconButtonIconVariants({ size, color: 'secondary' }))}\n              />\n            </span>\n          </Tag>\n        ))}\n      </div>\n    );\n  }\n\n  return (\n    <span data-slot=\"multi-select-value\" className={cn('truncate', hasClearButton && 'pr-ws-11')}>\n      {`${selectedOptions.length} ${\n        multiValuesLabel ?? (selectedOptions.length === 1 ? 'value selected' : 'values selected')\n      }`}\n    </span>\n  );\n};\n"
    }
  ],
  "meta": {
    "version": "1.0.0",
    "commit": "8bb3627"
  }
}
