turkey-district-maps-3 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,13 +4,20 @@
4
4
 
5
5
  [![NPM](https://img.shields.io/npm/v/turkey-district-maps-3.svg)](https://www.npmjs.com/package/turkey-district-maps-3) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![Made with React](https://img.shields.io/badge/React-17-blue?logo=react&logoColor=white)](https://www.npmjs.com/package/react)
6
6
 
7
+ ## 🌏 Open in the Cloud
8
+
9
+ Click any of the buttons below to start a new development environment to demo or contribute to the codebase without having to install anything on your machine:
10
+
11
+ [![Open in VS Code](https://img.shields.io/badge/Open%20in-VS%20Code-blue?logo=visualstudiocode)](https://vscode.dev/github/ritzykey/turkey-district-map)
12
+ [![Edit example-turkey-district-maps](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/example-turkey-district-maps-9qcxyk)
13
+
7
14
  ## Install
8
15
 
9
16
  ```bash
10
17
  npm install turkey-district-maps-3
11
18
  ```
12
19
 
13
- ## Usage [![Open in CodeSandbox](https://img.shields.io/badge/Open_in-CodeSandbox-black?logo=codesandbox&logoColor=white)](https://lsh7w.csb.app/)
20
+ ## Usage
14
21
 
15
22
  ```jsx
16
23
  import { Istanbul, Ankara } from 'turkey-district-maps-3'
@@ -69,8 +76,8 @@ This is generally used for [Antd](https://ant.design/components/tooltip/) style
69
76
  | Property | Description | Type | Default |
70
77
  | :---------- | :--------------------------------------------------------- | :----------------------------------------------------------------------------------- | :------------------------------------------------------------------- |
71
78
  | distWrapper | District DOMs are wrapped by provided component. | ( **cityComponent**: _JSX.Element_, **distData** : _distDataType_ ) => _JSX.Element_ | _Unwrapped district_ |
72
- | onClick | Event when a district clicked on the map. | ( **district** : _districtType_ ) => _void_ | - |
73
- | onHover | Event when a district hovered on the map. | ( **district** : _districtType_ ) => _void_ | - |
79
+ | onClick | Event when a district clicked on the map. | ( **district** : _distDataType_ ) => _void_ | - |
80
+ | onHover | Event when a district hovered on the map. | ( **district** : _distDataType_ ) => _void_ | - |
74
81
  | customStyle | Stylizing the component. | _customStyleType_ | { **idleColor**: _#444_, **hoverColor**: _#dc3522_ } |
75
82
  | strokeStyle | Stylizing the component. | _strokeStyleType_ | { **strokeWidth**: _0.08_, **strokeColor**: _white_ } |
76
83
  | viewBox | Position and dimension information of the map (svg) layout | _viewBoxType_ | { **top**: _30_, **left**: _75_, **width**: _74_, **height**: _45_ } |
package/dist/index.js CHANGED
@@ -3,21 +3,13 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
3
3
  var React = _interopDefault(require('react'));
4
4
 
5
5
  function _extends() {
6
- _extends = Object.assign || function (target) {
7
- for (var i = 1; i < arguments.length; i++) {
8
- var source = arguments[i];
9
-
10
- for (var key in source) {
11
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12
- target[key] = source[key];
13
- }
14
- }
6
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
7
+ for (var e = 1; e < arguments.length; e++) {
8
+ var t = arguments[e];
9
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
15
10
  }
16
-
17
- return target;
18
- };
19
-
20
- return _extends.apply(this, arguments);
11
+ return n;
12
+ }, _extends.apply(null, arguments);
21
13
  }
22
14
 
23
15
  var data = {
@@ -3031,7 +3023,6 @@ var onHover2 = function onHover2(e, onHover) {
3031
3023
  };
3032
3024
  var handleMouseEvent = function handleMouseEvent(e, callback) {
3033
3025
  var element = e.target;
3034
-
3035
3026
  if (element.tagName === "path") {
3036
3027
  var distPath = element.getAttribute("d");
3037
3028
  var name = element.id;
@@ -3052,33 +3043,30 @@ var parentSvgStyles = {
3052
3043
  width: 'auto',
3053
3044
  margin: '0 auto'
3054
3045
  };
3055
-
3056
3046
  var TurkeyCityMaps = function TurkeyCityMaps(_ref) {
3057
3047
  var city = _ref.city,
3058
- _ref$customStyle = _ref.customStyle,
3059
- idleColor = _ref$customStyle.idleColor,
3060
- hoverColor = _ref$customStyle.hoverColor,
3061
- _ref$strokeStyle = _ref.strokeStyle,
3062
- strokeWidth = _ref$strokeStyle.strokeWidth,
3063
- strokeColor = _ref$strokeStyle.strokeColor,
3064
- hidden = _ref.hidden,
3065
- _ref$viewBox = _ref.viewBox,
3066
- top = _ref$viewBox.top,
3067
- left = _ref$viewBox.left,
3068
- width = _ref$viewBox.width,
3069
- height = _ref$viewBox.height,
3070
- distWrapper = _ref.distWrapper,
3071
- _onClick = _ref.onClick,
3072
- onHover = _ref.onHover;
3073
-
3048
+ _ref$customStyle = _ref.customStyle,
3049
+ idleColor = _ref$customStyle.idleColor,
3050
+ hoverColor = _ref$customStyle.hoverColor,
3051
+ _ref$strokeStyle = _ref.strokeStyle,
3052
+ strokeWidth = _ref$strokeStyle.strokeWidth,
3053
+ strokeColor = _ref$strokeStyle.strokeColor,
3054
+ hidden = _ref.hidden,
3055
+ _ref$viewBox = _ref.viewBox,
3056
+ top = _ref$viewBox.top,
3057
+ left = _ref$viewBox.left,
3058
+ width = _ref$viewBox.width,
3059
+ height = _ref$viewBox.height,
3060
+ distWrapper = _ref.distWrapper,
3061
+ _onClick = _ref.onClick,
3062
+ onHover = _ref.onHover;
3074
3063
  var distWrapper2 = function distWrapper2() {
3075
3064
  return getDistrict().map(function (_ref2) {
3076
3065
  var element = _ref2.element,
3077
- distData = _ref2.distData;
3066
+ distData = _ref2.distData;
3078
3067
  return distWrapper ? distWrapper(element, distData) : element;
3079
3068
  });
3080
3069
  };
3081
-
3082
3070
  var getDistrict = function getDistrict() {
3083
3071
  return data["" + city].map(function (distData, i) {
3084
3072
  var element = /*#__PURE__*/React.createElement("path", {
@@ -3109,7 +3097,6 @@ var TurkeyCityMaps = function TurkeyCityMaps(_ref) {
3109
3097
  };
3110
3098
  });
3111
3099
  };
3112
-
3113
3100
  return /*#__PURE__*/React.createElement("div", {
3114
3101
  style: parentSvgStyles
3115
3102
  }, /*#__PURE__*/React.createElement("svg", {
@@ -3120,7 +3107,6 @@ var TurkeyCityMaps = function TurkeyCityMaps(_ref) {
3120
3107
  xmlnsXlink: "http://www.w3.org/1999/xlink"
3121
3108
  }, /*#__PURE__*/React.createElement("g", null, distWrapper2())));
3122
3109
  };
3123
-
3124
3110
  TurkeyCityMaps.defaultProps = {
3125
3111
  city: 'istanbul',
3126
3112
  customStyle: {