{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "select-item",
  "title": "UI Select Item",
  "description": "A select option row whose idle/hover/press/selected state is a pure function of the timeline; the row background, label color, and check icon are keyframed presets. Composed inside the Select panel.",
  "dependencies": ["remotion"],
  "registryDependencies": ["@remocn/remocn-ui"],
  "files": [
    {
      "path": "registry/remocn-ui/select-item/index.tsx",
      "content": "\"use client\";\n\nimport { mixOklch, type RemocnTheme, useRemocnTheme } from \"@/lib/remocn-ui\";\n\nexport type SelectItemState = \"idle\" | \"hover\" | \"press\" | \"selected\";\n\nexport interface SelectItemProps {\n  state?: SelectItemState;\n  style?: SelectItemStyle;\n  label?: string;\n  width?: number;\n  theme?: Partial<RemocnTheme>;\n  className?: string;\n}\n\nconst ROW_WIDTH = 260;\n\nexport interface SelectItemStyle {\n  background: string;\n  labelColor: string;\n  checkOpacity: number;\n  scale: number;\n}\n\nexport interface SelectItemStyleContext {\n  idleBg: string;\n  hoverBg: string;\n  pressBg: string;\n  selectedBg: string;\n  idleFg: string;\n  selectedFg: string;\n  check: string;\n}\n\nexport function selectItemStyleContext(\n  theme: RemocnTheme,\n): SelectItemStyleContext {\n  return {\n    idleBg: theme.popover,\n    hoverBg: theme.accent,\n    pressBg: mixOklch(theme.accent, theme.foreground, 0.08),\n    selectedBg: theme.accent,\n    idleFg: theme.popoverForeground,\n    selectedFg: theme.accentForeground,\n    check: theme.primary,\n  };\n}\n\nexport function selectItemStyle(\n  state: SelectItemState,\n  ctx: SelectItemStyleContext,\n): SelectItemStyle {\n  switch (state) {\n    case \"hover\":\n      return {\n        background: ctx.hoverBg,\n        labelColor: ctx.idleFg,\n        checkOpacity: 0,\n        scale: 1,\n      };\n    case \"press\":\n      return {\n        background: ctx.pressBg,\n        labelColor: ctx.idleFg,\n        checkOpacity: 0,\n        scale: 0.98,\n      };\n    case \"selected\":\n      return {\n        background: ctx.selectedBg,\n        labelColor: ctx.selectedFg,\n        checkOpacity: 1,\n        scale: 1,\n      };\n    default:\n      return {\n        background: ctx.idleBg,\n        labelColor: ctx.idleFg,\n        checkOpacity: 0,\n        scale: 1,\n      };\n  }\n}\n\nexport interface SelectItemRowProps {\n  style?: SelectItemStyle;\n  state?: SelectItemState;\n  ctx: SelectItemStyleContext;\n  label: string;\n  width: number;\n  radius: number;\n  check: string;\n}\n\nexport function SelectItemRow({\n  style,\n  state = \"idle\",\n  ctx,\n  label,\n  width,\n  radius,\n  check,\n}: SelectItemRowProps) {\n  const v = style ?? selectItemStyle(state, ctx);\n  return (\n    <div\n      className={undefined}\n      style={{\n        width,\n        boxSizing: \"border-box\",\n        display: \"flex\",\n        alignItems: \"center\",\n        justifyContent: \"space-between\",\n        gap: 12,\n        padding: \"8px 12px\",\n        borderRadius: radius,\n        transform: `scale(${v.scale})`,\n        background: v.background,\n        color: v.labelColor,\n        fontSize: 14,\n        letterSpacing: \"-0.01em\",\n      }}\n    >\n      <span>{label}</span>\n      <svg\n        width={16}\n        height={16}\n        viewBox=\"0 0 24 24\"\n        fill=\"none\"\n        style={{ flexShrink: 0, opacity: v.checkOpacity }}\n      >\n        <path\n          d=\"M5 12.5l4.5 4.5L19 7\"\n          stroke={check}\n          strokeWidth=\"2.4\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n        />\n      </svg>\n    </div>\n  );\n}\n\nexport function SelectItem({\n  state = \"idle\",\n  style,\n  label = \"Banana\",\n  width = ROW_WIDTH,\n  theme: themeOverride,\n  className,\n}: SelectItemProps) {\n  const theme = useRemocnTheme(themeOverride, \"light\");\n  const ctx = selectItemStyleContext(theme);\n\n  return (\n    <div\n      className={className}\n      style={{\n        position: \"absolute\",\n        inset: 0,\n        display: \"flex\",\n        alignItems: \"center\",\n        justifyContent: \"center\",\n        background: \"transparent\",\n        fontFamily:\n          \"var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif\",\n      }}\n    >\n      <SelectItemRow\n        style={style}\n        state={state}\n        ctx={ctx}\n        label={label}\n        width={width}\n        radius={theme.radius}\n        check={ctx.check}\n      />\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/select-item.tsx"
    },
    {
      "path": "registry/remocn-ui/select-item/use-select-item-transition.ts",
      "content": "\"use client\";\n\nimport {\n  type SelectItemState,\n  type SelectItemStyle,\n  selectItemStyle,\n  selectItemStyleContext,\n} from \"@/components/remocn/select-item\";\nimport {\n  easings,\n  mixOklch,\n  type RemocnTheme,\n  type Step,\n  useRemocnTheme,\n  useStateTransition,\n} from \"@/lib/remocn-ui\";\n\nexport const DEFAULT_DURATION = 8;\n\nexport function tweenSelectItemStyle(\n  a: SelectItemStyle,\n  b: SelectItemStyle,\n  t: number,\n): SelectItemStyle {\n  return {\n    background: mixOklch(a.background, b.background, t),\n    labelColor: mixOklch(a.labelColor, b.labelColor, t),\n    checkOpacity: a.checkOpacity + (b.checkOpacity - a.checkOpacity) * t,\n    scale: a.scale + (b.scale - a.scale) * t,\n  };\n}\n\nexport interface SelectItemTransitionOptions {\n  theme?: Partial<RemocnTheme>;\n  mode?: \"light\" | \"dark\";\n  speed?: number;\n  defaultDuration?: number;\n}\n\nexport function useSelectItemTransition(\n  steps: Step<SelectItemState>[],\n  opts: SelectItemTransitionOptions = {},\n): SelectItemStyle {\n  const {\n    theme: themeOverride,\n    mode,\n    speed = 1,\n    defaultDuration = DEFAULT_DURATION,\n  } = opts;\n  const theme = useRemocnTheme(themeOverride, mode);\n  const ctx = selectItemStyleContext(theme);\n  const { from, to, progress } = useStateTransition(\n    steps,\n    \"idle\",\n    speed,\n    defaultDuration,\n  );\n  const t = easings.out(progress);\n  return tweenSelectItemStyle(\n    selectItemStyle(from, ctx),\n    selectItemStyle(to, ctx),\n    t,\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/use-select-item-transition.ts"
    }
  ],
  "type": "registry:component"
}
