{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chip-group",
  "type": "registry:ui",
  "title": "ChipGroup",
  "description": "چیپ‌های فیلتر روشن و خاموش‌شونده، مثل دسته‌بندی‌ها یا وضعیت سفارش",
  "dependencies": [
    "@kashi-ui/persian@^1.8.0"
  ],
  "registryDependencies": [
    "https://kashi.sepantapouya.com/r/cx.json"
  ],
  "files": [
    {
      "path": "registry/kashi/ChipGroup.tsx",
      "type": "registry:ui",
      "target": "components/kashi/ChipGroup.tsx",
      "content": "\"use client\";\n\nimport { useState, type ReactNode } from \"react\";\nimport { toFaDigits } from \"@kashi-ui/persian\";\nimport { cx } from \"./cx\";\n\nexport interface ChipOption {\n  value: string;\n  label: ReactNode;\n  icon?: ReactNode;\n  /** تعداد نتیجه‌ها کنار برچسب */\n  count?: number;\n  disabled?: boolean;\n}\n\nexport interface ChipGroupProps {\n  options: ChipOption[];\n  /** مقدارهای انتخاب‌شده */\n  value?: string[];\n  defaultValue?: string[];\n  onChange?: (value: string[]) => void;\n  /** فقط یک انتخاب؛ کلیک دوباره انتخاب را برمی‌دارد */\n  single?: boolean;\n  \"aria-label\"?: string;\n  className?: string;\n}\n\nconst Check = () => (\n  <svg className=\"k-chip__check\" viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\"><path d=\"m5 10.5 3.2 3L15 7\" /></svg>\n);\n\n/** چیپ‌های فیلتر روشن و خاموش‌شونده، مثل دسته‌بندی‌ها یا وضعیت سفارش */\nexport function ChipGroup({ options, value, defaultValue = [], onChange, single, \"aria-label\": ariaLabel, className }: ChipGroupProps) {\n  const [inner, setInner] = useState(defaultValue);\n  const current = value ?? inner;\n  const toggle = (v: string) => {\n    const on = current.includes(v);\n    const next = single ? (on ? [] : [v]) : on ? current.filter((x) => x !== v) : [...current, v];\n    if (value === undefined) setInner(next);\n    onChange?.(next);\n  };\n  return (\n    <div role=\"group\" aria-label={ariaLabel} className={cx(\"k-chips\", className)}>\n      {options.map((o) => (\n        <button key={o.value} type=\"button\" className=\"k-chip\" aria-pressed={current.includes(o.value)} disabled={o.disabled} onClick={() => toggle(o.value)}>\n          <Check />\n          {o.icon}\n          {o.label}\n          {o.count !== undefined && <span className=\"k-chip__count\">{toFaDigits(o.count)}</span>}\n        </button>\n      ))}\n    </div>\n  );\n}\n"
    }
  ]
}