@targetprocess/dropdown-field 12.32.2 → 12.32.3-ci.2

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.
@@ -1,4 +1,6 @@
1
- /* eslint-env jest */
1
+ /*********************************************************************
2
+ * © Copyright IBM Corp. 2026
3
+ *********************************************************************/
2
4
  import React from 'react'
3
5
  import {mount} from 'enzyme'
4
6
  import {DropdownField} from '../DropdownField'
@@ -3,126 +3,105 @@ import classnames from 'classnames';
3
3
  import { Select } from '@targetprocess/select';
4
4
  import { Popover } from '@targetprocess/popover';
5
5
  import { Field } from '@targetprocess/field';
6
- import { LoadingIcon, ChevronIcon } from '@targetprocess/icons';
6
+ import { ChevronIcon, LoadingIcon } from '@targetprocess/icons';
7
7
 
8
- function _classCallCheck(instance, Constructor) {
9
- if (!(instance instanceof Constructor)) {
10
- throw new TypeError("Cannot call a class as a function");
11
- }
8
+ function _assertThisInitialized(e) {
9
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
10
+ return e;
11
+ }
12
+ function _callSuper(t, o, e) {
13
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
12
14
  }
13
- function _defineProperties(target, props) {
14
- for (var i = 0; i < props.length; i++) {
15
- var descriptor = props[i];
16
- descriptor.enumerable = descriptor.enumerable || false;
17
- descriptor.configurable = true;
18
- if ("value" in descriptor) descriptor.writable = true;
19
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
15
+ function _classCallCheck(a, n) {
16
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
17
+ }
18
+ function _defineProperties(e, r) {
19
+ for (var t = 0; t < r.length; t++) {
20
+ var o = r[t];
21
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
20
22
  }
21
23
  }
22
- function _createClass(Constructor, protoProps, staticProps) {
23
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
24
- if (staticProps) _defineProperties(Constructor, staticProps);
25
- Object.defineProperty(Constructor, "prototype", {
24
+ function _createClass(e, r, t) {
25
+ return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
26
26
  writable: false
27
- });
28
- return Constructor;
27
+ }), e;
29
28
  }
30
- function _defineProperty(obj, key, value) {
31
- key = _toPropertyKey(key);
32
- if (key in obj) {
33
- Object.defineProperty(obj, key, {
34
- value: value,
35
- enumerable: true,
36
- configurable: true,
37
- writable: true
38
- });
39
- } else {
40
- obj[key] = value;
41
- }
42
- return obj;
29
+ function _defineProperty(e, r, t) {
30
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
31
+ value: t,
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true
35
+ }) : e[r] = t, e;
43
36
  }
44
37
  function _extends() {
45
- _extends = Object.assign ? Object.assign.bind() : function (target) {
46
- for (var i = 1; i < arguments.length; i++) {
47
- var source = arguments[i];
48
- for (var key in source) {
49
- if (Object.prototype.hasOwnProperty.call(source, key)) {
50
- target[key] = source[key];
51
- }
52
- }
38
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
39
+ for (var e = 1; e < arguments.length; e++) {
40
+ var t = arguments[e];
41
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
53
42
  }
54
- return target;
55
- };
56
- return _extends.apply(this, arguments);
43
+ return n;
44
+ }, _extends.apply(null, arguments);
57
45
  }
58
- function _inherits(subClass, superClass) {
59
- if (typeof superClass !== "function" && superClass !== null) {
60
- throw new TypeError("Super expression must either be null or a function");
61
- }
62
- subClass.prototype = Object.create(superClass && superClass.prototype, {
46
+ function _getPrototypeOf(t) {
47
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
48
+ return t.__proto__ || Object.getPrototypeOf(t);
49
+ }, _getPrototypeOf(t);
50
+ }
51
+ function _inherits(t, e) {
52
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
53
+ t.prototype = Object.create(e && e.prototype, {
63
54
  constructor: {
64
- value: subClass,
55
+ value: t,
65
56
  writable: true,
66
57
  configurable: true
67
58
  }
68
- });
69
- Object.defineProperty(subClass, "prototype", {
59
+ }), Object.defineProperty(t, "prototype", {
70
60
  writable: false
71
- });
72
- if (superClass) _setPrototypeOf(subClass, superClass);
61
+ }), e && _setPrototypeOf(t, e);
73
62
  }
74
- function _getPrototypeOf(o) {
75
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
76
- return o.__proto__ || Object.getPrototypeOf(o);
77
- };
78
- return _getPrototypeOf(o);
63
+ function _isNativeReflectConstruct() {
64
+ try {
65
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
66
+ } catch (t) {}
67
+ return (_isNativeReflectConstruct = function () {
68
+ return !!t;
69
+ })();
79
70
  }
80
- function _setPrototypeOf(o, p) {
81
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
82
- o.__proto__ = p;
83
- return o;
84
- };
85
- return _setPrototypeOf(o, p);
71
+ function _possibleConstructorReturn(t, e) {
72
+ if (e && ("object" == typeof e || "function" == typeof e)) return e;
73
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
74
+ return _assertThisInitialized(t);
86
75
  }
87
- function _assertThisInitialized(self) {
88
- if (self === void 0) {
89
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
90
- }
91
- return self;
76
+ function _setPrototypeOf(t, e) {
77
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
78
+ return t.__proto__ = e, t;
79
+ }, _setPrototypeOf(t, e);
92
80
  }
93
- function _possibleConstructorReturn(self, call) {
94
- if (call && (typeof call === "object" || typeof call === "function")) {
95
- return call;
96
- } else if (call !== void 0) {
97
- throw new TypeError("Derived constructors may only return object or undefined");
98
- }
99
- return _assertThisInitialized(self);
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;
81
+ function _toPrimitive(t, e) {
82
+ if ("object" != typeof t || !t) return t;
83
+ var r;
84
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
85
+ var i = r.call(t, e);
86
+ if ("object" != typeof i) return i;
107
87
  throw new TypeError("@@toPrimitive must return a primitive value.");
108
88
  }
109
- return (hint === "string" ? String : Number)(input);
89
+ return (String )(t);
110
90
  }
111
- function _toPropertyKey(arg) {
112
- var key = _toPrimitive(arg, "string");
113
- return typeof key === "symbol" ? key : String(key);
91
+ function _toPropertyKey(t) {
92
+ var i = _toPrimitive(t, "string");
93
+ return "symbol" == typeof i ? i : i + "";
114
94
  }
115
95
 
116
96
  function styleInject(css, ref) {
117
- if ( ref === void 0 ) ref = {};
97
+ if (ref === void 0) ref = {};
118
98
  var insertAt = ref.insertAt;
119
-
120
- if (!css || typeof document === 'undefined') { return; }
121
-
99
+ if (typeof document === 'undefined') {
100
+ return;
101
+ }
122
102
  var head = document.head || document.getElementsByTagName('head')[0];
123
103
  var style = document.createElement('style');
124
104
  style.type = 'text/css';
125
-
126
105
  if (insertAt === 'top') {
127
106
  if (head.firstChild) {
128
107
  head.insertBefore(style, head.firstChild);
@@ -132,7 +111,6 @@ function styleInject(css, ref) {
132
111
  } else {
133
112
  head.appendChild(style);
134
113
  }
135
-
136
114
  if (style.styleSheet) {
137
115
  style.styleSheet.cssText = css;
138
116
  } else {
@@ -140,9 +118,9 @@ function styleInject(css, ref) {
140
118
  }
141
119
  }
142
120
 
143
- var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.popover-body--no-gutters__dropdown-field__12-32-2 {\n padding: 0;\n}\n";
144
- var styles = {"popover-body--no-gutters":"popover-body--no-gutters__dropdown-field__12-32-2"};
145
- styleInject(css);
121
+ var css_248z = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.popover-body--no-gutters__dropdown-field__12-32-3-ci-2 {\n padding: 0;\n}\n";
122
+ var styles = {"popover-body--no-gutters":"popover-body--no-gutters__dropdown-field__12-32-3-ci-2"};
123
+ styleInject(css_248z);
146
124
 
147
125
  var dropdownInnerSpace = 4;
148
126
  var boxShadowGutter = 3;
@@ -153,35 +131,33 @@ var boxShadowGutter = 3;
153
131
  **/
154
132
 
155
133
  var DropdownField = /*#__PURE__*/function (_React$Component) {
156
- _inherits(DropdownField, _React$Component);
157
134
  function DropdownField() {
158
- var _getPrototypeOf2;
159
135
  var _this;
160
136
  _classCallCheck(this, DropdownField);
161
137
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
162
138
  args[_key] = arguments[_key];
163
139
  }
164
- _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DropdownField)).call.apply(_getPrototypeOf2, [this].concat(args)));
165
- _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
140
+ _this = _callSuper(this, DropdownField, [].concat(args));
141
+ _defineProperty(_this, "state", {
166
142
  isOpen: false,
167
143
  currentValue: {
168
144
  displayText: ''
169
145
  }
170
146
  });
171
- _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "isControlledOpen", function () {
147
+ _defineProperty(_this, "isControlledOpen", function () {
172
148
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
173
149
  return typeof props.isOpen !== 'undefined' && props.isOpen !== null;
174
150
  });
175
- _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "isStateless", function () {
151
+ _defineProperty(_this, "isStateless", function () {
176
152
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
177
153
  return typeof props.selectedItem !== 'undefined' && props.selectedItem !== null;
178
154
  });
179
- _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onSetOpened", function (isOpen) {
155
+ _defineProperty(_this, "onSetOpened", function (isOpen) {
180
156
  return _this.props.onSetOpened ? _this.props.onSetOpened(isOpen) : _this.setState({
181
157
  isOpen: isOpen
182
158
  });
183
159
  });
184
- _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onSelectItem", function (item) {
160
+ _defineProperty(_this, "onSelectItem", function (item) {
185
161
  var onItemSelected = _this.props.onItemSelected;
186
162
  _this.setState(_extends({}, _this.isStateless() ? {} : {
187
163
  currentValue: item
@@ -194,21 +170,46 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
194
170
  });
195
171
  return _this;
196
172
  }
197
- _createClass(DropdownField, [{
173
+ _inherits(DropdownField, _React$Component);
174
+ return _createClass(DropdownField, [{
175
+ key: "body",
176
+ get: function get() {
177
+ var _this$props = this.props,
178
+ items = _this$props.items,
179
+ search = _this$props.search,
180
+ virtualization = _this$props.virtualization,
181
+ itemListMaxHeight = _this$props.itemListMaxHeight,
182
+ _this$props$className = _this$props.classNames,
183
+ selectClassName = _this$props$className.selectClassName,
184
+ popoverClassName = _this$props$className.popoverClassName;
185
+ return /*#__PURE__*/React.createElement(Popover.Body, {
186
+ classNameBody: classnames(popoverClassName, styles['popover-body--no-gutters'])
187
+ }, /*#__PURE__*/React.createElement(Select, {
188
+ searchEnabled: true,
189
+ className: selectClassName,
190
+ itemListMaxHeight: itemListMaxHeight,
191
+ showCheckbox: false,
192
+ search: search,
193
+ virtualization: virtualization,
194
+ items: items,
195
+ onItemSelectionChange: this.onSelectItem
196
+ }));
197
+ }
198
+ }, {
198
199
  key: "render",
199
200
  value: function render() {
200
201
  var _this2 = this;
201
- var _this$props = this.props,
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;
202
+ var _this$props2 = this.props,
203
+ isLoading = _this$props2.isLoading,
204
+ errorMessage = _this$props2.errorMessage,
205
+ selectedItem = _this$props2.selectedItem,
206
+ placeholder = _this$props2.placeholder,
207
+ search = _this$props2.search,
208
+ classNames = _this$props2.classNames;
208
209
  var isOpen = this.isControlledOpen() ? this.props.isOpen : this.state.isOpen;
209
210
  var currentValue = this.isStateless() ? selectedItem : this.state.currentValue;
210
211
  var isSearch = Boolean(search);
211
- return React.createElement(Popover, {
212
+ return /*#__PURE__*/React.createElement(Popover, {
212
213
  onOuterAction: function onOuterAction() {
213
214
  return _this2.onSetOpened(false);
214
215
  },
@@ -222,7 +223,7 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
222
223
  };
223
224
  },
224
225
  showTip: false
225
- }, React.createElement(Field, {
226
+ }, /*#__PURE__*/React.createElement(Field, {
226
227
  disableEdit: true,
227
228
  className: classNames.fieldClassName,
228
229
  message: errorMessage,
@@ -231,39 +232,14 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
231
232
  },
232
233
  value: currentValue.displayText,
233
234
  editing: isOpen,
234
- icon: isLoading ? React.createElement(LoadingIcon, null) : null,
235
+ icon: isLoading ? /*#__PURE__*/React.createElement(LoadingIcon, null) : null,
235
236
  placeholder: placeholder,
236
237
  editModeProps: {
237
- rightElement: React.createElement(ChevronIcon, null)
238
+ rightElement: /*#__PURE__*/React.createElement(ChevronIcon, null)
238
239
  }
239
240
  }));
240
241
  }
241
- }, {
242
- key: "body",
243
- get: function get() {
244
- var _this$props2 = this.props,
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;
252
- return React.createElement(Popover.Body, {
253
- classNameBody: classnames(popoverClassName, styles['popover-body--no-gutters'])
254
- }, React.createElement(Select, {
255
- searchEnabled: true,
256
- className: selectClassName,
257
- itemListMaxHeight: itemListMaxHeight,
258
- showCheckbox: false,
259
- search: search,
260
- virtualization: virtualization,
261
- items: items,
262
- onItemSelectionChange: this.onSelectItem
263
- }));
264
- }
265
242
  }]);
266
- return DropdownField;
267
243
  }(React.Component);
268
244
  _defineProperty(DropdownField, "defaultProps", {
269
245
  placeholder: 'Choose option',
@@ -272,8 +248,4 @@ _defineProperty(DropdownField, "defaultProps", {
272
248
  items: []
273
249
  });
274
250
 
275
- /*********************************************************************
276
- * © Copyright IBM Corp. 2024
277
- *********************************************************************/
278
-
279
251
  export { DropdownField };
@@ -1,129 +1,110 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var React = _interopDefault(require('react'));
8
- var classnames = _interopDefault(require('classnames'));
3
+ var React = require('react');
4
+ var classnames = require('classnames');
9
5
  var select = require('@targetprocess/select');
10
6
  var popover = require('@targetprocess/popover');
11
7
  var field = require('@targetprocess/field');
12
8
  var icons = require('@targetprocess/icons');
13
9
 
14
- function _classCallCheck(instance, Constructor) {
15
- if (!(instance instanceof Constructor)) {
16
- throw new TypeError("Cannot call a class as a function");
17
- }
10
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
+
12
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
13
+ var classnames__default = /*#__PURE__*/_interopDefaultCompat(classnames);
14
+
15
+ function _assertThisInitialized(e) {
16
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17
+ return e;
18
+ }
19
+ function _callSuper(t, o, e) {
20
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
21
+ }
22
+ function _classCallCheck(a, n) {
23
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
18
24
  }
19
- function _defineProperties(target, props) {
20
- for (var i = 0; i < props.length; i++) {
21
- var descriptor = props[i];
22
- descriptor.enumerable = descriptor.enumerable || false;
23
- descriptor.configurable = true;
24
- if ("value" in descriptor) descriptor.writable = true;
25
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
25
+ function _defineProperties(e, r) {
26
+ for (var t = 0; t < r.length; t++) {
27
+ var o = r[t];
28
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
26
29
  }
27
30
  }
28
- function _createClass(Constructor, protoProps, staticProps) {
29
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
30
- if (staticProps) _defineProperties(Constructor, staticProps);
31
- Object.defineProperty(Constructor, "prototype", {
31
+ function _createClass(e, r, t) {
32
+ return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
32
33
  writable: false
33
- });
34
- return Constructor;
34
+ }), e;
35
35
  }
36
- function _defineProperty(obj, key, value) {
37
- key = _toPropertyKey(key);
38
- if (key in obj) {
39
- Object.defineProperty(obj, key, {
40
- value: value,
41
- enumerable: true,
42
- configurable: true,
43
- writable: true
44
- });
45
- } else {
46
- obj[key] = value;
47
- }
48
- return obj;
36
+ function _defineProperty(e, r, t) {
37
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
38
+ value: t,
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true
42
+ }) : e[r] = t, e;
49
43
  }
50
44
  function _extends() {
51
- _extends = Object.assign ? Object.assign.bind() : function (target) {
52
- for (var i = 1; i < arguments.length; i++) {
53
- var source = arguments[i];
54
- for (var key in source) {
55
- if (Object.prototype.hasOwnProperty.call(source, key)) {
56
- target[key] = source[key];
57
- }
58
- }
45
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
46
+ for (var e = 1; e < arguments.length; e++) {
47
+ var t = arguments[e];
48
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
59
49
  }
60
- return target;
61
- };
62
- return _extends.apply(this, arguments);
50
+ return n;
51
+ }, _extends.apply(null, arguments);
63
52
  }
64
- function _inherits(subClass, superClass) {
65
- if (typeof superClass !== "function" && superClass !== null) {
66
- throw new TypeError("Super expression must either be null or a function");
67
- }
68
- subClass.prototype = Object.create(superClass && superClass.prototype, {
53
+ function _getPrototypeOf(t) {
54
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
55
+ return t.__proto__ || Object.getPrototypeOf(t);
56
+ }, _getPrototypeOf(t);
57
+ }
58
+ function _inherits(t, e) {
59
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
60
+ t.prototype = Object.create(e && e.prototype, {
69
61
  constructor: {
70
- value: subClass,
62
+ value: t,
71
63
  writable: true,
72
64
  configurable: true
73
65
  }
74
- });
75
- Object.defineProperty(subClass, "prototype", {
66
+ }), Object.defineProperty(t, "prototype", {
76
67
  writable: false
77
- });
78
- if (superClass) _setPrototypeOf(subClass, superClass);
68
+ }), e && _setPrototypeOf(t, e);
79
69
  }
80
- function _getPrototypeOf(o) {
81
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
82
- return o.__proto__ || Object.getPrototypeOf(o);
83
- };
84
- return _getPrototypeOf(o);
70
+ function _isNativeReflectConstruct() {
71
+ try {
72
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
73
+ } catch (t) {}
74
+ return (_isNativeReflectConstruct = function () {
75
+ return !!t;
76
+ })();
85
77
  }
86
- function _setPrototypeOf(o, p) {
87
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
88
- o.__proto__ = p;
89
- return o;
90
- };
91
- return _setPrototypeOf(o, p);
78
+ function _possibleConstructorReturn(t, e) {
79
+ if (e && ("object" == typeof e || "function" == typeof e)) return e;
80
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
81
+ return _assertThisInitialized(t);
92
82
  }
93
- function _assertThisInitialized(self) {
94
- if (self === void 0) {
95
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
96
- }
97
- return self;
98
- }
99
- function _possibleConstructorReturn(self, call) {
100
- if (call && (typeof call === "object" || typeof call === "function")) {
101
- return call;
102
- } else if (call !== void 0) {
103
- throw new TypeError("Derived constructors may only return object or undefined");
104
- }
105
- return _assertThisInitialized(self);
83
+ function _setPrototypeOf(t, e) {
84
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
85
+ return t.__proto__ = e, t;
86
+ }, _setPrototypeOf(t, e);
106
87
  }
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;
88
+ function _toPrimitive(t, e) {
89
+ if ("object" != typeof t || !t) return t;
90
+ var r;
91
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
92
+ var i = r.call(t, e);
93
+ if ("object" != typeof i) return i;
113
94
  throw new TypeError("@@toPrimitive must return a primitive value.");
114
95
  }
115
- return (hint === "string" ? String : Number)(input);
96
+ return (String )(t);
116
97
  }
117
- function _toPropertyKey(arg) {
118
- var key = _toPrimitive(arg, "string");
119
- return typeof key === "symbol" ? key : String(key);
98
+ function _toPropertyKey(t) {
99
+ var i = _toPrimitive(t, "string");
100
+ return "symbol" == typeof i ? i : i + "";
120
101
  }
121
102
 
122
103
  function styleInject(css, ref) {
123
104
  if ( ref === void 0 ) ref = {};
124
105
  var insertAt = ref.insertAt;
125
106
 
126
- if (!css || typeof document === 'undefined') { return; }
107
+ if (typeof document === 'undefined') { return; }
127
108
 
128
109
  var head = document.head || document.getElementsByTagName('head')[0];
129
110
  var style = document.createElement('style');
@@ -146,9 +127,9 @@ function styleInject(css, ref) {
146
127
  }
147
128
  }
148
129
 
149
- var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.popover-body--no-gutters__dropdown-field__12-32-2 {\n padding: 0;\n}\n";
150
- var styles = {"popover-body--no-gutters":"popover-body--no-gutters__dropdown-field__12-32-2"};
151
- styleInject(css);
130
+ var css_248z = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.popover-body--no-gutters__dropdown-field__12-32-3-ci-2 {\n padding: 0;\n}\n";
131
+ var styles = {"popover-body--no-gutters":"popover-body--no-gutters__dropdown-field__12-32-3-ci-2"};
132
+ styleInject(css_248z);
152
133
 
153
134
  var dropdownInnerSpace = 4;
154
135
  var boxShadowGutter = 3;
@@ -159,35 +140,33 @@ var boxShadowGutter = 3;
159
140
  **/
160
141
 
161
142
  var DropdownField = /*#__PURE__*/function (_React$Component) {
162
- _inherits(DropdownField, _React$Component);
163
143
  function DropdownField() {
164
- var _getPrototypeOf2;
165
144
  var _this;
166
145
  _classCallCheck(this, DropdownField);
167
146
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
168
147
  args[_key] = arguments[_key];
169
148
  }
170
- _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DropdownField)).call.apply(_getPrototypeOf2, [this].concat(args)));
171
- _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
149
+ _this = _callSuper(this, DropdownField, [].concat(args));
150
+ _defineProperty(_this, "state", {
172
151
  isOpen: false,
173
152
  currentValue: {
174
153
  displayText: ''
175
154
  }
176
155
  });
177
- _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "isControlledOpen", function () {
156
+ _defineProperty(_this, "isControlledOpen", function () {
178
157
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
179
158
  return typeof props.isOpen !== 'undefined' && props.isOpen !== null;
180
159
  });
181
- _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "isStateless", function () {
160
+ _defineProperty(_this, "isStateless", function () {
182
161
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
183
162
  return typeof props.selectedItem !== 'undefined' && props.selectedItem !== null;
184
163
  });
185
- _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onSetOpened", function (isOpen) {
164
+ _defineProperty(_this, "onSetOpened", function (isOpen) {
186
165
  return _this.props.onSetOpened ? _this.props.onSetOpened(isOpen) : _this.setState({
187
166
  isOpen: isOpen
188
167
  });
189
168
  });
190
- _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onSelectItem", function (item) {
169
+ _defineProperty(_this, "onSelectItem", function (item) {
191
170
  var onItemSelected = _this.props.onItemSelected;
192
171
  _this.setState(_extends({}, _this.isStateless() ? {} : {
193
172
  currentValue: item
@@ -200,21 +179,46 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
200
179
  });
201
180
  return _this;
202
181
  }
203
- _createClass(DropdownField, [{
182
+ _inherits(DropdownField, _React$Component);
183
+ return _createClass(DropdownField, [{
184
+ key: "body",
185
+ get: function get() {
186
+ var _this$props = this.props,
187
+ items = _this$props.items,
188
+ search = _this$props.search,
189
+ virtualization = _this$props.virtualization,
190
+ itemListMaxHeight = _this$props.itemListMaxHeight,
191
+ _this$props$className = _this$props.classNames,
192
+ selectClassName = _this$props$className.selectClassName,
193
+ popoverClassName = _this$props$className.popoverClassName;
194
+ return /*#__PURE__*/React__default.default.createElement(popover.Popover.Body, {
195
+ classNameBody: classnames__default.default(popoverClassName, styles['popover-body--no-gutters'])
196
+ }, /*#__PURE__*/React__default.default.createElement(select.Select, {
197
+ searchEnabled: true,
198
+ className: selectClassName,
199
+ itemListMaxHeight: itemListMaxHeight,
200
+ showCheckbox: false,
201
+ search: search,
202
+ virtualization: virtualization,
203
+ items: items,
204
+ onItemSelectionChange: this.onSelectItem
205
+ }));
206
+ }
207
+ }, {
204
208
  key: "render",
205
209
  value: function render() {
206
210
  var _this2 = this;
207
- var _this$props = this.props,
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;
211
+ var _this$props2 = this.props,
212
+ isLoading = _this$props2.isLoading,
213
+ errorMessage = _this$props2.errorMessage,
214
+ selectedItem = _this$props2.selectedItem,
215
+ placeholder = _this$props2.placeholder,
216
+ search = _this$props2.search,
217
+ classNames = _this$props2.classNames;
214
218
  var isOpen = this.isControlledOpen() ? this.props.isOpen : this.state.isOpen;
215
219
  var currentValue = this.isStateless() ? selectedItem : this.state.currentValue;
216
220
  var isSearch = Boolean(search);
217
- return React.createElement(popover.Popover, {
221
+ return /*#__PURE__*/React__default.default.createElement(popover.Popover, {
218
222
  onOuterAction: function onOuterAction() {
219
223
  return _this2.onSetOpened(false);
220
224
  },
@@ -228,7 +232,7 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
228
232
  };
229
233
  },
230
234
  showTip: false
231
- }, React.createElement(field.Field, {
235
+ }, /*#__PURE__*/React__default.default.createElement(field.Field, {
232
236
  disableEdit: true,
233
237
  className: classNames.fieldClassName,
234
238
  message: errorMessage,
@@ -237,40 +241,15 @@ var DropdownField = /*#__PURE__*/function (_React$Component) {
237
241
  },
238
242
  value: currentValue.displayText,
239
243
  editing: isOpen,
240
- icon: isLoading ? React.createElement(icons.LoadingIcon, null) : null,
244
+ icon: isLoading ? /*#__PURE__*/React__default.default.createElement(icons.LoadingIcon, null) : null,
241
245
  placeholder: placeholder,
242
246
  editModeProps: {
243
- rightElement: React.createElement(icons.ChevronIcon, null)
247
+ rightElement: /*#__PURE__*/React__default.default.createElement(icons.ChevronIcon, null)
244
248
  }
245
249
  }));
246
250
  }
247
- }, {
248
- key: "body",
249
- get: function get() {
250
- var _this$props2 = this.props,
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;
258
- return React.createElement(popover.Popover.Body, {
259
- classNameBody: classnames(popoverClassName, styles['popover-body--no-gutters'])
260
- }, React.createElement(select.Select, {
261
- searchEnabled: true,
262
- className: selectClassName,
263
- itemListMaxHeight: itemListMaxHeight,
264
- showCheckbox: false,
265
- search: search,
266
- virtualization: virtualization,
267
- items: items,
268
- onItemSelectionChange: this.onSelectItem
269
- }));
270
- }
271
251
  }]);
272
- return DropdownField;
273
- }(React.Component);
252
+ }(React__default.default.Component);
274
253
  _defineProperty(DropdownField, "defaultProps", {
275
254
  placeholder: 'Choose option',
276
255
  isLoading: false,
@@ -278,8 +257,4 @@ _defineProperty(DropdownField, "defaultProps", {
278
257
  items: []
279
258
  });
280
259
 
281
- /*********************************************************************
282
- * © Copyright IBM Corp. 2024
283
- *********************************************************************/
284
-
285
260
  exports.DropdownField = DropdownField;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@targetprocess/dropdown-field",
3
- "version": "12.32.2",
3
+ "version": "12.32.3-ci.2",
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.32.2",
14
- "@targetprocess/icons": "^12.32.2",
15
- "@targetprocess/popover": "12.32.2",
16
- "@targetprocess/select": "^12.32.2",
13
+ "@targetprocess/field": "^12.32.3-ci.2",
14
+ "@targetprocess/icons": "^12.32.3-ci.2",
15
+ "@targetprocess/popover": "^12.32.3-ci.2",
16
+ "@targetprocess/select": "^12.32.3-ci.2",
17
17
  "classnames": "^2.2.5",
18
18
  "prop-types": "^15.6.0",
19
19
  "react": "^16.7.0"
@@ -25,5 +25,5 @@
25
25
  "access": "public"
26
26
  },
27
27
  "sideEffects": false,
28
- "gitHead": "42107ff130ebf3943c68475aee7b66534fb139b1"
28
+ "gitHead": "97a2147da1774427ce1349a0ad34a47342458d76"
29
29
  }