RU-MAP is a lightweight library for web applications, without third-party dependencies.
Contains an svg map of Russia, with the following capabilities:
- Region selecting
- Selecting of the federal district
- Selecting a time zone (with information about the difference from UTC+0 in minutes)
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
}
To install and run the project, you need:
NodeJS v20+.
NPM v10+.
To install dependencies, run the command:
$ npm i
To start the development server, run the command:
npm run dev
To run a production build, run the command:
npm run build
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.
- 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.
- 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.