@synerise/ds-search 0.7.10 → 0.8.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
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.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@0.8.1...@synerise/ds-search@0.8.2) (2022-06-15)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-search
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.8.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@0.8.0...@synerise/ds-search@0.8.1) (2022-04-29)
15
+
16
+ **Note:** Version bump only for package @synerise/ds-search
17
+
18
+
19
+
20
+
21
+
22
+ # [0.8.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@0.7.10...@synerise/ds-search@0.8.0) (2022-04-08)
23
+
24
+
25
+ ### Features
26
+
27
+ * **card-tabs:** disable duplication when limit exceeded (cardTab) ([e83cedb](https://github.com/Synerise/synerise-design/commit/e83cedb0f8a975fce5dd7c181d3811715ac66a9f))
28
+
29
+
30
+
31
+
32
+
6
33
  ## [0.7.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@0.7.9...@synerise/ds-search@0.7.10) (2022-04-05)
7
34
 
8
35
  **Note:** Version bump only for package @synerise/ds-search
package/README.md CHANGED
@@ -115,6 +115,7 @@ return (
115
115
  | textLookupConfig | config of keys for lookup in parameters, recent and suggestions datasets | { parameters: string; recent: string; suggestions: string} | - |
116
116
  | value | The input content value | string | - |
117
117
  | width | Width of the search input when expanded | number | - |
118
+ | alwaysExpanded | Enable expanded input on Search component with dropdown | boolean / undefined | - |
118
119
 
119
120
  ### DataSetProps
120
121
 
package/dist/Search.js CHANGED
@@ -43,9 +43,11 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
43
43
  isInputOpen = _this$state.isInputOpen,
44
44
  label = _this$state.label,
45
45
  toggleInputTrigger = _this$state.toggleInputTrigger;
46
- var value = _this.props.value;
46
+ var _this$props = _this.props,
47
+ value = _this$props.value,
48
+ alwaysExpanded = _this$props.alwaysExpanded;
47
49
 
48
- if (isInputOpen && !value && !label) {
50
+ if (isInputOpen && !value && !label && !alwaysExpanded) {
49
51
  _this.setState({
50
52
  toggleInputTrigger: !toggleInputTrigger
51
53
  });
@@ -58,11 +60,11 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
58
60
  });
59
61
 
60
62
  _defineProperty(_assertThisInitialized(_this), "handleClearValue", function () {
61
- var _this$props = _this.props,
62
- parameters = _this$props.parameters,
63
- recent = _this$props.recent,
64
- suggestions = _this$props.suggestions,
65
- onClear = _this$props.onClear;
63
+ var _this$props2 = _this.props,
64
+ parameters = _this$props2.parameters,
65
+ recent = _this$props2.recent,
66
+ suggestions = _this$props2.suggestions,
67
+ onClear = _this$props2.onClear;
66
68
  onClear && onClear();
67
69
 
68
70
  _this.setState({
@@ -75,7 +77,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
75
77
  });
76
78
 
77
79
  _this.state = {
78
- isInputOpen: !!props.value || !!props.parameterValue,
80
+ isInputOpen: !!props.value || !!props.parameterValue || !!props.alwaysExpanded,
79
81
  label: props.parameterValue ? props.parameters.find(function (param) {
80
82
  return param[props.textLookupConfig.parameters] === props.parameterValue;
81
83
  }) : null,
@@ -98,14 +100,14 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
98
100
  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
99
101
  var _prevProps$suggestion;
100
102
 
101
- var _this$props2 = this.props,
102
- recent = _this$props2.recent,
103
- suggestions = _this$props2.suggestions,
104
- parameters = _this$props2.parameters,
105
- value = _this$props2.value,
106
- textLookupConfig = _this$props2.textLookupConfig,
107
- hideLabel = _this$props2.hideLabel,
108
- parameterValue = _this$props2.parameterValue;
103
+ var _this$props3 = this.props,
104
+ recent = _this$props3.recent,
105
+ suggestions = _this$props3.suggestions,
106
+ parameters = _this$props3.parameters,
107
+ value = _this$props3.value,
108
+ textLookupConfig = _this$props3.textLookupConfig,
109
+ hideLabel = _this$props3.hideLabel,
110
+ parameterValue = _this$props3.parameterValue;
109
111
 
110
112
  if (prevProps.value !== value && !value || prevProps.parameterValue && !parameterValue) {
111
113
  this.handleChange(value); // eslint-disable-next-line react/no-did-update-set-state
@@ -146,10 +148,10 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
146
148
  };
147
149
 
148
150
  _proto.onKeyDown = function onKeyDown(e) {
149
- var _this$props3 = this.props,
150
- value = _this$props3.value,
151
- onParameterValueChange = _this$props3.onParameterValueChange,
152
- recent = _this$props3.recent;
151
+ var _this$props4 = this.props,
152
+ value = _this$props4.value,
153
+ onParameterValueChange = _this$props4.onParameterValueChange,
154
+ recent = _this$props4.recent;
153
155
  var isInputOpen = this.state.isInputOpen;
154
156
 
155
157
  if (e.key === 'Backspace' && value === '' && isInputOpen) {
@@ -188,13 +190,13 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
188
190
  ;
189
191
 
190
192
  _proto.handleChange = function handleChange(currentValue) {
191
- var _this$props4 = this.props,
192
- parameterValue = _this$props4.parameterValue,
193
- recent = _this$props4.recent,
194
- suggestions = _this$props4.suggestions,
195
- parameters = _this$props4.parameters,
196
- onValueChange = _this$props4.onValueChange,
197
- textLookupConfig = _this$props4.textLookupConfig;
193
+ var _this$props5 = this.props,
194
+ parameterValue = _this$props5.parameterValue,
195
+ recent = _this$props5.recent,
196
+ suggestions = _this$props5.suggestions,
197
+ parameters = _this$props5.parameters,
198
+ onValueChange = _this$props5.onValueChange,
199
+ textLookupConfig = _this$props5.textLookupConfig;
198
200
  var isAnythingToShow;
199
201
  onValueChange(currentValue);
200
202
 
@@ -221,13 +223,13 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
221
223
  };
222
224
 
223
225
  _proto.isListItemRendered = function isListItemRendered() {
224
- var _this$props5 = this.props,
225
- suggestions = _this$props5.suggestions,
226
- recent = _this$props5.recent,
227
- parameters = _this$props5.parameters,
228
- value = _this$props5.value,
229
- parameterValue = _this$props5.parameterValue,
230
- textLookupConfig = _this$props5.textLookupConfig;
226
+ var _this$props6 = this.props,
227
+ suggestions = _this$props6.suggestions,
228
+ recent = _this$props6.recent,
229
+ parameters = _this$props6.parameters,
230
+ value = _this$props6.value,
231
+ parameterValue = _this$props6.parameterValue,
232
+ textLookupConfig = _this$props6.textLookupConfig;
231
233
  var isAnythingToShow;
232
234
 
233
235
  if (parameterValue) {
@@ -242,9 +244,9 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
242
244
  };
243
245
 
244
246
  _proto.selectResult = function selectResult(item, dataKey) {
245
- var _this$props6 = this.props,
246
- onValueChange = _this$props6.onValueChange,
247
- textLookupConfig = _this$props6.textLookupConfig;
247
+ var _this$props7 = this.props,
248
+ onValueChange = _this$props7.onValueChange,
249
+ textLookupConfig = _this$props7.textLookupConfig;
248
250
  this.setState({
249
251
  isResultChosen: true,
250
252
  moveCursorToEnd: true
@@ -253,11 +255,11 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
253
255
  };
254
256
 
255
257
  _proto.selectFilter = function selectFilter(item) {
256
- var _this$props7 = this.props,
257
- onValueChange = _this$props7.onValueChange,
258
- onParameterValueChange = _this$props7.onParameterValueChange,
259
- filterLookupKey = _this$props7.filterLookupKey,
260
- textLookupConfig = _this$props7.textLookupConfig;
258
+ var _this$props8 = this.props,
259
+ onValueChange = _this$props8.onValueChange,
260
+ onParameterValueChange = _this$props8.onParameterValueChange,
261
+ filterLookupKey = _this$props8.filterLookupKey,
262
+ textLookupConfig = _this$props8.textLookupConfig;
261
263
  onValueChange('');
262
264
  this.setState({
263
265
  label: item,
@@ -282,10 +284,10 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
282
284
  _proto.renderRecentItems = function renderRecentItems() {
283
285
  var _this2 = this;
284
286
 
285
- var _this$props8 = this.props,
286
- recent = _this$props8.recent,
287
- recentDisplayProps = _this$props8.recentDisplayProps,
288
- value = _this$props8.value;
287
+ var _this$props9 = this.props,
288
+ recent = _this$props9.recent,
289
+ recentDisplayProps = _this$props9.recentDisplayProps,
290
+ value = _this$props9.value;
289
291
  var _this$state2 = this.state,
290
292
  label = _this$state2.label,
291
293
  filteredRecent = _this$state2.filteredRecent,
@@ -312,12 +314,12 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
312
314
  _proto.renderParameters = function renderParameters() {
313
315
  var _this3 = this;
314
316
 
315
- var _this$props9 = this.props,
316
- parameters = _this$props9.parameters,
317
- parametersDisplayProps = _this$props9.parametersDisplayProps,
318
- value = _this$props9.value,
319
- dropdownMaxHeight = _this$props9.dropdownMaxHeight,
320
- recentDisplayProps = _this$props9.recentDisplayProps;
317
+ var _this$props10 = this.props,
318
+ parameters = _this$props10.parameters,
319
+ parametersDisplayProps = _this$props10.parametersDisplayProps,
320
+ value = _this$props10.value,
321
+ dropdownMaxHeight = _this$props10.dropdownMaxHeight,
322
+ recentDisplayProps = _this$props10.recentDisplayProps;
321
323
  var _this$state3 = this.state,
322
324
  label = _this$state3.label,
323
325
  filteredParameters = _this$state3.filteredParameters,
@@ -355,12 +357,12 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
355
357
  _proto.renderSuggestions = function renderSuggestions() {
356
358
  var _this4 = this;
357
359
 
358
- var _this$props10 = this.props,
359
- suggestions = _this$props10.suggestions,
360
- parameterValue = _this$props10.parameterValue,
361
- suggestionsDisplayProps = _this$props10.suggestionsDisplayProps,
362
- value = _this$props10.value,
363
- dropdownMaxHeight = _this$props10.dropdownMaxHeight;
360
+ var _this$props11 = this.props,
361
+ suggestions = _this$props11.suggestions,
362
+ parameterValue = _this$props11.parameterValue,
363
+ suggestionsDisplayProps = _this$props11.suggestionsDisplayProps,
364
+ value = _this$props11.value,
365
+ dropdownMaxHeight = _this$props11.dropdownMaxHeight;
364
366
  var _this$state4 = this.state,
365
367
  isResultChosen = _this$state4.isResultChosen,
366
368
  itemsListWidth = _this$state4.itemsListWidth,
@@ -388,14 +390,15 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
388
390
  _proto.renderInputWrapper = function renderInputWrapper() {
389
391
  var _this5 = this;
390
392
 
391
- var _this$props11 = this.props,
392
- placeholder = _this$props11.placeholder,
393
- clearTooltip = _this$props11.clearTooltip,
394
- value = _this$props11.value,
395
- textLookupConfig = _this$props11.textLookupConfig,
396
- filterLookupKey = _this$props11.filterLookupKey,
397
- disableInput = _this$props11.disableInput,
398
- inputProps = _this$props11.inputProps;
393
+ var _this$props12 = this.props,
394
+ placeholder = _this$props12.placeholder,
395
+ clearTooltip = _this$props12.clearTooltip,
396
+ value = _this$props12.value,
397
+ textLookupConfig = _this$props12.textLookupConfig,
398
+ filterLookupKey = _this$props12.filterLookupKey,
399
+ disableInput = _this$props12.disableInput,
400
+ inputProps = _this$props12.inputProps,
401
+ alwaysExpanded = _this$props12.alwaysExpanded;
399
402
  var _this$state5 = this.state,
400
403
  label = _this$state5.label,
401
404
  focusInputTrigger = _this$state5.focusInputTrigger,
@@ -418,7 +421,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
418
421
  },
419
422
  onClear: this.handleClearValue,
420
423
  onClick: function onClick() {
421
- return _this5.setState({
424
+ _this5.setState({
422
425
  isListVisible: true,
423
426
  itemsListWidth: _this5.getSearchWrapperWidth()
424
427
  });
@@ -443,18 +446,20 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
443
446
  value: value,
444
447
  moveCursorToEnd: moveCursorToEnd,
445
448
  disableInput: disableInput,
446
- inputProps: inputProps
449
+ inputProps: inputProps,
450
+ alwaysExpanded: alwaysExpanded,
451
+ closeOnClickOutside: !alwaysExpanded
447
452
  });
448
453
  };
449
454
 
450
455
  _proto.render = function render() {
451
456
  var _this6 = this;
452
457
 
453
- var _this$props12 = this.props,
454
- divider = _this$props12.divider,
455
- dropdownMaxHeight = _this$props12.dropdownMaxHeight,
456
- width = _this$props12.width,
457
- style = _this$props12.style;
458
+ var _this$props13 = this.props,
459
+ divider = _this$props13.divider,
460
+ dropdownMaxHeight = _this$props13.dropdownMaxHeight,
461
+ width = _this$props13.width,
462
+ style = _this$props13.style;
458
463
  var _this$state6 = this.state,
459
464
  isInputOpen = _this$state6.isInputOpen,
460
465
  label = _this$state6.label,
@@ -38,6 +38,7 @@ export declare type SearchProps<T extends AnyObject, U extends AnyObject> = {
38
38
  width?: number;
39
39
  hideLabel?: boolean;
40
40
  disableInput?: boolean;
41
+ alwaysExpanded?: boolean;
41
42
  };
42
43
  export declare type SearchState<T extends AnyObject> = {
43
44
  isInputOpen: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-search",
3
- "version": "0.7.10",
3
+ "version": "0.8.2",
4
4
  "description": "Search UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -33,9 +33,9 @@
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
35
  "@synerise/ds-button": "^0.17.2",
36
- "@synerise/ds-dropdown": "^0.17.16",
36
+ "@synerise/ds-dropdown": "^0.17.18",
37
37
  "@synerise/ds-icon": "^0.49.0",
38
- "@synerise/ds-menu": "^0.13.2",
38
+ "@synerise/ds-menu": "^0.14.0",
39
39
  "@synerise/ds-scrollbar": "^0.4.7",
40
40
  "@synerise/ds-typography": "^0.12.2",
41
41
  "@synerise/ds-utils": "^0.19.0",
@@ -50,5 +50,5 @@
50
50
  "@types/react-onclickoutside": "^6.7.3",
51
51
  "@types/react-window": "^1.8.2"
52
52
  },
53
- "gitHead": "5793ce09feb88b36cc8ca1923ddfcb272b889cb0"
53
+ "gitHead": "d787395998e479858cb58f6d56555e4c51fe45d5"
54
54
  }