@targetprocess/dropdown-field 12.18.0 → 12.18.2-alpha.1

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.
@@ -10,24 +10,25 @@ function _classCallCheck(instance, Constructor) {
10
10
  throw new TypeError("Cannot call a class as a function");
11
11
  }
12
12
  }
13
-
14
13
  function _defineProperties(target, props) {
15
14
  for (var i = 0; i < props.length; i++) {
16
15
  var descriptor = props[i];
17
16
  descriptor.enumerable = descriptor.enumerable || false;
18
17
  descriptor.configurable = true;
19
18
  if ("value" in descriptor) descriptor.writable = true;
20
- Object.defineProperty(target, descriptor.key, descriptor);
19
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
21
20
  }
22
21
  }
23
-
24
22
  function _createClass(Constructor, protoProps, staticProps) {
25
23
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
26
24
  if (staticProps) _defineProperties(Constructor, staticProps);
25
+ Object.defineProperty(Constructor, "prototype", {
26
+ writable: false
27
+ });
27
28
  return Constructor;
28
29
  }
29
-
30
30
  function _defineProperty(obj, key, value) {
31
+ key = _toPropertyKey(key);
31
32
  if (key in obj) {
32
33
  Object.defineProperty(obj, key, {
33
34
  value: value,
@@ -38,33 +39,26 @@ function _defineProperty(obj, key, value) {
38
39
  } else {
39
40
  obj[key] = value;
40
41
  }
41
-
42
42
  return obj;
43
43
  }
44
-
45
44
  function _extends() {
46
- _extends = Object.assign || function (target) {
45
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
47
46
  for (var i = 1; i < arguments.length; i++) {
48
47
  var source = arguments[i];
49
-
50
48
  for (var key in source) {
51
49
  if (Object.prototype.hasOwnProperty.call(source, key)) {
52
50
  target[key] = source[key];
53
51
  }
54
52
  }
55
53
  }
56
-
57
54
  return target;
58
55
  };
59
-
60
56
  return _extends.apply(this, arguments);
61
57
  }
62
-
63
58
  function _inherits(subClass, superClass) {
64
59
  if (typeof superClass !== "function" && superClass !== null) {
65
60
  throw new TypeError("Super expression must either be null or a function");
66
61
  }
67
-
68
62
  subClass.prototype = Object.create(superClass && superClass.prototype, {
69
63
  constructor: {
70
64
  value: subClass,
@@ -72,40 +66,52 @@ function _inherits(subClass, superClass) {
72
66
  configurable: true
73
67
  }
74
68
  });
69
+ Object.defineProperty(subClass, "prototype", {
70
+ writable: false
71
+ });
75
72
  if (superClass) _setPrototypeOf(subClass, superClass);
76
73
  }
77
-
78
74
  function _getPrototypeOf(o) {
79
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
75
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
80
76
  return o.__proto__ || Object.getPrototypeOf(o);
81
77
  };
82
78
  return _getPrototypeOf(o);
83
79
  }
84
-
85
80
  function _setPrototypeOf(o, p) {
86
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
81
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
87
82
  o.__proto__ = p;
88
83
  return o;
89
84
  };
90
-
91
85
  return _setPrototypeOf(o, p);
92
86
  }
93
-
94
87
  function _assertThisInitialized(self) {
95
88
  if (self === void 0) {
96
89
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
97
90
  }
98
-
99
91
  return self;
100
92
  }
101
-
102
93
  function _possibleConstructorReturn(self, call) {
103
94
  if (call && (typeof call === "object" || typeof call === "function")) {
104
95
  return call;
96
+ } else if (call !== void 0) {
97
+ throw new TypeError("Derived constructors may only return object or undefined");
105
98
  }
106
-
107
99
  return _assertThisInitialized(self);
108
100
  }
101
+ function _toPrimitive(input, hint) {
102
+ if (typeof input !== "object" || input === null) return input;
103
+ var prim = input[Symbol.toPrimitive];
104
+ if (prim !== undefined) {
105
+ var res = prim.call(input, hint || "default");
106
+ if (typeof res !== "object") return res;
107
+ throw new TypeError("@@toPrimitive must return a primitive value.");
108
+ }
109
+ return (hint === "string" ? String : Number)(input);
110
+ }
111
+ function _toPropertyKey(arg) {
112
+ var key = _toPrimitive(arg, "string");
113
+ return typeof key === "symbol" ? key : String(key);
114
+ }
109
115
 
110
116
  function styleInject(css, ref) {
111
117
  if ( ref === void 0 ) ref = {};
@@ -134,8 +140,8 @@ function styleInject(css, ref) {
134
140
  }
135
141
  }
136
142
 
137
- var css = ".popover-body--no-gutters__dropdown-field__12-18-0 {\r\n padding: 0;\r\n}\r\n";
138
- var styles = {"popover-body--no-gutters":"popover-body--no-gutters__dropdown-field__12-18-0"};
143
+ var css = ".popover-body--no-gutters__dropdown-field__12-18-2-alpha-1 {\r\n padding: 0;\r\n}\r\n";
144
+ var styles = {"popover-body--no-gutters":"popover-body--no-gutters__dropdown-field__12-18-2-alpha-1"};
139
145
  styleInject(css);
140
146
 
141
147
  var dropdownInnerSpace = 4;
@@ -148,72 +154,57 @@ var boxShadowGutter = 3;
148
154
 
149
155
  var DropdownField = /*#__PURE__*/function (_React$Component) {
150
156
  _inherits(DropdownField, _React$Component);
151
-
152
157
  function DropdownField() {
153
158
  var _getPrototypeOf2;
154
-
155
159
  var _this;
156
-
157
160
  _classCallCheck(this, DropdownField);
158
-
159
161
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
160
162
  args[_key] = arguments[_key];
161
163
  }
162
-
163
164
  _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DropdownField)).call.apply(_getPrototypeOf2, [this].concat(args)));
164
-
165
165
  _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
166
166
  isOpen: false,
167
167
  currentValue: {
168
168
  displayText: ''
169
169
  }
170
170
  });
171
-
172
171
  _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "isControlledOpen", function () {
173
172
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
174
173
  return typeof props.isOpen !== 'undefined' && props.isOpen !== null;
175
174
  });
176
-
177
175
  _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "isStateless", function () {
178
176
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
179
177
  return typeof props.selectedItem !== 'undefined' && props.selectedItem !== null;
180
178
  });
181
-
182
179
  _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onSetOpened", function (isOpen) {
183
180
  return _this.props.onSetOpened ? _this.props.onSetOpened(isOpen) : _this.setState({
184
181
  isOpen: isOpen
185
182
  });
186
183
  });
187
-
188
184
  _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onSelectItem", function (item) {
189
185
  var onItemSelected = _this.props.onItemSelected;
190
-
191
186
  _this.setState(_extends({}, _this.isStateless() ? {} : {
192
187
  currentValue: item
193
188
  }), function () {
194
189
  if (onItemSelected) {
195
190
  onItemSelected(item);
196
191
  }
197
-
198
192
  _this.onSetOpened(false);
199
193
  });
200
194
  });
201
-
202
195
  return _this;
203
196
  }
204
-
205
197
  _createClass(DropdownField, [{
206
198
  key: "render",
207
199
  value: function render() {
208
200
  var _this2 = this;
209
-
210
201
  var _this$props = this.props,
211
- isLoading = _this$props.isLoading,
212
- errorMessage = _this$props.errorMessage,
213
- selectedItem = _this$props.selectedItem,
214
- placeholder = _this$props.placeholder,
215
- search = _this$props.search,
216
- classNames = _this$props.classNames;
202
+ isLoading = _this$props.isLoading,
203
+ errorMessage = _this$props.errorMessage,
204
+ selectedItem = _this$props.selectedItem,
205
+ placeholder = _this$props.placeholder,
206
+ search = _this$props.search,
207
+ classNames = _this$props.classNames;
217
208
  var isOpen = this.isControlledOpen() ? this.props.isOpen : this.state.isOpen;
218
209
  var currentValue = this.isStateless() ? selectedItem : this.state.currentValue;
219
210
  var isSearch = Boolean(search);
@@ -251,13 +242,13 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
251
242
  key: "body",
252
243
  get: function get() {
253
244
  var _this$props2 = this.props,
254
- items = _this$props2.items,
255
- search = _this$props2.search,
256
- virtualization = _this$props2.virtualization,
257
- itemListMaxHeight = _this$props2.itemListMaxHeight,
258
- _this$props2$classNam = _this$props2.classNames,
259
- selectClassName = _this$props2$classNam.selectClassName,
260
- popoverClassName = _this$props2$classNam.popoverClassName;
245
+ items = _this$props2.items,
246
+ search = _this$props2.search,
247
+ virtualization = _this$props2.virtualization,
248
+ itemListMaxHeight = _this$props2.itemListMaxHeight,
249
+ _this$props2$classNam = _this$props2.classNames,
250
+ selectClassName = _this$props2$classNam.selectClassName,
251
+ popoverClassName = _this$props2$classNam.popoverClassName;
261
252
  return React.createElement(Popover.Body, {
262
253
  classNameBody: classnames(popoverClassName, styles['popover-body--no-gutters'])
263
254
  }, React.createElement(Select, {
@@ -272,10 +263,8 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
272
263
  }));
273
264
  }
274
265
  }]);
275
-
276
266
  return DropdownField;
277
267
  }(React.Component);
278
-
279
268
  _defineProperty(DropdownField, "defaultProps", {
280
269
  placeholder: 'Choose option',
281
270
  isLoading: false,
@@ -16,24 +16,25 @@ function _classCallCheck(instance, Constructor) {
16
16
  throw new TypeError("Cannot call a class as a function");
17
17
  }
18
18
  }
19
-
20
19
  function _defineProperties(target, props) {
21
20
  for (var i = 0; i < props.length; i++) {
22
21
  var descriptor = props[i];
23
22
  descriptor.enumerable = descriptor.enumerable || false;
24
23
  descriptor.configurable = true;
25
24
  if ("value" in descriptor) descriptor.writable = true;
26
- Object.defineProperty(target, descriptor.key, descriptor);
25
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
27
26
  }
28
27
  }
29
-
30
28
  function _createClass(Constructor, protoProps, staticProps) {
31
29
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
32
30
  if (staticProps) _defineProperties(Constructor, staticProps);
31
+ Object.defineProperty(Constructor, "prototype", {
32
+ writable: false
33
+ });
33
34
  return Constructor;
34
35
  }
35
-
36
36
  function _defineProperty(obj, key, value) {
37
+ key = _toPropertyKey(key);
37
38
  if (key in obj) {
38
39
  Object.defineProperty(obj, key, {
39
40
  value: value,
@@ -44,33 +45,26 @@ function _defineProperty(obj, key, value) {
44
45
  } else {
45
46
  obj[key] = value;
46
47
  }
47
-
48
48
  return obj;
49
49
  }
50
-
51
50
  function _extends() {
52
- _extends = Object.assign || function (target) {
51
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
53
52
  for (var i = 1; i < arguments.length; i++) {
54
53
  var source = arguments[i];
55
-
56
54
  for (var key in source) {
57
55
  if (Object.prototype.hasOwnProperty.call(source, key)) {
58
56
  target[key] = source[key];
59
57
  }
60
58
  }
61
59
  }
62
-
63
60
  return target;
64
61
  };
65
-
66
62
  return _extends.apply(this, arguments);
67
63
  }
68
-
69
64
  function _inherits(subClass, superClass) {
70
65
  if (typeof superClass !== "function" && superClass !== null) {
71
66
  throw new TypeError("Super expression must either be null or a function");
72
67
  }
73
-
74
68
  subClass.prototype = Object.create(superClass && superClass.prototype, {
75
69
  constructor: {
76
70
  value: subClass,
@@ -78,40 +72,52 @@ function _inherits(subClass, superClass) {
78
72
  configurable: true
79
73
  }
80
74
  });
75
+ Object.defineProperty(subClass, "prototype", {
76
+ writable: false
77
+ });
81
78
  if (superClass) _setPrototypeOf(subClass, superClass);
82
79
  }
83
-
84
80
  function _getPrototypeOf(o) {
85
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
81
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
86
82
  return o.__proto__ || Object.getPrototypeOf(o);
87
83
  };
88
84
  return _getPrototypeOf(o);
89
85
  }
90
-
91
86
  function _setPrototypeOf(o, p) {
92
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
87
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
93
88
  o.__proto__ = p;
94
89
  return o;
95
90
  };
96
-
97
91
  return _setPrototypeOf(o, p);
98
92
  }
99
-
100
93
  function _assertThisInitialized(self) {
101
94
  if (self === void 0) {
102
95
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
103
96
  }
104
-
105
97
  return self;
106
98
  }
107
-
108
99
  function _possibleConstructorReturn(self, call) {
109
100
  if (call && (typeof call === "object" || typeof call === "function")) {
110
101
  return call;
102
+ } else if (call !== void 0) {
103
+ throw new TypeError("Derived constructors may only return object or undefined");
111
104
  }
112
-
113
105
  return _assertThisInitialized(self);
114
106
  }
107
+ function _toPrimitive(input, hint) {
108
+ if (typeof input !== "object" || input === null) return input;
109
+ var prim = input[Symbol.toPrimitive];
110
+ if (prim !== undefined) {
111
+ var res = prim.call(input, hint || "default");
112
+ if (typeof res !== "object") return res;
113
+ throw new TypeError("@@toPrimitive must return a primitive value.");
114
+ }
115
+ return (hint === "string" ? String : Number)(input);
116
+ }
117
+ function _toPropertyKey(arg) {
118
+ var key = _toPrimitive(arg, "string");
119
+ return typeof key === "symbol" ? key : String(key);
120
+ }
115
121
 
116
122
  function styleInject(css, ref) {
117
123
  if ( ref === void 0 ) ref = {};
@@ -140,8 +146,8 @@ function styleInject(css, ref) {
140
146
  }
141
147
  }
142
148
 
143
- var css = ".popover-body--no-gutters__dropdown-field__12-18-0 {\r\n padding: 0;\r\n}\r\n";
144
- var styles = {"popover-body--no-gutters":"popover-body--no-gutters__dropdown-field__12-18-0"};
149
+ var css = ".popover-body--no-gutters__dropdown-field__12-18-2-alpha-1 {\r\n padding: 0;\r\n}\r\n";
150
+ var styles = {"popover-body--no-gutters":"popover-body--no-gutters__dropdown-field__12-18-2-alpha-1"};
145
151
  styleInject(css);
146
152
 
147
153
  var dropdownInnerSpace = 4;
@@ -154,72 +160,57 @@ var boxShadowGutter = 3;
154
160
 
155
161
  var DropdownField = /*#__PURE__*/function (_React$Component) {
156
162
  _inherits(DropdownField, _React$Component);
157
-
158
163
  function DropdownField() {
159
164
  var _getPrototypeOf2;
160
-
161
165
  var _this;
162
-
163
166
  _classCallCheck(this, DropdownField);
164
-
165
167
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
166
168
  args[_key] = arguments[_key];
167
169
  }
168
-
169
170
  _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DropdownField)).call.apply(_getPrototypeOf2, [this].concat(args)));
170
-
171
171
  _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
172
172
  isOpen: false,
173
173
  currentValue: {
174
174
  displayText: ''
175
175
  }
176
176
  });
177
-
178
177
  _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "isControlledOpen", function () {
179
178
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
180
179
  return typeof props.isOpen !== 'undefined' && props.isOpen !== null;
181
180
  });
182
-
183
181
  _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "isStateless", function () {
184
182
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
185
183
  return typeof props.selectedItem !== 'undefined' && props.selectedItem !== null;
186
184
  });
187
-
188
185
  _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onSetOpened", function (isOpen) {
189
186
  return _this.props.onSetOpened ? _this.props.onSetOpened(isOpen) : _this.setState({
190
187
  isOpen: isOpen
191
188
  });
192
189
  });
193
-
194
190
  _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onSelectItem", function (item) {
195
191
  var onItemSelected = _this.props.onItemSelected;
196
-
197
192
  _this.setState(_extends({}, _this.isStateless() ? {} : {
198
193
  currentValue: item
199
194
  }), function () {
200
195
  if (onItemSelected) {
201
196
  onItemSelected(item);
202
197
  }
203
-
204
198
  _this.onSetOpened(false);
205
199
  });
206
200
  });
207
-
208
201
  return _this;
209
202
  }
210
-
211
203
  _createClass(DropdownField, [{
212
204
  key: "render",
213
205
  value: function render() {
214
206
  var _this2 = this;
215
-
216
207
  var _this$props = this.props,
217
- isLoading = _this$props.isLoading,
218
- errorMessage = _this$props.errorMessage,
219
- selectedItem = _this$props.selectedItem,
220
- placeholder = _this$props.placeholder,
221
- search = _this$props.search,
222
- classNames = _this$props.classNames;
208
+ isLoading = _this$props.isLoading,
209
+ errorMessage = _this$props.errorMessage,
210
+ selectedItem = _this$props.selectedItem,
211
+ placeholder = _this$props.placeholder,
212
+ search = _this$props.search,
213
+ classNames = _this$props.classNames;
223
214
  var isOpen = this.isControlledOpen() ? this.props.isOpen : this.state.isOpen;
224
215
  var currentValue = this.isStateless() ? selectedItem : this.state.currentValue;
225
216
  var isSearch = Boolean(search);
@@ -257,13 +248,13 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
257
248
  key: "body",
258
249
  get: function get() {
259
250
  var _this$props2 = this.props,
260
- items = _this$props2.items,
261
- search = _this$props2.search,
262
- virtualization = _this$props2.virtualization,
263
- itemListMaxHeight = _this$props2.itemListMaxHeight,
264
- _this$props2$classNam = _this$props2.classNames,
265
- selectClassName = _this$props2$classNam.selectClassName,
266
- popoverClassName = _this$props2$classNam.popoverClassName;
251
+ items = _this$props2.items,
252
+ search = _this$props2.search,
253
+ virtualization = _this$props2.virtualization,
254
+ itemListMaxHeight = _this$props2.itemListMaxHeight,
255
+ _this$props2$classNam = _this$props2.classNames,
256
+ selectClassName = _this$props2$classNam.selectClassName,
257
+ popoverClassName = _this$props2$classNam.popoverClassName;
267
258
  return React.createElement(popover.Popover.Body, {
268
259
  classNameBody: classnames(popoverClassName, styles['popover-body--no-gutters'])
269
260
  }, React.createElement(select.Select, {
@@ -278,10 +269,8 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
278
269
  }));
279
270
  }
280
271
  }]);
281
-
282
272
  return DropdownField;
283
273
  }(React.Component);
284
-
285
274
  _defineProperty(DropdownField, "defaultProps", {
286
275
  placeholder: 'Choose option',
287
276
  isLoading: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@targetprocess/dropdown-field",
3
- "version": "12.18.0",
3
+ "version": "12.18.2-alpha.1",
4
4
  "description": "",
5
5
  "main": "dist/dropdown-field.js",
6
6
  "module": "dist/dropdown-field.es.js",
@@ -10,10 +10,10 @@
10
10
  "prepack": "node -r ../../.ts-node.js ../../config/rollup.config.js ."
11
11
  },
12
12
  "dependencies": {
13
- "@targetprocess/field": "^12.18.0",
14
- "@targetprocess/icons": "^12.18.0",
15
- "@targetprocess/popover": "^12.7.3",
16
- "@targetprocess/select": "^12.18.0",
13
+ "@targetprocess/field": "^12.18.2-alpha.1",
14
+ "@targetprocess/icons": "^12.18.2-alpha.1",
15
+ "@targetprocess/popover": "^12.18.2-alpha.1",
16
+ "@targetprocess/select": "^12.18.2-alpha.1",
17
17
  "classnames": "^2.2.5",
18
18
  "prop-types": "^15.6.0",
19
19
  "react": "^16.7.0"
@@ -22,5 +22,5 @@
22
22
  "access": "public"
23
23
  },
24
24
  "sideEffects": false,
25
- "gitHead": "ee2bac23927a0cbe36021923df66c10359b0f0ca"
25
+ "gitHead": "a0cbd3034253a0be67c3b03434cb8da591701e70"
26
26
  }