{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "icon-tile",
  "title": "Icon tile",
  "description": "An icon on a square of colour, for a step, a feature, a row or a status. Weight comes from the background alone, in any tone or a colour of your own, and its colours fade when it changes.",
  "dependencies": [
    "@ui-sdk/react",
    "class-variance-authority"
  ],
  "registryDependencies": [
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/icon-tile.tsx",
      "content": "'use client'\n\nimport { mergeProps, type PartProps, renderElement } from '@ui-sdk/react/primitive'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport type { CSSProperties, ReactNode } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * An icon, a number or a short glyph on a square of colour: a step on a rail,\n * a feature, a row's kind, an empty state, a status. It never has an outline:\n * weight comes from the background alone. Every weight is worked out from one\n * colour, `--icon-tile-color`, which a tone sets and `color` overrides, so a\n * brand's own colour takes the same tint and fill as the tones do. The corner\n * is a share of its side, `--mark-radius-share`, so a tile keeps its shape at\n * every size and turns round with the Round shape.\n */\n\n/**\n * A tile's size and corner, for a part that only takes its shape, such as a\n * logo's card: the corner is a share of the side, `--mark-radius-share`, and\n * never rounder than a control's, so it follows the Shape and the Radius.\n */\nconst iconTileShapeClassName =\n  'size-(--icon-tile-size) rounded-[min(calc(var(--icon-tile-size)*var(--mark-radius-share)),var(--control-radius))]'\n\nconst iconTileVariants = cva(\n  // Colours fade on `morph`, so a step that changes status changes colour in place, and nothing changes size.\n  `relative inline-flex [--icon-tile-tint:12%] dark:[--icon-tile-tint:18%] shrink-0 items-center justify-center overflow-hidden text-xs leading-none font-medium tabular-nums transition-[color,background-color] duration-(--motion-morph-duration) ease-(--motion-morph-fade-easing) select-none forced-colors:bg-[Canvas]! forced-colors:text-[CanvasText]! [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-(--icon-tile-icon) ${iconTileShapeClassName}`,\n  {\n    variants: {\n      tone: {\n        // The text colour at a lighter share, so its tint sits as the muted surfaces do.\n        neutral:\n          '[--icon-tile-color:var(--foreground)] [--icon-tile-tint:6%] dark:[--icon-tile-tint:10%]',\n        primary:\n          '[--icon-tile-color:var(--primary)] [--icon-tile-on:var(--primary-foreground)]',\n        success:\n          '[--icon-tile-color:var(--success)] [--icon-tile-ink:var(--success-foreground)]',\n        warning:\n          '[--icon-tile-color:var(--warning)] [--icon-tile-ink:var(--warning-foreground)]',\n        destructive: '[--icon-tile-color:var(--destructive)]',\n        // `color` sets the variables itself.\n        custom: '',\n      },\n      weight: {\n        // The lightest tint and a quieter icon: what hasn't happened yet, or doesn't count.\n        subtle:\n          'bg-[color-mix(in_oklab,var(--icon-tile-color)_calc(var(--icon-tile-tint,12%)*0.5),transparent)] text-foreground/70',\n        // The colour's tint, with the icon in its ink: the colour itself, kept dark enough in\n        // light mode and light enough in dark to read on its tint, so any colour holds 3:1.\n        soft: 'bg-[color-mix(in_oklab,var(--icon-tile-color)_var(--icon-tile-tint,12%),transparent)] text-(--icon-tile-ink,oklch(from_var(--icon-tile-color)_min(l,0.55)_c_h)) dark:text-(--icon-tile-ink,oklch(from_var(--icon-tile-color)_max(l,0.75)_c_h))',\n        // The colour itself, for the one tile that matters now. A colour with no `--icon-tile-on`\n        // takes white or near black, whichever its lightness can carry.\n        solid:\n          'bg-(--icon-tile-color) text-(--icon-tile-on,oklch(from_var(--icon-tile-color)_clamp(0.18,(0.68-l)*1000,1)_0_0)) forced-colors:bg-[Highlight]! forced-colors:text-[HighlightText]!',\n      },\n      size: {\n        xs: '[--icon-tile-icon:0.875rem] [--icon-tile-size:var(--control-height-xs)]',\n        sm: '[--icon-tile-icon:1rem] [--icon-tile-size:var(--control-height-sm)]',\n        md: '[--icon-tile-icon:1.125rem] [--icon-tile-size:var(--control-height)] text-sm',\n        lg: '[--icon-tile-icon:1.25rem] [--icon-tile-size:var(--control-height-lg)] text-sm',\n        xl: '[--icon-tile-icon:1.5rem] [--icon-tile-size:calc(var(--control-height-lg)+0.5rem)] text-base',\n      },\n    },\n    compoundVariants: [\n      // Neutral's fill is the text colour, so its tile is as dark as a primary button.\n      {\n        tone: 'neutral',\n        weight: 'solid',\n        className: '[--icon-tile-on:var(--background)]',\n      },\n    ],\n    defaultVariants: { tone: 'neutral', weight: 'soft', size: 'sm' },\n  },\n)\n\n/** Decorative unless it has a `label`: the words beside it say what it shows. */\nfunction IconTile({\n  className,\n  tone,\n  weight,\n  size,\n  color,\n  label,\n  style,\n  render,\n  children,\n  ...props\n}: Omit<PartProps<'span'>, 'className' | 'children' | 'color' | 'style'> & {\n  className?: string\n  children?: ReactNode\n  /** Any CSS colour, in place of the tone's. A soft tile keeps its icon dark enough, or light enough in dark mode, to read on the tint. */\n  color?: string\n  /** What it means, where nothing beside it says so, such as a status alone in a row. */\n  label?: string\n  style?: CSSProperties\n} & Omit<VariantProps<typeof iconTileVariants>, 'tone'> & {\n    tone?: Exclude<VariantProps<typeof iconTileVariants>['tone'], 'custom'>\n  }) {\n  return renderElement(\n    'span',\n    mergeProps(\n      {\n        'data-slot': 'icon-tile',\n        'data-tone': color ? 'custom' : (tone ?? 'neutral'),\n        'data-weight': weight ?? 'soft',\n        className: cn(\n          iconTileVariants({ tone: color ? 'custom' : tone, weight, size }),\n          className,\n        ),\n        style: color\n          ? ({\n              '--icon-tile-color': color,\n              ...style,\n            } as CSSProperties)\n          : style,\n        ...(label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true }),\n        children,\n      },\n      props,\n    ),\n    render,\n  )\n}\n\nexport { IconTile, iconTileShapeClassName, iconTileVariants }\n",
      "type": "registry:component",
      "target": "@components/kino/icon-tile.tsx"
    }
  ],
  "type": "registry:component"
}