{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "list-item",
  "type": "registry:ui",
  "title": "ListItem",
  "description": "ListItem is a row in menus, selects and lists: leading slot, label, description, trailing slot.",
  "dependencies": [
    "@remixicon/react@^4.9.0",
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "https://wideset.co/r/motion.json",
    "https://wideset.co/r/styles.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/components/list-item/ListItem.context.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/list-item/ListItem.context.tsx",
      "content": "'use client';\n\nimport type { VariantProps } from 'class-variance-authority';\nimport { createContext, useContext } from 'react';\n\nimport type { listItemVariants } from './ListItem.variants';\n\nexport type ListItemContextValue = {\n  variant: VariantProps<typeof listItemVariants>['variant'];\n  disabled?: boolean;\n};\n\nexport const ListItemContext = createContext<ListItemContextValue | undefined>(undefined);\n\nexport const useListItemContext = () => {\n  const context = useContext(ListItemContext);\n\n  if (context === undefined) {\n    throw new Error('useListItemContext must be used within a ListItem');\n  }\n\n  return context;\n};\n"
    },
    {
      "path": "src/components/list-item/ListItem.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/list-item/ListItem.tsx",
      "content": "'use client';\n\nimport { RiCheckLine } from '@remixicon/react';\nimport { forwardRef } from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport { ListItemContext } from './ListItem.context';\nimport type { ListItemProps, ListItemWithSubComponents } from './ListItem.types';\nimport { listItemMotionVariants, listItemVariants } from './ListItem.variants';\nimport { ListItemContent } from './ListItemContent';\nimport { ListItemDescription } from './ListItemDescription';\nimport { ListItemLabel } from './ListItemLabel';\nimport { ListItemPrefix } from './ListItemPrefix';\nimport { ListItemSuffix } from './ListItemSuffix';\n\nconst ListItem = forwardRef<HTMLDivElement, ListItemProps>(\n  (\n    {\n      children,\n      className,\n      variant = 'primary',\n      disabled,\n      shouldDisplayCheckmark = true,\n      defaultMotion,\n      ...props\n    },\n    ref,\n  ) => {\n    const motion = useDefaultMotion(defaultMotion);\n    const isDisabled = disabled || props['data-disabled'];\n\n    return (\n      <ListItemContext.Provider value={{ variant, disabled: isDisabled }}>\n        <div\n          className={cn(\n            listItemVariants({ variant }),\n            listItemMotionVariants({ enabled: motion }),\n            className,\n          )}\n          ref={ref}\n          aria-disabled={isDisabled}\n          data-slot=\"list-item\"\n          {...props}\n        >\n          {children}\n          {shouldDisplayCheckmark && props['data-state'] === 'checked' && (\n            <RiCheckLine aria-hidden=\"true\" focusable=\"false\" className=\"size-ws-10 shrink-0\" />\n          )}\n        </div>\n      </ListItemContext.Provider>\n    );\n  },\n) as ListItemWithSubComponents;\n\nListItem.displayName = 'ListItem';\n\nListItem.Content = ListItemContent;\nListItem.Description = ListItemDescription;\nListItem.Label = ListItemLabel;\nListItem.Prefix = ListItemPrefix;\nListItem.Suffix = ListItemSuffix;\n\nexport { ListItem };\n"
    },
    {
      "path": "src/components/list-item/ListItem.types.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/list-item/ListItem.types.ts",
      "content": "import type { VariantProps } from 'class-variance-authority';\nimport type {\n  ForwardRefExoticComponent,\n  HTMLAttributes,\n  PropsWithoutRef,\n  RefAttributes,\n} from 'react';\n\nimport type { MotionProps } from '@/lib/wideset/motion/Motion.types';\nimport type { listItemVariants } from './ListItem.variants';\nimport type { ListItemContent } from './ListItemContent';\nimport type { ListItemDescription } from './ListItemDescription';\nimport type { ListItemLabel } from './ListItemLabel';\nimport type { ListItemPrefix } from './ListItemPrefix';\nimport type { ListItemSuffix } from './ListItemSuffix';\n\n/** A composable row used within menus and selection controls. */\nexport type ListItemProps = HTMLAttributes<HTMLDivElement> &\n  VariantProps<typeof listItemVariants> &\n  MotionProps & {\n    /** Selection state. The checked state displays a checkmark when enabled. */\n    'data-state'?: 'checked' | 'unchecked';\n    /** Applies disabled styling for consumers such as Radix menu items. */\n    'data-disabled'?: boolean;\n    /** Disables the item and applies disabled styling. */\n    disabled?: boolean;\n    /** Allows a checkmark to appear for checked items. Defaults to `true`. */\n    shouldDisplayCheckmark?: boolean;\n  };\n\nexport type ListItemWithSubComponents = ForwardRefExoticComponent<\n  PropsWithoutRef<ListItemProps> & RefAttributes<HTMLDivElement>\n> & {\n  Content: typeof ListItemContent;\n  Description: typeof ListItemDescription;\n  Label: typeof ListItemLabel;\n  Prefix: typeof ListItemPrefix;\n  Suffix: typeof ListItemSuffix;\n};\n\n/** Leading slot of the list item, such as an icon, avatar or checkbox. */\nexport type ListItemPrefixProps = HTMLAttributes<HTMLDivElement>;\n\n/** Trailing slot of the list item, such as a badge, shortcut or chevron. */\nexport type ListItemSuffixProps = HTMLAttributes<HTMLDivElement>;\n\n/** The content surface rendered within `ListItem`. */\nexport type ListItemContentProps = HTMLAttributes<HTMLDivElement>;\n\n/** The text label associated with `ListItem`. */\nexport type ListItemLabelProps = HTMLAttributes<HTMLDivElement>;\n\n/** Supporting descriptive text. */\nexport type ListItemDescriptionProps = HTMLAttributes<HTMLDivElement>;\n"
    },
    {
      "path": "src/components/list-item/ListItem.variants.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/list-item/ListItem.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 listItemVariants = cva(\n  cn(\n    // Figma renders menu row labels at Font/Weight/Normal (480). Shared by every\n    // dropdown, select and menu in the library.\n    'rounded-ws-control-md typography-label-sm gap-ws-5 px-ws-5 py-ws-3 flex cursor-pointer flex-row items-center justify-between focus:outline-none',\n    'aria-disabled:cursor-default aria-disabled:bg-none aria-disabled:select-none',\n  ),\n  {\n    variants: {\n      variant: {\n        primary: cn(\n          'bg-ws-dynamic-secondary-alpha-default text-ws-dynamic-secondary-default',\n          'hover:not-aria-disabled:bg-ws-dynamic-secondary-alpha-hover hover:not-aria-disabled:text-ws-dynamic-secondary-hover',\n          'active:not-aria-disabled:bg-ws-dynamic-secondary-alpha-pressed active:not-aria-disabled:text-ws-dynamic-secondary-pressed',\n          'focus:not-aria-disabled:bg-ws-dynamic-secondary-alpha-hover focus:not-aria-disabled:text-ws-dynamic-secondary-default',\n          'data-[highlighted]:not-aria-disabled:bg-ws-dynamic-secondary-alpha-hover data-[highlighted]:not-aria-disabled:text-ws-dynamic-secondary-default',\n          'data-[state=checked]:not-aria-disabled:bg-ws-dynamic-primary-alpha-strong-default',\n          'aria-disabled:text-ws-dynamic-secondary-disabled',\n        ),\n        danger: cn(\n          'bg-ws-dynamic-danger-alpha-default text-ws-dynamic-danger-default',\n          'hover:not-aria-disabled:bg-ws-dynamic-danger-alpha-hover hover:not-aria-disabled:text-ws-dynamic-danger-hover',\n          'active:not-aria-disabled:bg-ws-dynamic-danger-alpha-pressed active:not-aria-disabled:text-ws-dynamic-danger-pressed',\n          'focus:not-aria-disabled:bg-ws-dynamic-danger-alpha-hover focus:not-aria-disabled:text-ws-dynamic-danger-default',\n          'data-[highlighted]:not-aria-disabled:bg-ws-dynamic-danger-alpha-hover data-[highlighted]:not-aria-disabled:text-ws-dynamic-danger-default',\n          'data-[state=checked]:not-aria-disabled:bg-ws-dynamic-danger-alpha-strong-default data-[state=checked]:not-aria-disabled:text-ws-dynamic-danger-default',\n          'aria-disabled:text-ws-dynamic-danger-disabled',\n        ),\n      },\n    },\n    defaultVariants: {\n      variant: 'primary',\n    },\n  },\n);\n\nexport const listItemMotionVariants = cva('', {\n  variants: {\n    enabled: { true: cn(hoverTintMotion, pressMotion), false: '' },\n  },\n  defaultVariants: { enabled: true },\n});\n\nexport const listItemDescriptionVariants = cva('typography-body-sm truncate', {\n  variants: {\n    variant: {\n      primary: 'text-ws-static-subtle',\n      danger: 'text-ws-dynamic-danger-default',\n    },\n    disabled: {\n      true: 'text-ws-dynamic-secondary-disabled',\n      false: '',\n    },\n  },\n  defaultVariants: {\n    variant: 'primary',\n    disabled: false,\n  },\n});\n"
    },
    {
      "path": "src/components/list-item/ListItemContent.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/list-item/ListItemContent.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { ListItemContentProps } from './ListItem.types';\n\nexport const ListItemContent = ({ children, className, ...props }: ListItemContentProps) => (\n  <div\n    data-slot=\"list-item-content\"\n    className={cn('mr-auto flex flex-col truncate', className)}\n    {...props}\n  >\n    {children}\n  </div>\n);\n\nListItemContent.displayName = 'ListItem.Content';\n"
    },
    {
      "path": "src/components/list-item/ListItemDescription.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/list-item/ListItemDescription.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useListItemContext } from './ListItem.context';\nimport type { ListItemDescriptionProps } from './ListItem.types';\nimport { listItemDescriptionVariants } from './ListItem.variants';\n\nexport const ListItemDescription = ({\n  children,\n  className,\n  ...props\n}: ListItemDescriptionProps) => {\n  const { variant, disabled } = useListItemContext();\n\n  return (\n    <div\n      data-slot=\"list-item-description\"\n      className={cn(listItemDescriptionVariants({ variant, disabled: !!disabled }), className)}\n      {...props}\n    >\n      {children}\n    </div>\n  );\n};\n\nListItemDescription.displayName = 'ListItem.Description';\n"
    },
    {
      "path": "src/components/list-item/ListItemLabel.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/list-item/ListItemLabel.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { ListItemLabelProps } from './ListItem.types';\n\nexport const ListItemLabel = ({ children, className, ...props }: ListItemLabelProps) => (\n  <div\n    data-slot=\"list-item-label\"\n    className={cn('typography-label-sm min-w-0 flex-1 truncate', className)}\n    {...props}\n  >\n    {children}\n  </div>\n);\n\nListItemLabel.displayName = 'ListItem.Label';\n"
    },
    {
      "path": "src/components/list-item/ListItemPrefix.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/list-item/ListItemPrefix.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { ListItemPrefixProps } from './ListItem.types';\n\nexport const ListItemPrefix = ({ children, className, ...props }: ListItemPrefixProps) => (\n  <div\n    data-slot=\"list-item-prefix\"\n    className={cn('gap-ws-5 flex shrink-0 items-center', className)}\n    {...props}\n  >\n    {children}\n  </div>\n);\n\nListItemPrefix.displayName = 'ListItem.Prefix';\n"
    },
    {
      "path": "src/components/list-item/ListItemSuffix.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/list-item/ListItemSuffix.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { ListItemSuffixProps } from './ListItem.types';\n\nexport const ListItemSuffix = ({ children, className, ...props }: ListItemSuffixProps) => (\n  <div\n    data-slot=\"list-item-suffix\"\n    className={cn('gap-ws-5 flex shrink-0 items-center', className)}\n    {...props}\n  >\n    {children}\n  </div>\n);\n\nListItemSuffix.displayName = 'ListItem.Suffix';\n"
    }
  ],
  "meta": {
    "version": "1.0.0",
    "commit": "8bb3627"
  }
}
