{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "features-03",
  "title": "Feature list with a live preview",
  "description": "Four views in a list whose indicator travels to the picked one, beside a preview that resizes and crossfades to show it.",
  "dependencies": [
    "@base-ui/react",
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/chip.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/kbd.json",
    "https://ui.ndekocode.dev/r/switch.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/features/features-03/index.tsx",
      "content": "'use client';\n\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\nimport { useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\n\nimport { DEFAULT_FEATURE_ID, FEATURES, type FeatureId, SECTION } from './data';\nimport { FeaturePreview } from './feature-previews';\n\nconst CROSSFADE_TRANSITION: Transition = {\n  duration: 0.22,\n  ease: [0.23, 1, 0.32, 1],\n};\n\nconst CROSSFADE_VARIANTS: Variants = {\n  enter: { opacity: 0, scale: 0.98, filter: 'blur(4px)' },\n  visible: { opacity: 1, scale: 1, filter: 'blur(0px)' },\n  exit: { opacity: 0, scale: 0.98, filter: 'blur(4px)' },\n};\n\nconst FADE_VARIANTS: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0 },\n};\n\nfunction crossfadeVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return CROSSFADE_VARIANTS;\n}\n\nfunction isFeatureId(value: unknown): value is FeatureId {\n  return FEATURES.some((feature) => feature.id === value);\n}\n\nfunction tabIdOf(id: FeatureId) {\n  return `features-03-tab-${id}`;\n}\n\nfunction panelIdOf(id: FeatureId) {\n  return `features-03-panel-${id}`;\n}\n\nexport default function Features03() {\n  const [activeId, setActiveId] = useState<FeatureId>(DEFAULT_FEATURE_ID);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const crossfadeVariants = crossfadeVariantsOf(shouldReduceMotion);\n\n  function pickFeature(value: unknown) {\n    if (isFeatureId(value)) {\n      setActiveId(value);\n    }\n  }\n\n  return (\n    <section className='px-4 py-16 sm:px-6 sm:py-24 lg:px-8'>\n      <div className='mx-auto flex max-w-6xl flex-col gap-10 sm:gap-14'>\n        <div className='flex max-w-2xl flex-col gap-3'>\n          <h2 className='text-2xl font-semibold text-balance sm:text-3xl'>\n            {SECTION.title}\n          </h2>\n          <p className='text-muted-foreground text-base text-pretty'>\n            {SECTION.description}\n          </p>\n        </div>\n        <TabsPrimitive.Root\n          value={activeId}\n          onValueChange={pickFeature}\n          orientation='vertical'\n          className='grid items-start gap-8 lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] lg:gap-12'\n        >\n          <TabsPrimitive.List\n            aria-label='Loomboard views'\n            className='relative flex flex-col gap-1'\n          >\n            {FEATURES.map((feature) => (\n              <TabsPrimitive.Tab\n                key={feature.id}\n                value={feature.id}\n                id={tabIdOf(feature.id)}\n                aria-controls={panelIdOf(feature.id)}\n                className='group/feature focus-visible:ring-ring/25 hover:bg-foreground/[0.025] relative z-10 flex w-full cursor-pointer items-start gap-3 rounded-xl p-3 text-left transition-colors outline-none focus-visible:ring-[3px] sm:p-4'\n              >\n                <span className='keycap-3d text-muted-foreground group-data-active/feature:text-primary-ink flex size-8 shrink-0 items-center justify-center rounded-lg transition-colors'>\n                  <feature.icon />\n                </span>\n                <span className='flex flex-col gap-1'>\n                  <span className='text-muted-foreground group-data-active/feature:text-foreground text-sm font-medium transition-colors'>\n                    {feature.title}\n                  </span>\n                  <span className='text-muted-foreground text-[13px] leading-relaxed text-pretty'>\n                    {feature.description}\n                  </span>\n                </span>\n              </TabsPrimitive.Tab>\n            ))}\n            <TabsPrimitive.Indicator className='bg-foreground/[0.04] before:bg-primary dark:bg-foreground/[0.06] pointer-events-none absolute top-0 left-0 h-(--active-tab-height) w-full translate-y-(--active-tab-top) rounded-xl transition-[translate,height] duration-300 ease-(--ease-out-strong) before:absolute before:inset-y-3 before:left-0 before:w-0.5 before:rounded-full' />\n          </TabsPrimitive.List>\n          <div className='bg-foreground/[0.025] rounded-2xl p-4 sm:p-8'>\n            <AnimatedSize contentClassName='relative'>\n              <AnimatePresence mode='popLayout' initial={false}>\n                <motion.div\n                  key={activeId}\n                  id={panelIdOf(activeId)}\n                  role='tabpanel'\n                  aria-labelledby={tabIdOf(activeId)}\n                  tabIndex={0}\n                  variants={crossfadeVariants}\n                  initial='enter'\n                  animate='visible'\n                  exit='exit'\n                  transition={CROSSFADE_TRANSITION}\n                  className='focus-visible:ring-ring/25 rounded-xl outline-none focus-visible:ring-[3px]'\n                >\n                  <FeaturePreview id={activeId} />\n                </motion.div>\n              </AnimatePresence>\n            </AnimatedSize>\n          </div>\n        </TabsPrimitive.Root>\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/features-03/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/features/features-03/feature-previews.tsx",
      "content": "import { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Chip } from '@/registry/ndeko/ui/chip';\nimport { Kbd } from '@/registry/ndeko/ui/kbd';\nimport { Switch } from '@/registry/ndeko/ui/switch';\n\nimport {\n  type DayHours,\n  type FeatureId,\n  HOURS_BY_DAY,\n  MINI_LANES,\n  RULE,\n  TIMELINE_BARS,\n  type TimelineBar,\n  WEEK_DAYS,\n} from './data';\n\nconst CARD =\n  'bg-card hairline-ring ring-border dark:bg-foreground/[0.05] rounded-lg shadow-[0_1px_2px_rgb(0_0_0/0.04)]';\n\nconst LANE_CARD =\n  'bg-card dark:bg-foreground/[0.05] rounded-lg shadow-[0_1px_2px_rgb(0_0_0/0.06)]';\n\nconst CHART = {\n  width: 320,\n  height: 176,\n  left: 30,\n  right: 6,\n  top: 10,\n  bottom: 26,\n  maxHours: 8,\n  gridStep: 2,\n  barRatio: 0.48,\n};\n\nconst HOURS_FORMAT = new Intl.NumberFormat('en', {\n  maximumFractionDigits: 1,\n});\n\nfunction BoardsPreview() {\n  return (\n    <div className='grid grid-cols-3 gap-2 sm:gap-3'>\n      {MINI_LANES.map((lane) => (\n        <div\n          key={lane.title}\n          className='bg-foreground/[0.03] flex min-w-0 flex-col gap-2 rounded-lg p-1.5 sm:p-2'\n        >\n          <div className='flex items-center justify-between gap-1 px-1 pt-0.5'>\n            <span className='truncate text-xs font-medium'>{lane.title}</span>\n            <Kbd>{lane.cards.length}</Kbd>\n          </div>\n          {lane.cards.map((card) => (\n            <div\n              key={card.title}\n              className={cn(LANE_CARD, 'flex flex-col gap-2 p-2')}\n            >\n              <p className='line-clamp-2 text-xs leading-snug font-medium'>\n                {card.title}\n              </p>\n              <Badge variant='secondary' className='text-muted-foreground'>\n                {card.label}\n              </Badge>\n            </div>\n          ))}\n        </div>\n      ))}\n    </div>\n  );\n}\n\nfunction gridColumnOf(bar: TimelineBar) {\n  return `${bar.startDay} / span ${bar.dayCount}`;\n}\n\nfunction TimelinePreview() {\n  return (\n    <div className='flex flex-col gap-2'>\n      <div className='grid grid-cols-5 gap-1.5'>\n        {WEEK_DAYS.map((day) => (\n          <span\n            key={day}\n            className='text-muted-foreground px-1 text-xs font-medium'\n          >\n            {day}\n          </span>\n        ))}\n      </div>\n      <div className='bg-foreground/[0.03] grid grid-cols-5 gap-x-1.5 gap-y-2 rounded-lg p-1.5'>\n        {TIMELINE_BARS.map((bar) => {\n          const barStyle = {\n            gridColumn: gridColumnOf(bar),\n            '--chip': 'var(--primary)',\n          } as React.CSSProperties;\n\n          return (\n            <div\n              key={bar.title}\n              style={barStyle}\n              className='chip-3d flex h-8 min-w-0 items-center rounded-md px-2.5 text-xs font-medium'\n            >\n              <span className='truncate'>{bar.title}</span>\n            </div>\n          );\n        })}\n      </div>\n    </div>\n  );\n}\n\nfunction runsLabelOf(count: number) {\n  if (count === 1) {\n    return 'Ran once this week';\n  }\n  return `Ran ${count} times this week`;\n}\n\nfunction AutomationsPreview() {\n  return (\n    <div className={cn(CARD, 'flex flex-col gap-4 rounded-xl p-4')}>\n      <div className='flex items-center justify-between gap-3'>\n        <p className='text-sm font-medium'>{RULE.name}</p>\n        <Switch defaultChecked aria-label={`Turn ${RULE.name} on or off`} />\n      </div>\n      <dl className='flex flex-col gap-2.5 text-[13px]'>\n        <div className='flex flex-wrap items-center gap-2'>\n          <dt className='text-muted-foreground w-12'>When</dt>\n          <dd className='flex flex-wrap items-center gap-1.5'>\n            <Badge variant='secondary' className='text-muted-foreground'>\n              {RULE.triggerField}\n            </Badge>\n            is\n            <Chip color='var(--success)'>{RULE.triggerValue}</Chip>\n          </dd>\n        </div>\n        <div className='flex flex-wrap items-center gap-2'>\n          <dt className='text-muted-foreground w-12'>Then</dt>\n          <dd className='flex flex-wrap items-center gap-1.5'>\n            {RULE.action}\n            <Badge variant='secondary' className='text-muted-foreground'>\n              {RULE.channel}\n            </Badge>\n          </dd>\n        </div>\n      </dl>\n      <p className='text-muted-foreground text-xs tabular-nums'>\n        {runsLabelOf(RULE.runsThisWeek)}\n      </p>\n    </div>\n  );\n}\n\nfunction plotWidthOf() {\n  const horizontalPadding = CHART.left + CHART.right;\n  return CHART.width - horizontalPadding;\n}\n\nfunction plotHeightOf() {\n  const verticalPadding = CHART.top + CHART.bottom;\n  return CHART.height - verticalPadding;\n}\n\nfunction yOf(hours: number) {\n  const ratio = hours / CHART.maxHours;\n  const remaining = 1 - ratio;\n  const plotHeight = plotHeightOf();\n  const offset = plotHeight * remaining;\n  return CHART.top + offset;\n}\n\nfunction gridHoursOf() {\n  const lines: number[] = [];\n  for (let hours = 0; hours <= CHART.maxHours; hours += CHART.gridStep) {\n    lines.push(hours);\n  }\n  return lines;\n}\n\nfunction slotWidthOf() {\n  return plotWidthOf() / HOURS_BY_DAY.length;\n}\n\nfunction barGeometryOf(entry: DayHours, index: number) {\n  const slotWidth = slotWidthOf();\n  const width = slotWidth * CHART.barRatio;\n  const slotOffset = slotWidth * index;\n  const slotStart = CHART.left + slotOffset;\n  const freeSpace = slotWidth - width;\n  const inset = freeSpace / 2;\n  const x = slotStart + inset;\n  const y = yOf(entry.hours);\n  const baseline = yOf(0);\n  const height = baseline - y;\n  const halfSlot = slotWidth / 2;\n  const center = slotStart + halfSlot;\n  return { x, y, width, height, center };\n}\n\nfunction hoursLabelOf(hours: number) {\n  const figure = HOURS_FORMAT.format(hours);\n  return `${figure} h`;\n}\n\nfunction totalHoursOf(entries: DayHours[]) {\n  let total = 0;\n  for (const entry of entries) {\n    total += entry.hours;\n  }\n  return total;\n}\n\nfunction ReportsPreview() {\n  const gridHours = gridHoursOf();\n  const chartRight = CHART.width - CHART.right;\n  const labelY = CHART.height - 8;\n  const tickX = CHART.left - 6;\n  const viewBox = `0 0 ${CHART.width} ${CHART.height}`;\n  const totalHours = totalHoursOf(HOURS_BY_DAY);\n\n  return (\n    <div className={cn(CARD, 'flex flex-col gap-3 rounded-xl p-4')}>\n      <div className='flex items-baseline justify-between gap-3'>\n        <div className='flex flex-col'>\n          <p className='text-sm font-medium'>Hours this week</p>\n          <p className='text-muted-foreground text-xs tabular-nums'>\n            {hoursLabelOf(totalHours)} logged\n          </p>\n        </div>\n        <Badge variant='secondary' className='text-muted-foreground'>\n          Illustrative\n        </Badge>\n      </div>\n      <svg viewBox={viewBox} aria-hidden='true' className='h-auto w-full'>\n        {gridHours.map((hours) => {\n          const y = yOf(hours);\n\n          return (\n            <g key={hours}>\n              <line\n                x1={CHART.left}\n                x2={chartRight}\n                y1={y}\n                y2={y}\n                className='stroke-border'\n                strokeWidth={1}\n                vectorEffect='non-scaling-stroke'\n              />\n              <text\n                x={tickX}\n                y={y}\n                textAnchor='end'\n                dominantBaseline='middle'\n                className='fill-muted-foreground text-[10px] tabular-nums'\n              >\n                {hours}h\n              </text>\n            </g>\n          );\n        })}\n        {HOURS_BY_DAY.map((entry, index) => {\n          const bar = barGeometryOf(entry, index);\n\n          return (\n            <g key={entry.day}>\n              <rect\n                x={bar.x}\n                y={bar.y}\n                width={bar.width}\n                height={bar.height}\n                rx={5}\n                className='fill-primary'\n              />\n              <text\n                x={bar.center}\n                y={labelY}\n                textAnchor='middle'\n                className='fill-muted-foreground text-[10px]'\n              >\n                {entry.day}\n              </text>\n            </g>\n          );\n        })}\n      </svg>\n      <div className='sr-only'>\n        <table>\n          <caption>Hours logged per day this week, illustrative</caption>\n          <thead>\n            <tr>\n              <th scope='col'>Day</th>\n              <th scope='col'>Hours</th>\n            </tr>\n          </thead>\n          <tbody>\n            {HOURS_BY_DAY.map((entry) => (\n              <tr key={entry.day}>\n                <th scope='row'>{entry.day}</th>\n                <td>{hoursLabelOf(entry.hours)}</td>\n              </tr>\n            ))}\n          </tbody>\n        </table>\n      </div>\n    </div>\n  );\n}\n\nconst PREVIEW_BY_ID: Record<FeatureId, () => React.ReactNode> = {\n  boards: BoardsPreview,\n  timeline: TimelinePreview,\n  automations: AutomationsPreview,\n  reports: ReportsPreview,\n};\n\nexport function FeaturePreview({ id }: { id: FeatureId }) {\n  const Preview = PREVIEW_BY_ID[id];\n  return <Preview />;\n}\n",
      "type": "registry:component",
      "target": "components/blocks/features-03/feature-previews.tsx"
    },
    {
      "path": "registry/ndeko/blocks/features/features-03/data.ts",
      "content": "import {\n  CalendarIcon,\n  ChartLineIcon,\n  type Icon,\n  LayoutGridIcon,\n  ZapIcon,\n} from '@/registry/ndeko/lib/icons';\n\nexport type FeatureId = 'boards' | 'timeline' | 'automations' | 'reports';\n\nexport type Feature = {\n  id: FeatureId;\n  icon: Icon;\n  title: string;\n  description: string;\n};\n\nexport const SECTION = {\n  title: 'Board, timeline, rules and report on the same cards',\n  description:\n    'Every view reads the same cards, so a date moved on the timeline is already moved on the board.',\n};\n\nexport const FEATURES: Feature[] = [\n  {\n    id: 'boards',\n    icon: LayoutGridIcon,\n    title: 'Boards',\n    description: 'Lanes for each stage, with owners and labels on every card',\n  },\n  {\n    id: 'timeline',\n    icon: CalendarIcon,\n    title: 'Timeline',\n    description: 'The same cards laid out on the week, so overlaps show early',\n  },\n  {\n    id: 'automations',\n    icon: ZapIcon,\n    title: 'Automations',\n    description: 'Rules that post, assign or move cards when something changes',\n  },\n  {\n    id: 'reports',\n    icon: ChartLineIcon,\n    title: 'Reports',\n    description: 'Where the hours of the week went, day by day',\n  },\n];\n\nexport const DEFAULT_FEATURE_ID: FeatureId = 'boards';\n\nexport type MiniCard = {\n  title: string;\n  label: string;\n};\n\nexport type MiniLane = {\n  title: string;\n  cards: MiniCard[];\n};\n\nexport const MINI_LANES: MiniLane[] = [\n  {\n    title: 'To do',\n    cards: [\n      { title: 'Pricing page copy', label: 'Copy' },\n      { title: 'Launch photos', label: 'Design' },\n    ],\n  },\n  {\n    title: 'In progress',\n    cards: [{ title: 'Onboarding checklist', label: 'Product' }],\n  },\n  {\n    title: 'Done',\n    cards: [\n      { title: 'Beta feedback notes', label: 'Research' },\n      { title: 'Press kit', label: 'Design' },\n    ],\n  },\n];\n\nexport const WEEK_DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'];\n\nexport type TimelineBar = {\n  title: string;\n  startDay: number;\n  dayCount: number;\n};\n\nexport const TIMELINE_BARS: TimelineBar[] = [\n  {\n    title: 'Pricing page copy',\n    startDay: 1,\n    dayCount: 2,\n  },\n  {\n    title: 'Onboarding checklist',\n    startDay: 2,\n    dayCount: 3,\n  },\n  { title: 'Launch photos', startDay: 3, dayCount: 2 },\n  { title: 'Launch email', startDay: 4, dayCount: 2 },\n];\n\nexport const RULE = {\n  name: 'Announce finished work',\n  triggerField: 'Status',\n  triggerValue: 'Done',\n  action: 'Post in',\n  channel: '#launch',\n  runsThisWeek: 3,\n};\n\nexport type DayHours = {\n  day: string;\n  hours: number;\n};\n\nexport const HOURS_BY_DAY: DayHours[] = [\n  { day: 'Mon', hours: 6.5 },\n  { day: 'Tue', hours: 7.5 },\n  { day: 'Wed', hours: 5 },\n  { day: 'Thu', hours: 8 },\n  { day: 'Fri', hours: 4.5 },\n];\n",
      "type": "registry:component",
      "target": "components/blocks/features-03/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "features"
  ],
  "type": "registry:block"
}