@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 +27 -0
- package/README.md +1 -0
- package/dist/Search.js +78 -73
- package/dist/Search.types.d.ts +1 -0
- package/package.json +4 -4
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
|
|
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$
|
|
62
|
-
parameters = _this$
|
|
63
|
-
recent = _this$
|
|
64
|
-
suggestions = _this$
|
|
65
|
-
onClear = _this$
|
|
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$
|
|
102
|
-
recent = _this$
|
|
103
|
-
suggestions = _this$
|
|
104
|
-
parameters = _this$
|
|
105
|
-
value = _this$
|
|
106
|
-
textLookupConfig = _this$
|
|
107
|
-
hideLabel = _this$
|
|
108
|
-
parameterValue = _this$
|
|
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$
|
|
150
|
-
value = _this$
|
|
151
|
-
onParameterValueChange = _this$
|
|
152
|
-
recent = _this$
|
|
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$
|
|
192
|
-
parameterValue = _this$
|
|
193
|
-
recent = _this$
|
|
194
|
-
suggestions = _this$
|
|
195
|
-
parameters = _this$
|
|
196
|
-
onValueChange = _this$
|
|
197
|
-
textLookupConfig = _this$
|
|
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$
|
|
225
|
-
suggestions = _this$
|
|
226
|
-
recent = _this$
|
|
227
|
-
parameters = _this$
|
|
228
|
-
value = _this$
|
|
229
|
-
parameterValue = _this$
|
|
230
|
-
textLookupConfig = _this$
|
|
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$
|
|
246
|
-
onValueChange = _this$
|
|
247
|
-
textLookupConfig = _this$
|
|
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$
|
|
257
|
-
onValueChange = _this$
|
|
258
|
-
onParameterValueChange = _this$
|
|
259
|
-
filterLookupKey = _this$
|
|
260
|
-
textLookupConfig = _this$
|
|
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$
|
|
286
|
-
recent = _this$
|
|
287
|
-
recentDisplayProps = _this$
|
|
288
|
-
value = _this$
|
|
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$
|
|
316
|
-
parameters = _this$
|
|
317
|
-
parametersDisplayProps = _this$
|
|
318
|
-
value = _this$
|
|
319
|
-
dropdownMaxHeight = _this$
|
|
320
|
-
recentDisplayProps = _this$
|
|
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$
|
|
359
|
-
suggestions = _this$
|
|
360
|
-
parameterValue = _this$
|
|
361
|
-
suggestionsDisplayProps = _this$
|
|
362
|
-
value = _this$
|
|
363
|
-
dropdownMaxHeight = _this$
|
|
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$
|
|
392
|
-
placeholder = _this$
|
|
393
|
-
clearTooltip = _this$
|
|
394
|
-
value = _this$
|
|
395
|
-
textLookupConfig = _this$
|
|
396
|
-
filterLookupKey = _this$
|
|
397
|
-
disableInput = _this$
|
|
398
|
-
inputProps = _this$
|
|
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
|
-
|
|
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$
|
|
454
|
-
divider = _this$
|
|
455
|
-
dropdownMaxHeight = _this$
|
|
456
|
-
width = _this$
|
|
457
|
-
style = _this$
|
|
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,
|
package/dist/Search.types.d.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
36
|
+
"@synerise/ds-dropdown": "^0.17.18",
|
|
37
37
|
"@synerise/ds-icon": "^0.49.0",
|
|
38
|
-
"@synerise/ds-menu": "^0.
|
|
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": "
|
|
53
|
+
"gitHead": "d787395998e479858cb58f6d56555e4c51fe45d5"
|
|
54
54
|
}
|