{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "empty",
  "title": "Empty",
  "description": "What shows where a list, a page or a panel has nothing in it: a picture, what belongs there and the next step. It rises into place when it comes back in place of content just cleared or filtered away.",
  "dependencies": [
    "@ui-sdk/react",
    "@ui-sdk/core",
    "class-variance-authority"
  ],
  "registryDependencies": [
    "https://kinoui.com/r/icon-tile.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/empty.tsx",
      "content": "'use client'\n\nimport { IconTile } from '@/registry/components/kino/icon-tile'\nimport { mergeProps, type PartProps, renderElement } from '@ui-sdk/react/primitive'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { type ReactNode, useState } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * The empty state: a picture, the title, a line on what belongs there and the\n * next step, all in the middle of the space it fills. The picture is an icon\n * in a tile, or the same icon in a stack of outlined rows that shows a list\n * waiting for its rows. One that comes back after being hidden rises\n * `--empty-rise` into place on `enter`, its picture landing as it comes and\n * the actions a moment after the words. `--empty-wait: 1` holds the entrance\n * back while what it replaces leaves on `exit`, as a table's rows do.\n */\n\nconst emptyVariants = cva(\n  'group/empty flex min-w-0 flex-1 flex-col items-center justify-center gap-(--surface-gap) p-(--surface-padding-lg) text-center',\n  {\n    variants: {\n      variant: {\n        default: '',\n        /** A dashed edge, for an empty state that shares the page with other content. */\n        outline: 'rounded-(--surface-radius) border border-dashed',\n      },\n    },\n    defaultVariants: { variant: 'default' },\n  },\n)\n\ninterface Arrival {\n  show: boolean | undefined\n  /** It has just come back, so its entrance plays. */\n  arrived: boolean\n}\n\n/**\n * What an empty state knows after its `show` changes to `show`. It has just\n * come back when it was hidden (`false`) and now shows, as when a list loses\n * its last row or a search stops matching. One that shows from the start, or\n * whose `show` is left out, is simply there, so nothing moves when a page\n * opens with it.\n */\nfunction arrivalAfter(previous: Arrival, show: boolean | undefined): Arrival {\n  if (previous.show === show) return previous\n  return { show, arrived: previous.show === false && show === true }\n}\n\nfunction useArrived(show: boolean | undefined) {\n  const [seen, setSeen] = useState<Arrival>({ show, arrived: false })\n  const next = arrivalAfter(seen, show)\n  if (next !== seen) setSeen(next)\n  return next.arrived\n}\n\n/** A long unbroken word breaks rather than run out of the box. */\nfunction EmptyTitle({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<'div'>, 'className'> & { className?: string }) {\n  return renderElement(\n    'div',\n    mergeProps(\n      {\n        'data-slot': 'empty-title',\n        className: cn(\n          'text-base leading-snug font-medium text-balance wrap-anywhere',\n          className,\n        ),\n      },\n      props,\n    ),\n    render,\n  )\n}\n\nfunction EmptyDescription({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<'p'>, 'className'> & { className?: string }) {\n  return renderElement(\n    'p',\n    mergeProps(\n      {\n        'data-slot': 'empty-description',\n        className: cn(\n          'text-muted-foreground *:[a]:hover:text-foreground text-sm text-pretty wrap-anywhere *:[a]:underline *:[a]:underline-offset-3',\n          className,\n        ),\n      },\n      props,\n    ),\n    render,\n  )\n}\n\nfunction Empty({\n  className,\n  variant,\n  show,\n  render,\n  ...props\n}: Omit<PartProps<'div'>, 'className'> & { className?: string } & VariantProps<\n    typeof emptyVariants\n  > & {\n    /**\n     * Whether it shows. Given, it stays mounted while hidden and plays its\n     * entrance when it comes back, such as when a list loses its last row or\n     * a search stops matching; one that shows from the start is simply there.\n     * Left out, it always shows and never moves.\n     */\n    show?: boolean\n  }) {\n  const arrived = useArrived(show)\n  const element = renderElement(\n    'div',\n    mergeProps(\n      {\n        'data-slot': 'empty',\n        'data-arrived': arrived ? '' : undefined,\n        className: cn(emptyVariants({ variant }), className),\n      },\n      props,\n    ),\n    render,\n  )\n  return show === false ? null : element\n}\n\nfunction EmptyHeader({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<'div'>, 'className'> & { className?: string }) {\n  return renderElement(\n    'div',\n    mergeProps(\n      {\n        'data-slot': 'empty-header',\n        className: cn(\n          'flex w-full max-w-sm min-w-0 flex-col items-center gap-1.5 transition-[opacity,translate] [transition-delay:calc(var(--motion-exit-duration)*var(--empty-wait,0))] duration-(--motion-enter-duration) ease-(--motion-enter-easing) group-data-arrived/empty:starting:opacity-0 motion-safe:group-data-arrived/empty:starting:translate-y-(--empty-rise,0.5rem)',\n          className,\n        ),\n      },\n      props,\n    ),\n    render,\n  )\n}\n\n/** An outlined row: a picture's place and two lines of text. */\nconst rowClassName =\n  'bg-card flex h-12 w-full items-center gap-2.5 rounded-(--surface-radius) border px-2.5 shadow-xs'\n\nconst barClassName = 'bg-muted h-1.5 rounded-full'\n\n/**\n * A row behind the first: scaled down from its top edge and lifted, so its top\n * shows above the row in front. It starts hidden behind that row.\n */\nconst backRowClassName =\n  'col-start-1 row-start-1 origin-top transition-[translate,scale,opacity] [transition-delay:calc(var(--motion-exit-duration)*var(--empty-wait,0))] duration-(--motion-enter-duration) ease-(--motion-enter-easing) group-data-arrived/empty:starting:opacity-0 motion-safe:group-data-arrived/empty:starting:translate-y-0 motion-safe:group-data-arrived/empty:starting:scale-100'\n\nfunction BackRow({ className }: { className: string }) {\n  return (\n    <div className={cn(rowClassName, backRowClassName, className)}>\n      <IconTile size='sm' />\n      <div className='flex flex-1 flex-col gap-1.5'>\n        <div className={cn(barClassName, 'w-3/5')} />\n        <div className={cn(barClassName, 'w-2/5 opacity-60')} />\n      </div>\n    </div>\n  )\n}\n\nconst emptyMediaVariants = cva(\n  'mb-2.5 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0',\n  {\n    variants: {\n      variant: {\n        /** Whatever it holds, as it is: an avatar, a picture. */\n        default: '',\n        /** An icon in an Icon tile, which lands as the empty state comes back. */\n        icon: '',\n        /**\n         * An icon in the first of three outlined rows, the two behind it\n         * smaller and fainter, so the space reads as a list waiting for its\n         * rows. They fan out from behind the first as it comes back.\n         */\n        stack: 'grid w-56 max-w-full grid-cols-1 pt-5',\n      },\n    },\n    defaultVariants: { variant: 'default' },\n  },\n)\n\n/** Decorative: the title says what it shows. */\nfunction EmptyMedia({\n  className,\n  variant,\n  render,\n  children,\n  ...props\n}: Omit<PartProps<'div'>, 'className' | 'children'> & {\n  className?: string\n  children?: ReactNode\n} & VariantProps<typeof emptyMediaVariants>) {\n  return renderElement(\n    'div',\n    mergeProps(\n      {\n        'data-slot': 'empty-media',\n        'data-variant': variant ?? 'default',\n        className: cn(emptyMediaVariants({ variant }), className),\n        'aria-hidden': true,\n        children:\n          variant === 'stack' ? (\n            <>\n              <BackRow className='-translate-y-5 scale-84 opacity-40' />\n              <BackRow className='-translate-y-2.5 scale-92 opacity-70' />\n              <div className={cn(rowClassName, 'relative col-start-1 row-start-1')}>\n                <IconTile size='sm'>{children}</IconTile>\n                <div className='flex flex-1 flex-col gap-1.5'>\n                  <div className={cn(barClassName, 'bg-foreground/15 w-3/5')} />\n                  <div className={cn(barClassName, 'w-2/5')} />\n                </div>\n              </div>\n            </>\n          ) : variant === 'icon' ? (\n            <IconTile\n              size='lg'\n              className='transition-[scale] [transition-delay:calc(var(--motion-exit-duration)*var(--empty-wait,0))] duration-(--motion-enter-duration) ease-(--motion-enter-easing) motion-safe:group-data-arrived/empty:starting:scale-95'\n            >\n              {children}\n            </IconTile>\n          ) : (\n            children\n          ),\n      },\n      props,\n    ),\n    render,\n  )\n}\n\n/** The next step: one action, a second where there are two real paths, and a link. */\nfunction EmptyContent({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<'div'>, 'className'> & { className?: string }) {\n  return renderElement(\n    'div',\n    mergeProps(\n      {\n        'data-slot': 'empty-content',\n        className: cn(\n          'flex w-full max-w-sm min-w-0 flex-wrap items-center justify-center gap-2 text-sm transition-[opacity,translate] [transition-delay:calc(var(--motion-exit-duration)*var(--empty-wait,0)+var(--motion-enter-duration)*0.15)] duration-(--motion-enter-duration) ease-(--motion-enter-easing) group-data-arrived/empty:starting:opacity-0 motion-safe:group-data-arrived/empty:starting:translate-y-(--empty-rise,0.5rem)',\n          className,\n        ),\n      },\n      props,\n    ),\n    render,\n  )\n}\n\nexport {\n  Empty,\n  EmptyContent,\n  EmptyDescription,\n  EmptyHeader,\n  EmptyMedia,\n  emptyMediaVariants,\n  EmptyTitle,\n  emptyVariants,\n}\n\nexport { arrivalAfter }\n",
      "type": "registry:component",
      "target": "@components/kino/empty.tsx"
    }
  ],
  "type": "registry:component"
}