Skip to content

🌍 RU-MAP is a lightweight library for web applications, following capabilities: region selecting, selecting of the federal district, selecting a time zone (with information about the difference from UTC+0 in minutes)

License

Notifications You must be signed in to change notification settings

ibeloyar/ru-map

Repository files navigation

RU-MAP

NPM Version License

RU-MAP is a lightweight library for web applications, without third-party dependencies.
Contains an svg map of Russia, with the following capabilities:

  1. Region selecting
  2. Selecting of the federal district
  3. Selecting a time zone (with information about the difference from UTC+0 in minutes)

Image

Getting started

Install npm package using command:

$ npm i ru-map

And add to your project:

import { RUMap, type Region } from 'ru-map';

const idRootHTMLElement = 'ru-map-root';

const map = new RUMap(idRootHTMLElement, { 
    mode: 'region',
    locale: 'en',
    onRegionClick: (value: Region) => {
        // your code here
    }, 
});

The region interface contains:

export interface Region {
    id: string; // region id
    title: string; // region name 'en' || 'ru'
    federalDistrict: string; // district of region 'en' || 'ru'
    timezone: string; // region time zone 'en' || 'ru'
    timezoneOffset: number; // offset from UTC+0 in minutes
}

Development

Requirements

To install and run the project, you need:
NodeJS v20+.
NPM v10+.

Installing dependencies

To install dependencies, run the command:

$ npm i

Launching the Development server

To start the development server, run the command:

npm run dev

Creating a build

To run a production build, run the command:

npm run build

Contributing

Thank you for taking the time to read our rules for contributing to ru-map. You can start contributing in many ways, such as filing bug reports, improving code and documentation, or helping others.

Our open source community strives to be pleasant, welcoming, and professional. Abusive, harassing or otherwise inappropriate behavior will not be tolerated.

Pull Request

  • ru-map is written in ES6.
  • We use ESLint to test our code. You can use npm run lint:fix before submitting a pull request.
  • Please use a semantic commit message.

Bugs

  • Before submitting a bug report, look for similar tickets. Your problem may have already been discussed and resolved.
  • Feel free to add comments to an existing issue, even if it is closed.
  • Be careful when choosing a title and report, do not miss important details.
  • In English, please.

About

🌍 RU-MAP is a lightweight library for web applications, following capabilities: region selecting, selecting of the federal district, selecting a time zone (with information about the difference from UTC+0 in minutes)

Resources

License

Stars

Watchers

Forks

Packages

No packages published