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 +10 -3
- package/dist/index.js +22 -36
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +22 -36
- package/dist/index.modern.js.map +1 -1
- package/package.json +69 -69
package/README.md
CHANGED
|
@@ -4,13 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/turkey-district-maps-3) [](https://standardjs.com) [](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
|
+
[](https://vscode.dev/github/ritzykey/turkey-district-map)
|
|
12
|
+
[](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
|
|
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** :
|
|
73
|
-
| onHover | Event when a district hovered on the map. | ( **district** :
|
|
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
|
|
7
|
-
for (var
|
|
8
|
-
var
|
|
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
|
-
|
|
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
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
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
|
-
|
|
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: {
|