@synerise/ds-item-picker 1.7.1 → 1.8.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 +22 -0
- package/dist/ItemPicker.d.ts +2 -1
- package/dist/components/ItemPickerList/ItemPickerList.d.ts +1 -1
- package/dist/components/ItemPickerList/ItemPickerList.js +40 -19
- package/dist/components/ItemPickerList/ItemPickerList.styles.js +3 -2
- package/dist/components/ItemPickerList/ItemPickerList.types.d.ts +5 -3
- package/dist/components/ItemPickerList/components/EmptyListMessage.d.ts +2 -2
- package/dist/components/ItemPickerList/components/EmptyListMessage.js +2 -2
- package/dist/components/ItemPickerList/components/ListSearchInput.d.ts +6 -5
- package/dist/components/ItemPickerList/components/ListSearchInput.js +9 -10
- package/dist/components/ItemPickerList/constants.d.ts +2 -1
- package/dist/components/ItemPickerList/constants.js +1 -0
- package/dist/components/ItemPickerList/hooks/useFlattenFolders.d.ts +4 -26
- package/dist/components/ItemPickerList/hooks/useItemsInSections.d.ts +10 -5
- package/dist/components/ItemPickerList/hooks/useItemsInSections.js +179 -125
- package/dist/components/ItemPickerList/hooks/useItemsInSections.utils.d.ts +1 -20
- package/dist/components/ItemPickerList/hooks/useItemsInSections.utils.js +20 -77
- package/dist/components/ItemPickerList/utils/actionItemsUtils.d.ts +101 -0
- package/dist/components/ItemPickerList/utils/actionItemsUtils.js +115 -0
- package/dist/components/ItemPickerList/utils/findSectionById.d.ts +1 -1
- package/dist/components/ItemPickerList/utils/getContextAwareActions.d.ts +2 -0
- package/dist/components/ItemPickerList/utils/getContextAwareActions.js +25 -0
- package/dist/components/ItemPickerList/utils/getSearchByActionItems.d.ts +10 -0
- package/dist/components/ItemPickerList/utils/{getSearchActionItems.js → getSearchByActionItems.js} +7 -6
- package/dist/components/ItemPickerList/utils/resolveSectionId.d.ts +12 -0
- package/dist/components/ItemPickerList/utils/resolveSectionId.js +23 -0
- package/dist/components/ItemPickerList/utils/typeguards.utils.d.ts +5 -2
- package/dist/components/ItemPickerList/utils/typeguards.utils.js +6 -2
- package/dist/components/ItemPickerNew/ItemPickerNew.d.ts +2 -1
- package/dist/components/ItemPickerNew/ItemPickerNew.types.d.ts +2 -42
- package/dist/components/ItemPickerNew/types/actions.types.d.ts +48 -0
- package/dist/components/ItemPickerNew/types/actions.types.js +7 -0
- package/dist/components/ItemPickerNew/types/baseItemSectionType.types.d.ts +15 -0
- package/dist/components/ItemPickerNew/types/baseItemSectionType.types.js +1 -0
- package/dist/index.d.ts +3 -1
- package/package.json +3 -3
- package/dist/components/ItemPickerList/utils/getGlobalOrLocalSearchActionType.d.ts +0 -2
- package/dist/components/ItemPickerList/utils/getGlobalOrLocalSearchActionType.js +0 -7
- package/dist/components/ItemPickerList/utils/getSearchActionItems.d.ts +0 -10
- package/dist/components/ItemPickerList/utils/getSearchActionSectionLabel.d.ts +0 -3
- package/dist/components/ItemPickerList/utils/getSearchActionSectionLabel.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.8.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-item-picker@1.8.0...@synerise/ds-item-picker@1.8.1) (2025-07-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **item-picker:** back action overflow with ellipsis ([c35f1c2](https://github.com/Synerise/synerise-design/commit/c35f1c2340e4fd905e9df0e723856d192c8f4d6c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [1.8.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-item-picker@1.7.1...@synerise/ds-item-picker@1.8.0) (2025-07-11)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **item-picker:** add search in action ([e7517f6](https://github.com/Synerise/synerise-design/commit/e7517f68961535b6e9d2ccc39c6ad64e2c76a066))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [1.7.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-item-picker@1.7.0...@synerise/ds-item-picker@1.7.1) (2025-07-08)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @synerise/ds-item-picker
|
package/dist/ItemPicker.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type ItemPickerProps } from './components/ItemPickerLegacy/ItemPickerLegacy.types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ItemPickerProps as ItemPickerPropsNew } from './components/ItemPickerNew/ItemPickerNew.types';
|
|
4
|
+
import type { BaseItemType, BaseSectionType } from './components/ItemPickerNew/types/baseItemSectionType.types';
|
|
4
5
|
declare const ItemPicker: <ItemType extends BaseItemType, SectionType extends BaseSectionType | undefined>(props: ItemPickerProps<import("@synerise/ds-list-item").ListItemProps> | ItemPickerPropsNew<ItemType, SectionType>) => React.JSX.Element;
|
|
5
6
|
export default ItemPicker;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { BaseItemType, BaseSectionType } from '../ItemPickerNew/
|
|
2
|
+
import type { BaseItemType, BaseSectionType } from '../ItemPickerNew/types/baseItemSectionType.types';
|
|
3
3
|
import type { ItemPickerListProps } from './ItemPickerList.types';
|
|
4
4
|
export declare const ItemPickerList: <ItemType extends BaseItemType, SectionType extends BaseSectionType | undefined>({ items, recents, sections, actions, texts, isLoading, selectedItem, scrollbarProps, searchBarProps, showItemsSectionLabel, onItemSelect, onRefresh, containerHeight, isVisible, onSectionChange, containerRef: forwardedRef, includeFooter, includeSearchBar, onLoadedData, ...htmlAttributes }: ItemPickerListProps<ItemType, SectionType>) => React.JSX.Element;
|
|
5
5
|
export default ItemPickerList;
|
|
@@ -8,6 +8,7 @@ import { useTheme } from '@synerise/ds-core';
|
|
|
8
8
|
import Dropdown from '@synerise/ds-dropdown';
|
|
9
9
|
import Icon, { ArrowLeftM } from '@synerise/ds-icon';
|
|
10
10
|
import { itemSizes } from '@synerise/ds-list-item';
|
|
11
|
+
import { Text } from '@synerise/ds-typography';
|
|
11
12
|
import { focusWithArrowKeys, useCombinedRefs, useKeyboardShortcuts, useScrollContain } from '@synerise/ds-utils';
|
|
12
13
|
import { useDefaultTexts } from '../../hooks/useDefaultTexts';
|
|
13
14
|
import * as S from './ItemPickerList.styles';
|
|
@@ -16,7 +17,6 @@ import { ListSearchInput } from './components/ListSearchInput';
|
|
|
16
17
|
import { ITEM_SIZE, LIST_INNER_PADDING, LIST_STYLE, SECTION_HEADER_HEIGHT } from './constants';
|
|
17
18
|
import { useItemsInSections, useListHeight } from './hooks';
|
|
18
19
|
import { findSectionById, isNavKey, isTitle } from './utils';
|
|
19
|
-
import { getSearchActionSectionLabel } from './utils/getSearchActionSectionLabel';
|
|
20
20
|
export var ItemPickerList = function ItemPickerList(_ref) {
|
|
21
21
|
var items = _ref.items,
|
|
22
22
|
recents = _ref.recents,
|
|
@@ -99,10 +99,13 @@ export var ItemPickerList = function ItemPickerList(_ref) {
|
|
|
99
99
|
refreshItems = _useItemsInSections.refreshItems,
|
|
100
100
|
refreshEnabled = _useItemsInSections.refreshEnabled,
|
|
101
101
|
contentHeight = _useItemsInSections.contentHeight,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
listActions = _useItemsInSections.listActions
|
|
102
|
+
searchByParamConfig = _useItemsInSections.searchByParamConfig,
|
|
103
|
+
setSearchByParamConfig = _useItemsInSections.setSearchByParamConfig,
|
|
104
|
+
searchByAction = _useItemsInSections.searchByAction,
|
|
105
|
+
listActions = _useItemsInSections.listActions,
|
|
106
|
+
searchInAction = _useItemsInSections.searchInAction,
|
|
107
|
+
searchInItem = _useItemsInSections.searchInItem,
|
|
108
|
+
canPerformListActions = _useItemsInSections.canPerformListActions;
|
|
106
109
|
var handleScroll = useCallback(function (_ref2) {
|
|
107
110
|
var currentTarget = _ref2.currentTarget;
|
|
108
111
|
var scrollTop = currentTarget.scrollTop,
|
|
@@ -149,7 +152,7 @@ export var ItemPickerList = function ItemPickerList(_ref) {
|
|
|
149
152
|
}, [mergedItemsList, classNames, getItemSize, allTexts, isLoadingMore, isLoadedAll, isLoadingMoreError]);
|
|
150
153
|
var handleRefresh = onRefresh || refreshItems ? function () {
|
|
151
154
|
changeSearchQuery('');
|
|
152
|
-
|
|
155
|
+
setSearchByParamConfig(undefined);
|
|
153
156
|
resetCurrentSection();
|
|
154
157
|
onRefresh && onRefresh();
|
|
155
158
|
if (refreshItems) {
|
|
@@ -166,7 +169,8 @@ export var ItemPickerList = function ItemPickerList(_ref) {
|
|
|
166
169
|
outerWrapperHeight = _ref3.outerWrapperHeight,
|
|
167
170
|
listWrapperHeight = _ref3.listWrapperHeight,
|
|
168
171
|
offsetSpace = _ref3.offsetSpace;
|
|
169
|
-
var
|
|
172
|
+
var isActionSection = Boolean(searchByAction || searchInAction || searchInItem);
|
|
173
|
+
var isSection = Boolean(currentSection || isActionSection);
|
|
170
174
|
var listHeight = (isSection ? listWrapperHeight - SECTION_HEADER_HEIGHT : listWrapperHeight) - LIST_INNER_PADDING;
|
|
171
175
|
var clearSearchQuery = function clearSearchQuery() {
|
|
172
176
|
changeSearchQuery('');
|
|
@@ -183,6 +187,18 @@ export var ItemPickerList = function ItemPickerList(_ref) {
|
|
|
183
187
|
wrapperHeight: listWrapperHeight
|
|
184
188
|
});
|
|
185
189
|
}
|
|
190
|
+
var getSectionLabel = function getSectionLabel() {
|
|
191
|
+
var itemsPath = currentPath || [currentSection == null ? void 0 : currentSection.text];
|
|
192
|
+
var searchByActionLabel = (searchByAction == null ? void 0 : searchByAction.sectionTitle) || (searchByAction == null ? void 0 : searchByAction.text);
|
|
193
|
+
var searchInActionLabel = searchInAction == null ? void 0 : searchInAction.text;
|
|
194
|
+
var searchInItemLabel = searchInItem && "" + (searchInAction == null ? void 0 : searchInAction.renderSearchInValueText(searchInItem));
|
|
195
|
+
var labelParts = [].concat(itemsPath, [searchInActionLabel, searchInItemLabel, searchByActionLabel]).filter(Boolean).join(' - ');
|
|
196
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
197
|
+
ellipsis: {
|
|
198
|
+
tooltip: labelParts
|
|
199
|
+
}
|
|
200
|
+
}, labelParts);
|
|
201
|
+
};
|
|
186
202
|
return /*#__PURE__*/React.createElement(React.Fragment, null, isSection && /*#__PURE__*/React.createElement(Dropdown.BackAction, {
|
|
187
203
|
tooltipProps: {
|
|
188
204
|
title: allTexts.backTooltip,
|
|
@@ -193,7 +209,7 @@ export var ItemPickerList = function ItemPickerList(_ref) {
|
|
|
193
209
|
component: /*#__PURE__*/React.createElement(ArrowLeftM, null)
|
|
194
210
|
})]
|
|
195
211
|
},
|
|
196
|
-
label:
|
|
212
|
+
label: getSectionLabel(),
|
|
197
213
|
onClick: goBack
|
|
198
214
|
}), (mergedItemsList == null ? void 0 : mergedItemsList.length) === 0 ? /*#__PURE__*/React.createElement(EmptyListMessage, {
|
|
199
215
|
buttonOnClick: function buttonOnClick() {
|
|
@@ -202,7 +218,7 @@ export var ItemPickerList = function ItemPickerList(_ref) {
|
|
|
202
218
|
listActions: listActions,
|
|
203
219
|
hasCurrentSection: isSection,
|
|
204
220
|
texts: allTexts,
|
|
205
|
-
|
|
221
|
+
isActionSection: isActionSection
|
|
206
222
|
}) : /*#__PURE__*/React.createElement(S.StyledScrollbar, _extends({
|
|
207
223
|
withSectionHeader: isSection,
|
|
208
224
|
maxHeight: listHeight,
|
|
@@ -233,7 +249,7 @@ export var ItemPickerList = function ItemPickerList(_ref) {
|
|
|
233
249
|
if (isVisible) {
|
|
234
250
|
resetCurrentSection();
|
|
235
251
|
clearSearchQuery();
|
|
236
|
-
|
|
252
|
+
setSearchByParamConfig(undefined);
|
|
237
253
|
setTimeout(focusSearchInput, 0);
|
|
238
254
|
}
|
|
239
255
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -246,7 +262,7 @@ export var ItemPickerList = function ItemPickerList(_ref) {
|
|
|
246
262
|
listRef.current.resetAfterIndex(0);
|
|
247
263
|
setTimeout(focusSearchInput, 0);
|
|
248
264
|
}
|
|
249
|
-
}, [
|
|
265
|
+
}, [searchByAction, searchByParamConfig, searchInAction, searchInItem, currentSection, focusSearchInput]);
|
|
250
266
|
useEffect(function () {
|
|
251
267
|
listRef.current && listRef.current.resetAfterIndex(0);
|
|
252
268
|
}, [mergedItemsList]);
|
|
@@ -256,8 +272,13 @@ export var ItemPickerList = function ItemPickerList(_ref) {
|
|
|
256
272
|
if (!((_combinedScrollRef$cu = combinedScrollRef.current) != null && _combinedScrollRef$cu.offsetParent)) {
|
|
257
273
|
return;
|
|
258
274
|
}
|
|
259
|
-
|
|
260
|
-
|
|
275
|
+
var isMetaOrCtrlKey = event.metaKey || event.ctrlKey;
|
|
276
|
+
if (isMetaOrCtrlKey) {
|
|
277
|
+
event.preventDefault();
|
|
278
|
+
event.stopPropagation();
|
|
279
|
+
goBack();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
261
282
|
},
|
|
262
283
|
Escape: function Escape(event) {
|
|
263
284
|
var _combinedScrollRef$cu2;
|
|
@@ -270,10 +291,10 @@ export var ItemPickerList = function ItemPickerList(_ref) {
|
|
|
270
291
|
clearSearchQuery();
|
|
271
292
|
return;
|
|
272
293
|
}
|
|
273
|
-
if (
|
|
294
|
+
if (searchByParamConfig) {
|
|
274
295
|
event.preventDefault();
|
|
275
296
|
event.stopPropagation();
|
|
276
|
-
|
|
297
|
+
setSearchByParamConfig(undefined);
|
|
277
298
|
}
|
|
278
299
|
}
|
|
279
300
|
});
|
|
@@ -286,14 +307,14 @@ export var ItemPickerList = function ItemPickerList(_ref) {
|
|
|
286
307
|
wrapperHeight: outerWrapperHeight
|
|
287
308
|
}, htmlAttributes), includeSearchBar && /*#__PURE__*/React.createElement(ListSearchInput, {
|
|
288
309
|
clearSearchQuery: clearSearchQuery,
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
setSearchParamConfig: setSearchParamConfig,
|
|
310
|
+
searchByParamConfig: searchByParamConfig,
|
|
311
|
+
setSearchByParamConfig: setSearchByParamConfig,
|
|
292
312
|
searchBarProps: searchBarProps,
|
|
293
313
|
debouncedChangeSearchQuery: debouncedSearchQueryChange,
|
|
294
314
|
inputRef: inputRef,
|
|
295
315
|
changeLocalSearchQueryRef: changeLocalSearchQueryRef,
|
|
296
|
-
allTexts: allTexts
|
|
316
|
+
allTexts: allTexts,
|
|
317
|
+
canPerformListActions: canPerformListActions
|
|
297
318
|
}), /*#__PURE__*/React.createElement(S.ListWrapper, {
|
|
298
319
|
"data-testid": "list-wrapper",
|
|
299
320
|
ref: scrollContainRef,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VariableSizeList } from 'react-window';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import Dropdown from '@synerise/ds-dropdown';
|
|
4
|
+
import { Label as DropdownBackActionLabel } from '@synerise/ds-dropdown/dist/elements/BackAction/BackAction.styles';
|
|
4
5
|
import DSEmptyStates from '@synerise/ds-empty-states';
|
|
5
6
|
import DSLoader from '@synerise/ds-loader';
|
|
6
7
|
import Scrollbar from '@synerise/ds-scrollbar';
|
|
@@ -10,13 +11,13 @@ import { LIST_INNER_PADDING } from './constants';
|
|
|
10
11
|
export var ListWrapper = styled.div.withConfig({
|
|
11
12
|
displayName: "ItemPickerListstyles__ListWrapper",
|
|
12
13
|
componentId: "sc-1r33ill-0"
|
|
13
|
-
})(["position:relative;flex:1 0 calc(100% - ", "px);", " ", ""], function (props) {
|
|
14
|
+
})(["position:relative;flex:1 0 calc(100% - ", "px);", " ", " ", "{min-width:0;}"], function (props) {
|
|
14
15
|
return props.offsetSpace;
|
|
15
16
|
}, function (props) {
|
|
16
17
|
return props.wrapperHeight !== undefined && "height: " + (props.wrapperHeight + LIST_INNER_PADDING) + "px;";
|
|
17
18
|
}, function (props) {
|
|
18
19
|
return props.centered && css(["display:flex;flex-direction:column;"]);
|
|
19
|
-
});
|
|
20
|
+
}, DropdownBackActionLabel);
|
|
20
21
|
export var ListContainer = styled(Dropdown.Wrapper).withConfig({
|
|
21
22
|
displayName: "ItemPickerListstyles__ListContainer",
|
|
22
23
|
componentId: "sc-1r33ill-1"
|
|
@@ -3,7 +3,9 @@ import type { ListItemProps } from '@synerise/ds-list-item';
|
|
|
3
3
|
import type { ScrollbarAdditionalProps } from '@synerise/ds-scrollbar';
|
|
4
4
|
import type { SearchBarProps } from '@synerise/ds-search-bar';
|
|
5
5
|
import type { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
6
|
-
import type {
|
|
6
|
+
import type { ContainerHeightType, ItemLoaderConfig, ItemsConfig, OnLoadedData } from '../ItemPickerNew/ItemPickerNew.types';
|
|
7
|
+
import type { Action } from '../ItemPickerNew/types/actions.types';
|
|
8
|
+
import type { BaseItemType, BaseSectionType, BaseSectionTypeWithFolders } from '../ItemPickerNew/types/baseItemSectionType.types';
|
|
7
9
|
type TextsAsReactNode = 'basicSearchPlaceholder' | 'searchPlaceholder' | 'refreshButtonLabel' | 'showMoreResultsLabel' | 'noItems' | 'noResults' | 'noResultsInSection' | 'searchAllFoldersButtonLabel' | 'recentsSectionLabel' | 'actionsSectionLabel' | 'resultsSectionLabel' | 'noActions' | 'itemsSectionLabel' | 'infiniteScrollLoadingMore' | 'infiniteScrollLoadingError' | 'errorMessageTitle' | 'errorMessageDetails' | 'backTooltip' | 'clearSearchTooltip' | 'infiniteScrollAllLoaded';
|
|
8
10
|
export type ItemPickerListTexts = {
|
|
9
11
|
[key in TextsAsReactNode]: ReactNode;
|
|
@@ -11,7 +13,7 @@ export type ItemPickerListTexts = {
|
|
|
11
13
|
export type ItemSelectHandler<ItemType extends BaseItemType, SectionType extends BaseSectionType | undefined> = SectionType extends BaseSectionType ? (item: ItemType, section?: BaseSectionTypeWithFolders<BaseSectionType>) => void : (item: ItemType) => void;
|
|
12
14
|
export type ItemPickerListProps<ItemType extends BaseItemType, SectionType extends BaseSectionType | undefined> = WithHTMLAttributes<HTMLDivElement, {
|
|
13
15
|
recents?: ItemType[];
|
|
14
|
-
actions?:
|
|
16
|
+
actions?: Action[];
|
|
15
17
|
texts?: Partial<ItemPickerListTexts>;
|
|
16
18
|
containerHeight?: ContainerHeightType;
|
|
17
19
|
showItemsSectionLabel?: boolean;
|
|
@@ -20,7 +22,7 @@ export type ItemPickerListProps<ItemType extends BaseItemType, SectionType exten
|
|
|
20
22
|
onItemSelect: ItemSelectHandler<ItemType, SectionType>;
|
|
21
23
|
onSectionChange?: SectionType extends BaseSectionType ? (section?: BaseSectionTypeWithFolders<SectionType>) => void : undefined;
|
|
22
24
|
selectedItem?: ItemType;
|
|
23
|
-
getItemHeight?: (item: ItemType | SectionType |
|
|
25
|
+
getItemHeight?: (item: ItemType | SectionType | Action) => number;
|
|
24
26
|
scrollbarProps?: ScrollbarAdditionalProps;
|
|
25
27
|
searchBarProps?: Omit<SearchBarProps, 'value' | 'onSearchChange' | 'placeholder'>;
|
|
26
28
|
onRefresh?: () => void;
|
|
@@ -4,8 +4,8 @@ type EmptyListMessageProps = {
|
|
|
4
4
|
texts: Pick<ItemPickerListTexts, 'noResultsInSection' | 'noResults' | 'noItems' | 'noActions' | 'searchAllFoldersButtonLabel'>;
|
|
5
5
|
hasCurrentSection?: boolean;
|
|
6
6
|
listActions: boolean;
|
|
7
|
-
|
|
7
|
+
isActionSection: boolean;
|
|
8
8
|
buttonOnClick: () => void;
|
|
9
9
|
};
|
|
10
|
-
export declare const EmptyListMessage: ({ texts, listActions,
|
|
10
|
+
export declare const EmptyListMessage: ({ texts, listActions, isActionSection, hasCurrentSection, buttonOnClick, }: EmptyListMessageProps) => React.JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -5,7 +5,7 @@ import * as S from '../ItemPickerList.styles';
|
|
|
5
5
|
export var EmptyListMessage = function EmptyListMessage(_ref) {
|
|
6
6
|
var texts = _ref.texts,
|
|
7
7
|
listActions = _ref.listActions,
|
|
8
|
-
|
|
8
|
+
isActionSection = _ref.isActionSection,
|
|
9
9
|
hasCurrentSection = _ref.hasCurrentSection,
|
|
10
10
|
buttonOnClick = _ref.buttonOnClick;
|
|
11
11
|
if (listActions) {
|
|
@@ -15,7 +15,7 @@ export var EmptyListMessage = function EmptyListMessage(_ref) {
|
|
|
15
15
|
label: texts.noActions
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
if (hasCurrentSection && !
|
|
18
|
+
if (hasCurrentSection && !isActionSection) {
|
|
19
19
|
return /*#__PURE__*/React.createElement(S.EmptyStates, {
|
|
20
20
|
customIcon: /*#__PURE__*/React.createElement(SearchNoResultsL, null),
|
|
21
21
|
label: texts.noResultsInSection,
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import React, { type MutableRefObject } from 'react';
|
|
2
2
|
import type { SearchBarProps } from '@synerise/ds-search-bar';
|
|
3
|
-
import type { ItemPickerTexts
|
|
3
|
+
import type { ItemPickerTexts } from '../../ItemPickerNew/ItemPickerNew.types';
|
|
4
|
+
import type { SearchByParamConfig } from '../../ItemPickerNew/types/actions.types';
|
|
4
5
|
type ListSearchInputProps = {
|
|
5
|
-
|
|
6
|
-
searchActionSection?: SearchActionType;
|
|
6
|
+
searchByParamConfig?: SearchByParamConfig;
|
|
7
7
|
clearSearchQuery: () => void;
|
|
8
|
-
|
|
8
|
+
setSearchByParamConfig: (searchByParamConfig: SearchByParamConfig | undefined) => void;
|
|
9
9
|
debouncedChangeSearchQuery: (value: string) => void;
|
|
10
10
|
inputRef: MutableRefObject<HTMLInputElement | null>;
|
|
11
11
|
changeLocalSearchQueryRef: MutableRefObject<((value: string) => void) | null>;
|
|
12
12
|
searchBarProps?: Omit<SearchBarProps, 'value' | 'onSearchChange' | 'placeholder'>;
|
|
13
13
|
allTexts: ItemPickerTexts;
|
|
14
|
+
canPerformListActions: boolean;
|
|
14
15
|
};
|
|
15
|
-
export declare const ListSearchInput: ({
|
|
16
|
+
export declare const ListSearchInput: ({ searchByParamConfig, changeLocalSearchQueryRef, clearSearchQuery, setSearchByParamConfig, debouncedChangeSearchQuery, searchBarProps, allTexts, inputRef, canPerformListActions, }: ListSearchInputProps) => React.JSX.Element;
|
|
16
17
|
export {};
|
|
@@ -8,20 +8,19 @@ var CLEAR_TOOLTIP_PROPS = {
|
|
|
8
8
|
shortCuts: 'ESC'
|
|
9
9
|
};
|
|
10
10
|
export var ListSearchInput = function ListSearchInput(_ref) {
|
|
11
|
-
var
|
|
12
|
-
searchActionSection = _ref.searchActionSection,
|
|
11
|
+
var searchByParamConfig = _ref.searchByParamConfig,
|
|
13
12
|
changeLocalSearchQueryRef = _ref.changeLocalSearchQueryRef,
|
|
14
13
|
clearSearchQuery = _ref.clearSearchQuery,
|
|
15
|
-
|
|
14
|
+
setSearchByParamConfig = _ref.setSearchByParamConfig,
|
|
16
15
|
debouncedChangeSearchQuery = _ref.debouncedChangeSearchQuery,
|
|
17
16
|
searchBarProps = _ref.searchBarProps,
|
|
18
17
|
allTexts = _ref.allTexts,
|
|
19
|
-
inputRef = _ref.inputRef
|
|
18
|
+
inputRef = _ref.inputRef,
|
|
19
|
+
canPerformListActions = _ref.canPerformListActions;
|
|
20
20
|
var theme = useTheme();
|
|
21
21
|
var _useState = useState(''),
|
|
22
22
|
localSearchQuery = _useState[0],
|
|
23
23
|
setLocalSearchQuery = _useState[1];
|
|
24
|
-
var isSearchParamOrSearchSectionActive = Boolean(searchParamConfig || searchActionSection);
|
|
25
24
|
var handleSearchChange = useCallback(function (value) {
|
|
26
25
|
setLocalSearchQuery(value);
|
|
27
26
|
debouncedChangeSearchQuery(value);
|
|
@@ -32,7 +31,7 @@ export var ListSearchInput = function ListSearchInput(_ref) {
|
|
|
32
31
|
}, [inputRef]);
|
|
33
32
|
var handleKeyDown = function handleKeyDown(event) {
|
|
34
33
|
if (event.key === 'Backspace' && !localSearchQuery) {
|
|
35
|
-
|
|
34
|
+
setSearchByParamConfig(undefined);
|
|
36
35
|
}
|
|
37
36
|
};
|
|
38
37
|
var handleClearInput = function handleClearInput() {
|
|
@@ -40,7 +39,7 @@ export var ListSearchInput = function ListSearchInput(_ref) {
|
|
|
40
39
|
clearSearchQuery();
|
|
41
40
|
return;
|
|
42
41
|
}
|
|
43
|
-
|
|
42
|
+
setSearchByParamConfig(undefined);
|
|
44
43
|
};
|
|
45
44
|
useEffect(function () {
|
|
46
45
|
var ref = changeLocalSearchQueryRef;
|
|
@@ -50,12 +49,12 @@ export var ListSearchInput = function ListSearchInput(_ref) {
|
|
|
50
49
|
"data-testid": "search-wrapper"
|
|
51
50
|
}, /*#__PURE__*/React.createElement(Dropdown.SearchInput, _extends({
|
|
52
51
|
iconLeft: /*#__PURE__*/React.createElement(Icon, {
|
|
53
|
-
component: (
|
|
52
|
+
component: (searchByParamConfig == null ? void 0 : searchByParamConfig.icon) || /*#__PURE__*/React.createElement(SearchM, null),
|
|
54
53
|
color: theme.palette['grey-600']
|
|
55
54
|
}),
|
|
56
|
-
placeholder:
|
|
55
|
+
placeholder: canPerformListActions ? allTexts.searchPlaceholder : allTexts.basicSearchPlaceholder
|
|
57
56
|
}, searchBarProps, {
|
|
58
|
-
valuePrefix:
|
|
57
|
+
valuePrefix: searchByParamConfig == null ? void 0 : searchByParamConfig.paramKeyLabel,
|
|
59
58
|
onKeyDown: handleKeyDown,
|
|
60
59
|
clearTooltip: allTexts.clearSearchTooltip,
|
|
61
60
|
clearTooltipProps: CLEAR_TOOLTIP_PROPS,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
import type { BaseItemType } from '../ItemPickerNew/
|
|
2
|
+
import type { BaseItemType } from '../ItemPickerNew/types/baseItemSectionType.types';
|
|
3
3
|
export declare const LIST_STYLE: CSSProperties;
|
|
4
4
|
export declare const ITEM_SIZE: {
|
|
5
5
|
large: number;
|
|
@@ -14,6 +14,7 @@ export declare const SEARCH_BAR_HEIGHT = 53;
|
|
|
14
14
|
export declare const FOOTER_HEIGHT = 48;
|
|
15
15
|
export declare const LIST_INNER_PADDING = 8;
|
|
16
16
|
export declare const FIRST_PAGE = 0;
|
|
17
|
+
export declare const SECOND_PAGE = 1;
|
|
17
18
|
export declare const ITEMS_PER_PAGE = 150;
|
|
18
19
|
export declare const ITEMS_PER_SECTION = 4;
|
|
19
20
|
export declare const ITEMS_PER_SECTION_IN_SEARCH = 4;
|
|
@@ -13,6 +13,7 @@ export var SEARCH_BAR_HEIGHT = 53;
|
|
|
13
13
|
export var FOOTER_HEIGHT = 48;
|
|
14
14
|
export var LIST_INNER_PADDING = 8;
|
|
15
15
|
export var FIRST_PAGE = 0;
|
|
16
|
+
export var SECOND_PAGE = 1;
|
|
16
17
|
export var ITEMS_PER_PAGE = 150;
|
|
17
18
|
export var ITEMS_PER_SECTION = 4;
|
|
18
19
|
export var ITEMS_PER_SECTION_IN_SEARCH = 4;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { BaseSectionType, BaseSectionTypeWithFolders } from '../../ItemPickerNew/
|
|
2
|
+
import type { BaseSectionType, BaseSectionTypeWithFolders } from '../../ItemPickerNew/types/baseItemSectionType.types';
|
|
3
3
|
type NestedFoldersProps<SectionType extends BaseSectionType | undefined> = {
|
|
4
4
|
currentSection?: SectionType extends BaseSectionType ? BaseSectionTypeWithFolders<SectionType> : undefined;
|
|
5
5
|
sections?: SectionType extends BaseSectionType ? BaseSectionTypeWithFolders<SectionType>[] : undefined;
|
|
@@ -11,7 +11,7 @@ export declare const useFlattenFolders: <SectionType extends BaseSectionType | u
|
|
|
11
11
|
id: string;
|
|
12
12
|
selected?: boolean | undefined;
|
|
13
13
|
highlight?: string | undefined;
|
|
14
|
-
hoverTooltipProps?: (import("rc-trigger").TriggerProps & {
|
|
14
|
+
hoverTooltipProps?: (Pick<import("rc-trigger").TriggerProps, "mouseEnterDelay" | "mouseLeaveDelay" | "getPopupContainer" | "onPopupVisibleChange" | "onPopupClick" | "defaultPopupVisible" | "action" | "afterPopupVisibleChange" | "popupPlacement" | "forceRender"> & {
|
|
15
15
|
ref?: import("react").LegacyRef<import("@synerise/ds-list-item/dist/ListItem.types").TriggerHandle> | undefined;
|
|
16
16
|
}) | undefined;
|
|
17
17
|
prefixel?: ReactNode | import("@synerise/ds-list-item/dist/ListItem.types").AddonRenderer;
|
|
@@ -20,18 +20,7 @@ export declare const useFlattenFolders: <SectionType extends BaseSectionType | u
|
|
|
20
20
|
text: string;
|
|
21
21
|
folders?: BaseSectionTypeWithFolders<BaseSectionType>[] | undefined;
|
|
22
22
|
}[] | undefined;
|
|
23
|
-
childFolders: ({
|
|
24
|
-
type?: import("@synerise/ds-list-item").ItemType | undefined;
|
|
25
|
-
id?: string | undefined;
|
|
26
|
-
selected?: boolean | undefined;
|
|
27
|
-
highlight?: string | undefined;
|
|
28
|
-
hoverTooltipProps?: (import("rc-trigger").TriggerProps & {
|
|
29
|
-
ref?: import("react").LegacyRef<import("@synerise/ds-list-item/dist/ListItem.types").TriggerHandle> | undefined;
|
|
30
|
-
}) | undefined;
|
|
31
|
-
prefixel?: ReactNode | import("@synerise/ds-list-item/dist/ListItem.types").AddonRenderer;
|
|
32
|
-
renderHoverTooltip?: (() => JSX.Element) | undefined;
|
|
33
|
-
timeToHideTooltip?: number | undefined;
|
|
34
|
-
} & {
|
|
23
|
+
childFolders: (import("../../ItemPickerNew/types/baseItemSectionType.types").InheritedFromListItem & {
|
|
35
24
|
text: string;
|
|
36
25
|
id: string | number;
|
|
37
26
|
} & {
|
|
@@ -40,18 +29,7 @@ export declare const useFlattenFolders: <SectionType extends BaseSectionType | u
|
|
|
40
29
|
titles?: ReactNode[] | undefined;
|
|
41
30
|
})[] | undefined;
|
|
42
31
|
parentFolder: BaseSectionTypeWithFolders<BaseSectionType> | undefined;
|
|
43
|
-
currentFolders: ({
|
|
44
|
-
type?: import("@synerise/ds-list-item").ItemType | undefined;
|
|
45
|
-
id?: string | undefined;
|
|
46
|
-
selected?: boolean | undefined;
|
|
47
|
-
highlight?: string | undefined;
|
|
48
|
-
hoverTooltipProps?: (import("rc-trigger").TriggerProps & {
|
|
49
|
-
ref?: import("react").LegacyRef<import("@synerise/ds-list-item/dist/ListItem.types").TriggerHandle> | undefined;
|
|
50
|
-
}) | undefined;
|
|
51
|
-
prefixel?: ReactNode | import("@synerise/ds-list-item/dist/ListItem.types").AddonRenderer;
|
|
52
|
-
renderHoverTooltip?: (() => JSX.Element) | undefined;
|
|
53
|
-
timeToHideTooltip?: number | undefined;
|
|
54
|
-
} & {
|
|
32
|
+
currentFolders: (import("../../ItemPickerNew/types/baseItemSectionType.types").InheritedFromListItem & {
|
|
55
33
|
text: string;
|
|
56
34
|
id: string | number;
|
|
57
35
|
} & {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { OnLoadedData } from '../../ItemPickerNew/ItemPickerNew.types';
|
|
3
|
+
import type { SearchByAction, SearchByParamConfig, SearchInAction } from '../../ItemPickerNew/types/actions.types';
|
|
4
|
+
import type { BaseItemType, BaseSectionType, BaseSectionTypeWithFolders } from '../../ItemPickerNew/types/baseItemSectionType.types';
|
|
3
5
|
import type { ItemPickerListProps, ItemPickerListTexts } from '../ItemPickerList.types';
|
|
4
6
|
type ItemsInSectionsType<ItemType extends BaseItemType, SectionType extends BaseSectionType | undefined> = {
|
|
5
7
|
items: ItemPickerListProps<ItemType, SectionType>['items'];
|
|
@@ -22,7 +24,7 @@ export declare const useItemsInSections: <ItemType extends BaseItemType, Section
|
|
|
22
24
|
goBack: () => void;
|
|
23
25
|
resetCurrentSection: () => void;
|
|
24
26
|
setCurrentSection: (section?: BaseSectionType | SectionType | undefined) => void;
|
|
25
|
-
mergedItemsList:
|
|
27
|
+
mergedItemsList: (import("@synerise/ds-list-item").ListItemProps | import("../ItemPickerList.types").TitleListItemProps)[];
|
|
26
28
|
isLoading: boolean;
|
|
27
29
|
isLoadingMore: boolean;
|
|
28
30
|
isLoadedAll: boolean;
|
|
@@ -32,9 +34,12 @@ export declare const useItemsInSections: <ItemType extends BaseItemType, Section
|
|
|
32
34
|
isLoadingMoreError: boolean;
|
|
33
35
|
contentHeight: number | undefined;
|
|
34
36
|
refreshEnabled: boolean;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
searchByAction: SearchByAction | undefined;
|
|
38
|
+
searchByParamConfig: SearchByParamConfig | undefined;
|
|
39
|
+
setSearchByParamConfig: import("react").Dispatch<import("react").SetStateAction<SearchByParamConfig | undefined>>;
|
|
38
40
|
listActions: boolean;
|
|
41
|
+
searchInItem: ItemType | undefined;
|
|
42
|
+
searchInAction: SearchInAction | undefined;
|
|
43
|
+
canPerformListActions: boolean;
|
|
39
44
|
};
|
|
40
45
|
export {};
|