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

@smoothglue/smoothglue-coordinate-entry

v3.0.1

Published

A robust ๐Ÿ—๏ธ, type-safe ๐Ÿ›ก๏ธ React UI component library for interacting with and parsing geospatial coordinates ๐Ÿ—บ๏ธ in various formats. This library provides ready-to-use input fields, poppers, and utility hooks for seamless coordinate management in Smooth

Readme

๐ŸŒ Smoothglue Coordinate Entry

A robust ๐Ÿ—๏ธ, type-safe ๐Ÿ›ก๏ธ React UI component library for interacting with and parsing geospatial coordinates ๐Ÿ—บ๏ธ in various formats. This library provides ready-to-use input fields, poppers, and utility hooks for seamless coordinate management in SmoothGlue applications.

Table of Contents ๐Ÿ“‘


โœจ Features

  • ๐Ÿ—บ๏ธ Multi-Format Support: Effortlessly parse and interact with multiple coordinate systems:
    • Decimal Degrees (e.g. 12.4567ยฐS, 14ยฐW)
    • Decimal-Minutes Degrees (e.g. 32ยฐ57'S, 032ยฐ57'E)
    • Decimal-Minutes-Seconds Degrees (e.g. 32ยฐ57'28.08"S, 032ยฐ57'28.08"E)
    • Universal Transverse Mercator (UTM) (e.g. 23N330)
    • Military Grid Reference System (MGRS) (e.g. 02QGF100)
    • Global Area Reference System (GARS) (e.g. 004RT23)
  • ๐Ÿ›ก๏ธ Type-Safe: Built entirely in TypeScript with strict geospatial definitions.
  • ๐ŸŽจ Theming Support: Leverages Material UI (MUI) and ships with theme configurations.
  • ๐Ÿงฉ React Hook Form Integration: Components are designed to work seamlessly with complex form state management.
  • ๐Ÿช Custom Hooks: Exposes utility hooks like useCoordinateDispatcher for managing dispatch events outside the main input component.

๐Ÿš€ Getting Started

๐Ÿ“ฆ Installation

Install the package using npm or yarn:

npm install @smoothglue/smoothglue-coordinate-entry

Peer Dependencies ๐Ÿค

This library relies on several peer dependencies that must be installed in your project ๐Ÿ”—.

Ensure you have the core React and Material UI packages installed:

npm install react react-dom @mui/material @mui/icons-material @emotion/react @emotion/styled lodash

Note: This package requires React 18+ and Material UI @mui/material v6+.

Usage ๐ŸŽฎ

SgCoordinateEntry ๐Ÿงญ

The SgCoordinateEntry is the primary UI component. It provides a text input that automatically parses strings into structured coordinate objects, and offers a popper overlay for discrete degree/minute/second editing.

import { useState } from 'react'
import { SgCoordinateEntry, CartographicDegree } from '@smoothglue/smoothglue-coordinate-entry'

export const CoordinateForm = () => {
    const [coordinate, setCoordinate] = useState<CartographicDegree | null>(null)

    const handleChange = (newCoordinate: CartographicDegree) => {
        setCoordinate(newCoordinate)
        console.log('Updated Coordinate:', newCoordinate)
    }

    return (
        <SgCoordinateEntry
            label="Object Location"
            value={coordinate}
            onChange={handleChange}
            placeholder="e.g. 38ยฐ 53' 23 N, 77ยฐ 0' 32 W"
        />
    )
}

SgCoordinateEntry Props โš™๏ธ

A brief overview of the primary props available on the main component.

| Prop | Type | Description | | :------------- | :------------------------------------ | :-------------------------------------------------------------------- | | value | CartographicDegree | The current coordinate value. | | onChange | (coord: CartographicDegree) => void | Callback fired when the coordinate is successfully parsed or updated. | | label | string | The label for the MUI TextField. | | disabled | boolean | Disables the input field. | | error | boolean | Flags the input in an error state. |

useCoordinateDispatcher Hook ๐Ÿช

The useCoordinateDispatcher hook allows you to dispatch custom coordinate events to update the entry state externally.

import { useCoordinateDispatcher } from '@smoothglue/smoothglue-coordinate-entry'
import { Button } from '@mui/material'

const ExternalUpdater = () => {
    const { dispatchCoordinate } = useCoordinateDispatcher()

    const setWashingtonDC = () => {
        dispatchCoordinate({
            latitude: 38.8895,
            longitude: -77.0353,
            height: 0
        })
    }

    return <Button onClick={setWashingtonDC}>Set to Washington D.C.</Button>
}

๐Ÿ“š Running Storybook

This project uses Storybook to develop, document, and test UI components in isolation.

  1. Install dependencies:

    npm install
  2. Start the Storybook server:

    npm run storybook
  3. Open your browser: Navigate to http://localhost:6006 to view the interactive component stories.

Contributing ๐Ÿคฒ

๐Ÿ“‚ Project Structure

  • src/components/: Core React UI components, including SgCoordinateEntry and SgDegreeFields.
  • src/utilities/: Core business logic for geospatial math, coordinate conversions, and validation.
  • src/themes/: Material UI theme definitions specific to SmoothGlue product lines.
  • src/types/: Centralized TypeScript type definitions.
  • .storybook/: Configuration for the Storybook component explorer.

Available Scripts ๐Ÿ“œ

In the project directory, you can run:

  • npm run storybook: Starts the Storybook development server on port 6006 ๐ŸŽจ.
  • npm run build: Runs TypeScript type checking (tsc) and builds the library using Vite ๐Ÿ“ฆ.
  • npm run test: Runs the unit test suite using Vitest (JSDom) ๐Ÿงช.
  • npm run test:all: Runs both unit tests and browser-based component tests via Storybook Playwright integration ๐ŸŽญ.
  • npm run lint: Runs ESLint to analyze the code for quality issues ๐Ÿงน.
  • npm run coverage: Runs unit tests and outputs a coverage report ๐Ÿ“Š.