@synerise/ds-search 0.8.95 → 0.9.1
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,26 @@
|
|
|
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.9.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@0.9.0...@synerise/ds-search@0.9.1) (2024-07-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-search
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.9.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@0.8.95...@synerise/ds-search@0.9.0) (2024-07-05)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **inline-edit:** swapped Menu.Item for ListItem ([94c79a3](https://github.com/Synerise/synerise-design/commit/94c79a3eb3c731952c11418bcbd49b4af8c916d9))
|
|
20
|
+
* **item-picker:** swapped Menu.Item for ListItem ([cb90ba7](https://github.com/Synerise/synerise-design/commit/cb90ba7532bd091b44f62f9bd7394e789c16597e))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [0.8.95](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@0.8.94...@synerise/ds-search@0.8.95) (2024-06-27)
|
|
7
27
|
|
|
8
28
|
**Note:** Version bump only for package @synerise/ds-search
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { ReactNode, ReactElement } from 'react';
|
|
2
2
|
import { SearchItemListProps } from './SearchItems.types';
|
|
3
|
-
export declare function renderSearchList<V extends any>(props: SearchItemListProps<V>, children?:
|
|
4
|
-
declare const SearchItems:
|
|
3
|
+
export declare function renderSearchList<V extends any>(props: SearchItemListProps<V>, children?: ReactNode): ReactElement<SearchItemListProps<V>>;
|
|
4
|
+
declare const SearchItems: ({ data, height, highlight, itemRender, listProps, onItemClick, rowHeight, visibleRows, width, renderInMenu, }: SearchItemListProps<any>) => React.JSX.Element;
|
|
5
5
|
export default SearchItems;
|
|
@@ -6,7 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
6
|
|
|
7
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; }
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import React, { useMemo, useRef, useEffect, cloneElement } from 'react';
|
|
10
10
|
import Menu from '@synerise/ds-menu';
|
|
11
11
|
import { FixedSizeList as List } from 'react-window';
|
|
12
12
|
var listStyle = {
|
|
@@ -28,7 +28,7 @@ var rowRenderer = function rowRenderer(_ref) {
|
|
|
28
28
|
|
|
29
29
|
var mergedStyles = _objectSpread({}, rendererCustomStyles, {}, style);
|
|
30
30
|
|
|
31
|
-
return
|
|
31
|
+
return cloneElement(itemReturnedFromRenderer, _objectSpread({}, itemReturnedFromRenderer.props, {
|
|
32
32
|
style: mergedStyles,
|
|
33
33
|
highlight: data.highlight,
|
|
34
34
|
onClick: function onClick() {
|
|
@@ -36,8 +36,7 @@ var rowRenderer = function rowRenderer(_ref) {
|
|
|
36
36
|
},
|
|
37
37
|
className: 'ds-search-item'
|
|
38
38
|
}));
|
|
39
|
-
};
|
|
40
|
-
|
|
39
|
+
};
|
|
41
40
|
|
|
42
41
|
var SearchItems = function SearchItems(_ref2) {
|
|
43
42
|
var data = _ref2.data,
|
|
@@ -48,9 +47,11 @@ var SearchItems = function SearchItems(_ref2) {
|
|
|
48
47
|
onItemClick = _ref2.onItemClick,
|
|
49
48
|
rowHeight = _ref2.rowHeight,
|
|
50
49
|
visibleRows = _ref2.visibleRows,
|
|
51
|
-
width = _ref2.width
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
width = _ref2.width,
|
|
51
|
+
_ref2$renderInMenu = _ref2.renderInMenu,
|
|
52
|
+
renderInMenu = _ref2$renderInMenu === void 0 ? true : _ref2$renderInMenu;
|
|
53
|
+
var listRef = useRef(null);
|
|
54
|
+
var listHeight = useMemo(function () {
|
|
54
55
|
if (data) {
|
|
55
56
|
var dataHeight = data.length * rowHeight;
|
|
56
57
|
|
|
@@ -67,13 +68,13 @@ var SearchItems = function SearchItems(_ref2) {
|
|
|
67
68
|
|
|
68
69
|
return 0;
|
|
69
70
|
}, [data, height, rowHeight, visibleRows]);
|
|
70
|
-
|
|
71
|
+
useEffect(function () {
|
|
71
72
|
if (listRef.current && listProps) {
|
|
72
73
|
listRef.current.scrollTo(Math.max(0, listProps.scrollTop || 0));
|
|
73
74
|
}
|
|
74
75
|
}, [listProps]);
|
|
75
|
-
|
|
76
|
-
height:
|
|
76
|
+
var list = data && /*#__PURE__*/React.createElement(List, _extends({
|
|
77
|
+
height: listHeight,
|
|
77
78
|
itemCount: data.length,
|
|
78
79
|
itemData: {
|
|
79
80
|
highlight: highlight,
|
|
@@ -85,7 +86,8 @@ var SearchItems = function SearchItems(_ref2) {
|
|
|
85
86
|
ref: listRef,
|
|
86
87
|
style: listStyle,
|
|
87
88
|
width: width
|
|
88
|
-
}, listProps), rowRenderer)
|
|
89
|
+
}, listProps), rowRenderer);
|
|
90
|
+
return renderInMenu ? /*#__PURE__*/React.createElement(Menu, null, list) : /*#__PURE__*/React.createElement(React.Fragment, null, list);
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
export default SearchItems;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-search",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Search UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -33,28 +33,20 @@
|
|
|
33
33
|
],
|
|
34
34
|
"types": "dist/index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@synerise/ds-button": "^0.21.
|
|
37
|
-
"@synerise/ds-icon": "^0.
|
|
38
|
-
"@synerise/ds-menu": "^0.19.
|
|
39
|
-
"@synerise/ds-scrollbar": "^0.11.
|
|
40
|
-
"@synerise/ds-tooltip": "^0.14.
|
|
41
|
-
"@synerise/ds-utils": "^0.
|
|
36
|
+
"@synerise/ds-button": "^0.21.3",
|
|
37
|
+
"@synerise/ds-icon": "^0.64.1",
|
|
38
|
+
"@synerise/ds-menu": "^0.19.5",
|
|
39
|
+
"@synerise/ds-scrollbar": "^0.11.4",
|
|
40
|
+
"@synerise/ds-tooltip": "^0.14.33",
|
|
41
|
+
"@synerise/ds-utils": "^0.28.0",
|
|
42
42
|
"react-onclickoutside": "^6.9.0",
|
|
43
43
|
"react-window": "^1.8.5"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@synerise/ds-core": "*",
|
|
47
47
|
"antd": "4.7.0",
|
|
48
|
-
"react": ">=16.9.0
|
|
48
|
+
"react": ">=16.9.0 <= 17.0.2",
|
|
49
49
|
"styled-components": "5.0.1"
|
|
50
50
|
},
|
|
51
|
-
"
|
|
52
|
-
"@testing-library/dom": "^7.0.2",
|
|
53
|
-
"@testing-library/jest-dom": "5.1.1",
|
|
54
|
-
"@testing-library/react": "10.0.1",
|
|
55
|
-
"@testing-library/user-event": "^10.3.1",
|
|
56
|
-
"@types/react-onclickoutside": "^6.7.4",
|
|
57
|
-
"@types/react-window": "^1.8.5"
|
|
58
|
-
},
|
|
59
|
-
"gitHead": "587eb113074985ae21e4f0c25ec33c3e3e2e072b"
|
|
51
|
+
"gitHead": "6f4996380356c1e5cb9a9d8b553069ad9cea7c27"
|
|
60
52
|
}
|