{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "loader",
  "type": "registry:ui",
  "title": "Loader",
  "description": "Show indeterminate activity beside task feedback.",
  "dependencies": [],
  "registryDependencies": [
    "https://ghost-ui.com/r/ghost-tokens.json",
    "https://ghost-ui.com/r/foundation.json"
  ],
  "files": [
    {
      "path": "src/components/ui/loader.tsx",
      "type": "registry:component",
      "target": "@ui/loader.tsx",
      "content": "import \"./foundation.css\";\nimport * as React from 'react'\nimport './loader.css'\n\nexport type LoaderType = 'spinner' | 'petals' | 'dots' | 'flower' | 'orbit' | 'bars'\nexport type LoaderProps = Omit<React.ComponentPropsWithRef<'svg'>, 'role' | 'aria-label' | 'type'> & {\n  type?: LoaderType\n  size?: 'sm' | 'default' | 'lg' | number\n  label?: string\n}\n\nconst sizeValue = (size: LoaderProps['size']) => typeof size === 'number' && Number.isFinite(size) && size > 0 ? size : size === 'sm' ? 16 : size === 'lg' ? 24 : 20\nconst segmentCount = { petals: 8, dots: 8, flower: 6, orbit: 8, bars: 12 }\n\nfunction geometry(type: Exclude<LoaderType, 'spinner'>) {\n  switch (type) {\n    case 'petals': return <ellipse cx=\"12\" cy=\"4\" rx=\"2\" ry=\"3\" />\n    case 'dots': return <circle cx=\"12\" cy=\"3.8\" r=\"1.8\" />\n    case 'flower': return <path d=\"M12 1C8 1 9 7 12 9C15 7 16 1 12 1Z\" />\n    case 'orbit': return <ellipse cx=\"12\" cy=\"4\" rx=\"3\" ry=\"1.8\" />\n    case 'bars': return <rect x=\"11\" y=\"1\" width=\"2\" height=\"6\" rx=\"1\" />\n  }\n}\n\nexport const Loader = React.forwardRef<SVGSVGElement, LoaderProps>(function Loader({ type = 'spinner', size = 'default', label, className, children, ...props }, ref) {\n  const px = sizeValue(size)\n  const accessibleLabel = label?.trim()\n  const count = type === 'spinner' ? 0 : segmentCount[type]\n  return <svg ref={ref} className={`ui-loader${className ? ` ${className}` : ''}`} width={px} height={px} viewBox=\"0 0 24 24\" fill=\"none\" {...props} data-type={type} role={accessibleLabel ? 'status' : undefined} aria-label={accessibleLabel || undefined} aria-hidden={accessibleLabel ? undefined : true} focusable=\"false\">\n    {type === 'spinner' ? <g className=\"ui-loader__spinner\">{children ?? <><circle className=\"ui-loader__track\" cx=\"12\" cy=\"12\" r=\"9\" /><path className=\"ui-loader__arc\" d=\"M12 3a9 9 0 0 1 9 9\" /></>}</g> : children ?? Array.from({ length: count }, (_, index) => <g key={index} className=\"ui-loader__segment\" transform={`rotate(${index * 360 / count} 12 12)`} style={{ animationDelay: `${index / count - 1}s` }}>{geometry(type)}</g>)}\n  </svg>\n})\nexport default Loader\n\nexport interface TypingDotsProps extends React.HTMLAttributes<HTMLSpanElement> {}\n\n/** Three bouncing dots; a typing indicator for message bubbles. */\nexport const TypingDots = React.forwardRef<HTMLSpanElement, TypingDotsProps>(function TypingDots({ className, children, ...props }, ref) {\n  return <span {...props} ref={ref} aria-hidden=\"true\" className={`ui-typing-dots${className ? ` ${className}` : ''}`}>{children ?? [<span key={0} />, <span key={1} />, <span key={2} />]}</span>;\n})\n\nexport interface EllipsisProps extends React.HTMLAttributes<HTMLSpanElement> {}\n\n/** Three revealing periods; a thinking state for pending text. */\nexport const Ellipsis = React.forwardRef<HTMLSpanElement, EllipsisProps>(function Ellipsis({ className, children, ...props }, ref) {\n  return <span {...props} ref={ref} aria-hidden=\"true\" className={`ui-ellipsis${className ? ` ${className}` : ''}`}>{children ?? [<span key={0}>.</span>, <span key={1}>.</span>, <span key={2}>.</span>]}</span>;\n})\n"
    },
    {
      "path": "src/components/ui/loader.css",
      "type": "registry:file",
      "target": "@ui/loader.css",
      "content": ".ui-loader{display:inline-block;flex:0 0 auto;color:inherit}\n.ui-loader__spinner{transform-box:view-box;transform-origin:50% 50%;animation:ui-loader-rotate .8s linear infinite}\n.ui-loader__track{stroke:currentColor;stroke-width:2;opacity:.2}\n.ui-loader__arc{stroke:currentColor;stroke-width:2;stroke-linecap:round}\n.ui-loader__segment{fill:currentColor;opacity:.2;animation:ui-loader-fade 1s linear infinite}\n@keyframes ui-loader-rotate{to{transform:rotate(360deg)}}\n@keyframes ui-loader-fade{from{opacity:1}to{opacity:.2}}\n@media(prefers-reduced-motion:reduce){.ui-loader__spinner,.ui-loader__segment{animation:none}}\n.ui-typing-dots{display:inline-flex;align-items:center;gap:.3em;vertical-align:middle;flex-shrink:0}\n.ui-typing-dots>span{display:inline-block;width:.3em;height:.3em;border-radius:50%;aspect-ratio:1/1;background:currentColor;flex-shrink:0;animation:ui-typing-bounce 1.2s cubic-bezier(.4, 0, .2, 1) infinite backwards}\n.ui-typing-dots>span:nth-child(2){animation-delay:120ms}\n.ui-typing-dots>span:nth-child(3){animation-delay:240ms}\n@keyframes ui-typing-bounce{0%,30%,100%{translate:0 0;opacity:.25}15%{translate:0 -.28em;opacity:1}}\n.ui-ellipsis{display:inline-flex;gap:0}\n.ui-ellipsis>span{display:inline-block;min-width:.18em;animation:ui-ellipsis-steps-1 1.2s steps(1, end) infinite}\n.ui-ellipsis>span:nth-child(2){animation-name:ui-ellipsis-steps-2}\n.ui-ellipsis>span:nth-child(3){animation-name:ui-ellipsis-steps-3}\n/* Hide glyphs as well as ink so a parent text-clipped shimmer cannot paint hidden periods. */\n@keyframes ui-ellipsis-steps-1{0%,50%{visibility:visible}75%,100%{visibility:hidden}}\n@keyframes ui-ellipsis-steps-2{0%{visibility:hidden}25%,50%{visibility:visible}75%,100%{visibility:hidden}}\n@keyframes ui-ellipsis-steps-3{0%,25%{visibility:hidden}50%{visibility:visible}75%,100%{visibility:hidden}}\n@media(prefers-reduced-motion:reduce),(forced-colors:active){.ui-typing-dots>span,.ui-ellipsis>span{animation:none;opacity:1;translate:0 0;visibility:visible}}\n"
    }
  ]
}
