{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "guest-count-picker",
  "title": "Guest Count Picker",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/guest-count-picker/GuestCountPicker.tsx",
      "content": "import { View, type ViewProps } from 'react-native'\nimport { QuantityStepper } from '@/components/ui/quantity-stepper'\nimport { Text } from '@/components/ui/text'\nimport { cn } from '@/lib/utils'\n\nexport interface GuestCounts {\n  adults: number\n  children: number\n  infants: number\n}\n\nexport interface GuestCountGroup {\n  label?: string\n  /** The booking provider's own age range or attendance rule. */\n  detail?: string\n  max?: number\n  incrementLabel?: string\n  decrementLabel?: string\n}\n\nexport interface GuestCountPickerProps extends Omit<ViewProps, 'children'> {\n  className?: string\n  title?: string\n  value: GuestCounts\n  /** Total capacity across all three groups, including infants. */\n  maxGuests?: number\n  groups?: Partial<Record<keyof GuestCounts, GuestCountGroup>>\n  disabled?: boolean\n  formatCapacity?: (total: number, maxGuests: number) => string\n  formatGroupLimit?: (max: number) => string\n  onValueChange: (value: GuestCounts) => void\n}\n\nconst groupDefinitions = [\n  { key: 'adults', label: 'Adults', detail: 'Ages 13 and over', min: 1 },\n  { key: 'children', label: 'Children', detail: 'Ages 2–12', min: 0 },\n  { key: 'infants', label: 'Infants', detail: 'Under 2', min: 0 },\n] as const\nconst formatter = new Intl.NumberFormat()\n\nfunction count(value: number, minimum: number) {\n  return Number.isSafeInteger(value) ? Math.max(minimum, value) : minimum\n}\n\nexport function GuestCountPicker({\n  className,\n  title = 'Guests',\n  value,\n  maxGuests = 8,\n  groups,\n  disabled = false,\n  formatCapacity,\n  formatGroupLimit,\n  onValueChange,\n  ...props\n}: GuestCountPickerProps) {\n  const capacity = Number.isSafeInteger(maxGuests) ? Math.max(1, maxGuests) : 8\n  const counts = {\n    adults: count(value.adults, 1),\n    children: count(value.children, 0),\n    infants: count(value.infants, 0),\n  }\n  const total = counts.adults + counts.children + counts.infants\n  const remaining = Math.max(0, capacity - total)\n\n  return (\n    <View {...props} className={cn('gap-[16px]', className)}>\n      <View className=\"gap-[4px]\">\n        <Text size=\"title\" accessibilityRole=\"header\">\n          {title}\n        </Text>\n        <Text variant=\"muted\">\n          {formatCapacity?.(total, capacity) ?? `${formatter.format(total)} of ${formatter.format(capacity)} guests`}\n        </Text>\n      </View>\n      <View className=\"rounded-lg border border-border bg-card\">\n        {groupDefinitions.map(({ key, label: defaultLabel, detail: defaultDetail, min }, index) => {\n          const group = groups?.[key]\n          const current = counts[key]\n          const label = group?.label ?? defaultLabel\n          const detail = group?.detail ?? defaultDetail\n          const configuredLimit = group?.max\n          const limit =\n            configuredLimit !== undefined && Number.isSafeInteger(configuredLimit)\n              ? Math.max(min, Math.min(capacity, configuredLimit))\n              : capacity\n          const max = Math.max(current, Math.min(limit, current + remaining))\n          const rule =\n            configuredLimit === undefined\n              ? undefined\n              : (formatGroupLimit?.(limit) ?? `Maximum ${formatter.format(limit)}`)\n          return (\n            <View\n              key={key}\n              className={cn(\n                'flex-row flex-wrap items-center justify-between gap-[12px] p-[16px]',\n                index > 0 && 'border-t border-border',\n              )}\n            >\n              <View className=\"min-w-[95px] flex-1 gap-[4px]\">\n                <Text className=\"font-semibold text-card-foreground\">{label}</Text>\n                {detail ? (\n                  <Text size=\"sm\" variant=\"muted\">\n                    {detail}\n                  </Text>\n                ) : null}\n                {rule ? (\n                  <Text size=\"sm\" variant=\"muted\">\n                    {rule}\n                  </Text>\n                ) : null}\n              </View>\n              <QuantityStepper\n                accessibilityLabel={label}\n                accessibilityHint={[detail, rule].filter(Boolean).join('. ') || undefined}\n                decrementLabel={group?.decrementLabel ?? `Decrease ${label.toLocaleLowerCase()}`}\n                incrementLabel={group?.incrementLabel ?? `Increase ${label.toLocaleLowerCase()}`}\n                disabled={disabled}\n                min={min}\n                max={max}\n                value={current}\n                onValueChange={(next) => onValueChange({ ...counts, [key]: next })}\n              />\n            </View>\n          )\n        })}\n      </View>\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/guest-count-picker/GuestCountPicker.tsx"
    },
    {
      "path": "packages/registry-native/blocks/guest-count-picker/index.ts",
      "content": "export {\n  GuestCountPicker,\n  type GuestCountGroup,\n  type GuestCountPickerProps,\n  type GuestCounts,\n} from './GuestCountPicker'\n",
      "type": "registry:block",
      "target": "~/components/blocks/guest-count-picker/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/quantity-stepper.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Controlled age-group guest counts with a shared total capacity and accessible group limits.",
  "categories": [
    "reservation"
  ]
}