@synerise/ds-items-roll 0.7.15 → 0.8.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 +21 -0
- package/README.md +4 -1
- package/dist/Extras/Extras.d.ts +4 -3
- package/dist/Extras/Extras.js +3 -9
- package/dist/ItemsRoll.d.ts +1 -1
- package/dist/ItemsRoll.js +41 -43
- package/dist/ItemsRoll.types.d.ts +9 -6
- package/dist/ItemsRollComponents/Footer.d.ts +1 -1
- package/dist/ItemsRollComponents/Footer.js +18 -22
- package/dist/ItemsRollComponents/Footer.types.d.ts +6 -6
- package/dist/ItemsRollComponents/Header.d.ts +1 -1
- package/dist/ItemsRollComponents/Header.js +15 -17
- package/dist/ItemsRollComponents/Header.types.d.ts +4 -4
- package/dist/ItemsRollComponents/ItemRemoveIcon.d.ts +1 -1
- package/dist/ItemsRollComponents/ItemRemoveIcon.js +8 -7
- package/dist/ItemsRollComponents/ItemRemoveIcon.styles.js +1 -2
- package/dist/ItemsRollComponents/ItemRemoveIcon.types.d.ts +3 -3
- package/dist/ItemsRollComponents/List.d.ts +1 -1
- package/dist/ItemsRollComponents/List.js +50 -45
- package/dist/ItemsRollComponents/List.types.d.ts +4 -4
- package/dist/ItemsRollComponents/ListItem.d.ts +1 -1
- package/dist/ItemsRollComponents/ListItem.js +7 -14
- package/dist/ItemsRollComponents/ListItem.styles.d.ts +1 -1
- package/dist/ItemsRollComponents/ListItem.styles.js +2 -2
- package/dist/ItemsRollComponents/ListItem.types.d.ts +3 -3
- package/dist/ItemsRollComponents/VirtualizedListItem.d.ts +2 -2
- package/dist/ItemsRollComponents/VirtualizedListItem.js +15 -23
- package/dist/ItemsRollComponents/VirtualizedListItem.types.d.ts +3 -3
- package/package.json +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,27 @@
|
|
|
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.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-items-roll@0.7.16...@synerise/ds-items-roll@0.8.0) (2024-11-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **items-roll:** add renderCount prop ([ec61af1](https://github.com/Synerise/synerise-design/commit/ec61af19b812608c1f12a736eeceaf32c85722e7))
|
|
12
|
+
* **items-roll:** isDisabled prop added ([e7eec53](https://github.com/Synerise/synerise-design/commit/e7eec53b482981a424c5b5ab80899407e660999b))
|
|
13
|
+
* **items-roll:** replaced Menu.Item with ListItem ([2cfcbdc](https://github.com/Synerise/synerise-design/commit/2cfcbdc501c0ad21557372c0f9d9cb76b3d034cb))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## [0.7.16](https://github.com/Synerise/synerise-design/compare/@synerise/ds-items-roll@0.7.15...@synerise/ds-items-roll@0.7.16) (2024-11-22)
|
|
20
|
+
|
|
21
|
+
**Note:** Version bump only for package @synerise/ds-items-roll
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
6
27
|
## [0.7.15](https://github.com/Synerise/synerise-design/compare/@synerise/ds-items-roll@0.7.14...@synerise/ds-items-roll@0.7.15) (2024-11-21)
|
|
7
28
|
|
|
8
29
|
**Note:** Version bump only for package @synerise/ds-items-roll
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ import ItemsRoll from '@synerise/ds-items-roll';
|
|
|
34
34
|
## API
|
|
35
35
|
|
|
36
36
|
| Property | Description | Type | Default |
|
|
37
|
-
|
|
37
|
+
|------------------------------|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|---------|
|
|
38
38
|
| actions | ItemRollElement array with configuration for action dropdown menu | ItemRollElement[] | - |
|
|
39
39
|
| changeSelectionIcon | The custom changeSelection icon | `(props: React.SVGProps<SVGSVGElement>) => JSX.Element` | EditM |
|
|
40
40
|
| changeSelectionDropdownProps | Object with ds-dropdown props | DropdownProps | |
|
|
@@ -42,6 +42,7 @@ import ItemsRoll from '@synerise/ds-items-roll';
|
|
|
42
42
|
| customSidebarActions | Allow put developer sidebar actions that are not defined | React.ReactNode | - |
|
|
43
43
|
| groups | Array of strings where each one corresponds to a group prop in ItemRollElement | string[] | - |
|
|
44
44
|
| hideSearch | Hide search component in itemsroll | booleam | - |
|
|
45
|
+
| isDisabled | prevents rendering 'remove' / 'clear all' buttons | booleam | - |
|
|
45
46
|
| items | ItemRollElement array for list | ItemRollElement[] | - |
|
|
46
47
|
| maxToShowItems | Amount of initial ItemsRollElement to render. Note that if number is greater than 20, list will becoma scrollable | number | 10 |
|
|
47
48
|
| onClearAll | Callback function that is fired when click on clearAll button | () => void | - |
|
|
@@ -54,12 +55,14 @@ import ItemsRoll from '@synerise/ds-items-roll';
|
|
|
54
55
|
| searchValue | Value of search input component | string | - |
|
|
55
56
|
| showMoreStep | Amount of items to load on show more button click | number | 10 |
|
|
56
57
|
| style | Object with CSS properties | React.CSSProperties | - |
|
|
58
|
+
| renderCount | Custom items count renderer | (count: number) => ReactNode | - |
|
|
57
59
|
| texts | Object contains texts for buttons, title etc. | Texts | - |
|
|
58
60
|
| useFooter | Whether the footer is visibile | boolean | - |
|
|
59
61
|
| useVirtualizedList | Whether to use react-virtualized for list | boolean | `false` |
|
|
60
62
|
| virtualizedRowHeight | Height of virtualizedlist row | number | 32px |
|
|
61
63
|
| virtualizedRowWidth | Width of virtualized list | number | - |
|
|
62
64
|
|
|
65
|
+
|
|
63
66
|
#### ItemRollElement
|
|
64
67
|
|
|
65
68
|
| Property | Description | Type | Default |
|
package/dist/Extras/Extras.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { MenuItemProps } from '@synerise/ds-menu';
|
|
3
|
+
import type { ItemRollElement } from '../ItemsRoll.types';
|
|
3
4
|
export type ExtrasProps = {
|
|
4
|
-
actions: ItemRollElement[];
|
|
5
|
+
actions: ItemRollElement<MenuItemProps>[];
|
|
5
6
|
};
|
|
6
|
-
declare const Extras: React.
|
|
7
|
+
declare const Extras: ({ actions }: ExtrasProps) => React.JSX.Element;
|
|
7
8
|
export default Extras;
|
package/dist/Extras/Extras.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import styled from 'styled-components';
|
|
5
3
|
import Dropdown from '@synerise/ds-dropdown';
|
|
@@ -10,18 +8,15 @@ var ItemMenu = styled(Menu).withConfig({
|
|
|
10
8
|
displayName: "Extras__ItemMenu",
|
|
11
9
|
componentId: "sc-1cdoprb-0"
|
|
12
10
|
})(["padding:8px;"]);
|
|
13
|
-
|
|
14
11
|
var Extras = function Extras(_ref) {
|
|
15
12
|
var actions = _ref.actions;
|
|
16
13
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
17
14
|
trigger: ['click'],
|
|
18
15
|
placement: "bottomRight",
|
|
19
|
-
overlay: /*#__PURE__*/React.createElement(
|
|
16
|
+
overlay: /*#__PURE__*/React.createElement("div", {
|
|
20
17
|
"data-testid": "items-roll-action-menu"
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
key: action.id
|
|
24
|
-
}), action.text);
|
|
18
|
+
}, /*#__PURE__*/React.createElement(ItemMenu, {
|
|
19
|
+
dataSource: actions
|
|
25
20
|
}))
|
|
26
21
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
27
22
|
type: "ghost",
|
|
@@ -30,5 +25,4 @@ var Extras = function Extras(_ref) {
|
|
|
30
25
|
component: /*#__PURE__*/React.createElement(OptionHorizontalM, null)
|
|
31
26
|
})));
|
|
32
27
|
};
|
|
33
|
-
|
|
34
28
|
export default Extras;
|
package/dist/ItemsRoll.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ItemsRollProps } from './ItemsRoll.types';
|
|
3
|
-
export declare const ItemsRoll: ({ actions, changeSelectionIcon, changeSelectionDropdownProps, className, customSidebarActions, groups, hideSearch, items, maxToShowItems, onClearAll, onChangeSelection, onItemClick, onItemRemove, onSearchClear, onSearch, searchValue, searchPlaceholder, showMoreStep, style, texts, useFooter, useVirtualizedList, virtualizedRowWidth, virtualizedRowHeight, }: ItemsRollProps) => React.JSX.Element;
|
|
3
|
+
export declare const ItemsRoll: ({ actions, changeSelectionIcon, changeSelectionDropdownProps, className, customSidebarActions, groups, hideSearch, isDisabled, items, maxToShowItems, onClearAll, onChangeSelection, onItemClick, onItemRemove, onSearchClear, onSearch, renderCount, searchValue, searchPlaceholder, showMoreStep, style, texts, useFooter, useVirtualizedList, virtualizedRowWidth, virtualizedRowHeight, }: ItemsRollProps) => React.JSX.Element;
|
|
4
4
|
export default ItemsRoll;
|
package/dist/ItemsRoll.js
CHANGED
|
@@ -1,44 +1,41 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
4
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
8
|
-
|
|
9
5
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
-
|
|
11
|
-
import React from 'react';
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
12
7
|
import { useIntl } from 'react-intl';
|
|
13
8
|
import { Footer, Header, List } from './ItemsRollComponents';
|
|
14
9
|
import * as S from './ItemsRoll.styles';
|
|
15
10
|
export var ItemsRoll = function ItemsRoll(_ref) {
|
|
16
11
|
var actions = _ref.actions,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
12
|
+
changeSelectionIcon = _ref.changeSelectionIcon,
|
|
13
|
+
changeSelectionDropdownProps = _ref.changeSelectionDropdownProps,
|
|
14
|
+
className = _ref.className,
|
|
15
|
+
customSidebarActions = _ref.customSidebarActions,
|
|
16
|
+
groups = _ref.groups,
|
|
17
|
+
hideSearch = _ref.hideSearch,
|
|
18
|
+
isDisabled = _ref.isDisabled,
|
|
19
|
+
items = _ref.items,
|
|
20
|
+
_ref$maxToShowItems = _ref.maxToShowItems,
|
|
21
|
+
maxToShowItems = _ref$maxToShowItems === void 0 ? 10 : _ref$maxToShowItems,
|
|
22
|
+
onClearAll = _ref.onClearAll,
|
|
23
|
+
onChangeSelection = _ref.onChangeSelection,
|
|
24
|
+
onItemClick = _ref.onItemClick,
|
|
25
|
+
onItemRemove = _ref.onItemRemove,
|
|
26
|
+
onSearchClear = _ref.onSearchClear,
|
|
27
|
+
onSearch = _ref.onSearch,
|
|
28
|
+
renderCount = _ref.renderCount,
|
|
29
|
+
searchValue = _ref.searchValue,
|
|
30
|
+
searchPlaceholder = _ref.searchPlaceholder,
|
|
31
|
+
_ref$showMoreStep = _ref.showMoreStep,
|
|
32
|
+
showMoreStep = _ref$showMoreStep === void 0 ? 10 : _ref$showMoreStep,
|
|
33
|
+
style = _ref.style,
|
|
34
|
+
texts = _ref.texts,
|
|
35
|
+
useFooter = _ref.useFooter,
|
|
36
|
+
useVirtualizedList = _ref.useVirtualizedList,
|
|
37
|
+
virtualizedRowWidth = _ref.virtualizedRowWidth,
|
|
38
|
+
virtualizedRowHeight = _ref.virtualizedRowHeight;
|
|
42
39
|
var intl = useIntl();
|
|
43
40
|
var defaultTexts = {
|
|
44
41
|
changeSelectionLabel: intl.formatMessage({
|
|
@@ -79,27 +76,28 @@ export var ItemsRoll = function ItemsRoll(_ref) {
|
|
|
79
76
|
})
|
|
80
77
|
};
|
|
81
78
|
var allTexts = texts ? _objectSpread({}, defaultTexts, {}, texts) : defaultTexts;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
React.useEffect(function () {
|
|
79
|
+
var _useState = useState(maxToShowItems),
|
|
80
|
+
visibleItemsAmount = _useState[0],
|
|
81
|
+
setVisibleItemsAmount = _useState[1];
|
|
82
|
+
useEffect(function () {
|
|
88
83
|
setVisibleItemsAmount(maxToShowItems);
|
|
89
84
|
}, [maxToShowItems]);
|
|
90
|
-
var showAdditionalItems =
|
|
85
|
+
var showAdditionalItems = useCallback(function () {
|
|
91
86
|
if (visibleItemsAmount + showMoreStep < items.length) {
|
|
92
87
|
setVisibleItemsAmount(visibleItemsAmount + showMoreStep);
|
|
93
88
|
} else {
|
|
94
89
|
setVisibleItemsAmount(items.length);
|
|
95
90
|
}
|
|
96
91
|
}, [items.length, visibleItemsAmount, showMoreStep]);
|
|
97
|
-
var visibleItems =
|
|
92
|
+
var visibleItems = useMemo(function () {
|
|
98
93
|
return visibleItemsAmount === items.length ? items : items.slice(0, visibleItemsAmount);
|
|
99
94
|
}, [items, visibleItemsAmount]);
|
|
100
|
-
var showDefaultItemsAmount =
|
|
95
|
+
var showDefaultItemsAmount = useCallback(function () {
|
|
101
96
|
setVisibleItemsAmount(maxToShowItems);
|
|
102
97
|
}, [maxToShowItems]);
|
|
98
|
+
var itemsCount = useMemo(function () {
|
|
99
|
+
return renderCount ? renderCount(items.length) : /*#__PURE__*/React.createElement(React.Fragment, null, allTexts.itemsLabel, ": ", /*#__PURE__*/React.createElement(S.Bold, null, items.length));
|
|
100
|
+
}, [allTexts.itemsLabel, items.length, renderCount]);
|
|
103
101
|
return /*#__PURE__*/React.createElement(S.Wrapper, {
|
|
104
102
|
style: style || {},
|
|
105
103
|
className: className || '',
|
|
@@ -111,7 +109,7 @@ export var ItemsRoll = function ItemsRoll(_ref) {
|
|
|
111
109
|
changeSelectionDropdownProps: changeSelectionDropdownProps,
|
|
112
110
|
customSidebarActions: customSidebarActions,
|
|
113
111
|
hideSearch: hideSearch,
|
|
114
|
-
itemsCount:
|
|
112
|
+
itemsCount: itemsCount,
|
|
115
113
|
onChangeSelection: onChangeSelection,
|
|
116
114
|
onSearch: onSearch,
|
|
117
115
|
onSearchClear: onSearchClear,
|
|
@@ -123,7 +121,7 @@ export var ItemsRoll = function ItemsRoll(_ref) {
|
|
|
123
121
|
groups: groups,
|
|
124
122
|
items: items,
|
|
125
123
|
onItemClick: onItemClick,
|
|
126
|
-
onItemRemove: onItemRemove,
|
|
124
|
+
onItemRemove: !isDisabled ? onItemRemove : undefined,
|
|
127
125
|
noResultsLabel: allTexts.noResultsLabel,
|
|
128
126
|
removeTooltipLabel: allTexts.removeTooltipLabel,
|
|
129
127
|
searchValue: searchValue,
|
|
@@ -136,7 +134,7 @@ export var ItemsRoll = function ItemsRoll(_ref) {
|
|
|
136
134
|
allTexts: allTexts,
|
|
137
135
|
itemsCount: items.length,
|
|
138
136
|
maxToShowItems: maxToShowItems,
|
|
139
|
-
onClearAll: onClearAll,
|
|
137
|
+
onClearAll: !isDisabled ? onClearAll : undefined,
|
|
140
138
|
showAdditionalItems: showAdditionalItems,
|
|
141
139
|
showDefaultItemsAmount: showDefaultItemsAmount,
|
|
142
140
|
showMoreStep: showMoreStep,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ReactNode, CSSProperties, SVGProps } from 'react';
|
|
2
|
-
import { IntlShape } from 'react-intl';
|
|
3
|
-
import { MenuItemProps } from '@synerise/ds-menu
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import type { ReactNode, CSSProperties, SVGProps } from 'react';
|
|
2
|
+
import type { IntlShape } from 'react-intl';
|
|
3
|
+
import type { MenuItemProps } from '@synerise/ds-menu';
|
|
4
|
+
import type { ListItemProps } from '@synerise/ds-list-item';
|
|
5
|
+
import type { DropdownProps } from '@synerise/ds-dropdown/dist/Dropdown';
|
|
6
|
+
export type ItemRollElement<BaseType extends ListItemProps | MenuItemProps = ListItemProps> = BaseType & {
|
|
6
7
|
id: string;
|
|
7
8
|
group?: string;
|
|
8
9
|
};
|
|
@@ -10,12 +11,14 @@ export type Texts = 'changeSelectionLabel' | 'clearAllLabel' | 'itemsLabel' | 'm
|
|
|
10
11
|
export type ItemsRollGroup = string;
|
|
11
12
|
export type ItemsRollProps = {
|
|
12
13
|
intl?: IntlShape;
|
|
14
|
+
isDisabled?: boolean;
|
|
13
15
|
items: ItemRollElement[];
|
|
14
16
|
onSearch?: (value: string) => void;
|
|
17
|
+
renderCount?: (count: number) => ReactNode;
|
|
15
18
|
onSearchClear?: () => void;
|
|
16
19
|
searchValue?: string;
|
|
17
20
|
searchPlaceholder?: string;
|
|
18
|
-
actions?: ItemRollElement[];
|
|
21
|
+
actions?: ItemRollElement<MenuItemProps>[];
|
|
19
22
|
changeSelectionIcon?: (props: SVGProps<SVGSVGElement>) => JSX.Element;
|
|
20
23
|
changeSelectionDropdownProps?: DropdownProps;
|
|
21
24
|
customSidebarActions?: ReactNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FooterProps } from './Footer.types';
|
|
3
|
-
declare const Footer: React.
|
|
3
|
+
declare const Footer: ({ allTexts, itemsCount, maxToShowItems, onClearAll, showAdditionalItems, showDefaultItemsAmount, showMoreStep, visibleItemsCount, searchMode, }: FooterProps) => React.JSX.Element | null;
|
|
4
4
|
export default Footer;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import Popconfirm from '@synerise/ds-popconfirm';
|
|
3
3
|
import Icon, { ArrowDownCircleM, ArrowUpCircleM, CloseS, WarningFillM } from '@synerise/ds-icon';
|
|
4
4
|
import * as S from '../ItemsRoll.styles';
|
|
5
|
-
|
|
6
5
|
var ShowLessButton = function ShowLessButton(_ref) {
|
|
7
6
|
var showDefaultItemsAmount = _ref.showDefaultItemsAmount,
|
|
8
|
-
|
|
7
|
+
showLessLabel = _ref.showLessLabel;
|
|
9
8
|
return /*#__PURE__*/React.createElement(S.ShowButton, {
|
|
10
9
|
type: "ghost",
|
|
11
10
|
mode: "icon-label",
|
|
@@ -17,12 +16,11 @@ var ShowLessButton = function ShowLessButton(_ref) {
|
|
|
17
16
|
className: "bold-label"
|
|
18
17
|
}, showLessLabel));
|
|
19
18
|
};
|
|
20
|
-
|
|
21
19
|
var ShowMoreButton = function ShowMoreButton(_ref2) {
|
|
22
20
|
var showLabel = _ref2.showLabel,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
moreLabel = _ref2.moreLabel,
|
|
22
|
+
showAdditionalItems = _ref2.showAdditionalItems,
|
|
23
|
+
getShowMoreNumber = _ref2.getShowMoreNumber;
|
|
26
24
|
return /*#__PURE__*/React.createElement(S.ShowButton, {
|
|
27
25
|
type: "ghost",
|
|
28
26
|
mode: "icon-label",
|
|
@@ -34,26 +32,25 @@ var ShowMoreButton = function ShowMoreButton(_ref2) {
|
|
|
34
32
|
className: "bold-label"
|
|
35
33
|
}, getShowMoreNumber), " ", moreLabel));
|
|
36
34
|
};
|
|
37
|
-
|
|
38
35
|
var Footer = function Footer(_ref3) {
|
|
39
36
|
var allTexts = _ref3.allTexts,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var getShowMoreNumber =
|
|
37
|
+
itemsCount = _ref3.itemsCount,
|
|
38
|
+
_ref3$maxToShowItems = _ref3.maxToShowItems,
|
|
39
|
+
maxToShowItems = _ref3$maxToShowItems === void 0 ? 10 : _ref3$maxToShowItems,
|
|
40
|
+
onClearAll = _ref3.onClearAll,
|
|
41
|
+
showAdditionalItems = _ref3.showAdditionalItems,
|
|
42
|
+
showDefaultItemsAmount = _ref3.showDefaultItemsAmount,
|
|
43
|
+
_ref3$showMoreStep = _ref3.showMoreStep,
|
|
44
|
+
showMoreStep = _ref3$showMoreStep === void 0 ? 10 : _ref3$showMoreStep,
|
|
45
|
+
visibleItemsCount = _ref3.visibleItemsCount,
|
|
46
|
+
searchMode = _ref3.searchMode;
|
|
47
|
+
var getShowMoreNumber = useMemo(function () {
|
|
51
48
|
return visibleItemsCount + showMoreStep < itemsCount ? showMoreStep : itemsCount - visibleItemsCount;
|
|
52
49
|
}, [itemsCount, showMoreStep, visibleItemsCount]);
|
|
53
|
-
var showDivider =
|
|
50
|
+
var showDivider = useMemo(function () {
|
|
54
51
|
return !searchMode || searchMode && itemsCount > maxToShowItems;
|
|
55
52
|
}, [searchMode, maxToShowItems, itemsCount]);
|
|
56
|
-
var buttonsConfiguration =
|
|
53
|
+
var buttonsConfiguration = useMemo(function () {
|
|
57
54
|
if (visibleItemsCount === itemsCount) return /*#__PURE__*/React.createElement(ShowLessButton, {
|
|
58
55
|
showLessLabel: allTexts.showLessLabel,
|
|
59
56
|
showDefaultItemsAmount: showDefaultItemsAmount
|
|
@@ -96,5 +93,4 @@ var Footer = function Footer(_ref3) {
|
|
|
96
93
|
size: 22
|
|
97
94
|
}), allTexts.clearAllLabel)))) : null;
|
|
98
95
|
};
|
|
99
|
-
|
|
100
96
|
export default Footer;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { Texts, ItemsRollProps } from '../ItemsRoll.types';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Texts, ItemsRollProps } from '../ItemsRoll.types';
|
|
3
3
|
export type FooterProps = Pick<ItemsRollProps, 'onClearAll' | 'maxToShowItems' | 'showMoreStep'> & {
|
|
4
4
|
allTexts: {
|
|
5
|
-
[k in Texts]:
|
|
5
|
+
[k in Texts]: ReactNode;
|
|
6
6
|
};
|
|
7
7
|
itemsCount: number;
|
|
8
8
|
showAdditionalItems: () => void;
|
|
@@ -12,11 +12,11 @@ export type FooterProps = Pick<ItemsRollProps, 'onClearAll' | 'maxToShowItems' |
|
|
|
12
12
|
};
|
|
13
13
|
export type ShowLessButtonProps = {
|
|
14
14
|
showDefaultItemsAmount: () => void;
|
|
15
|
-
showLessLabel:
|
|
15
|
+
showLessLabel: ReactNode;
|
|
16
16
|
};
|
|
17
17
|
export type ShowMoreButtonProps = {
|
|
18
18
|
getShowMoreNumber: number;
|
|
19
|
-
moreLabel:
|
|
19
|
+
moreLabel: ReactNode;
|
|
20
20
|
showAdditionalItems: () => void;
|
|
21
|
-
showLabel:
|
|
21
|
+
showLabel: ReactNode;
|
|
22
22
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { HeaderProps } from './Header.types';
|
|
3
|
-
declare const Header: React.
|
|
3
|
+
declare const Header: ({ actions, allTexts, changeSelectionIcon: ChangeSelectionIcon, changeSelectionDropdownProps, customSidebarActions, hideSearch, itemsCount, onChangeSelection, onSearch, searchValue, onSearchClear, searchPlaceholder, }: HeaderProps) => React.JSX.Element;
|
|
4
4
|
export default Header;
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { SearchInput } from '@synerise/ds-search/dist/Elements';
|
|
3
3
|
import Icon, { EditM } from '@synerise/ds-icon';
|
|
4
4
|
import Dropdown from '@synerise/ds-dropdown';
|
|
5
5
|
import { NOOP } from '@synerise/ds-utils';
|
|
6
6
|
import Extras from '../Extras';
|
|
7
7
|
import * as S from '../ItemsRoll.styles';
|
|
8
|
-
|
|
9
8
|
var Header = function Header(_ref) {
|
|
10
9
|
var actions = _ref.actions,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var ChangeSelectionButton =
|
|
10
|
+
allTexts = _ref.allTexts,
|
|
11
|
+
_ref$changeSelectionI = _ref.changeSelectionIcon,
|
|
12
|
+
ChangeSelectionIcon = _ref$changeSelectionI === void 0 ? EditM : _ref$changeSelectionI,
|
|
13
|
+
changeSelectionDropdownProps = _ref.changeSelectionDropdownProps,
|
|
14
|
+
customSidebarActions = _ref.customSidebarActions,
|
|
15
|
+
hideSearch = _ref.hideSearch,
|
|
16
|
+
itemsCount = _ref.itemsCount,
|
|
17
|
+
onChangeSelection = _ref.onChangeSelection,
|
|
18
|
+
onSearch = _ref.onSearch,
|
|
19
|
+
searchValue = _ref.searchValue,
|
|
20
|
+
onSearchClear = _ref.onSearchClear,
|
|
21
|
+
searchPlaceholder = _ref.searchPlaceholder;
|
|
22
|
+
var ChangeSelectionButton = useMemo(function () {
|
|
24
23
|
return /*#__PURE__*/React.createElement(S.ChangeSelection, {
|
|
25
24
|
type: "ghost",
|
|
26
25
|
mode: "icon-label",
|
|
@@ -30,7 +29,7 @@ var Header = function Header(_ref) {
|
|
|
30
29
|
size: 24
|
|
31
30
|
}), allTexts.changeSelectionLabel);
|
|
32
31
|
}, [ChangeSelectionIcon, onChangeSelection, allTexts.changeSelectionLabel]);
|
|
33
|
-
return /*#__PURE__*/React.createElement(S.ContainerSpaceBetween, null, /*#__PURE__*/React.createElement(S.HeaderLeft, null,
|
|
32
|
+
return /*#__PURE__*/React.createElement(S.ContainerSpaceBetween, null, /*#__PURE__*/React.createElement(S.HeaderLeft, null, itemsCount), /*#__PURE__*/React.createElement(S.HeaderRight, null, onChangeSelection && (changeSelectionDropdownProps ? /*#__PURE__*/React.createElement(Dropdown, changeSelectionDropdownProps, ChangeSelectionButton) : ChangeSelectionButton), !hideSearch && /*#__PURE__*/React.createElement(S.SearchWrapper, null, /*#__PURE__*/React.createElement(SearchInput, {
|
|
34
33
|
clearTooltip: allTexts.searchClearTooltipLabel,
|
|
35
34
|
onClear: onSearchClear || NOOP,
|
|
36
35
|
onChange: onSearch || NOOP,
|
|
@@ -41,5 +40,4 @@ var Header = function Header(_ref) {
|
|
|
41
40
|
actions: actions
|
|
42
41
|
})));
|
|
43
42
|
};
|
|
44
|
-
|
|
45
43
|
export default Header;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ItemsRollProps, Texts } from '../ItemsRoll.types';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ItemsRollProps, Texts } from '../ItemsRoll.types';
|
|
3
3
|
export type HeaderProps = Pick<ItemsRollProps, 'actions' | 'changeSelectionIcon' | 'changeSelectionDropdownProps' | 'onChangeSelection' | 'onSearch' | 'onSearchClear' | 'searchValue' | 'searchPlaceholder' | 'hideSearch' | 'customSidebarActions'> & {
|
|
4
4
|
allTexts: {
|
|
5
|
-
[k in Texts]:
|
|
5
|
+
[k in Texts]: ReactNode;
|
|
6
6
|
};
|
|
7
|
-
itemsCount:
|
|
7
|
+
itemsCount: ReactNode;
|
|
8
8
|
};
|
|
@@ -3,18 +3,19 @@ import Icon, { CloseS } from '@synerise/ds-icon';
|
|
|
3
3
|
import Tooltip from '@synerise/ds-tooltip';
|
|
4
4
|
import { theme } from '@synerise/ds-core';
|
|
5
5
|
import { RemoveIconWrapper } from './ItemRemoveIcon.styles';
|
|
6
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
7
6
|
export var RemoveIcon = function RemoveIcon(_ref) {
|
|
8
7
|
var id = _ref.id,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
handleRemove = _ref.handleRemove,
|
|
9
|
+
tooltipLabel = _ref.tooltipLabel,
|
|
10
|
+
group = _ref.group;
|
|
12
11
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
13
12
|
title: tooltipLabel
|
|
14
|
-
}, /*#__PURE__*/React.createElement(RemoveIconWrapper,
|
|
13
|
+
}, /*#__PURE__*/React.createElement(RemoveIconWrapper, {
|
|
14
|
+
"data-testid": "items-roll-remove-icon"
|
|
15
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
15
16
|
className: "element-remove-icon",
|
|
16
|
-
onClick: function onClick(
|
|
17
|
-
|
|
17
|
+
onClick: function onClick(event) {
|
|
18
|
+
event.stopPropagation();
|
|
18
19
|
handleRemove(id, group);
|
|
19
20
|
},
|
|
20
21
|
component: /*#__PURE__*/React.createElement(CloseS, null),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
1
|
+
import styled from 'styled-components';
|
|
3
2
|
export var RemoveIconWrapper = styled.div.withConfig({
|
|
4
3
|
displayName: "ItemRemoveIconstyles__RemoveIconWrapper",
|
|
5
4
|
componentId: "sc-1uw1dzt-0"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ItemsRollGroup } from '../ItemsRoll.types';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ItemsRollGroup } from '../ItemsRoll.types';
|
|
3
3
|
export type RemoveIconProps = {
|
|
4
4
|
id: string;
|
|
5
5
|
group?: ItemsRollGroup;
|
|
6
6
|
handleRemove: (id: string, group?: ItemsRollGroup) => void;
|
|
7
|
-
tooltipLabel:
|
|
7
|
+
tooltipLabel: ReactNode;
|
|
8
8
|
};
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ItemRollElement } from '../ItemsRoll.types';
|
|
3
3
|
import { ListProps } from './List.types';
|
|
4
4
|
export declare const itemsInGroup: (group: string, items: ItemRollElement[]) => ItemRollElement[];
|
|
5
|
-
declare const List: React.
|
|
5
|
+
declare const List: ({ groups, items, onItemClick, onItemRemove, noResultsLabel, removeTooltipLabel, searchValue, useVirtualizedList, visibleItems, virtualizedRowHeight, virtualizedRowWidth, }: ListProps) => React.JSX.Element;
|
|
6
6
|
export default List;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { FixedSizeList } from 'react-window';
|
|
3
3
|
import Icon, { SearchNoResultsM } from '@synerise/ds-icon';
|
|
4
|
-
import
|
|
4
|
+
import { GroupItem } from '@synerise/ds-list-item';
|
|
5
5
|
import ItemElement from './ListItem';
|
|
6
6
|
import ItemRenderer from './VirtualizedListItem';
|
|
7
7
|
import * as S from '../ItemsRoll.styles';
|
|
@@ -10,24 +10,58 @@ export var itemsInGroup = function itemsInGroup(group, items) {
|
|
|
10
10
|
return item.group === group;
|
|
11
11
|
});
|
|
12
12
|
};
|
|
13
|
-
|
|
14
13
|
var List = function List(_ref) {
|
|
15
14
|
var groups = _ref.groups,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
items = _ref.items,
|
|
16
|
+
onItemClick = _ref.onItemClick,
|
|
17
|
+
onItemRemove = _ref.onItemRemove,
|
|
18
|
+
noResultsLabel = _ref.noResultsLabel,
|
|
19
|
+
removeTooltipLabel = _ref.removeTooltipLabel,
|
|
20
|
+
searchValue = _ref.searchValue,
|
|
21
|
+
useVirtualizedList = _ref.useVirtualizedList,
|
|
22
|
+
visibleItems = _ref.visibleItems,
|
|
23
|
+
_ref$virtualizedRowHe = _ref.virtualizedRowHeight,
|
|
24
|
+
virtualizedRowHeight = _ref$virtualizedRowHe === void 0 ? 32 : _ref$virtualizedRowHe,
|
|
25
|
+
virtualizedRowWidth = _ref.virtualizedRowWidth;
|
|
26
|
+
var groupedList = useMemo(function () {
|
|
27
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, groups == null ? void 0 : groups.map(function (group) {
|
|
28
|
+
var groupItems = itemsInGroup(group, visibleItems);
|
|
29
|
+
return groupItems.length > 0 ?
|
|
30
|
+
/*#__PURE__*/
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
React.createElement(GroupItem, {
|
|
33
|
+
key: group,
|
|
34
|
+
title: group
|
|
35
|
+
}, groupItems.map(function (item) {
|
|
36
|
+
return /*#__PURE__*/React.createElement(ItemElement, {
|
|
37
|
+
group: group,
|
|
38
|
+
key: item.id,
|
|
39
|
+
highlight: searchValue,
|
|
40
|
+
onItemClick: onItemClick,
|
|
41
|
+
onItemRemove: onItemRemove,
|
|
42
|
+
item: item,
|
|
43
|
+
removeTooltipLabel: removeTooltipLabel
|
|
44
|
+
});
|
|
45
|
+
})) : null;
|
|
46
|
+
}));
|
|
47
|
+
}, [groups, onItemClick, onItemRemove, removeTooltipLabel, searchValue, visibleItems]);
|
|
48
|
+
var standardList = useMemo(function () {
|
|
49
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, visibleItems.map(function (item) {
|
|
50
|
+
return /*#__PURE__*/React.createElement(ItemElement, {
|
|
51
|
+
key: item.id,
|
|
52
|
+
highlight: searchValue,
|
|
53
|
+
item: item,
|
|
54
|
+
onItemClick: onItemClick,
|
|
55
|
+
onItemRemove: onItemRemove,
|
|
56
|
+
removeTooltipLabel: removeTooltipLabel
|
|
57
|
+
});
|
|
58
|
+
}));
|
|
59
|
+
}, [onItemClick, onItemRemove, removeTooltipLabel, searchValue, visibleItems]);
|
|
60
|
+
var finalItems = groups ? groupedList : standardList;
|
|
27
61
|
return visibleItems.length === 0 ? /*#__PURE__*/React.createElement(S.NoResults, null, /*#__PURE__*/React.createElement(S.NoResultIconWrapper, null, /*#__PURE__*/React.createElement(Icon, {
|
|
28
62
|
component: /*#__PURE__*/React.createElement(SearchNoResultsM, null),
|
|
29
63
|
size: 25
|
|
30
|
-
})), noResultsLabel) : /*#__PURE__*/React.createElement(S.ListWrapper, null, useVirtualizedList && !groups ? /*#__PURE__*/React.createElement(
|
|
64
|
+
})), noResultsLabel) : /*#__PURE__*/React.createElement(S.ListWrapper, null, useVirtualizedList && !groups ? /*#__PURE__*/React.createElement("div", {
|
|
31
65
|
"data-testid": "items-roll-virtualized-list"
|
|
32
66
|
}, /*#__PURE__*/React.createElement(FixedSizeList, {
|
|
33
67
|
height: visibleItems.length * virtualizedRowHeight,
|
|
@@ -40,35 +74,6 @@ var List = function List(_ref) {
|
|
|
40
74
|
onItemClick: onItemClick,
|
|
41
75
|
onItemRemove: onItemRemove,
|
|
42
76
|
tooltipLabel: removeTooltipLabel
|
|
43
|
-
}))) :
|
|
44
|
-
var groupItems = itemsInGroup(group, visibleItems);
|
|
45
|
-
return groupItems.length > 0 ?
|
|
46
|
-
/*#__PURE__*/
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
React.createElement(Menu.ItemGroup, {
|
|
49
|
-
key: group,
|
|
50
|
-
title: group
|
|
51
|
-
}, groupItems.map(function (item) {
|
|
52
|
-
return /*#__PURE__*/React.createElement(ItemElement, {
|
|
53
|
-
group: group,
|
|
54
|
-
key: item.id,
|
|
55
|
-
highlight: searchValue,
|
|
56
|
-
onItemClick: onItemClick,
|
|
57
|
-
onItemRemove: onItemRemove,
|
|
58
|
-
item: item,
|
|
59
|
-
removeTooltipLabel: removeTooltipLabel
|
|
60
|
-
});
|
|
61
|
-
})) : null;
|
|
62
|
-
}) : visibleItems.map(function (item) {
|
|
63
|
-
return /*#__PURE__*/React.createElement(ItemElement, {
|
|
64
|
-
key: item.id,
|
|
65
|
-
highlight: searchValue,
|
|
66
|
-
item: item,
|
|
67
|
-
onItemClick: onItemClick,
|
|
68
|
-
onItemRemove: onItemRemove,
|
|
69
|
-
removeTooltipLabel: removeTooltipLabel
|
|
70
|
-
});
|
|
71
|
-
})));
|
|
77
|
+
}))) : finalItems);
|
|
72
78
|
};
|
|
73
|
-
|
|
74
79
|
export default List;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ItemRollElement, ItemsRollProps } from '../ItemsRoll.types';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ItemRollElement, ItemsRollProps } from '../ItemsRoll.types';
|
|
3
3
|
export type ListProps = Pick<ItemsRollProps, 'groups' | 'items' | 'onItemClick' | 'onItemRemove' | 'searchValue' | 'useVirtualizedList' | 'virtualizedRowHeight' | 'virtualizedRowWidth'> & {
|
|
4
|
-
noResultsLabel:
|
|
5
|
-
removeTooltipLabel:
|
|
4
|
+
noResultsLabel: ReactNode;
|
|
5
|
+
removeTooltipLabel: ReactNode;
|
|
6
6
|
visibleItems: ItemRollElement[];
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ItemElementProps } from './ListItem.types';
|
|
3
|
-
declare const ItemElement: React.
|
|
3
|
+
declare const ItemElement: ({ item, group, highlight, onItemClick, onItemRemove, removeTooltipLabel }: ItemElementProps) => React.JSX.Element;
|
|
4
4
|
export default ItemElement;
|
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { NOOP } from '@synerise/ds-utils';
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
5
3
|
import { RemoveIcon } from './ItemRemoveIcon';
|
|
6
4
|
import * as S from './ListItem.styles';
|
|
7
|
-
|
|
8
5
|
var ItemElement = function ItemElement(_ref) {
|
|
9
6
|
var item = _ref.item,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var onClick =
|
|
7
|
+
group = _ref.group,
|
|
8
|
+
highlight = _ref.highlight,
|
|
9
|
+
onItemClick = _ref.onItemClick,
|
|
10
|
+
onItemRemove = _ref.onItemRemove,
|
|
11
|
+
removeTooltipLabel = _ref.removeTooltipLabel;
|
|
12
|
+
var onClick = useCallback(function () {
|
|
16
13
|
return onItemClick && onItemClick(item.id, group);
|
|
17
14
|
}, [onItemClick, item.id, group]);
|
|
18
|
-
|
|
19
15
|
var renderSuffixElement = function renderSuffixElement(hovered) {
|
|
20
16
|
return item.suffixel instanceof Function ? item.suffixel(hovered) : item.suffixel;
|
|
21
17
|
};
|
|
22
|
-
|
|
23
18
|
return /*#__PURE__*/React.createElement(S.ListItem, _extends({}, item, {
|
|
24
19
|
className: "items-roll-list-item",
|
|
25
20
|
highlight: highlight,
|
|
26
|
-
onItemHover: NOOP,
|
|
27
21
|
suffixel: function suffixel(hovered) {
|
|
28
22
|
return /*#__PURE__*/React.createElement(S.SuffixelWrapper, null, renderSuffixElement(hovered) || null, onItemRemove && /*#__PURE__*/React.createElement(RemoveIcon, {
|
|
29
23
|
id: item.id,
|
|
@@ -35,5 +29,4 @@ var ItemElement = function ItemElement(_ref) {
|
|
|
35
29
|
onClick: onClick
|
|
36
30
|
}), item.text);
|
|
37
31
|
};
|
|
38
|
-
|
|
39
32
|
export default ItemElement;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const ListItem: import("styled-components").StyledComponent<
|
|
2
|
+
export declare const ListItem: import("styled-components").StyledComponent<(props: import("@synerise/ds-list-item").ListItemProps) => import("react").JSX.Element, any, {}, never>;
|
|
3
3
|
export declare const SuffixelWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import
|
|
2
|
+
import DSListItem from '@synerise/ds-list-item';
|
|
3
3
|
import { RemoveIconWrapper } from './ItemRemoveIcon.styles';
|
|
4
|
-
export var ListItem = styled(
|
|
4
|
+
export var ListItem = styled(DSListItem).withConfig({
|
|
5
5
|
displayName: "ListItemstyles__ListItem",
|
|
6
6
|
componentId: "x6qavm-0"
|
|
7
7
|
})(["&{", "{opacity:0;display:none;}}&:hover{", "{opacity:1;display:flex;}}"], RemoveIconWrapper, RemoveIconWrapper);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ItemRollElement, ItemsRollGroup } from '../ItemsRoll.types';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ItemRollElement, ItemsRollGroup } from '../ItemsRoll.types';
|
|
3
3
|
export type ItemElementProps = {
|
|
4
4
|
highlight?: string;
|
|
5
5
|
item: ItemRollElement;
|
|
6
6
|
group?: ItemsRollGroup;
|
|
7
7
|
onItemClick?: (id: string, group?: ItemsRollGroup) => void;
|
|
8
8
|
onItemRemove?: (id: string, group?: ItemsRollGroup) => void;
|
|
9
|
-
removeTooltipLabel:
|
|
9
|
+
removeTooltipLabel: ReactNode;
|
|
10
10
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { ListChildComponentProps } from 'react-window';
|
|
3
3
|
import { ItemRendererProps } from './VirtualizedListItem.types';
|
|
4
|
-
declare const ItemRenderer: ({ highlight, onItemClick, onItemRemove, tooltipLabel, group }: ItemRendererProps) => ({ index, style, data }: ListChildComponentProps) => JSX.Element;
|
|
4
|
+
declare const ItemRenderer: ({ highlight, onItemClick, onItemRemove, tooltipLabel, group }: ItemRendererProps) => ({ index, style, data }: ListChildComponentProps) => React.JSX.Element;
|
|
5
5
|
export default ItemRenderer;
|
|
@@ -1,47 +1,39 @@
|
|
|
1
1
|
var _excluded = ["suffixel"];
|
|
2
|
-
|
|
3
2
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import Menu from '@synerise/ds-menu';
|
|
7
|
-
import { NOOP } from '@synerise/ds-utils';
|
|
3
|
+
import React, { useCallback } from 'react';
|
|
8
4
|
import * as S from './ListItem.styles';
|
|
9
5
|
import { RemoveIcon } from './ItemRemoveIcon';
|
|
10
|
-
|
|
11
6
|
var ItemRenderer = function ItemRenderer(_ref) {
|
|
12
7
|
var highlight = _ref.highlight,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
onItemClick = _ref.onItemClick,
|
|
9
|
+
onItemRemove = _ref.onItemRemove,
|
|
10
|
+
tooltipLabel = _ref.tooltipLabel,
|
|
11
|
+
group = _ref.group;
|
|
17
12
|
return function (_ref2) {
|
|
18
13
|
var index = _ref2.index,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
style = _ref2.style,
|
|
15
|
+
data = _ref2.data;
|
|
22
16
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
23
17
|
var _ref3 = data[index],
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
suffixel = _ref3.suffixel,
|
|
19
|
+
item = _objectWithoutPropertiesLoose(_ref3, _excluded);
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
var onClick =
|
|
21
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
22
|
+
var onClick = useCallback(function () {
|
|
29
23
|
return onItemClick && onItemClick(item.id, group);
|
|
30
24
|
}, [item.id]);
|
|
31
|
-
return /*#__PURE__*/React.createElement(S.ListItem,
|
|
25
|
+
return /*#__PURE__*/React.createElement(S.ListItem, {
|
|
32
26
|
className: "items-roll-list-item",
|
|
33
27
|
highlight: highlight,
|
|
34
|
-
onItemHover: NOOP,
|
|
35
28
|
onClick: onClick,
|
|
36
29
|
style: style,
|
|
37
|
-
suffixel: /*#__PURE__*/React.createElement(S.SuffixelWrapper, null, suffixel, !!onItemRemove && /*#__PURE__*/React.createElement(RemoveIcon, {
|
|
30
|
+
suffixel: /*#__PURE__*/React.createElement(S.SuffixelWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, suffixel, !!onItemRemove && /*#__PURE__*/React.createElement(RemoveIcon, {
|
|
38
31
|
id: item.id,
|
|
39
32
|
handleRemove: onItemRemove,
|
|
40
33
|
tooltipLabel: tooltipLabel,
|
|
41
34
|
group: group
|
|
42
|
-
}))
|
|
43
|
-
}, item.text)
|
|
35
|
+
})))
|
|
36
|
+
}, item.text);
|
|
44
37
|
};
|
|
45
38
|
};
|
|
46
|
-
|
|
47
39
|
export default ItemRenderer;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ItemsRollGroup } from '../ItemsRoll.types';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ItemsRollGroup } from '../ItemsRoll.types';
|
|
3
3
|
export type ItemRendererProps = {
|
|
4
4
|
highlight?: string;
|
|
5
5
|
group?: ItemsRollGroup;
|
|
6
6
|
onItemClick?: (id: string, group?: ItemsRollGroup) => void;
|
|
7
7
|
onItemRemove?: (id: string, group?: ItemsRollGroup) => void;
|
|
8
|
-
tooltipLabel:
|
|
8
|
+
tooltipLabel: ReactNode;
|
|
9
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-items-roll",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "ItemsRoll UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,14 +34,15 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-button": "^0.21.
|
|
38
|
-
"@synerise/ds-divider": "^0.7.
|
|
39
|
-
"@synerise/ds-dropdown": "^0.18.
|
|
40
|
-
"@synerise/ds-icon": "^0.67.
|
|
41
|
-
"@synerise/ds-
|
|
42
|
-
"@synerise/ds-
|
|
43
|
-
"@synerise/ds-
|
|
44
|
-
"@synerise/ds-
|
|
37
|
+
"@synerise/ds-button": "^0.21.20",
|
|
38
|
+
"@synerise/ds-divider": "^0.7.16",
|
|
39
|
+
"@synerise/ds-dropdown": "^0.18.25",
|
|
40
|
+
"@synerise/ds-icon": "^0.67.1",
|
|
41
|
+
"@synerise/ds-list-item": "^0.5.0",
|
|
42
|
+
"@synerise/ds-menu": "^0.20.7",
|
|
43
|
+
"@synerise/ds-popconfirm": "^0.10.62",
|
|
44
|
+
"@synerise/ds-search": "^0.9.20",
|
|
45
|
+
"@synerise/ds-tooltip": "^0.14.50",
|
|
45
46
|
"@synerise/ds-utils": "^0.31.2",
|
|
46
47
|
"react-window": "^1.8.5"
|
|
47
48
|
},
|
|
@@ -50,5 +51,5 @@
|
|
|
50
51
|
"react": ">=16.9.0 <= 17.0.2",
|
|
51
52
|
"styled-components": "5.0.1"
|
|
52
53
|
},
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "4a56ee7ef816c22341ce704154dc7aa65b7d1dcc"
|
|
54
55
|
}
|