@synerise/ds-search 0.8.87 → 0.8.88

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.8.88](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@0.8.87...@synerise/ds-search@0.8.88) (2024-04-25)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **search:** prevent toggling input if dropdown is open ([e601c44](https://github.com/Synerise/synerise-design/commit/e601c449acb9179229c41d7b0a8d053e4d5f810a))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.8.87](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@0.8.86...@synerise/ds-search@0.8.87) (2024-04-15)
7
18
 
8
19
  **Note:** Version bump only for package @synerise/ds-search
@@ -1,7 +1,5 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
4
-
5
3
  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
6
4
 
7
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -16,16 +14,14 @@ import * as S from '../../Search.styles';
16
14
  import SearchButton from '../SearchButton/SearchButton';
17
15
 
18
16
  var SearchInput = /*#__PURE__*/function (_React$Component) {
19
- _inheritsLoose(SearchInput, _React$Component);
20
-
21
17
  function SearchInput(props) {
22
18
  var _this;
23
19
 
24
20
  _this = _React$Component.call(this, props) || this; // eslint-disable-next-line react/state-in-constructor
25
21
 
26
- _defineProperty(_assertThisInitialized(_this), "inputRef", React.createRef());
22
+ _defineProperty(_this, "inputRef", React.createRef());
27
23
 
28
- _defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function () {
24
+ _defineProperty(_this, "componentDidUpdate", function () {
29
25
  var _this$props = _this.props,
30
26
  moveCursorToEnd = _this$props.moveCursorToEnd,
31
27
  value = _this$props.value;
@@ -37,11 +33,11 @@ var SearchInput = /*#__PURE__*/function (_React$Component) {
37
33
  }
38
34
  });
39
35
 
40
- _defineProperty(_assertThisInitialized(_this), "focusInput", function () {
36
+ _defineProperty(_this, "focusInput", function () {
41
37
  _this.inputRef.current && _this.inputRef.current.focus();
42
38
  });
43
39
 
44
- _defineProperty(_assertThisInitialized(_this), "toggleOpen", function () {
40
+ _defineProperty(_this, "toggleOpen", function () {
45
41
  var onToggle = _this.props.onToggle;
46
42
  var isInputOpen = _this.state.isInputOpen;
47
43
  onToggle && onToggle(!isInputOpen);
@@ -53,7 +49,7 @@ var SearchInput = /*#__PURE__*/function (_React$Component) {
53
49
  });
54
50
  });
55
51
 
56
- _defineProperty(_assertThisInitialized(_this), "handleSearchButtonClick", function () {
52
+ _defineProperty(_this, "handleSearchButtonClick", function () {
57
53
  var _this$props2 = _this.props,
58
54
  alwaysExpanded = _this$props2.alwaysExpanded,
59
55
  onButtonClick = _this$props2.onButtonClick;
@@ -67,7 +63,7 @@ var SearchInput = /*#__PURE__*/function (_React$Component) {
67
63
  }
68
64
  });
69
65
 
70
- _defineProperty(_assertThisInitialized(_this), "handleClearValue", function () {
66
+ _defineProperty(_this, "handleClearValue", function () {
71
67
  var onClear = _this.props.onClear;
72
68
 
73
69
  _this.setState({
@@ -80,7 +76,7 @@ var SearchInput = /*#__PURE__*/function (_React$Component) {
80
76
  onClear();
81
77
  });
82
78
 
83
- _defineProperty(_assertThisInitialized(_this), "handleChangeValue", function (_ref) {
79
+ _defineProperty(_this, "handleChangeValue", function (_ref) {
84
80
  var value = _ref.target.value;
85
81
  var onChange = _this.props.onChange;
86
82
  onChange(value);
@@ -90,26 +86,28 @@ var SearchInput = /*#__PURE__*/function (_React$Component) {
90
86
  });
91
87
  });
92
88
 
93
- _defineProperty(_assertThisInitialized(_this), "handleSearchInputContentClick", function () {
89
+ _defineProperty(_this, "handleSearchInputContentClick", function () {
94
90
  var onClick = _this.props.onClick;
95
91
  onClick && onClick();
96
92
 
97
93
  _this.focusInput();
98
94
  });
99
95
 
100
- _defineProperty(_assertThisInitialized(_this), "handleOffsetWithFilter", function (ref) {
96
+ _defineProperty(_this, "handleOffsetWithFilter", function (ref) {
101
97
  ref && _this.setState({
102
98
  inputOffset: ref.getBoundingClientRect().width
103
99
  });
104
100
  });
105
101
 
106
- _defineProperty(_assertThisInitialized(_this), "handleClickOutside", function () {
102
+ // This handler is used for onClickOutside HOC
103
+ _defineProperty(_this, "handleClickOutside", function () {
107
104
  var _this$props3 = _this.props,
108
105
  closeOnClickOutside = _this$props3.closeOnClickOutside,
109
106
  onToggle = _this$props3.onToggle,
110
- value = _this$props3.value;
107
+ value = _this$props3.value,
108
+ filterLabel = _this$props3.filterLabel;
111
109
 
112
- if (closeOnClickOutside && !value) {
110
+ if (closeOnClickOutside && !value && !filterLabel) {
113
111
  _this.setState({
114
112
  isInputOpen: false
115
113
  });
@@ -127,6 +125,8 @@ var SearchInput = /*#__PURE__*/function (_React$Component) {
127
125
  return _this;
128
126
  }
129
127
 
128
+ _inheritsLoose(SearchInput, _React$Component);
129
+
130
130
  var _proto = SearchInput.prototype;
131
131
 
132
132
  _proto.getSnapshotBeforeUpdate = function getSnapshotBeforeUpdate(prevProps) {
package/dist/Search.js CHANGED
@@ -2,8 +2,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
2
2
 
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
4
 
5
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
6
-
7
5
  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
8
6
 
9
7
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -29,16 +27,15 @@ var getParametersScrollTop = function getParametersScrollTop(_ref) {
29
27
  };
30
28
 
31
29
  var Search = /*#__PURE__*/function (_React$PureComponent) {
32
- _inheritsLoose(Search, _React$PureComponent);
33
-
34
30
  function Search(props) {
35
31
  var _this;
36
32
 
37
33
  _this = _React$PureComponent.call(this, props) || this; // eslint-disable-next-line react/state-in-constructor
38
34
 
39
- _defineProperty(_assertThisInitialized(_this), "wrapperRef", React.createRef());
35
+ _defineProperty(_this, "wrapperRef", React.createRef());
40
36
 
41
- _defineProperty(_assertThisInitialized(_this), "handleClickOutside", function () {
37
+ // This handler is used for onClickOutside HOC
38
+ _defineProperty(_this, "handleClickOutside", function () {
42
39
  var _this$state = _this.state,
43
40
  isInputOpen = _this$state.isInputOpen,
44
41
  label = _this$state.label,
@@ -59,7 +56,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
59
56
  });
60
57
  });
61
58
 
62
- _defineProperty(_assertThisInitialized(_this), "handleClearValue", function () {
59
+ _defineProperty(_this, "handleClearValue", function () {
63
60
  var _this$props2 = _this.props,
64
61
  parameters = _this$props2.parameters,
65
62
  recent = _this$props2.recent,
@@ -95,6 +92,8 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
95
92
  return _this;
96
93
  }
97
94
 
95
+ _inheritsLoose(Search, _React$PureComponent);
96
+
98
97
  var _proto = Search.prototype;
99
98
 
100
99
  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
@@ -186,8 +185,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
186
185
  }
187
186
 
188
187
  return 0;
189
- } // This handler is used for onClickOutside HOC
190
- ;
188
+ };
191
189
 
192
190
  _proto.handleChange = function handleChange(currentValue) {
193
191
  var _this$props5 = this.props,
@@ -260,9 +258,11 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
260
258
  onParameterValueChange = _this$props8.onParameterValueChange,
261
259
  filterLookupKey = _this$props8.filterLookupKey,
262
260
  textLookupConfig = _this$props8.textLookupConfig;
261
+ var focusInputTrigger = this.state.focusInputTrigger;
263
262
  onValueChange('');
264
263
  this.setState({
265
264
  label: item,
265
+ focusInputTrigger: !focusInputTrigger,
266
266
  moveCursorToEnd: true
267
267
  });
268
268
 
@@ -399,6 +399,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
399
399
  alwaysExpanded = _this$props12.alwaysExpanded;
400
400
  var _this$state5 = this.state,
401
401
  label = _this$state5.label,
402
+ isListVisible = _this$state5.isListVisible,
402
403
  focusInputTrigger = _this$state5.focusInputTrigger,
403
404
  toggleInputTrigger = _this$state5.toggleInputTrigger,
404
405
  moveCursorToEnd = _this$state5.moveCursorToEnd;
@@ -446,7 +447,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
446
447
  disableInput: disableInput,
447
448
  inputProps: inputProps,
448
449
  alwaysExpanded: alwaysExpanded,
449
- closeOnClickOutside: !alwaysExpanded
450
+ closeOnClickOutside: !alwaysExpanded && !isListVisible
450
451
  });
451
452
  };
452
453
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-search",
3
- "version": "0.8.87",
3
+ "version": "0.8.88",
4
4
  "description": "Search UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -56,5 +56,5 @@
56
56
  "@types/react-onclickoutside": "^6.7.4",
57
57
  "@types/react-window": "^1.8.5"
58
58
  },
59
- "gitHead": "fcc57aef73d1309a366e4c6e80ce4defdd9f20f8"
59
+ "gitHead": "161a021c19407a11c92822eb2647907cdce5c516"
60
60
  }