{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "components-item",
  "type": "registry:component",
  "title": "Item",
  "description": "One row of a list, with media, text and actions",
  "author": "sudo-kw <https://github.com/sudo-kw>",
  "dependencies": [
    "@gpuix/native@0.11.0",
    "@gpuix/react@0.11.0",
    "effect@4.1.2",
    "react@^19.2.4"
  ],
  "registryDependencies": [
    "https://gpuixui.sudokw.com/gpuix-tokens.json",
    "https://gpuixui.sudokw.com/gpuix-tw.json"
  ],
  "files": [
    {
      "path": "packages/components/src/internal/parts.ts",
      "target": "@ui/gpuixui/components/internal/parts.ts",
      "type": "registry:lib",
      "content": "import * as Arr from \"effect/Array\";\nimport * as P from \"effect/Predicate\";\nimport {\n  Children,\n  Fragment,\n  isValidElement,\n  type ReactElement,\n  type ReactNode,\n} from \"react\";\n\nexport type PartComponent = (props: never) => ReactNode;\n\nexport type PartChildren =\n  | ReactElement<unknown>\n  | boolean\n  | null\n  | undefined\n  | ReadonlyArray<PartChildren>;\n\nexport interface PartsContract {\n  readonly parent: string;\n\n  readonly family: ReadonlyArray<PartComponent>;\n\n  readonly accepts: ReadonlyArray<PartComponent>;\n\n  readonly hint?: string;\n}\n\nconst componentName = (type: unknown): string =>\n  P.isString(type)\n    ? type\n    : P.isFunction(type)\n      ? type.name || \"anonymous\"\n      : \"element\";\n\nconst fragmentChildren = (element: ReactElement<unknown>): ReactNode =>\n  hasChildren(element.props) ? element.props.children : undefined;\n\nconst hasChildren = (\n  value: unknown,\n): value is { readonly children?: ReactNode } =>\n  P.isObject(value) && \"children\" in value;\n\nconst leaves = (children: ReactNode): ReadonlyArray<unknown> =>\n  Arr.flatMap(Children.toArray(children), (child) =>\n    isValidElement<unknown>(child) && child.type === Fragment\n      ? leaves(fragmentChildren(child))\n      : [child],\n  );\n\nexport const assertParts = (\n  contract: PartsContract,\n  children: ReactNode,\n): void => {\n  Arr.forEach(leaves(children), (leaf) => {\n    if (!isValidElement(leaf)) return;\n    if (Arr.some(contract.accepts, (part) => part === leaf.type)) return;\n    if (!Arr.some(contract.family, (part) => part === leaf.type)) return;\n\n    throw new Error(\n      `${componentName(leaf.type)} cannot be used inside ${contract.parent}.` +\n        (contract.hint === undefined ? \"\" : ` ${contract.hint}`),\n    );\n  });\n};\n"
    },
    {
      "path": "packages/components/src/internal/recipe.ts",
      "target": "@ui/gpuixui/components/internal/recipe.ts",
      "type": "registry:lib",
      "content": "import type { StyleDesc } from \"@gpuix/react\";\nimport { createRecipeCache } from \"../../tw/index.js\";\nimport type { Theme } from \"./theme.js\";\n\nexport const recipeStyle: (recipe: string, theme: Theme) => StyleDesc =\n  createRecipeCache(512);\n"
    },
    {
      "path": "packages/components/src/internal/theme.ts",
      "target": "@ui/gpuixui/components/internal/theme.ts",
      "type": "registry:lib",
      "content": "import type { StyleDesc } from \"@gpuix/react\";\nimport * as Schema from \"effect/Schema\";\nimport {\n  alpha,\n  avatarPixels,\n  avatarSize,\n  brandTextOn,\n  controlFocusRing,\n  controlHeight,\n  controlPaddingX,\n  currentPlatform,\n  darkTheme,\n  disabledAction,\n  disabledOpacity,\n  elevationShadow,\n  filledHover,\n  filledPressed,\n  findHighlight,\n  focusRing,\n  keyboardFocusRing,\n  lightTheme,\n  nativeTextTheme,\n  pointerWash,\n  selectionOn,\n  statusTone,\n  syntaxColors,\n  targetSize,\n  textStyle,\n  type BoxShadow,\n  type ElevationLevel,\n  type FindHighlightSource,\n  type NativeTextFill,\n  type PlatformName,\n  type PointerWashSurface,\n  type StatusTone,\n  type SyntaxColors,\n  type SyntaxRole,\n  type TextRole,\n  type Theme,\n  type ThemeColors,\n} from \"../../tokens/index.js\";\n\nexport {\n  alpha,\n  avatarPixels,\n  avatarSize,\n  controlFocusRing,\n  controlHeight,\n  controlPaddingX,\n  currentPlatform,\n  darkTheme,\n  disabledAction,\n  disabledOpacity,\n  elevationShadow,\n  filledHover,\n  filledPressed,\n  findHighlight,\n  focusRing,\n  keyboardFocusRing,\n  lightTheme,\n  nativeTextTheme,\n  statusTone,\n  syntaxColors,\n  targetSize,\n  textStyle,\n};\nexport type {\n  BoxShadow,\n  ElevationLevel,\n  FindHighlightSource,\n  NativeTextFill,\n  PlatformName,\n  StatusTone,\n  SyntaxColors,\n  SyntaxRole,\n  TextRole,\n  Theme,\n};\nexport { ThemeProvider, useTheme } from \"../../tokens/react.js\";\n\nexport const keyboardRing = (theme: Theme, invalid = false): StyleDesc =>\n  controlFocusRing(theme, { invalid }) ?? {};\n\nexport interface ControlRingState {\n  readonly disabled?: boolean;\n\n  readonly invalid?: boolean;\n}\n\nexport const controlRing = (\n  theme: Theme,\n  state: ControlRingState = {},\n): StyleDesc => controlFocusRing(theme, state) ?? {};\n\nexport const pressWash = (theme: Theme, replaced: PointerWashSurface): string =>\n  pointerWash(theme, \"active\", replaced) ?? theme.colors.active;\n\nexport const selectionWash = (theme: Theme): StyleDesc => ({\n  selectionColor: theme.colors.selection,\n});\n\nexport const keepContent: StyleDesc = { keyboardFocusDim: false };\n\nexport const disabledFade = (\n  disabled: boolean,\n): { readonly opacity: number } | undefined =>\n  disabled ? { opacity: disabledOpacity } : undefined;\n\nconst Tones = Schema.Literals([\"info\", \"success\", \"warning\", \"danger\"]);\n\nexport type Tone = typeof Tones.Type;\n\nexport const toneOf = (value: unknown): Tone =>\n  Schema.is(Tones)(value) ? value : \"info\";\n\nexport interface ToneStyle {\n  readonly fg: string;\n  readonly bg: string;\n  readonly border: string;\n}\n\nconst TOKEN_TONE: Readonly<Record<Tone, StatusTone>> = {\n  info: \"info\",\n  success: \"success\",\n  warning: \"warning\",\n  danger: \"destructive\",\n};\n\nexport const tone = (theme: Theme, value: Tone): ToneStyle => {\n  const { background, border, foreground } = statusTone(\n    theme,\n    TOKEN_TONE[value],\n  );\n  return { bg: background, border, fg: foreground };\n};\n\nconst softRoles: Readonly<Record<Tone, keyof ThemeColors>> = {\n  info: \"infoSoft\",\n  success: \"successSoft\",\n  warning: \"warningSoft\",\n  danger: \"destructiveSoft\",\n};\n\nexport const messageLink = (theme: Theme, value: Tone): string =>\n  brandTextOn(theme, softRoles[value]);\n\nexport const messageSelection = (theme: Theme, value: Tone): string =>\n  selectionOn(theme, softRoles[value]);\n\nexport const toneSurface = (theme: Theme, value: Tone): StyleDesc => {\n  const { bg, border, fg } = tone(theme, value);\n  return {\n    backgroundColor: bg,\n    color: fg,\n    borderWidth: theme.borderWidth.thin,\n    borderColor: border,\n  };\n};\n"
    },
    {
      "path": "packages/components/src/item.tsx",
      "target": "@ui/gpuixui/components/item.tsx",
      "type": "registry:component",
      "content": "/** @jsxImportSource @gpuix/react */\nimport type { Props } from \"@gpuix/react\";\nimport type { ReactNode } from \"react\";\nimport { mergeStyles } from \"@gpuix/react/floating\";\nimport {\n  ITEM_ACTIONS,\n  ITEM_BASE,\n  ITEM_CONTENT,\n  ITEM_DESCRIPTION,\n  ITEM_FOOTER,\n  ITEM_GROUP,\n  ITEM_HEADER,\n  ITEM_MEDIA,\n  ITEM_MEDIA_VARIANTS,\n  ITEM_SIZES,\n  ITEM_TITLE,\n  ITEM_VARIANTS,\n  cn,\n} from \"../tw/index.js\";\nimport * as Schema from \"effect/Schema\";\nimport {\n  assertParts,\n  type PartChildren,\n  type PartComponent,\n  type PartsContract,\n} from \"./internal/parts.js\";\nimport { recipeStyle } from \"./internal/recipe.js\";\nimport { useTheme } from \"./internal/theme.js\";\n\nconst ItemVariants = Schema.Literals([\"default\", \"outline\", \"muted\"]);\n\nexport type ItemVariant = typeof ItemVariants.Type;\n\nconst ItemSizes = Schema.Literals([\"default\", \"sm\"]);\n\nexport type ItemSize = typeof ItemSizes.Type;\n\nconst ItemMediaVariants = Schema.Literals([\"default\", \"icon\", \"image\"]);\n\nexport type ItemMediaVariant = keyof typeof ITEM_MEDIA_VARIANTS;\n\nconst itemVariantOf = (value: unknown): ItemVariant =>\n  Schema.is(ItemVariants)(value) ? value : \"default\";\n\nconst itemSizeOf = (value: unknown): ItemSize =>\n  Schema.is(ItemSizes)(value) ? value : \"default\";\n\nconst itemMediaOf = (value: unknown): ItemMediaVariant =>\n  Schema.is(ItemMediaVariants)(value) ? value : \"default\";\n\ninterface PartProps extends Omit<Props, \"children\"> {\n  readonly className?: string;\n  readonly children?: PartChildren;\n}\n\ninterface TextPartProps extends Omit<Props, \"children\"> {\n  readonly className?: string;\n  readonly children?: ReactNode;\n}\n\nexport interface ItemProps extends PartProps {\n  readonly variant?: ItemVariant;\n\n  readonly size?: ItemSize;\n}\n\nexport interface ItemGroupProps extends PartProps {}\n\nexport interface ItemMediaProps extends PartProps {\n  readonly variant?: ItemMediaVariant;\n}\n\nexport const Item = ({\n  variant = \"default\",\n  size = \"default\",\n  className,\n  children,\n  style,\n  ...rest\n}: ItemProps) => {\n  const theme = useTheme();\n  assertParts(itemContract, children);\n  return (\n    <div\n      {...rest}\n      style={mergeStyles(\n        recipeStyle(\n          cn(\n            ITEM_BASE,\n            ITEM_VARIANTS[itemVariantOf(variant)],\n            ITEM_SIZES[itemSizeOf(size)],\n            className,\n          ),\n          theme,\n        ),\n        style,\n      )}\n    >\n      {children}\n    </div>\n  );\n};\n\nexport const ItemGroup = ({\n  className,\n  children,\n  style,\n  ...rest\n}: ItemGroupProps) => {\n  const theme = useTheme();\n  return (\n    <div\n      {...rest}\n      role=\"list\"\n      style={mergeStyles(recipeStyle(cn(ITEM_GROUP, className), theme), style)}\n    >\n      {children}\n    </div>\n  );\n};\n\nexport const ItemMedia = ({\n  variant = \"default\",\n  className,\n  children,\n  style,\n  ...rest\n}: ItemMediaProps) => {\n  const theme = useTheme();\n  return (\n    <div\n      {...rest}\n      style={mergeStyles(\n        recipeStyle(\n          cn(ITEM_MEDIA, ITEM_MEDIA_VARIANTS[itemMediaOf(variant)], className),\n          theme,\n        ),\n        style,\n      )}\n    >\n      {children}\n    </div>\n  );\n};\n\nexport const ItemContent = ({\n  className,\n  children,\n  style,\n  ...rest\n}: PartProps) => {\n  const theme = useTheme();\n  return (\n    <div\n      {...rest}\n      style={mergeStyles(\n        recipeStyle(cn(ITEM_CONTENT, className), theme),\n        style,\n      )}\n    >\n      {children}\n    </div>\n  );\n};\n\nexport const ItemTitle = ({\n  className,\n  children,\n  style,\n  ...rest\n}: TextPartProps) => {\n  const theme = useTheme();\n  return (\n    <text\n      {...rest}\n      style={mergeStyles(recipeStyle(cn(ITEM_TITLE, className), theme), style)}\n    >\n      {children}\n    </text>\n  );\n};\n\nexport const ItemDescription = ({\n  className,\n  children,\n  style,\n  ...rest\n}: TextPartProps) => {\n  const theme = useTheme();\n  return (\n    <text\n      {...rest}\n      style={mergeStyles(\n        recipeStyle(cn(ITEM_DESCRIPTION, className), theme),\n        style,\n      )}\n    >\n      {children}\n    </text>\n  );\n};\n\nexport const ItemActions = ({\n  className,\n  children,\n  style,\n  ...rest\n}: PartProps) => {\n  const theme = useTheme();\n  return (\n    <div\n      {...rest}\n      style={mergeStyles(\n        recipeStyle(cn(ITEM_ACTIONS, className), theme),\n        style,\n      )}\n    >\n      {children}\n    </div>\n  );\n};\n\nexport const ItemHeader = ({\n  className,\n  children,\n  style,\n  ...rest\n}: PartProps) => {\n  const theme = useTheme();\n  return (\n    <div\n      {...rest}\n      style={mergeStyles(recipeStyle(cn(ITEM_HEADER, className), theme), style)}\n    >\n      {children}\n    </div>\n  );\n};\n\nexport const ItemFooter = ({\n  className,\n  children,\n  style,\n  ...rest\n}: PartProps) => {\n  const theme = useTheme();\n  return (\n    <div\n      {...rest}\n      style={mergeStyles(recipeStyle(cn(ITEM_FOOTER, className), theme), style)}\n    >\n      {children}\n    </div>\n  );\n};\n\nconst itemParts: ReadonlyArray<PartComponent> = [\n  Item,\n  ItemGroup,\n  ItemMedia,\n  ItemContent,\n  ItemTitle,\n  ItemDescription,\n  ItemActions,\n  ItemHeader,\n  ItemFooter,\n];\n\nconst itemContract: PartsContract = {\n  parent: \"Item\",\n  family: itemParts,\n  accepts: [\n    ItemMedia,\n    ItemContent,\n    ItemTitle,\n    ItemDescription,\n    ItemActions,\n    ItemHeader,\n    ItemFooter,\n  ],\n  hint: \"Put ItemMedia, ItemContent and ItemActions directly inside Item.\",\n};\n\nexport const itemMeta = {\n  name: \"Item\",\n  tier: 2,\n  status: \"done\",\n  gpuixSupport: \"yes\",\n  limitations: [\n    \"`line-clamp-2` has no native utility, so a description clips its overflow instead of ending in an ellipsis after two lines\",\n    \"no `ItemSeparator` part: put a `Separator` between rows\",\n    \"a row paints no hover or press state — wrap it in a `ListItem` or a Button when it acts\",\n  ],\n  docs: \"docs/item.mdx\",\n  example: \"examples/item.example.tsx\",\n  testFile: \"src/behaviour/item.test.tsx\",\n} as const;\n"
    }
  ],
  "docs": "[Item](https://gpuixui.sudokw.com/components/item) — These are GPUix native components: the files render through GPUix's reconciler against `@gpuix/react`, not the DOM, and need the per-platform `@gpuix/native` binding. The CLI installs the `@gpuixui/*` runtime the components import as registry items, so the copied tree resolves on its own; wrap it in `ThemeProvider` before it renders.",
  "meta": {
    "url": "/components/item",
    "kind": "component",
    "runtime": "gpuix",
    "registry": "gpuixui"
  }
}