@synerise/ds-search 1.2.8 → 1.3.0
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 +11 -0
- package/README.md +2 -1
- package/dist/Search.js +15 -7
- package/dist/Search.styles.d.ts +5 -5
- package/dist/Search.styles.js +4 -2
- package/dist/Search.types.d.ts +5 -0
- package/package.json +8 -8
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
|
+
# [1.3.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@1.2.8...@synerise/ds-search@1.3.0) (2025-08-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **search:** allow custom dropdown width ([0555d9d](https://github.com/Synerise/synerise-design/commit/0555d9d39abc49868a490e5b559184c720e4d8d3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.2.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@1.2.7...@synerise/ds-search@1.2.8) (2025-08-20)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-search
|
package/README.md
CHANGED
|
@@ -113,7 +113,8 @@ return (
|
|
|
113
113
|
| suggestionsDisplayProps | An object containing the details of how suggestions list should render | DataSetProps or undefined or null | - |
|
|
114
114
|
| textLookupConfig | config of keys for lookup in parameters, recent and suggestions datasets | { parameters: string; recent: string; suggestions: string} | - |
|
|
115
115
|
| value | The input content value | string | - |
|
|
116
|
-
|
|
|
116
|
+
| searchWidth | Width of the search input when expanded | number | - |
|
|
117
|
+
| dropdownWidth | Width of the suggestions dropdown. Will match search input if undefined | number | - |
|
|
117
118
|
| alwaysExpanded | Enable expanded input on Search component with dropdown | boolean / undefined | - |
|
|
118
119
|
|
|
119
120
|
### DataSetProps
|
package/dist/Search.js
CHANGED
|
@@ -21,7 +21,6 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
21
21
|
function Search(props) {
|
|
22
22
|
var _this;
|
|
23
23
|
_this = _React$PureComponent.call(this, props) || this;
|
|
24
|
-
// eslint-disable-next-line react/state-in-constructor
|
|
25
24
|
_this.wrapperRef = /*#__PURE__*/React.createRef();
|
|
26
25
|
// This handler is used for onClickOutside HOC
|
|
27
26
|
_this.handleClickOutside = function () {
|
|
@@ -57,6 +56,8 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
57
56
|
isResultChosen: false
|
|
58
57
|
});
|
|
59
58
|
};
|
|
59
|
+
var searchWidth = props.width || props.searchWidth;
|
|
60
|
+
// eslint-disable-next-line react/state-in-constructor
|
|
60
61
|
_this.state = {
|
|
61
62
|
isInputOpen: !!props.value || !!props.parameterValue || !!props.alwaysExpanded,
|
|
62
63
|
label: props.parameterValue ? props.parameters.find(function (param) {
|
|
@@ -67,7 +68,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
67
68
|
filteredSuggestions: props.suggestions,
|
|
68
69
|
isListVisible: false,
|
|
69
70
|
isResultChosen: false,
|
|
70
|
-
itemsListWidth:
|
|
71
|
+
itemsListWidth: searchWidth ? searchWidth - MENU_WIDTH_OFFSET : 0,
|
|
71
72
|
toggleInputTrigger: false,
|
|
72
73
|
focusInputTrigger: false,
|
|
73
74
|
scrollbarScrollTop: 0,
|
|
@@ -234,6 +235,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
234
235
|
var _this$props9 = this.props,
|
|
235
236
|
recent = _this$props9.recent,
|
|
236
237
|
recentDisplayProps = _this$props9.recentDisplayProps,
|
|
238
|
+
dropdownWidth = _this$props9.dropdownWidth,
|
|
237
239
|
value = _this$props9.value;
|
|
238
240
|
var _this$state2 = this.state,
|
|
239
241
|
label = _this$state2.label,
|
|
@@ -254,7 +256,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
254
256
|
return _this2.selectResult(item, SelectResultDataKeys.RECENT);
|
|
255
257
|
},
|
|
256
258
|
rowHeight: rowHeight,
|
|
257
|
-
width: itemsListWidth,
|
|
259
|
+
width: dropdownWidth ? dropdownWidth - MENU_WIDTH_OFFSET : itemsListWidth,
|
|
258
260
|
renderInMenu: false
|
|
259
261
|
}));
|
|
260
262
|
};
|
|
@@ -265,6 +267,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
265
267
|
parametersDisplayProps = _this$props10.parametersDisplayProps,
|
|
266
268
|
value = _this$props10.value,
|
|
267
269
|
dropdownMaxHeight = _this$props10.dropdownMaxHeight,
|
|
270
|
+
dropdownWidth = _this$props10.dropdownWidth,
|
|
268
271
|
recentDisplayProps = _this$props10.recentDisplayProps;
|
|
269
272
|
var _this$state3 = this.state,
|
|
270
273
|
label = _this$state3.label,
|
|
@@ -289,7 +292,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
289
292
|
return _this3.selectFilter(item);
|
|
290
293
|
},
|
|
291
294
|
rowHeight: rowHeight,
|
|
292
|
-
width: itemsListWidth,
|
|
295
|
+
width: dropdownWidth ? dropdownWidth - MENU_WIDTH_OFFSET : itemsListWidth,
|
|
293
296
|
listProps: _extends({
|
|
294
297
|
scrollTop: getParametersScrollTop({
|
|
295
298
|
scrollTop: scrollbarScrollTop,
|
|
@@ -307,6 +310,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
307
310
|
parameterValue = _this$props11.parameterValue,
|
|
308
311
|
suggestionsDisplayProps = _this$props11.suggestionsDisplayProps,
|
|
309
312
|
value = _this$props11.value,
|
|
313
|
+
dropdownWidth = _this$props11.dropdownWidth,
|
|
310
314
|
dropdownMaxHeight = _this$props11.dropdownMaxHeight;
|
|
311
315
|
var _this$state4 = this.state,
|
|
312
316
|
isResultChosen = _this$state4.isResultChosen,
|
|
@@ -325,7 +329,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
325
329
|
return _this4.selectResult(item, SelectResultDataKeys.SUGGESTIONS);
|
|
326
330
|
},
|
|
327
331
|
rowHeight: suggestionsDisplayProps.rowHeight,
|
|
328
|
-
width: itemsListWidth,
|
|
332
|
+
width: dropdownWidth ? dropdownWidth - MENU_WIDTH_OFFSET : itemsListWidth,
|
|
329
333
|
listProps: _extends({
|
|
330
334
|
scrollTop: scrollbarScrollTop
|
|
331
335
|
}, suggestionsDisplayProps.listProps || {}),
|
|
@@ -403,7 +407,9 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
403
407
|
divider = _this$props13.divider,
|
|
404
408
|
dropdownMaxHeight = _this$props13.dropdownMaxHeight,
|
|
405
409
|
width = _this$props13.width,
|
|
406
|
-
|
|
410
|
+
searchWidth = _this$props13.searchWidth,
|
|
411
|
+
style = _this$props13.style,
|
|
412
|
+
dropdownWidth = _this$props13.dropdownWidth;
|
|
407
413
|
var _this$state6 = this.state,
|
|
408
414
|
isInputOpen = _this$state6.isInputOpen,
|
|
409
415
|
label = _this$state6.label,
|
|
@@ -412,11 +418,12 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
412
418
|
isResultChosen = _this$state6.isResultChosen,
|
|
413
419
|
filteredParameters = _this$state6.filteredParameters,
|
|
414
420
|
filteredRecent = _this$state6.filteredRecent;
|
|
421
|
+
var mergedWidth = searchWidth !== undefined ? searchWidth : width;
|
|
415
422
|
return /*#__PURE__*/React.createElement(S.SearchWrapper, {
|
|
416
423
|
ref: this.wrapperRef,
|
|
417
424
|
className: "SearchWrapper",
|
|
418
425
|
inputOpen: isInputOpen,
|
|
419
|
-
width:
|
|
426
|
+
$width: mergedWidth,
|
|
420
427
|
onKeyDown: function onKeyDown(e) {
|
|
421
428
|
focusWithArrowKeys(e, 'ds-search-item', function () {
|
|
422
429
|
_this6.setState({
|
|
@@ -426,6 +433,7 @@ var Search = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
426
433
|
},
|
|
427
434
|
style: style
|
|
428
435
|
}, this.renderInputWrapper(), isListVisible && /*#__PURE__*/React.createElement(S.SearchDropdownWrapper, {
|
|
436
|
+
dropdownWidth: dropdownWidth,
|
|
429
437
|
onClick: function onClick() {
|
|
430
438
|
_this6.setState({
|
|
431
439
|
focusInputTrigger: !focusInputTrigger
|
package/dist/Search.styles.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export declare const openDropdownAnimation: import("styled-components").Keyframes;
|
|
2
|
-
export declare const SearchInputWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
-
width?: number;
|
|
4
|
-
}, never>;
|
|
2
|
+
export declare const SearchInputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
3
|
export declare const SearchWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
6
|
-
width?: number;
|
|
4
|
+
$width?: number;
|
|
7
5
|
inputOpen?: boolean;
|
|
8
6
|
}, never>;
|
|
9
7
|
export declare const LeftSide: import("styled-components").StyledComponent<"span", any, {
|
|
@@ -32,4 +30,6 @@ export declare const SearchDropdownContent: import("styled-components").StyledCo
|
|
|
32
30
|
}, never>;
|
|
33
31
|
export declare const MenuHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
34
32
|
export declare const HeaderIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
35
|
-
export declare const SearchDropdownWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
33
|
+
export declare const SearchDropdownWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
34
|
+
dropdownWidth?: number;
|
|
35
|
+
}, never>;
|
package/dist/Search.styles.js
CHANGED
|
@@ -9,7 +9,7 @@ export var SearchWrapper = styled.div.withConfig({
|
|
|
9
9
|
displayName: "Searchstyles__SearchWrapper",
|
|
10
10
|
componentId: "sc-1w8jj1b-1"
|
|
11
11
|
})(["", ";position:relative;direction:rtl;"], function (props) {
|
|
12
|
-
return !!props
|
|
12
|
+
return !!props.$width && "\n " + (props.inputOpen ? "width:" + props.$width + "px;" : "width:32px") + ";\n ";
|
|
13
13
|
});
|
|
14
14
|
export var LeftSide = styled.span.withConfig({
|
|
15
15
|
displayName: "Searchstyles__LeftSide",
|
|
@@ -88,4 +88,6 @@ export var HeaderIconWrapper = styled.div.withConfig({
|
|
|
88
88
|
export var SearchDropdownWrapper = styled.div.withConfig({
|
|
89
89
|
displayName: "Searchstyles__SearchDropdownWrapper",
|
|
90
90
|
componentId: "sc-1w8jj1b-13"
|
|
91
|
-
})(["width:0;& > .search-list-open{width:
|
|
91
|
+
})(["width:0;& > .search-list-open{width:", ";animation:", " 0.3s ease-in-out 0s 1;opacity:1;display:initial;padding:8px 0 8px 8px;z-index:10;}"], function (props) {
|
|
92
|
+
return props.dropdownWidth ? props.dropdownWidth + "px" : '100%';
|
|
93
|
+
}, openDropdownAnimation);
|
package/dist/Search.types.d.ts
CHANGED
|
@@ -36,7 +36,12 @@ export type SearchProps<T extends AnyObject, U extends AnyObject> = {
|
|
|
36
36
|
suggestionsDisplayProps?: DataSetProps | null;
|
|
37
37
|
textLookupConfig: SearchLookupConfig<T, U>;
|
|
38
38
|
value: string;
|
|
39
|
+
/** @deprecated - use searchWidth instead */
|
|
39
40
|
width?: number;
|
|
41
|
+
/** @description - by default the suggestions dropdown will match the search input width, provide `dropdownWidth` param if you want to customise dropdown width */
|
|
42
|
+
searchWidth?: number;
|
|
43
|
+
/** @description - by default the suggestions dropdown will match the search input width, provide `dropdownWidth` param if you want to customise dropdown width */
|
|
44
|
+
dropdownWidth?: number;
|
|
40
45
|
hideLabel?: boolean;
|
|
41
46
|
disableInput?: boolean;
|
|
42
47
|
alwaysExpanded?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-search",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Search UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-button": "^1.4.
|
|
38
|
-
"@synerise/ds-icon": "^1.7.
|
|
39
|
-
"@synerise/ds-menu": "^1.0.
|
|
40
|
-
"@synerise/ds-scrollbar": "^1.1.
|
|
41
|
-
"@synerise/ds-tooltip": "^1.1.
|
|
42
|
-
"@synerise/ds-utils": "^1.4.
|
|
37
|
+
"@synerise/ds-button": "^1.4.9",
|
|
38
|
+
"@synerise/ds-icon": "^1.7.1",
|
|
39
|
+
"@synerise/ds-menu": "^1.0.21",
|
|
40
|
+
"@synerise/ds-scrollbar": "^1.1.7",
|
|
41
|
+
"@synerise/ds-tooltip": "^1.1.17",
|
|
42
|
+
"@synerise/ds-utils": "^1.4.1",
|
|
43
43
|
"react-onclickoutside": "^6.9.0",
|
|
44
44
|
"react-window": "^1.8.11"
|
|
45
45
|
},
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"react": ">=16.9.0 <= 18.3.1",
|
|
50
50
|
"styled-components": "^5.3.3"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "5f5d424cf8c7fa89e231c36a45f5ab3e4cfac8e7"
|
|
53
53
|
}
|