{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "aside-03",
  "title": "Filters",
  "description": "Status, assignee, priority and due date filters with removable chips and a button that counts the matching tasks",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/checkbox.json",
    "https://ui.ndekocode.dev/r/chip.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/radio-group.json",
    "https://ui.ndekocode.dev/r/sheet.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/toggle-group.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/components/aside/aside-03.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\nimport { useId, useState } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { XIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Checkbox } from '@/registry/ndeko/ui/checkbox';\nimport { Chip } from '@/registry/ndeko/ui/chip';\nimport { RadioGroup, RadioGroupItem } from '@/registry/ndeko/ui/radio-group';\nimport { ToggleGroup, ToggleGroupItem } from '@/registry/ndeko/ui/toggle-group';\n\nimport {\n  ASIDE_SURFACE,\n  AsideCloseButton,\n  AsideDescription,\n  AsidePreview,\n  AsideTitle,\n} from './_parts/aside-frame';\nimport { chipVariantsOf } from './_parts/motion';\nimport { PEOPLE, firstNameOf } from './_parts/people';\nimport { PersonAvatar } from './_parts/person-avatar';\nimport {\n  MetaGlyph,\n  PRIORITY_META,\n  PRIORITY_ORDER,\n  STATUS_META,\n  STATUS_ORDER,\n  type PriorityId,\n  type StatusId,\n} from './_parts/task-meta';\n\ntype Due = 'overdue' | 'this-week' | 'next-week' | 'later';\n\ntype DuePreset = 'any' | 'overdue' | 'this-week' | 'next-week';\n\ntype Task = {\n  id: string;\n  status: StatusId;\n  assignee: string;\n  priority: PriorityId;\n  due: Due;\n};\n\ntype Filters = {\n  statuses: StatusId[];\n  assignees: string[];\n  priorities: PriorityId[];\n  due: DuePreset;\n};\n\ntype ActiveFilter = { key: string; label: string; remove: () => void };\n\nfunction taskOf(\n  id: string,\n  status: StatusId,\n  assignee: string,\n  priority: PriorityId,\n  due: Due\n): Task {\n  return { id, status, assignee, priority, due };\n}\n\nconst TASKS: Task[] = [\n  taskOf('t1', 'todo', 'amara', 'high', 'this-week'),\n  taskOf('t2', 'todo', 'priya', 'medium', 'next-week'),\n  taskOf('t3', 'in-progress', 'priya', 'urgent', 'overdue'),\n  taskOf('t4', 'in-progress', 'lucas', 'high', 'this-week'),\n  taskOf('t5', 'in-review', 'mateo', 'medium', 'this-week'),\n  taskOf('t6', 'backlog', 'hana', 'low', 'later'),\n  taskOf('t7', 'done', 'amara', 'medium', 'this-week'),\n  taskOf('t8', 'todo', 'mateo', 'low', 'next-week'),\n  taskOf('t9', 'in-progress', 'amara', 'medium', 'this-week'),\n  taskOf('t10', 'todo', 'priya', 'high', 'this-week'),\n  taskOf('t11', 'backlog', 'lucas', 'low', 'later'),\n  taskOf('t12', 'in-review', 'priya', 'high', 'overdue'),\n  taskOf('t13', 'done', 'hana', 'urgent', 'this-week'),\n  taskOf('t14', 'todo', 'hana', 'medium', 'later'),\n  taskOf('t15', 'in-progress', 'mateo', 'urgent', 'this-week'),\n  taskOf('t16', 'todo', 'lucas', 'medium', 'next-week'),\n  taskOf('t17', 'backlog', 'priya', 'low', 'later'),\n  taskOf('t18', 'done', 'mateo', 'high', 'next-week'),\n  taskOf('t19', 'in-progress', 'priya', 'medium', 'next-week'),\n  taskOf('t20', 'todo', 'amara', 'low', 'later'),\n  taskOf('t21', 'in-review', 'lucas', 'urgent', 'this-week'),\n  taskOf('t22', 'todo', 'mateo', 'high', 'overdue'),\n  taskOf('t23', 'backlog', 'amara', 'medium', 'later'),\n  taskOf('t24', 'in-progress', 'hana', 'high', 'next-week'),\n];\n\nconst DUE_PRESETS: { value: DuePreset; label: string; chipLabel: string }[] = [\n  { value: 'any', label: 'Any time', chipLabel: 'Any time' },\n  { value: 'overdue', label: 'Overdue', chipLabel: 'Overdue' },\n  { value: 'this-week', label: 'This week', chipLabel: 'Due this week' },\n  { value: 'next-week', label: 'Next week', chipLabel: 'Due next week' },\n];\n\nconst ASSIGNEES = PEOPLE.slice(0, 5);\n\nconst INITIAL_FILTERS: Filters = {\n  statuses: ['todo', 'in-progress'],\n  assignees: ['priya'],\n  priorities: [],\n  due: 'any',\n};\n\nconst NO_FILTERS: Filters = {\n  statuses: [],\n  assignees: [],\n  priorities: [],\n  due: 'any',\n};\n\nfunction includesOrAll<Value>(picked: Value[], value: Value) {\n  const isUnfiltered = picked.length === 0;\n  return isUnfiltered || picked.includes(value);\n}\n\nfunction matchesDue(preset: DuePreset, due: Due) {\n  if (preset === 'any') {\n    return true;\n  }\n  return preset === due;\n}\n\nfunction matches(task: Task, filters: Filters) {\n  const statusMatches = includesOrAll(filters.statuses, task.status);\n  const assigneeMatches = includesOrAll(filters.assignees, task.assignee);\n  const priorityMatches = includesOrAll(filters.priorities, task.priority);\n  const dueMatches = matchesDue(filters.due, task.due);\n  return statusMatches && assigneeMatches && priorityMatches && dueMatches;\n}\n\nfunction toggled<Value>(values: Value[], value: Value) {\n  if (values.includes(value)) {\n    return values.filter((candidate) => candidate !== value);\n  }\n  return [...values, value];\n}\n\nfunction isPriority(value: string): value is PriorityId {\n  return PRIORITY_ORDER.some((priority) => priority === value);\n}\n\nfunction isDuePreset(value: unknown): value is DuePreset {\n  return DUE_PRESETS.some((preset) => preset.value === value);\n}\n\nfunction countWhere(predicate: (task: Task) => boolean) {\n  return TASKS.filter(predicate).length;\n}\n\nfunction resultLabelOf(count: number) {\n  if (count === 1) {\n    return 'task';\n  }\n  return 'tasks';\n}\n\nfunction FilterGroup({\n  title,\n  children,\n}: {\n  title: string;\n  children: React.ReactNode;\n}) {\n  return (\n    <fieldset className='flex flex-col gap-1'>\n      <legend className='text-muted-foreground mb-1.5 text-xs font-medium'>\n        {title}\n      </legend>\n      {children}\n    </fieldset>\n  );\n}\n\nfunction CheckRow({\n  isChecked,\n  count,\n  onToggle,\n  children,\n}: {\n  isChecked: boolean;\n  count: number;\n  onToggle: () => void;\n  children: React.ReactNode;\n}) {\n  const id = useId();\n\n  return (\n    <div className='hover:bg-foreground/[0.03] -mx-2 flex h-8 items-center gap-2.5 rounded-md px-2'>\n      <Checkbox id={id} checked={isChecked} onCheckedChange={onToggle} />\n      <label\n        htmlFor={id}\n        className='flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-[13px]'\n      >\n        {children}\n        <span className='text-muted-foreground ml-auto text-xs tabular-nums'>\n          {count}\n        </span>\n      </label>\n    </div>\n  );\n}\n\nfunction ActiveFilters({ filters }: { filters: ActiveFilter[] }) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = chipVariantsOf(shouldReduceMotion);\n  const allowsLayout = !shouldReduceMotion;\n  const hasFilters = filters.length > 0;\n\n  return (\n    <AnimatedSize>\n      {!hasFilters && (\n        <p className='text-muted-foreground py-1 text-[13px]'>\n          No filter: every task shows\n        </p>\n      )}\n      {hasFilters && (\n        <ul\n          aria-label='Active filters'\n          className='relative flex flex-wrap gap-1'\n        >\n          <AnimatePresence initial={false} mode='popLayout'>\n            {filters.map((filter) => (\n              <motion.li\n                key={filter.key}\n                layout={allowsLayout}\n                variants={variants}\n                initial='hidden'\n                animate='shown'\n                exit='hidden'\n                className='flex'\n              >\n                <Chip\n                  color='var(--primary)'\n                  className='h-6 gap-1 pr-0.5 pl-2 text-xs'\n                >\n                  {filter.label}\n                  <button\n                    type='button'\n                    aria-label={`Remove the filter ${filter.label}`}\n                    onClick={filter.remove}\n                    className='hover:bg-foreground/10 focus-visible:ring-ring/25 flex size-5 cursor-pointer items-center justify-center rounded-[5px] outline-none focus-visible:ring-[3px]'\n                  >\n                    <XIcon className='size-3' />\n                  </button>\n                </Chip>\n              </motion.li>\n            ))}\n          </AnimatePresence>\n        </ul>\n      )}\n    </AnimatedSize>\n  );\n}\n\nfunction activeFiltersOf(\n  filters: Filters,\n  setFilters: React.Dispatch<React.SetStateAction<Filters>>\n) {\n  const active: ActiveFilter[] = [];\n  for (const status of filters.statuses) {\n    active.push({\n      key: `status-${status}`,\n      label: STATUS_META[status].label,\n      remove: () =>\n        setFilters((previous) => ({\n          ...previous,\n          statuses: toggled(previous.statuses, status),\n        })),\n    });\n  }\n  for (const personId of filters.assignees) {\n    const person = PEOPLE.find((candidate) => candidate.id === personId);\n    if (!person) {\n      continue;\n    }\n    active.push({\n      key: `assignee-${personId}`,\n      label: firstNameOf(person),\n      remove: () =>\n        setFilters((previous) => ({\n          ...previous,\n          assignees: toggled(previous.assignees, personId),\n        })),\n    });\n  }\n  for (const priority of filters.priorities) {\n    active.push({\n      key: `priority-${priority}`,\n      label: `${PRIORITY_META[priority].label} priority`,\n      remove: () =>\n        setFilters((previous) => ({\n          ...previous,\n          priorities: toggled(previous.priorities, priority),\n        })),\n    });\n  }\n  const hasDue = filters.due !== 'any';\n  if (hasDue) {\n    const preset = DUE_PRESETS.find((item) => item.value === filters.due);\n    active.push({\n      key: 'due',\n      label: preset?.chipLabel ?? 'Due date',\n      remove: () => setFilters((previous) => ({ ...previous, due: 'any' })),\n    });\n  }\n  return active;\n}\n\nfunction TaskFilters() {\n  const [filters, setFilters] = useState<Filters>(INITIAL_FILTERS);\n  const resultCount = countWhere((task) => matches(task, filters));\n  const hasResults = resultCount > 0;\n  const active = activeFiltersOf(filters, setFilters);\n  const hasActive = active.length > 0;\n\n  function toggleStatus(status: StatusId) {\n    setFilters((previous) => ({\n      ...previous,\n      statuses: toggled(previous.statuses, status),\n    }));\n  }\n\n  function toggleAssignee(personId: string) {\n    setFilters((previous) => ({\n      ...previous,\n      assignees: toggled(previous.assignees, personId),\n    }));\n  }\n\n  function changePriorities(values: string[]) {\n    const priorities = values.filter(isPriority);\n    setFilters((previous) => ({ ...previous, priorities }));\n  }\n\n  function changeDue(value: unknown) {\n    if (isDuePreset(value)) {\n      setFilters((previous) => ({ ...previous, due: value }));\n    }\n  }\n\n  function clearAll() {\n    setFilters(NO_FILTERS);\n  }\n\n  return (\n    <div className='flex min-h-full flex-col'>\n      <div className='flex flex-col gap-4 px-5 pt-5 pb-6'>\n        <div className='flex items-start gap-3'>\n          <div className='flex min-w-0 flex-1 flex-col gap-1'>\n            <AsideTitle>Filters</AsideTitle>\n            <AsideDescription>Tasks of the Product team</AsideDescription>\n          </div>\n          <AsideCloseButton label='Close filters' className='-mt-1 -mr-2' />\n        </div>\n        <ActiveFilters filters={active} />\n      </div>\n      <div className='flex flex-1 flex-col gap-6 px-5 pb-6'>\n        <FilterGroup title='Status'>\n          {STATUS_ORDER.map((status) => {\n            const meta = STATUS_META[status];\n            const isChecked = filters.statuses.includes(status);\n            const count = countWhere((task) => task.status === status);\n\n            function toggle() {\n              toggleStatus(status);\n            }\n\n            return (\n              <CheckRow\n                key={status}\n                isChecked={isChecked}\n                count={count}\n                onToggle={toggle}\n              >\n                <MetaGlyph meta={meta} />\n                {meta.label}\n              </CheckRow>\n            );\n          })}\n        </FilterGroup>\n        <FilterGroup title='Assignee'>\n          {ASSIGNEES.map((person) => {\n            const isChecked = filters.assignees.includes(person.id);\n            const count = countWhere((task) => task.assignee === person.id);\n\n            function toggle() {\n              toggleAssignee(person.id);\n            }\n\n            return (\n              <CheckRow\n                key={person.id}\n                isChecked={isChecked}\n                count={count}\n                onToggle={toggle}\n              >\n                <PersonAvatar person={person} size='xs' />\n                <span className='truncate'>{person.name}</span>\n              </CheckRow>\n            );\n          })}\n        </FilterGroup>\n        <FilterGroup title='Priority'>\n          <ToggleGroup\n            multiple\n            value={filters.priorities}\n            onValueChange={changePriorities}\n            variant='outline'\n            size='sm'\n            aria-label='Priority'\n            className='grid w-full grid-cols-2 gap-1.5'\n          >\n            {PRIORITY_ORDER.map((priority) => {\n              const meta = PRIORITY_META[priority];\n\n              return (\n                <ToggleGroupItem\n                  key={priority}\n                  value={priority}\n                  className='justify-start gap-2 text-xs'\n                >\n                  <MetaGlyph meta={meta} />\n                  {meta.label}\n                </ToggleGroupItem>\n              );\n            })}\n          </ToggleGroup>\n        </FilterGroup>\n        <FilterGroup title='Due date'>\n          <RadioGroup\n            value={filters.due}\n            onValueChange={changeDue}\n            className='gap-0'\n          >\n            {DUE_PRESETS.map((preset) => (\n              <label\n                key={preset.value}\n                className='hover:bg-foreground/[0.03] -mx-2 flex h-8 cursor-pointer items-center gap-2.5 rounded-md px-2 text-[13px]'\n              >\n                <RadioGroupItem value={preset.value} />\n                {preset.label}\n              </label>\n            ))}\n          </RadioGroup>\n        </FilterGroup>\n      </div>\n      <div\n        className={cn(\n          'sticky bottom-0 mt-auto flex items-center gap-2 px-5 pt-2 pb-4',\n          ASIDE_SURFACE\n        )}\n      >\n        <Button variant='ghost' disabled={!hasActive} onClick={clearAll}>\n          Clear all\n        </Button>\n        <Button disabled={!hasResults} className='ml-auto'>\n          {hasResults && (\n            <span className='flex items-center gap-1'>\n              Show\n              <MotionNumber value={resultCount} />\n              {resultLabelOf(resultCount)}\n            </span>\n          )}\n          {!hasResults && 'No task matches'}\n        </Button>\n      </div>\n    </div>\n  );\n}\n\nexport default function Aside03() {\n  return (\n    <AsidePreview triggerLabel='Open filters'>\n      <TaskFilters />\n    </AsidePreview>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/aside/aside-03.tsx"
    },
    {
      "path": "registry/ndeko/components/aside/_parts/aside-frame.tsx",
      "content": "'use client';\n\nimport { createContext, useContext } from 'react';\n\nimport { PanelsTopLeftIcon, XIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport {\n  Sheet,\n  SheetClose,\n  SheetContent,\n  SheetDescription,\n  SheetTitle,\n  SheetTrigger,\n} from '@/registry/ndeko/ui/sheet';\n\n/** Where an aside's content is drawn: open in the page as a preview, or inside the real sheet. */\nexport type AsideHost = 'preview' | 'sheet';\n\nconst AsideHostContext = createContext<AsideHost>('preview');\n\nexport function useAsideHost() {\n  return useContext(AsideHostContext);\n}\n\nexport type AsideSide = 'left' | 'right';\n\nconst TITLE = 'text-lg leading-tight font-semibold';\n\nconst DESCRIPTION = 'text-muted-foreground text-[13px]';\n\n/** The background of the surface the aside sits on, for parts that must cover what scrolls under them. */\nexport const ASIDE_SURFACE = 'bg-[var(--aside-surface)]';\n\ntype AsideTextProps = { className?: string; children: React.ReactNode };\n\nexport function AsideTitle({ className, children }: AsideTextProps) {\n  const host = useAsideHost();\n  if (host === 'sheet') {\n    return <SheetTitle className={className}>{children}</SheetTitle>;\n  }\n  return <h2 className={cn(TITLE, className)}>{children}</h2>;\n}\n\nexport function AsideDescription({ className, children }: AsideTextProps) {\n  const host = useAsideHost();\n  if (host === 'sheet') {\n    return (\n      <SheetDescription className={className}>{children}</SheetDescription>\n    );\n  }\n  return <p className={cn(DESCRIPTION, className)}>{children}</p>;\n}\n\n/** The close button of the sheet's header. The preview has nothing to close, so it draws nothing. */\nexport function AsideCloseButton({\n  label = 'Close panel',\n  className,\n}: {\n  label?: string;\n  className?: string;\n}) {\n  const host = useAsideHost();\n  if (host === 'preview') {\n    return null;\n  }\n  return (\n    <SheetClose\n      render={\n        <Button\n          variant='ghost'\n          size='icon-sm'\n          aria-label={label}\n          className={cn('text-muted-foreground', className)}\n        />\n      }\n    >\n      <XIcon />\n    </SheetClose>\n  );\n}\n\ntype AsidePreviewProps = {\n  /** The content, drawn twice: open in the page, and inside the sheet the trigger opens. */\n  children: React.ReactNode;\n  triggerLabel: string;\n  side?: AsideSide;\n  className?: string;\n};\n\n/** Shows an aside open and whole on the page, with a small trigger that slides the same content in as a real sheet. */\nexport function AsidePreview({\n  children,\n  triggerLabel,\n  side = 'right',\n  className,\n}: AsidePreviewProps) {\n  return (\n    <div className='flex w-full flex-col items-center gap-4'>\n      <AsideHostContext.Provider value='preview'>\n        <div\n          className={cn(\n            'surface-raised flex w-full max-w-sm flex-col overflow-hidden rounded-2xl text-left [--aside-surface:var(--popover)]',\n            className\n          )}\n        >\n          {children}\n        </div>\n      </AsideHostContext.Provider>\n      <Sheet>\n        <SheetTrigger render={<Button variant='outline' size='sm' />}>\n          <PanelsTopLeftIcon />\n          {triggerLabel}\n        </SheetTrigger>\n        <SheetContent\n          side={side}\n          showCloseButton={false}\n          className={cn('gap-0 p-0 [--aside-surface:var(--card)]', className)}\n        >\n          <AsideHostContext.Provider value='sheet'>\n            {children}\n          </AsideHostContext.Provider>\n        </SheetContent>\n      </Sheet>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/aside-frame.tsx"
    },
    {
      "path": "registry/ndeko/components/aside/_parts/motion.ts",
      "content": "import type { Transition, Variants } from 'motion/react';\n\nexport const SWAP_TRANSITION: Transition = {\n  duration: 0.15,\n  ease: [0.2, 0, 0, 1],\n};\n\nconst TRAVEL_SPRING: Transition = { type: 'spring', bounce: 0, duration: 0.3 };\n\nconst INSTANT: Transition = { duration: 0 };\n\nconst ENTER: Transition = { duration: 0.2, ease: [0.23, 1, 0.32, 1] };\n\nconst LEAVE: Transition = { duration: 0.14, ease: [0.23, 1, 0.32, 1] };\n\nconst ICON_SWAP: Variants = {\n  enter: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n  visible: { opacity: 1, scale: 1, filter: 'blur(0px)' },\n  exit: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n};\n\nconst LABEL_SWAP: Variants = {\n  enter: { opacity: 0, filter: 'blur(2px)' },\n  visible: { opacity: 1, filter: 'blur(0px)' },\n  exit: { opacity: 0, filter: 'blur(2px)' },\n};\n\nconst FADE: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0 },\n};\n\nconst HEIGHT_PRESENCE: Variants = {\n  hidden: { height: 0, opacity: 0, overflow: 'hidden', transition: LEAVE },\n  shown: {\n    height: 'auto',\n    opacity: 1,\n    transition: ENTER,\n    transitionEnd: { overflow: 'visible' },\n  },\n};\n\nconst FADE_PRESENCE: Variants = {\n  hidden: { opacity: 0, transition: LEAVE },\n  shown: { opacity: 1, transition: ENTER },\n};\n\nconst CHIP_PRESENCE: Variants = {\n  hidden: { opacity: 0, scale: 0.9, transition: LEAVE },\n  shown: { opacity: 1, scale: 1, transition: ENTER },\n};\n\nexport type SwapKind = 'icon' | 'label';\n\nexport function swapVariantsOf(\n  shouldReduceMotion: boolean | null,\n  kind: SwapKind = 'icon'\n) {\n  if (shouldReduceMotion) {\n    return FADE;\n  }\n  if (kind === 'label') {\n    return LABEL_SWAP;\n  }\n  return ICON_SWAP;\n}\n\n/** A row that joins or leaves a list: its height opens or collapses, so what follows slides instead of jumping. */\nexport function rowVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_PRESENCE;\n  }\n  return HEIGHT_PRESENCE;\n}\n\nexport function chipVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_PRESENCE;\n  }\n  return CHIP_PRESENCE;\n}\n\nexport function travelOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return INSTANT;\n  }\n  return TRAVEL_SPRING;\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/motion.ts"
    },
    {
      "path": "registry/ndeko/components/aside/_parts/people.ts",
      "content": "export type Presence = 'tracking' | 'online' | 'away' | 'offline';\n\nexport type Person = {\n  id: string;\n  name: string;\n  email: string;\n  title: string;\n  presence: Presence;\n};\n\nexport const PEOPLE: Person[] = [\n  {\n    id: 'amara',\n    name: 'Amara Okafor',\n    email: 'amara@lattice.example',\n    title: 'Product designer',\n    presence: 'tracking',\n  },\n  {\n    id: 'lucas',\n    name: 'Lucas Moreau',\n    email: 'lucas@lattice.example',\n    title: 'Engineering lead',\n    presence: 'online',\n  },\n  {\n    id: 'priya',\n    name: 'Priya Raman',\n    email: 'priya@lattice.example',\n    title: 'Frontend engineer',\n    presence: 'online',\n  },\n  {\n    id: 'mateo',\n    name: 'Mateo Silva',\n    email: 'mateo@lattice.example',\n    title: 'Backend engineer',\n    presence: 'away',\n  },\n  {\n    id: 'hana',\n    name: 'Hana Kobayashi',\n    email: 'hana@lattice.example',\n    title: 'Product manager',\n    presence: 'tracking',\n  },\n  {\n    id: 'jonas',\n    name: 'Jonas Weber',\n    email: 'jonas@lattice.example',\n    title: 'QA engineer',\n    presence: 'offline',\n  },\n  {\n    id: 'zola',\n    name: 'Zola Mbeki',\n    email: 'zola@lattice.example',\n    title: 'Content designer',\n    presence: 'online',\n  },\n];\n\nfunction isKnownPerson(person: Person | undefined): person is Person {\n  return person !== undefined;\n}\n\nexport function peopleByIds(ids: string[]) {\n  const found = ids.map((id) => PEOPLE.find((person) => person.id === id));\n  return found.filter(isKnownPerson);\n}\n\nexport function firstNameOf(person: Person) {\n  const [firstName] = person.name.split(' ');\n  return firstName;\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/people.ts"
    },
    {
      "path": "registry/ndeko/components/aside/_parts/person-avatar.tsx",
      "content": "import {\n  CheckIcon,\n  ClockIcon,\n  MinusIcon,\n  MoonIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\n\nimport type { Person, Presence } from './people';\n\ntype PresenceMeta = { label: string; color: string; icon: Icon };\n\nexport const PRESENCE_META: Record<Presence, PresenceMeta> = {\n  tracking: {\n    label: 'Tracking time',\n    color: 'var(--primary)',\n    icon: ClockIcon,\n  },\n  online: { label: 'Online', color: 'var(--success)', icon: CheckIcon },\n  away: { label: 'Away', color: 'var(--warning)', icon: MoonIcon },\n  offline: {\n    label: 'Offline',\n    color: 'var(--muted-foreground)',\n    icon: MinusIcon,\n  },\n};\n\ntype AvatarSize = 'xs' | 'sm' | 'md' | 'lg';\n\nconst AVATAR_SIZE: Record<AvatarSize, string> = {\n  xs: 'size-5',\n  sm: 'size-6',\n  md: 'size-8',\n  lg: 'size-12',\n};\n\nconst BADGE_SIZE: Record<AvatarSize, string> = {\n  xs: 'size-2.5 [&_svg]:size-1.5',\n  sm: 'size-3 [&_svg]:size-2',\n  md: 'size-3.5 [&_svg]:size-2',\n  lg: 'size-4.5 [&_svg]:size-3',\n};\n\ntype PersonAvatarProps = {\n  person: Pick<Person, 'name'>;\n  size?: AvatarSize;\n  /** Drawn as a small glyph on the avatar, never as a plain dot; its label is read by screen readers. */\n  presence?: Presence;\n  className?: string;\n};\n\nexport function PersonAvatar({\n  person,\n  size = 'md',\n  presence,\n  className,\n}: PersonAvatarProps) {\n  return (\n    <span className={cn('relative inline-flex shrink-0', className)}>\n      <Avatar className={AVATAR_SIZE[size]} seed={person.name} />\n      {presence && <PresenceGlyph presence={presence} size={size} />}\n    </span>\n  );\n}\n\nfunction PresenceGlyph({\n  presence,\n  size,\n}: {\n  presence: Presence;\n  size: AvatarSize;\n}) {\n  const meta = PRESENCE_META[presence];\n  const Glyph = meta.icon;\n  const badgeStyle = { '--chip': meta.color } as React.CSSProperties;\n\n  return (\n    <>\n      <span className='absolute -right-0.5 -bottom-0.5 flex rounded-full bg-[var(--aside-surface,var(--popover))] p-px'>\n        <span\n          style={badgeStyle}\n          className={cn(\n            'chip-3d flex items-center justify-center rounded-full',\n            BADGE_SIZE[size]\n          )}\n        >\n          <Glyph strokeWidth={2.75} />\n        </span>\n      </span>\n      <span className='sr-only'>{meta.label}</span>\n    </>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/person-avatar.tsx"
    },
    {
      "path": "registry/ndeko/components/aside/_parts/task-meta.tsx",
      "content": "import {\n  BookmarkIcon,\n  CheckIcon,\n  ChevronDownIcon,\n  ChevronUpIcon,\n  CircleAlertIcon,\n  CircleCheckIcon,\n  CircleDashedIcon,\n  CircleIcon,\n  EclipseIcon,\n  EyeIcon,\n  MinusIcon,\n  TriangleAlertIcon,\n  ZapIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nexport type Meta = { label: string; color: string; icon: Icon };\n\nexport type StatusId =\n  'backlog' | 'todo' | 'in-progress' | 'in-review' | 'done';\n\nexport type PriorityId = 'urgent' | 'high' | 'medium' | 'low';\n\nexport type IssueType = 'task' | 'bug' | 'story' | 'epic';\n\nexport const STATUS_ORDER: StatusId[] = [\n  'backlog',\n  'todo',\n  'in-progress',\n  'in-review',\n  'done',\n];\n\nexport const STATUS_META: Record<StatusId, Meta> = {\n  backlog: {\n    label: 'Backlog',\n    color: 'var(--muted-foreground)',\n    icon: CircleDashedIcon,\n  },\n  todo: { label: 'Todo', color: 'var(--info)', icon: CircleIcon },\n  'in-progress': {\n    label: 'In progress',\n    color: 'var(--warning)',\n    icon: EclipseIcon,\n  },\n  'in-review': { label: 'In review', color: 'var(--primary)', icon: EyeIcon },\n  done: { label: 'Done', color: 'var(--success)', icon: CircleCheckIcon },\n};\n\nexport const PRIORITY_ORDER: PriorityId[] = ['urgent', 'high', 'medium', 'low'];\n\nexport const PRIORITY_META: Record<PriorityId, Meta> = {\n  urgent: {\n    label: 'Urgent',\n    color: 'var(--destructive)',\n    icon: TriangleAlertIcon,\n  },\n  high: { label: 'High', color: 'var(--warning)', icon: ChevronUpIcon },\n  medium: { label: 'Medium', color: 'var(--info)', icon: MinusIcon },\n  low: {\n    label: 'Low',\n    color: 'var(--muted-foreground)',\n    icon: ChevronDownIcon,\n  },\n};\n\nexport const ISSUE_TYPE_META: Record<IssueType, Meta> = {\n  task: { label: 'Task', color: 'var(--info)', icon: CheckIcon },\n  bug: { label: 'Bug', color: 'var(--destructive)', icon: CircleAlertIcon },\n  story: { label: 'Story', color: 'var(--success)', icon: BookmarkIcon },\n  epic: { label: 'Epic', color: 'var(--primary)', icon: ZapIcon },\n};\n\nexport function isStatusId(value: unknown): value is StatusId {\n  return STATUS_ORDER.some((status) => status === value);\n}\n\nexport function IssueTypeGem({\n  type,\n  className,\n}: {\n  type: IssueType;\n  className?: string;\n}) {\n  const meta = ISSUE_TYPE_META[type];\n  const TypeGlyph = meta.icon;\n  const gemStyle = { '--gem': meta.color } as React.CSSProperties;\n\n  return (\n    <span\n      style={gemStyle}\n      className={cn(\n        'gem-plate inline-flex size-4 shrink-0 items-center justify-center rounded-[4px]',\n        className\n      )}\n    >\n      <TypeGlyph className='size-2.5' strokeWidth={2.75} />\n      <span className='sr-only'>{meta.label}</span>\n    </span>\n  );\n}\n\nexport function MetaGlyph({\n  meta,\n  className,\n}: {\n  meta: Meta;\n  className?: string;\n}) {\n  const Glyph = meta.icon;\n  const glyphStyle = { color: meta.color } as React.CSSProperties;\n\n  return (\n    <Glyph\n      style={glyphStyle}\n      strokeWidth={2.25}\n      className={cn('size-3.5 shrink-0', className)}\n    />\n  );\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/task-meta.tsx"
    }
  ],
  "categories": [
    "components",
    "aside"
  ],
  "type": "registry:component"
}