New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@taida-dream/map-picker

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@taida-dream/map-picker

A highly customizable React component library for Google Maps location selection and preview, featuring dark/light mode support, fullscreen capabilities, and seamless Tailwind CSS integration.

latest
npmnpm
Version
1.0.22
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

React Google Map Location

A highly customizable React component library for Google Maps location selection and preview, featuring dark/light mode support, fullscreen capabilities, and seamless Tailwind CSS integration. Built with TypeScript for robust type safety and modern development practices.

Installation

npm install @taida-dream/map-picker
# or
yarn add @taida-dream/map-picker

Usage

import React, { useState } from 'react';
import { GoogleMapSelector, GoogleMapPreview } from '@taida-dream/map-picker';


function App() {
  const [selectedCoords, setSelectedCoords] = useState<{ lat: number; lng: number } | null>(null);

  return (
    <div>
      <h2>Map Selector</h2>
      <GoogleMapSelector
        apiKey="YOUR_GOOGLE_MAPS_API_KEY"
        onLocationSelect={setSelectedCoords}
        selectedLocation={selectedCoords}
        // Example customization:
        // showSaveCancel={true}
        // saveText="Confirm Location"
        // defaultMapMode="light"
      />

      <h2>Preview</h2>
      <GoogleMapPreview
        apiKey="YOUR_GOOGLE_MAPS_API_KEY"
        latitude={selectedCoords?.lat}
        longitude={selectedCoords?.lng}
        // Example customization:
        // height="200px"
        // mapType="satellite"
      />

      {selectedCoords && (
        <p>
          Selected: Lat {selectedCoords.lat.toFixed(6)}, Lng {selectedCoords.lng.toFixed(6)}
        </p>
      )}
    </div>
  );
}

export default App;

API

GoogleMapSelector Props

PropTypeDefaultDescription
apiKeystringnullRequired. Google Maps API Key.
onLocationSelect`(coords: Coordsnull) => void`-
selectedLocation`Coordsnull`null
defaultCenterCoords{ lat: 15.3694, lng: 44.1910 } (Sana'a)Initial map center if selectedLocation
is not provided.
defaultZoomnumber12The initial zoom level of the map.
heightstring"60vh"Height of the map container
(e.g., '500px', '70vh').
widthstring"100%"Width of the map container
(e.g., '100%', '600px').
defaultMapMode`'dark''light'`'dark'
showModeTogglebooleantrueShow/hide the dark/light mode
toggle button.
showFullscreenTogglebooleantrueShow/hide the fullscreen
toggle button.
showLocationButtonbooleantrueShow/hide the "Get my current
location" button.
showSaveCancelbooleanfalseShow/hide the Save and Cancel buttons.
showCoordinatesDisplaybooleantrueShow/hide the selected coordinates
text below the map.
saveTextstring"Save Changes"Text for the Save button.
cancelTextstring"Cancel"Text for the Cancel button.
savingTextstring"Saving..."Text for Save button
while isSaving is true.
onSave() => void-Callback executed when Save
button is clicked.
onCancel() => void-Callback executed when Cancel
button is clicked.
isSavingbooleanfalseIf true, disables Save/Cancel
and shows savingText.
modeToggleButtonColorstring"#ffffff"Text/Icon color for the mode
toggle button.
modeToggleButtonBgstring"rgba(31, 41, 55, 0.8)"Background color for the mode
toggle button.
saveButtonColorstring"#ffffff"Text color for the Save button.
saveButtonBgstring"#374151"Background color for the Save button.
cancelButtonColorstring"#f3f4f6"Text color for the Cancel button.
cancelButtonBgstring"#374151"Background color for the Cancel button.
fullscreenButtonColorstring"#ffffff"Text/Icon color for the
fullscreen button.
fullscreenButtonBgstring"rgba(31, 41, 55, 0.8)"Background color for the
fullscreen button.
locationButtonColorstring"#ffffff"Text/Icon color for the
location button.
locationButtonBgstring"rgba(31, 41, 55, 0.8)"Background color for the
location button.
containerClassNamestring""Custom CSS classes for the
main map container div.
modeToggleButtonClassNamestring""Custom CSS classes for the
mode toggle button.
saveButtonClassNamestring""Custom CSS classes for the Save button.
cancelButtonClassNamestring""Custom CSS classes for the Cancel button.
fullscreenButtonClassNamestring""Custom CSS classes for the
fullscreen button.
locationButtonClassNamestring""Custom CSS classes for the
location button.
customLoadingIndicatorReact.ReactNode-Replace default loading spinner
with a custom component.
customErrorDisplay(error: string | null) => React.ReactNode-Render custom component
when an error occurs.
customModeToggleReact.ReactNode-Replace default mode toggle
with a custom component.
customFullscreenToggleReact.ReactNode-Replace default fullscreen button
with a custom component.
customLocationButtonReact.ReactNode-Replace default location button
with a custom component.
customSaveButtonReact.ReactNode-Replace default Save button
with a custom component.
customCancelButtonReact.ReactNode-Replace default Cancel button
with a custom component.
customCoordinatesDisplay(coords: Coords | null) => React.ReactNode-Render custom component
to display selected coords.
modeToggleStyleCSSProperties{ position: 'absolute', top: '0.5rem', left: '0.5rem', zIndex: 10 }Inline styles for the mode
toggle button's position.
saveButtonStyleCSSProperties{ position: 'absolute', top: '0.5rem', right: '0.5rem', zIndex: 10 }Inline styles for the Save
button's position.
cancelButtonStyleCSSProperties{ position: 'absolute', top: '0.5rem', right: 'calc(0.5rem + 130px + 8px)', zIndex: 10 }Inline styles for the Cancel
button's position.
locationButtonStyleCSSProperties{ position: 'absolute', bottom: '3.5rem', right: '2rem', zIndex: 10 }Inline styles for the location
button's position.
fullscreenToggleStyleCSSProperties{ position: 'absolute', bottom: '1rem', right: '2rem', zIndex: 10 }Inline styles for the fullscreen
button's position.

Note on Coords type: { lat: number; lng: number }

GoogleMapPreview Props

PropTypeDefaultDescription
apiKeystring | nullnullRequired. Google Maps API Key.
Displays error if missing.
latitudenumber | string | nullnullLatitude for the map preview center.
Can be number or "-".
longitudenumber | string | nullnullLongitude for the map preview center.
Can be number or "-".
heightstring"150px"Height of the preview container
(e.g., '100px', '20vh').
widthstring"100%"Width of the preview container
(e.g., '100%', '300px').
zoomnumber14Zoom level for the static map
image (0-21).
mapType'roadmap' | 'satellite' | 'hybrid' | 'terrain''roadmap'Map tiles type for the preview image.
containerClassNamestring""Custom CSS classes for the main
preview container div.
placeholderTextClassNamestring""Custom CSS classes for placeholder text
(p tags) shown when key/coords
are missing.
apiKeyMissingPlaceholderReact.ReactNode-Custom component/node to display
when the API key is missing.
noCoordsPlaceholderReact.ReactNode-Custom component/node to display
when no coordinates are provided.

License

ISC

Keywords

react

FAQs

Package last updated on 17 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts