{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "fulfillment-window-picker",
  "title": "Fulfillment Window Picker",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/fulfillment-window-picker/FulfillmentWindowPicker.tsx",
      "content": "import * as React from 'react'\nimport { View, type ViewProps } from 'react-native'\nimport { Button } from '@/components/ui/button'\nimport { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'\nimport { Spinner } from '@/components/ui/spinner'\nimport { Text } from '@/components/ui/text'\nimport { cn } from '@/lib/utils'\n\nexport interface FulfillmentWindow {\n  id: string\n  /** Localized range in the fulfillment location's time zone. */\n  label: string\n  detail?: string\n  /** Readable reason for a window that the user cannot reserve. */\n  unavailableReason?: string\n}\n\nexport interface FulfillmentWindowPickerProps extends Omit<ViewProps, 'children'> {\n  className?: string\n  title?: string\n  description?: string\n  /** Supply the currently viewed day's windows. Window IDs must be unique and nonempty. */\n  windows?: readonly FulfillmentWindow[]\n  value?: string | null\n  defaultValue?: string\n  loading?: boolean\n  pending?: boolean\n  error?: string\n  labels?: Partial<Record<'confirm' | 'loading' | 'empty' | 'retry', string>>\n  onValueChange?: (windowId: string) => void\n  onConfirm: (windowId: string) => void\n  onRetry?: () => void\n}\n\nexport function FulfillmentWindowPicker({\n  className,\n  title = 'Pickup window',\n  description,\n  windows = [],\n  value,\n  defaultValue,\n  loading = false,\n  pending = false,\n  error,\n  labels,\n  onValueChange,\n  onConfirm,\n  onRetry,\n  ...props\n}: FulfillmentWindowPickerProps) {\n  const [internal, setInternal] = React.useState(defaultValue)\n  const current = value === undefined ? internal : value\n  const selected = windows.find(({ id, unavailableReason }) => id && id === current && !unavailableReason)\n\n  React.useEffect(() => {\n    if (value === undefined && internal !== undefined && !selected && !loading && !error) setInternal(undefined)\n  }, [value, internal, selected, loading, error])\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        {description ? <Text variant=\"muted\">{description}</Text> : null}\n      </View>\n\n      {loading ? (\n        <Spinner accessibilityLabel={labels?.loading ?? 'Loading pickup windows'} className=\"self-start\" />\n      ) : error ? (\n        <View className=\"gap-[8px]\">\n          <Text accessibilityRole=\"alert\" className=\"text-destructive\">\n            {error}\n          </Text>\n          {onRetry ? (\n            <Button variant=\"outline\" accessibilityLabel={labels?.retry ?? 'Try again'} onPress={onRetry}>\n              {labels?.retry ?? 'Try again'}\n            </Button>\n          ) : null}\n        </View>\n      ) : windows.length === 0 ? (\n        <Text variant=\"muted\">{labels?.empty ?? 'No pickup windows are available.'}</Text>\n      ) : (\n        <>\n          <RadioGroup\n            accessibilityLabel={title}\n            value={selected?.id ?? ''}\n            disabled={pending}\n            onValueChange={(next) => {\n              if (value === undefined) setInternal(next)\n              onValueChange?.(next)\n            }}\n          >\n            {windows.map(({ id, label, detail, unavailableReason }) => (\n              <RadioGroupItem\n                key={id}\n                value={id}\n                label={label}\n                disabled={!id || Boolean(unavailableReason)}\n                accessibilityLabel={[label, detail, unavailableReason].filter(Boolean).join(', ')}\n                className={cn('rounded-lg border border-border bg-card', selected?.id === id && 'border-primary')}\n              >\n                {detail ? (\n                  <Text size=\"sm\" variant=\"muted\">\n                    {detail}\n                  </Text>\n                ) : null}\n                {unavailableReason ? (\n                  <Text size=\"sm\" variant=\"muted\">\n                    {unavailableReason}\n                  </Text>\n                ) : null}\n              </RadioGroupItem>\n            ))}\n          </RadioGroup>\n          <Button\n            disabled={!selected}\n            loading={pending}\n            accessibilityLabel={labels?.confirm ?? 'Reserve pickup window'}\n            onPress={() => {\n              if (selected && !pending) onConfirm(selected.id)\n            }}\n          >\n            {labels?.confirm ?? 'Reserve pickup window'}\n          </Button>\n        </>\n      )}\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/fulfillment-window-picker/FulfillmentWindowPicker.tsx"
    },
    {
      "path": "packages/registry-native/blocks/fulfillment-window-picker/index.ts",
      "content": "export {\n  FulfillmentWindowPicker,\n  type FulfillmentWindow,\n  type FulfillmentWindowPickerProps,\n} from './FulfillmentWindowPicker'\n",
      "type": "registry:block",
      "target": "~/components/blocks/fulfillment-window-picker/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/radio-group.json",
    "https://native.uipkge.dev/r/native/spinner.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Reserve an available pickup or delivery window with current availability, loading, and retry states.",
  "categories": [
    "commerce"
  ]
}