@corpsmap/corpsmap 3.2.2 → 3.2.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/css/corpsmap.css CHANGED
@@ -1,112 +1,3 @@
1
- .loading-container {
2
- height: 100px;
3
- display: flex;
4
- flex-direction: column;
5
- justify-content: center;
6
- align-items: center;
7
- }
8
-
9
- .loading-text {
10
- font-size: 18px;
11
- margin-top: 15px;
12
- }
13
-
14
- .loading-spinner {
15
- font-size: 12px;
16
- height: 12px;
17
- width: 12px;
18
- margin: 0 auto;
19
- background-color: red;
20
- -webkit-animation: move 3s linear infinite; /* Safari */
21
- animation: move 3s linear infinite;
22
- animation-play-state: running;
23
- }
24
-
25
- @keyframes move {
26
- 0%,
27
- 100% {
28
- transform: translate(-10px, -10px);
29
- background-color: #f5f5f5;
30
- border-radius: 40%;
31
- }
32
- 25% {
33
- transform: translate(10px, -10px);
34
- border-radius: 20%;
35
- }
36
- 50% {
37
- transform: translate(10px, 10px);
38
- background-color: #4d4c4e;
39
- border-radius: 0%;
40
- }
41
- 75% {
42
- transform: translate(-10px, 10px);
43
- border-radius: 20%;
44
- }
45
- }
46
-
47
- /* Safari */
48
- @-webkit-keyframes move {
49
- 0%,
50
- 100% {
51
- -webkit-transform: translate(-10px, -10px);
52
- background-color: #f5f5f5;
53
- border-radius: 40%;
54
- }
55
- 25% {
56
- -webkit-transform: translate(10px, -10px);
57
- border-radius: 20%;
58
- }
59
- 50% {
60
- -webkit-transform: translate(10px, 10px);
61
- background-color: #4d4c4e;
62
- border-radius: 0%;
63
- }
64
- 75% {
65
- -webkit-transform: translate(-10px, 10px);
66
- border-radius: 20%;
67
- }
68
- }
69
-
70
- .cm-map-loading-container {
71
- display: flex;
72
- flex-direction: column;
73
- justify-content: center;
74
- align-items: center;
75
- }
76
- .cm-loading-indicator {
77
- margin: 5px;
78
- border: 2px solid #f3f3f3;
79
- border-radius: 50%;
80
- border-top: 2px solid #3498db;
81
- width: 25px;
82
- height: 25px;
83
- -webkit-animation: spin 1s linear infinite; /* Safari */
84
- animation: spin 1s linear infinite;
85
- }
86
- .cm-map-ready {
87
- padding: 5px;
88
- width: 25px;
89
- height: 25px;
90
- }
91
-
92
- /* Safari */
93
- @-webkit-keyframes spin {
94
- 0% {
95
- -webkit-transform: rotate(0deg);
96
- }
97
- 100% {
98
- -webkit-transform: rotate(360deg);
99
- }
100
- }
101
-
102
- @keyframes spin {
103
- 0% {
104
- transform: rotate(0deg);
105
- }
106
- 100% {
107
- transform: rotate(360deg);
108
- }
109
- }
110
1
  .corpsmap .sidebar {
111
2
  display: flex;
112
3
  position: absolute;
@@ -278,6 +169,115 @@
278
169
  outline: 0;
279
170
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
280
171
  }
172
+ .loading-container {
173
+ height: 100px;
174
+ display: flex;
175
+ flex-direction: column;
176
+ justify-content: center;
177
+ align-items: center;
178
+ }
179
+
180
+ .loading-text {
181
+ font-size: 18px;
182
+ margin-top: 15px;
183
+ }
184
+
185
+ .loading-spinner {
186
+ font-size: 12px;
187
+ height: 12px;
188
+ width: 12px;
189
+ margin: 0 auto;
190
+ background-color: red;
191
+ -webkit-animation: move 3s linear infinite; /* Safari */
192
+ animation: move 3s linear infinite;
193
+ animation-play-state: running;
194
+ }
195
+
196
+ @keyframes move {
197
+ 0%,
198
+ 100% {
199
+ transform: translate(-10px, -10px);
200
+ background-color: #f5f5f5;
201
+ border-radius: 40%;
202
+ }
203
+ 25% {
204
+ transform: translate(10px, -10px);
205
+ border-radius: 20%;
206
+ }
207
+ 50% {
208
+ transform: translate(10px, 10px);
209
+ background-color: #4d4c4e;
210
+ border-radius: 0%;
211
+ }
212
+ 75% {
213
+ transform: translate(-10px, 10px);
214
+ border-radius: 20%;
215
+ }
216
+ }
217
+
218
+ /* Safari */
219
+ @-webkit-keyframes move {
220
+ 0%,
221
+ 100% {
222
+ -webkit-transform: translate(-10px, -10px);
223
+ background-color: #f5f5f5;
224
+ border-radius: 40%;
225
+ }
226
+ 25% {
227
+ -webkit-transform: translate(10px, -10px);
228
+ border-radius: 20%;
229
+ }
230
+ 50% {
231
+ -webkit-transform: translate(10px, 10px);
232
+ background-color: #4d4c4e;
233
+ border-radius: 0%;
234
+ }
235
+ 75% {
236
+ -webkit-transform: translate(-10px, 10px);
237
+ border-radius: 20%;
238
+ }
239
+ }
240
+
241
+ .cm-map-loading-container {
242
+ display: flex;
243
+ flex-direction: column;
244
+ justify-content: center;
245
+ align-items: center;
246
+ }
247
+ .cm-loading-indicator {
248
+ margin: 5px;
249
+ border: 2px solid #f3f3f3;
250
+ border-radius: 50%;
251
+ border-top: 2px solid #3498db;
252
+ width: 25px;
253
+ height: 25px;
254
+ -webkit-animation: spin 1s linear infinite; /* Safari */
255
+ animation: spin 1s linear infinite;
256
+ }
257
+ .cm-map-ready {
258
+ padding: 5px;
259
+ width: 25px;
260
+ height: 25px;
261
+ }
262
+
263
+ /* Safari */
264
+ @-webkit-keyframes spin {
265
+ 0% {
266
+ -webkit-transform: rotate(0deg);
267
+ }
268
+ 100% {
269
+ -webkit-transform: rotate(360deg);
270
+ }
271
+ }
272
+
273
+ @keyframes spin {
274
+ 0% {
275
+ transform: rotate(0deg);
276
+ }
277
+ 100% {
278
+ transform: rotate(360deg);
279
+ }
280
+ }
281
281
  @import url("https://fonts.googleapis.com/css?family=Roboto:300,400,500,700");
282
282
 
283
283
  /*!
package/lib/dev.js CHANGED
@@ -106551,7 +106551,7 @@ var config = {
106551
106551
  };
106552
106552
 
106553
106553
  var name = "@corpsmap/corpsmap";
106554
- var version$1 = "3.2.2";
106554
+ var version$1 = "3.2.3";
106555
106555
  var description = "CorpsMap as React Components";
106556
106556
  var main = "index.js";
106557
106557
  var scripts = {
@@ -135521,8 +135521,7 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
135521
135521
 
135522
135522
  _this = _super.call(this, props);
135523
135523
  _this.state = {
135524
- selectedIdx: null,
135525
- currentVal: ""
135524
+ selectedIdx: null
135526
135525
  };
135527
135526
  _this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
135528
135527
  _this.fireSearch = _this.fireSearch.bind(_assertThisInitialized(_this));
@@ -135544,23 +135543,16 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
135544
135543
  value: function handleChange(val) {
135545
135544
  var doSearchSetQuery = this.props.doSearchSetQuery;
135546
135545
  this.setState({
135547
- selectedIdx: null,
135548
- currentVal: val
135546
+ selectedIdx: null
135549
135547
  });
135550
135548
  doSearchSetQuery(val);
135551
- console.log(val);
135552
-
135553
- if (val.length < 3) {
135554
- return null;
135555
- } else {
135556
- this.debouncedSearch();
135557
- }
135549
+ if (val.length > 2) this.debouncedSearch();
135558
135550
  }
135559
135551
  }, {
135560
135552
  key: "fireSearch",
135561
135553
  value: function fireSearch() {
135562
135554
  var doSearchShouldFire = this.props.doSearchShouldFire;
135563
- doSearchShouldFire(this.state.currentVal);
135555
+ doSearchShouldFire();
135564
135556
  }
135565
135557
  }, {
135566
135558
  key: "handleKeyUp",
@@ -135599,15 +135591,11 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
135599
135591
  var _classnames,
135600
135592
  _this2 = this;
135601
135593
 
135602
- var _this$state = this.state,
135603
- selectedIdx = _this$state.selectedIdx,
135604
- currentVal = _this$state.currentVal;
135594
+ var selectedIdx = this.state.selectedIdx;
135605
135595
  var _this$props = this.props,
135606
135596
  theme = _this$props.theme,
135607
135597
  searchResults = _this$props.searchResults,
135608
135598
  searchQueryString = _this$props.searchQueryString;
135609
- var emptyArry = [];
135610
- var optSearchResults = currentVal < 2 ? emptyArry : searchResults;
135611
135599
  var containerClass = classnames((_classnames = {}, _defineProperty(_classnames, theme, true), _defineProperty(_classnames, "cm-btn-group", true), _classnames));
135612
135600
  return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("div", {
135613
135601
  className: containerClass,
@@ -135628,7 +135616,7 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
135628
135616
  _this2.searchResultsList = el;
135629
135617
  },
135630
135618
  onItemClick: this.handleItemClick,
135631
- items: optSearchResults,
135619
+ items: searchResults,
135632
135620
  selectedIdx: selectedIdx
135633
135621
  }));
135634
135622
  }
package/lib/prod.js CHANGED
@@ -106465,7 +106465,7 @@ var config = {
106465
106465
  };
106466
106466
 
106467
106467
  var name = "@corpsmap/corpsmap";
106468
- var version$1 = "3.2.2";
106468
+ var version$1 = "3.2.3";
106469
106469
  var description = "CorpsMap as React Components";
106470
106470
  var main = "index.js";
106471
106471
  var scripts = {
@@ -135435,8 +135435,7 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
135435
135435
 
135436
135436
  _this = _super.call(this, props);
135437
135437
  _this.state = {
135438
- selectedIdx: null,
135439
- currentVal: ""
135438
+ selectedIdx: null
135440
135439
  };
135441
135440
  _this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
135442
135441
  _this.fireSearch = _this.fireSearch.bind(_assertThisInitialized(_this));
@@ -135458,23 +135457,16 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
135458
135457
  value: function handleChange(val) {
135459
135458
  var doSearchSetQuery = this.props.doSearchSetQuery;
135460
135459
  this.setState({
135461
- selectedIdx: null,
135462
- currentVal: val
135460
+ selectedIdx: null
135463
135461
  });
135464
135462
  doSearchSetQuery(val);
135465
- console.log(val);
135466
-
135467
- if (val.length < 3) {
135468
- return null;
135469
- } else {
135470
- this.debouncedSearch();
135471
- }
135463
+ if (val.length > 2) this.debouncedSearch();
135472
135464
  }
135473
135465
  }, {
135474
135466
  key: "fireSearch",
135475
135467
  value: function fireSearch() {
135476
135468
  var doSearchShouldFire = this.props.doSearchShouldFire;
135477
- doSearchShouldFire(this.state.currentVal);
135469
+ doSearchShouldFire();
135478
135470
  }
135479
135471
  }, {
135480
135472
  key: "handleKeyUp",
@@ -135513,15 +135505,11 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
135513
135505
  var _classnames,
135514
135506
  _this2 = this;
135515
135507
 
135516
- var _this$state = this.state,
135517
- selectedIdx = _this$state.selectedIdx,
135518
- currentVal = _this$state.currentVal;
135508
+ var selectedIdx = this.state.selectedIdx;
135519
135509
  var _this$props = this.props,
135520
135510
  theme = _this$props.theme,
135521
135511
  searchResults = _this$props.searchResults,
135522
135512
  searchQueryString = _this$props.searchQueryString;
135523
- var emptyArry = [];
135524
- var optSearchResults = currentVal < 2 ? emptyArry : searchResults;
135525
135513
  var containerClass = classnames((_classnames = {}, _defineProperty(_classnames, theme, true), _defineProperty(_classnames, "cm-btn-group", true), _classnames));
135526
135514
  return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("div", {
135527
135515
  className: containerClass,
@@ -135542,7 +135530,7 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
135542
135530
  _this2.searchResultsList = el;
135543
135531
  },
135544
135532
  onItemClick: this.handleItemClick,
135545
- items: optSearchResults,
135533
+ items: searchResults,
135546
135534
  selectedIdx: selectedIdx
135547
135535
  }));
135548
135536
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corpsmap/corpsmap",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
4
4
  "description": "CorpsMap as React Components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,8 +8,7 @@ class SearchBar extends React.Component {
8
8
  constructor(props) {
9
9
  super(props);
10
10
  this.state = {
11
- selectedIdx: null,
12
- currentVal : ""
11
+ selectedIdx: null
13
12
  };
14
13
  this.handleChange = this.handleChange.bind(this);
15
14
  this.fireSearch = this.fireSearch.bind(this);
@@ -26,20 +25,14 @@ class SearchBar extends React.Component {
26
25
 
27
26
  handleChange(val) {
28
27
  const { doSearchSetQuery } = this.props;
29
- this.setState({ selectedIdx: null, currentVal: val });
28
+ this.setState({ selectedIdx: null });
30
29
  doSearchSetQuery(val);
31
- console.log(val)
32
- if (val.length < 3){
33
- return null;
34
- }
35
- else{
36
- this.debouncedSearch();
37
- }
30
+ if (val.length > 2) this.debouncedSearch();
38
31
  }
39
32
 
40
33
  fireSearch() {
41
34
  const { doSearchShouldFire } = this.props;
42
- doSearchShouldFire(this.state.currentVal);
35
+ doSearchShouldFire();
43
36
  }
44
37
 
45
38
  handleKeyUp(e) {
@@ -72,10 +65,8 @@ class SearchBar extends React.Component {
72
65
  }
73
66
 
74
67
  render() {
75
- const { selectedIdx, currentVal } = this.state;
68
+ const { selectedIdx } = this.state;
76
69
  const { theme, searchResults, searchQueryString } = this.props;
77
- const emptyArry = [];
78
- let optSearchResults = currentVal < 2 ? emptyArry : searchResults
79
70
  const containerClass = classnames({
80
71
  [theme]: true,
81
72
  "cm-btn-group": true
@@ -104,7 +95,7 @@ class SearchBar extends React.Component {
104
95
  this.searchResultsList = el;
105
96
  }}
106
97
  onItemClick={this.handleItemClick}
107
- items={optSearchResults}
98
+ items={searchResults}
108
99
  selectedIdx={selectedIdx}
109
100
  />
110
101
  </div>
@@ -0,0 +1,123 @@
1
+ import React from "react";
2
+ import { connect } from "redux-bundler-react";
3
+ import classnames from "classnames";
4
+ import { SearchInput, SearchResultsList } from "../../application-controls";
5
+ import _ from "lodash";
6
+
7
+ class SearchBar extends React.Component {
8
+ constructor(props) {
9
+ super(props);
10
+ this.state = {
11
+ selectedIdx: null,
12
+ currentVal : ""
13
+ };
14
+ this.handleChange = this.handleChange.bind(this);
15
+ this.fireSearch = this.fireSearch.bind(this);
16
+ this.handleKeyUp = this.handleKeyUp.bind(this);
17
+ this.handleItemClick = this.handleItemClick.bind(this);
18
+ this.debouncedSearch = _.debounce(this.fireSearch, 200);
19
+ }
20
+
21
+ handleItemClick(item) {
22
+ const { doSearchSelectItem } = this.props;
23
+ doSearchSelectItem(item);
24
+ this.handleChange("");
25
+ }
26
+
27
+ handleChange(val) {
28
+ const { doSearchSetQuery } = this.props;
29
+ this.setState({ selectedIdx: null, currentVal: val });
30
+ doSearchSetQuery(val);
31
+ console.log(val)
32
+ if (val.length < 3){
33
+ return null;
34
+ }
35
+ else{
36
+ this.debouncedSearch();
37
+ }
38
+ }
39
+
40
+ fireSearch() {
41
+ const { doSearchShouldFire } = this.props;
42
+ doSearchShouldFire(this.state.currentVal);
43
+ }
44
+
45
+ handleKeyUp(e) {
46
+ const { searchResults } = this.props;
47
+ let { selectedIdx } = this.state;
48
+ switch (e.keyCode) {
49
+ case 40:
50
+ if (selectedIdx === null) {
51
+ selectedIdx = 0;
52
+ } else if (selectedIdx < searchResults.length - 1) {
53
+ selectedIdx++;
54
+ }
55
+ this.setState({
56
+ selectedIdx: selectedIdx
57
+ });
58
+ break;
59
+ case 38:
60
+ if (selectedIdx > 0) selectedIdx--;
61
+ this.setState({
62
+ selectedIdx: selectedIdx
63
+ });
64
+ break;
65
+ case 13:
66
+ if (selectedIdx !== null)
67
+ this.handleItemClick(searchResults[selectedIdx]);
68
+ break;
69
+ default:
70
+ break;
71
+ }
72
+ }
73
+
74
+ render() {
75
+ const { selectedIdx, currentVal } = this.state;
76
+ const { theme, searchResults, searchQueryString } = this.props;
77
+ const emptyArry = [];
78
+ let optSearchResults = currentVal < 2 ? emptyArry : searchResults
79
+ const containerClass = classnames({
80
+ [theme]: true,
81
+ "cm-btn-group": true
82
+ });
83
+ return (
84
+ <div>
85
+ <div
86
+ className={containerClass}
87
+ style={{
88
+ width: "250px",
89
+ position: "relative",
90
+ paddingLeft: "10px",
91
+ paddingRight: "10px"
92
+ }}
93
+ >
94
+ <SearchInput
95
+ inline={true}
96
+ onKeyUp={this.handleKeyUp}
97
+ onUpdate={this.handleChange}
98
+ filterString={searchQueryString}
99
+ placeholder="Location Search..."
100
+ ></SearchInput>
101
+ </div>
102
+ <SearchResultsList
103
+ ref={el => {
104
+ this.searchResultsList = el;
105
+ }}
106
+ onItemClick={this.handleItemClick}
107
+ items={optSearchResults}
108
+ selectedIdx={selectedIdx}
109
+ />
110
+ </div>
111
+ );
112
+ }
113
+ }
114
+
115
+ export default connect(
116
+ "doSearchSelectItem",
117
+ "doSearchShouldFire",
118
+ "doSearchSetQuery",
119
+ "selectTheme",
120
+ "selectSearchQueryString",
121
+ "selectSearchResults",
122
+ SearchBar
123
+ );