npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@acreblitz/react-components

v0.1.6

Published

Reusable React components from AcreBlitz

Downloads

719

Readme

@acreblitz/react-components

Reusable React components from AcreBlitz for agricultural applications.

Installation

npm install @acreblitz/react-components

Try It

Full Demo App:

Open in StackBlitz

Map Component Demo:

Open in StackBlitz

Components

Map

Interactive Leaflet-based map with satellite imagery, drawing tools, measurement, and data overlays. Includes support for SSURGO soil data and USGS 3DHP hydrographic features with interactive selection, tooltips, and custom styling.

import { Map, DEFAULT_LAYERS } from '@acreblitz/react-components';
import '@acreblitz/react-components/styles.css';

function App() {
  return (
    <Map
      center={[39.7456, -97.0892]}
      zoom={13}
      height="500px"
      drawing={{ enabled: true }}
      measure={{ enabled: true }}
      layers={{
        baseLayers: [DEFAULT_LAYERS.esriWorldImagery],
        defaultBaseLayer: 'esri-satellite',
      }}
    />
  );
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | center | [number, number] | [39.7456, -97.0892] | Initial map center as [lat, lng] | | zoom | number | 13 | Initial zoom level | | minZoom | number | - | Minimum zoom level | | maxZoom | number | - | Maximum zoom level | | bounds | LatLngBoundsExpression | - | Initial bounds to fit (overrides center/zoom) | | height | string \| number | '400px' | Map height | | width | string \| number | '100%' | Map width | | className | string | - | Custom CSS class | | style | CSSProperties | - | Inline styles | | layers | LayerConfig | - | Layer configuration (base layers, overlays) | | showLayerControl | boolean | true | Show layer switching control | | showZoomControl | boolean | true | Show zoom controls | | showScaleControl | boolean | false | Show scale control | | showAttributionControl | boolean | true | Show attribution | | units | { distance?: 'metric' \| 'imperial', area?: 'metric' \| 'imperial' \| 'acres' \| 'hectares' } | - | Unit configuration | | drawing | DrawingOptions | - | Drawing tools configuration | | measure | MeasureOptions | - | Measurement tool configuration | | clickForecast | ClickForecastOptions | - | Click-to-forecast configuration | | dataOverlays | DataOverlayProps | - | Data overlay configuration (soil, hydro) | | eventHandlers | MapEventHandlers | - | Event handler callbacks | | loadingComponent | ReactNode | - | Custom loading UI | | errorComponent | ReactNode | - | Custom error UI | | scrollWheelZoom | boolean | true | Enable scroll wheel zoom | | doubleClickZoom | boolean | true | Enable double-click zoom | | dragging | boolean | true | Enable map dragging | | maxBounds | LatLngBoundsExpression | - | Maximum bounds for panning | | initialGeoJSON | GeoJSON.FeatureCollection | - | Existing GeoJSON to display on mount |

Drawing Options

drawing={{
  enabled: true,
  position: 'topright',
  draw: {
    polygon: true,
    rectangle: true,
    polyline: true,
    circle: true,
    marker: true,
  },
  edit: {
    edit: true,
    remove: true,
  },
  shapeOptions: {
    color: '#3b82f6',
    weight: 2,
    fillOpacity: 0.2,
  },
}}

Measurement Options

measure={{
  enabled: true,
  position: 'topleft',
  color: '#FF0080',
}}

Layer Configuration

import { DEFAULT_LAYERS } from '@acreblitz/react-components';

layers={{
  baseLayers: [
    DEFAULT_LAYERS.esriWorldImagery,
    DEFAULT_LAYERS.openStreetMap,
    DEFAULT_LAYERS.esriWorldTopoMap,
  ],
  overlays: [],
  defaultBaseLayer: 'esri-satellite',
  defaultOverlays: [],
}}

Event Handlers

eventHandlers={{
  onReady: (map) => console.log('Map ready', map),
  onClick: (event) => console.log('Clicked', event.latlng),
  onDrawCreated: (event) => console.log('Shape drawn', event.geoJSON),
  onMeasureComplete: (event) => console.log('Measured', event.displayValue),
}}

useMapInstance Hook

For programmatic map control:

import { Map, useMapInstance } from '@acreblitz/react-components';
import { useRef } from 'react';

function MyMap() {
  const mapRef = useRef(null);
  const { flyTo, exportGeoJSON, clearDrawnItems, isReady } = useMapInstance({ mapRef });

  return (
    <>
      <Map ref={mapRef} center={[39.7456, -97.0892]} zoom={13} />
      <button onClick={() => flyTo([40.0, -98.0], 14)}>Fly to Location</button>
      <button onClick={() => console.log(exportGeoJSON())}>Export GeoJSON</button>
    </>
  );
}

Data Overlays

The Map component supports interactive data overlays for displaying geographic features like soil polygons and hydrographic features. Overlays include:

  • SSURGO Soil Data: USDA NRCS soil polygons with drainage class, farmland classification, and hydric rating (min zoom: 12)
  • 3DHP Hydro Features: USGS streams, rivers, lakes, and drainage areas (min zoom: 14)

Features include click-to-select, hover tooltips, custom styling, and event callbacks.

Basic Example:

import { Map, SSURGO_OVERLAY_CONFIG, HYDRO_3DHP_OVERLAY_CONFIG } from '@acreblitz/react-components';

function MyMap() {
  return (
    <Map
      center={[39.7456, -97.0892]}
      zoom={14}
      height="500px"
      dataOverlays={{
        enabled: true,
        showPanel: true,
        overlays: [SSURGO_OVERLAY_CONFIG, HYDRO_3DHP_OVERLAY_CONFIG],
        defaultVisibility: {
          'ssurgo-soil': true,
          '3dhp-hydro': true,
        },
      }}
      eventHandlers={{
        onSoilFeatureClick: (e) => {
          console.log('Soil:', e.feature.properties.muname);
          console.log('Drainage:', e.feature.properties.drclassdcd);
        },
        onHydroFeatureClick: (e) => {
          console.log('Hydro:', e.feature.properties.gnis_name);
          console.log('Type:', e.feature.featureType);
        },
        onSoilFeatureSelect: (e) => {
          console.log('Selected soil features:', e.selectedFeatures);
        },
      }}
    />
  );
}

Using the Data Overlay Hook:

import { Map, useDataOverlay, SSURGO_OVERLAY_CONFIG } from '@acreblitz/react-components';

function SoilInfo() {
  const { selection, visibility, toggleOverlay, clearSelection } = useDataOverlay();
  const selectedSoil = selection.soilFeatures;

  return (
    <div>
      <p>{selectedSoil.length} soil features selected</p>
      <button onClick={() => toggleOverlay('ssurgo-soil')}>
        {visibility['ssurgo-soil'] ? 'Hide' : 'Show'} Soil Layer
      </button>
      {selectedSoil.map((feature) => (
        <div key={feature.id}>
          <strong>{feature.properties.muname}</strong>
          <p>Drainage: {feature.properties.drclassdcd}</p>
        </div>
      ))}
    </div>
  );
}

Data Overlay Configuration:

dataOverlays={{
  enabled: true,
  showPanel: true,  // Show control panel for toggling layers
  overlays: [SSURGO_OVERLAY_CONFIG, HYDRO_3DHP_OVERLAY_CONFIG],
  defaultVisibility: {
    'ssurgo-soil': false,  // Hidden by default
    '3dhp-hydro': true,    // Visible by default
  },
  panelConfig: {
    position: 'bottomright',
    title: 'Overlays',
    collapsed: true,
  },
}}

For detailed documentation on data overlays, see:

Weather

Display current weather conditions and hourly forecast using the National Weather Service API.

import { Weather } from '@acreblitz/react-components';
import '@acreblitz/react-components/styles.css';

function App() {
  return (
    <Weather
      latitude={39.7456}
      longitude={-97.0892}
    />
  );
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | latitude | number | required | Latitude (-90 to 90) | | longitude | number | required | Longitude (-180 to 180) | | className | string | - | Custom CSS class | | refreshInterval | number | 0 | Auto-refresh interval in ms (0 = disabled) | | showRefreshButton | boolean | true | Show manual refresh button | | forecastDays | number | 7 | Number of forecast days (1-7) | | units | 'imperial' \| 'metric' | 'imperial' | Temperature units | | compact | boolean | false | Show only current conditions | | onDataLoad | (data: WeatherData) => void | - | Callback when data loads | | onError | (error: Error) => void | - | Callback on error | | loadingComponent | ReactNode | - | Custom loading UI | | errorComponent | ReactNode | - | Custom error UI |

useWeather Hook

For custom implementations, use the useWeather hook directly:

import { useWeather } from '@acreblitz/react-components';

function CustomWeather({ lat, lon }) {
  const { data, isLoading, error, refetch, lastUpdated } = useWeather({
    latitude: lat,
    longitude: lon,
    refreshInterval: 300000, // 5 minutes
  });

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;
  if (!data) return null;

  return (
    <div>
      <h2>{data.location.city}, {data.location.state}</h2>
      <p>Temperature: {data.currentConditions?.temperature}°F</p>
      <button onClick={refetch}>Refresh</button>
      {lastUpdated && <p>Last updated: {lastUpdated.toLocaleTimeString()}</p>}
    </div>
  );
}

Data Source

This component uses the National Weather Service API (api.weather.gov), which is free and does not require an API key. The API is US-only.

Types

interface WeatherData {
  location: WeatherLocation;
  currentConditions: CurrentConditions | null;
  hourlyForecast: HourlyForecastPeriod[];
  updated: string;
}

interface WeatherLocation {
  city: string;
  state: string;
  gridId: string;
  gridX: number;
  gridY: number;
}

interface CurrentConditions {
  timestamp: string;
  temperature: number | null;
  temperatureUnit: string;
  description: string;
  icon: string;
  humidity: number | null;
  windSpeed: number | null;
  windDirection: number | null;
  pressure: number | null;
}

interface HourlyForecastPeriod {
  time: string;
  temperature: number;
  temperatureUnit: string;
  precipitationChance: number | null;
  relativeHumidity: number | null;
  windSpeed: string;
  windDirection: string;
  icon: string;
  shortForecast: string;
  isDaytime: boolean;
}

License

MIT