{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "result-notice",
  "type": "registry:ui",
  "title": "Result Notice",
  "description": "Says a chart or timeline shows only part of the result.",
  "categories": [
    "feedback"
  ],
  "dependencies": [
    "@hugeicons/core-free-icons@4.4.0",
    "@hugeicons/react@1.1.10"
  ],
  "registryDependencies": [
    "https://sprout.tulipfarm.ai/r/sprout-base.json"
  ],
  "files": [
    {
      "path": "registry/sprout/components/ui/result-notice.tsx",
      "type": "registry:ui",
      "target": "components/ui/result-notice.tsx",
      "content": "import type { ComponentProps, ReactNode } from 'react';\nimport { InfoIcon } from '@/lib/sprout/icons/info-icon';\nimport { cn } from '@/lib/sprout/classes';\n\nexport interface ResultNoticeProps extends Omit<ComponentProps<'div'>, 'children'> {\n  shown: number;\n  total: number | string;\n  noun: string;\n  action?: ReactNode;\n}\n\nconst countPattern = /^(\\d+)(\\+?)$/;\n\nconst formatCount = (value: number | string) => {\n  if (typeof value === 'number') return value.toLocaleString('en-US');\n  const match = countPattern.exec(value.trim());\n  return match ? `${Number(match[1]).toLocaleString('en-US')}${match[2]}` : value;\n};\n\nconst exactCount = (value: number | string) => {\n  if (typeof value === 'number') return value;\n  const match = countPattern.exec(value.trim());\n  return match && !match[2] ? Number(match[1]) : undefined;\n};\n\nexport function ResultNotice({ shown, total, noun, action, className, ...props }: ResultNoticeProps) {\n  const exact = exactCount(total);\n  if (exact !== undefined && exact <= shown) return null;\n  return (\n    <div data-slot=\"result-notice\" className={cn('sprout-result-notice', className)} {...props}>\n      <div className=\"sprout-result-notice-content\">\n        <InfoIcon aria-hidden=\"true\" className=\"sprout-result-notice-icon\" />\n        <p role=\"status\" data-slot=\"result-notice-message\" className=\"sprout-result-notice-message\">\n          {shown === 1 ? (\n            'Showing the first of '\n          ) : (\n            <>\n              Showing the first <strong>{formatCount(shown)}</strong> of{' '}\n            </>\n          )}\n          <strong>{formatCount(total)}</strong> {noun}.\n        </p>\n      </div>\n      {action != null && action !== false && (\n        <div data-slot=\"result-notice-action\" className=\"sprout-result-notice-action\">\n          {action}\n        </div>\n      )}\n    </div>\n  );\n}\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/create-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/create-icon.tsx",
      "content": "import { HugeiconsIcon, type IconSvgElement } from '@hugeicons/react';\nimport type { ReactElement, Ref, SVGProps } from 'react';\n\nexport const iconSizes = {\n  xs: 12,\n  sm: 14,\n  md: 16,\n  lg: 18,\n  xl: 20,\n  '2xl': 24,\n} as const;\n\nexport type IconSize = keyof typeof iconSizes;\n\nexport const iconStrokeWidth = 1.5;\n\nexport type IconProps = Omit<SVGProps<SVGSVGElement>, 'ref'> & {\n  size?: IconSize | number;\n  ref?: Ref<SVGSVGElement>;\n};\n\nexport type IconComponent = (props: IconProps) => ReactElement;\n\nexport function createIcon(glyph: IconSvgElement, name: string): IconComponent {\n  const Icon = ({ size = '2xl', strokeWidth = iconStrokeWidth, ...props }: IconProps) => (\n    <HugeiconsIcon\n      icon={glyph}\n      size={typeof size === 'number' ? size : iconSizes[size]}\n      strokeWidth={Number(strokeWidth)}\n      {...props}\n    />\n  );\n  Icon.displayName = name;\n  return Icon;\n}\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/info-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/info-icon.tsx",
      "content": "import { InformationCircleIcon as glyph } from '@hugeicons/core-free-icons';\nimport { createIcon } from '@/lib/sprout/icons/create-icon';\n\nexport const InfoIcon = /* @__PURE__ */ createIcon(glyph, 'InfoIcon');\n"
    }
  ],
  "css": {
    "@layer components": {
      ".sprout-result-notice": {
        "box-sizing": "border-box",
        "border": "1px solid var(--sprout-line)",
        "border-radius": "calc(var(--sprout-radius-control) + 2px)",
        "background": "var(--sprout-surface)",
        "width": "100%",
        "min-width": "0",
        "min-height": "36px",
        "color": "var(--sprout-muted)",
        "font-family": "var(--sprout-font)",
        "font-size": "var(--sprout-text-sm)",
        "font-variant-numeric": "tabular-nums",
        "flex-wrap": "wrap",
        "align-items": "center",
        "gap": "4px 12px",
        "padding": "3px 3px 3px 10px",
        "line-height": "1.25rem",
        "display": "flex"
      },
      ".sprout-result-notice:not(:has( > [data-slot=\"result-notice-action\"]))": {
        "padding-inline-end": "10px"
      },
      ".sprout-result-notice-content": {
        "flex": "16rem",
        "align-items": "flex-start",
        "gap": "8px",
        "min-width": "0",
        "padding-block": "4px",
        "display": "flex"
      },
      ".sprout-result-notice-icon": {
        "flex-shrink": "0",
        "width": "16px",
        "height": "16px",
        "translate": "0 2px"
      },
      ".sprout-result-notice-message": {
        "overflow-wrap": "anywhere",
        "min-width": "0",
        "margin": "0"
      },
      ".sprout-result-notice-message strong": {
        "color": "var(--sprout-text)",
        "font-weight": "500"
      },
      ".sprout-result-notice-action": {
        "flex-wrap": "wrap",
        "flex-shrink": "0",
        "align-items": "center",
        "gap": "8px",
        "min-width": "0",
        "padding-inline-start": "14px",
        "display": "flex"
      },
      "@media (forced-colors: active)": {
        ".sprout-result-notice": {
          "border-color": "canvastext"
        }
      },
      "@media (prefers-reduced-motion: no-preference)": {
        ".sprout-result-notice": {
          "animation": "sprout-result-notice-in var(--sprout-motion-normal) var(--sprout-motion-ease)"
        }
      },
      "@keyframes sprout-result-notice-in": {
        "from": {
          "opacity": "0",
          "transform": "translateY(-2px)"
        }
      }
    }
  },
  "docs": "Docs and examples: https://sprout.tulipfarm.ai/components/result-notice/",
  "meta": {
    "source": "packages/sprout/src/components/result-notice.tsx"
  }
}
