{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "select",
  "type": "registry:ui",
  "title": "Select",
  "description": "فهرست انتخابی روی <select> بومی: در گوشی انتخاب‌گر سیستم باز می‌شود و صفحه‌خوان کامل پشتیبانی می‌کند",
  "registryDependencies": [
    "https://kashi.sepantapouya.com/r/cx.json",
    "https://kashi.sepantapouya.com/r/field.json"
  ],
  "files": [
    {
      "path": "registry/kashi/Select.tsx",
      "type": "registry:ui",
      "target": "components/kashi/Select.tsx",
      "content": "\"use client\";\n\nimport { forwardRef, useId, type ReactNode, type SelectHTMLAttributes } from \"react\";\nimport { cx } from \"./cx\";\nimport { Field, describedBy } from \"./Field\";\n\nexport interface SelectOption { value: string; label: ReactNode; disabled?: boolean }\n\nexport interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, \"size\"> {\n  label?: ReactNode;\n  hint?: ReactNode;\n  error?: ReactNode;\n  /** گزینهٔ خالی اول، مثل «انتخاب کنید» */\n  placeholder?: string;\n  /** گزینه‌ها؛ یا به‌جای آن <option> را به‌عنوان children بدهید */\n  options?: SelectOption[];\n  /** @default \"md\" */\n  size?: \"sm\" | \"md\" | \"lg\";\n  fieldClassName?: string;\n}\n\n/** فهرست انتخابی روی <select> بومی: در گوشی انتخاب‌گر سیستم باز می‌شود و صفحه‌خوان کامل پشتیبانی می‌کند */\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(\n  { label, hint, error, placeholder, options, size = \"md\", id, required, className, fieldClassName, children, \"aria-describedby\": extra, ...rest },\n  ref,\n) {\n  const autoId = useId();\n  const selectId = id ?? autoId;\n  const placeholderSelected = placeholder !== undefined && rest.value === undefined && rest.defaultValue === undefined;\n  return (\n    <Field id={selectId} label={label} hint={hint} error={error} required={required} className={fieldClassName}>\n      <div className={cx(\"k-select\", size !== \"md\" && `k-select--${size}`, className)}>\n        <select\n          ref={ref}\n          id={selectId}\n          className=\"k-select__control\"\n          required={required}\n          aria-invalid={error ? true : undefined}\n          aria-describedby={describedBy(selectId, hint, error, extra)}\n          defaultValue={placeholderSelected ? \"\" : undefined}\n          {...rest}\n        >\n          {placeholder !== undefined && <option value=\"\" disabled>{placeholder}</option>}\n          {options?.map((o) => (\n            <option key={o.value} value={o.value} disabled={o.disabled}>{o.label}</option>\n          ))}\n          {children}\n        </select>\n      </div>\n    </Field>\n  );\n});\n"
    }
  ]
}