@synerise/ds-items-roll 1.5.11 → 1.5.12
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 +4 -0
- package/dist/Extras/Extras.d.ts +3 -3
- package/dist/Extras/Extras.js +13 -21
- package/dist/Extras/index.js +4 -1
- package/dist/ItemsRoll.d.ts +2 -2
- package/dist/ItemsRoll.js +71 -101
- package/dist/ItemsRoll.styles.d.ts +14 -14
- package/dist/ItemsRoll.styles.js +78 -77
- package/dist/ItemsRoll.types.d.ts +5 -5
- package/dist/ItemsRoll.types.js +1 -1
- package/dist/ItemsRollComponents/Footer.d.ts +2 -2
- package/dist/ItemsRollComponents/Footer.js +60 -92
- package/dist/ItemsRollComponents/Footer.types.d.ts +2 -2
- package/dist/ItemsRollComponents/Footer.types.js +1 -1
- package/dist/ItemsRollComponents/Header.d.ts +2 -2
- package/dist/ItemsRollComponents/Header.js +41 -47
- package/dist/ItemsRollComponents/Header.types.d.ts +4 -4
- package/dist/ItemsRollComponents/Header.types.js +1 -1
- package/dist/ItemsRollComponents/ItemRemoveIcon.d.ts +2 -2
- package/dist/ItemsRollComponents/ItemRemoveIcon.js +17 -25
- package/dist/ItemsRollComponents/ItemRemoveIcon.styles.d.ts +1 -1
- package/dist/ItemsRollComponents/ItemRemoveIcon.styles.js +6 -3
- package/dist/ItemsRollComponents/ItemRemoveIcon.types.d.ts +2 -2
- package/dist/ItemsRollComponents/ItemRemoveIcon.types.js +1 -1
- package/dist/ItemsRollComponents/List.d.ts +3 -3
- package/dist/ItemsRollComponents/List.js +32 -53
- package/dist/ItemsRollComponents/List.types.d.ts +2 -2
- package/dist/ItemsRollComponents/List.types.js +1 -1
- package/dist/ItemsRollComponents/ListItem.d.ts +2 -2
- package/dist/ItemsRollComponents/ListItem.js +21 -31
- package/dist/ItemsRollComponents/ListItem.styles.d.ts +2 -2
- package/dist/ItemsRollComponents/ListItem.styles.js +10 -6
- package/dist/ItemsRollComponents/ListItem.types.d.ts +2 -2
- package/dist/ItemsRollComponents/ListItem.types.js +1 -1
- package/dist/ItemsRollComponents/index.js +8 -3
- package/dist/index.js +4 -1
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/package.json +16 -15
|
@@ -1,100 +1,68 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
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 () {
|
|
48
|
-
return visibleItemsCount + showMoreStep < itemsCount ? showMoreStep : itemsCount - visibleItemsCount;
|
|
49
|
-
}, [itemsCount, showMoreStep, visibleItemsCount]);
|
|
50
|
-
var showDivider = useMemo(function () {
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import Icon, { CloseS, WarningFillM, ArrowUpCircleM, ArrowDownCircleM } from "@synerise/ds-icon";
|
|
4
|
+
import Popconfirm from "@synerise/ds-popconfirm";
|
|
5
|
+
import { ShowButtonsWrapper, Divider, ContainerSpaceBetween, ClearButton, WarningIcon, ShowButton, ArrowIcon, ShowButtonLabel } from "../ItemsRoll.styles.js";
|
|
6
|
+
const ShowLessButton = ({
|
|
7
|
+
showDefaultItemsAmount,
|
|
8
|
+
showLessLabel
|
|
9
|
+
}) => /* @__PURE__ */ jsxs(ShowButton, { type: "ghost", mode: "icon-label", onClick: showDefaultItemsAmount, children: [
|
|
10
|
+
/* @__PURE__ */ jsx(ArrowIcon, { component: /* @__PURE__ */ jsx(ArrowUpCircleM, {}), size: 20 }),
|
|
11
|
+
/* @__PURE__ */ jsx("span", { className: "bold-label", children: showLessLabel })
|
|
12
|
+
] });
|
|
13
|
+
const ShowMoreButton = ({
|
|
14
|
+
showLabel,
|
|
15
|
+
moreLabel,
|
|
16
|
+
showAdditionalItems,
|
|
17
|
+
getShowMoreNumber
|
|
18
|
+
}) => /* @__PURE__ */ jsxs(ShowButton, { type: "ghost", mode: "icon-label", onClick: showAdditionalItems, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(ArrowIcon, { component: /* @__PURE__ */ jsx(ArrowDownCircleM, {}), size: 20 }),
|
|
20
|
+
/* @__PURE__ */ jsxs(ShowButtonLabel, { children: [
|
|
21
|
+
showLabel,
|
|
22
|
+
` `,
|
|
23
|
+
/* @__PURE__ */ jsx("span", { className: "bold-label", children: getShowMoreNumber }),
|
|
24
|
+
` `,
|
|
25
|
+
moreLabel
|
|
26
|
+
] })
|
|
27
|
+
] });
|
|
28
|
+
const Footer = ({
|
|
29
|
+
allTexts,
|
|
30
|
+
itemsCount,
|
|
31
|
+
maxToShowItems = 10,
|
|
32
|
+
onClearAll,
|
|
33
|
+
showAdditionalItems,
|
|
34
|
+
showDefaultItemsAmount,
|
|
35
|
+
showMoreStep = 10,
|
|
36
|
+
visibleItemsCount,
|
|
37
|
+
searchMode
|
|
38
|
+
}) => {
|
|
39
|
+
const getShowMoreNumber = useMemo(() => visibleItemsCount + showMoreStep < itemsCount ? showMoreStep : itemsCount - visibleItemsCount, [itemsCount, showMoreStep, visibleItemsCount]);
|
|
40
|
+
const showDivider = useMemo(() => {
|
|
51
41
|
return !searchMode || searchMode && itemsCount > maxToShowItems;
|
|
52
42
|
}, [searchMode, maxToShowItems, itemsCount]);
|
|
53
|
-
|
|
43
|
+
const buttonsConfiguration = useMemo(() => {
|
|
54
44
|
if (visibleItemsCount === itemsCount) {
|
|
55
|
-
return
|
|
56
|
-
showLessLabel: allTexts.showLessLabel,
|
|
57
|
-
showDefaultItemsAmount: showDefaultItemsAmount
|
|
58
|
-
});
|
|
45
|
+
return /* @__PURE__ */ jsx(ShowLessButton, { showLessLabel: allTexts.showLessLabel, showDefaultItemsAmount });
|
|
59
46
|
}
|
|
60
47
|
if (visibleItemsCount === maxToShowItems) {
|
|
61
|
-
return
|
|
62
|
-
getShowMoreNumber: getShowMoreNumber,
|
|
63
|
-
moreLabel: allTexts.moreLabel,
|
|
64
|
-
showLabel: allTexts.showLabel,
|
|
65
|
-
showAdditionalItems: showAdditionalItems
|
|
66
|
-
});
|
|
48
|
+
return /* @__PURE__ */ jsx(ShowMoreButton, { getShowMoreNumber, moreLabel: allTexts.moreLabel, showLabel: allTexts.showLabel, showAdditionalItems });
|
|
67
49
|
}
|
|
68
|
-
return
|
|
69
|
-
getShowMoreNumber:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
showAdditionalItems: showAdditionalItems
|
|
73
|
-
}), /*#__PURE__*/React.createElement(ShowLessButton, {
|
|
74
|
-
showLessLabel: allTexts.showLessLabel,
|
|
75
|
-
showDefaultItemsAmount: showDefaultItemsAmount
|
|
76
|
-
}));
|
|
50
|
+
return /* @__PURE__ */ jsxs(ShowButtonsWrapper, { children: [
|
|
51
|
+
/* @__PURE__ */ jsx(ShowMoreButton, { getShowMoreNumber, moreLabel: allTexts.moreLabel, showLabel: allTexts.showLabel, showAdditionalItems }),
|
|
52
|
+
/* @__PURE__ */ jsx(ShowLessButton, { showLessLabel: allTexts.showLessLabel, showDefaultItemsAmount })
|
|
53
|
+
] });
|
|
77
54
|
}, [itemsCount, maxToShowItems, visibleItemsCount, getShowMoreNumber, showDefaultItemsAmount, showAdditionalItems, allTexts]);
|
|
78
|
-
return visibleItemsCount !== 0 ?
|
|
79
|
-
dashed: true,
|
|
80
|
-
footer:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}, /*#__PURE__*/React.createElement(S.ClearButton, {
|
|
92
|
-
type: "custom-color-ghost",
|
|
93
|
-
color: "red",
|
|
94
|
-
mode: "icon-label"
|
|
95
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
96
|
-
component: /*#__PURE__*/React.createElement(CloseS, null),
|
|
97
|
-
size: 22
|
|
98
|
-
}), allTexts.clearAllLabel)))) : null;
|
|
55
|
+
return visibleItemsCount !== 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
|
+
showDivider && /* @__PURE__ */ jsx(Divider, { dashed: true, footer: true }),
|
|
57
|
+
/* @__PURE__ */ jsxs(ContainerSpaceBetween, { "data-testid": "items-roll-footer", children: [
|
|
58
|
+
itemsCount > maxToShowItems && buttonsConfiguration,
|
|
59
|
+
onClearAll && !searchMode && /* @__PURE__ */ jsx(Popconfirm, { onConfirm: onClearAll, icon: /* @__PURE__ */ jsx(WarningIcon, { component: /* @__PURE__ */ jsx(WarningFillM, {}) }), cancelText: allTexts.popconfirmNoLabel, okText: allTexts.popconfirmYesLabel, title: allTexts.popconfirmTitleLabel, children: /* @__PURE__ */ jsxs(ClearButton, { type: "custom-color-ghost", color: "red", mode: "icon-label", children: [
|
|
60
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CloseS, {}), size: 22 }),
|
|
61
|
+
allTexts.clearAllLabel
|
|
62
|
+
] }) })
|
|
63
|
+
] })
|
|
64
|
+
] }) : null;
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
Footer as default
|
|
99
68
|
};
|
|
100
|
-
export default Footer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ItemsRollProps, Texts } from '../ItemsRoll.types';
|
|
3
3
|
export type FooterProps = Pick<ItemsRollProps, 'onClearAll' | 'maxToShowItems' | 'showMoreStep'> & {
|
|
4
4
|
allTexts: {
|
|
5
5
|
[k in Texts]: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { HeaderProps } from './Header.types';
|
|
3
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,48 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import Dropdown from
|
|
4
|
-
import Icon, { EditM } from
|
|
5
|
-
import { SearchInput } from
|
|
6
|
-
import { NOOP } from
|
|
7
|
-
import Extras from
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
42
|
-
value: searchValue || '',
|
|
43
|
-
closeOnClickOutside: true
|
|
44
|
-
})), customSidebarActions, actions && /*#__PURE__*/React.createElement(Extras, {
|
|
45
|
-
actions: actions
|
|
46
|
-
})));
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import Dropdown from "@synerise/ds-dropdown";
|
|
4
|
+
import Icon, { EditM } from "@synerise/ds-icon";
|
|
5
|
+
import { SearchInput } from "@synerise/ds-search/dist/Elements";
|
|
6
|
+
import { NOOP } from "@synerise/ds-utils";
|
|
7
|
+
import Extras from "../Extras/Extras.js";
|
|
8
|
+
import { ChangeSelection, ContainerSpaceBetween, HeaderLeft, HeaderRight, SearchWrapper } from "../ItemsRoll.styles.js";
|
|
9
|
+
const Header = ({
|
|
10
|
+
actions,
|
|
11
|
+
allTexts,
|
|
12
|
+
changeSelectionIcon: ChangeSelectionIcon = EditM,
|
|
13
|
+
changeSelectionDropdownProps,
|
|
14
|
+
customSidebarActions,
|
|
15
|
+
hideSearch,
|
|
16
|
+
itemsCount,
|
|
17
|
+
onChangeSelection,
|
|
18
|
+
onSearch,
|
|
19
|
+
searchValue,
|
|
20
|
+
onSearchClear,
|
|
21
|
+
searchPlaceholder
|
|
22
|
+
}) => {
|
|
23
|
+
const ChangeSelectionButton = useMemo(() => /* @__PURE__ */ jsxs(ChangeSelection, { type: "ghost", mode: "icon-label", onClick: onChangeSelection, children: [
|
|
24
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(ChangeSelectionIcon, {}), size: 24 }),
|
|
25
|
+
allTexts.changeSelectionLabel
|
|
26
|
+
] }), [ChangeSelectionIcon, onChangeSelection, allTexts.changeSelectionLabel]);
|
|
27
|
+
return /* @__PURE__ */ jsxs(ContainerSpaceBetween, { children: [
|
|
28
|
+
/* @__PURE__ */ jsx(HeaderLeft, { children: itemsCount }),
|
|
29
|
+
/* @__PURE__ */ jsxs(HeaderRight, { children: [
|
|
30
|
+
onChangeSelection && (changeSelectionDropdownProps ? /* @__PURE__ */ jsx(Dropdown, { ...changeSelectionDropdownProps, popoverProps: {
|
|
31
|
+
testId: "items-roll-change-selection",
|
|
32
|
+
...changeSelectionDropdownProps?.popoverProps
|
|
33
|
+
}, children: ChangeSelectionButton }) : ChangeSelectionButton),
|
|
34
|
+
!hideSearch && /* @__PURE__ */ jsx(SearchWrapper, { children: /* @__PURE__ */ jsx(SearchInput, { clearTooltip: allTexts.searchClearTooltipLabel, onClear: onSearchClear || NOOP, onChange: onSearch || NOOP, placeholder: searchPlaceholder, value: searchValue || "", closeOnClickOutside: true }) }),
|
|
35
|
+
customSidebarActions,
|
|
36
|
+
actions && /* @__PURE__ */ jsx(Extras, { actions })
|
|
37
|
+
] })
|
|
38
|
+
] });
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
Header as default
|
|
47
42
|
};
|
|
48
|
-
export default Header;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ListItemProps } from '@synerise/ds-list-item';
|
|
3
|
+
import { MenuItemProps } from '@synerise/ds-menu';
|
|
4
|
+
import { ItemsRollProps, Texts } from '../ItemsRoll.types';
|
|
5
5
|
export type HeaderProps<ActionItemType extends ListItemProps | MenuItemProps = ListItemProps> = Pick<ItemsRollProps<ActionItemType>, 'actions' | 'changeSelectionIcon' | 'changeSelectionDropdownProps' | 'onChangeSelection' | 'onSearch' | 'onSearchClear' | 'searchValue' | 'searchPlaceholder' | 'hideSearch' | 'customSidebarActions'> & {
|
|
6
6
|
allTexts: {
|
|
7
7
|
[k in Texts]: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { RemoveIconProps } from './ItemRemoveIcon.types';
|
|
3
3
|
export declare const RemoveIcon: ({ id, handleRemove, tooltipLabel, group, }: RemoveIconProps) => React.JSX.Element;
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { theme } from
|
|
3
|
-
import Icon, { CloseS } from
|
|
4
|
-
import Tooltip from
|
|
5
|
-
import { RemoveIconWrapper } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
event.stopPropagation();
|
|
19
|
-
handleRemove(id, group);
|
|
20
|
-
},
|
|
21
|
-
component: /*#__PURE__*/React.createElement(CloseS, null),
|
|
22
|
-
color: theme.palette['red-600'],
|
|
23
|
-
size: 24
|
|
24
|
-
})));
|
|
25
|
-
};
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { theme } from "@synerise/ds-core";
|
|
3
|
+
import Icon, { CloseS } from "@synerise/ds-icon";
|
|
4
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
5
|
+
import { RemoveIconWrapper } from "./ItemRemoveIcon.styles.js";
|
|
6
|
+
const RemoveIcon = ({
|
|
7
|
+
id,
|
|
8
|
+
handleRemove,
|
|
9
|
+
tooltipLabel,
|
|
10
|
+
group
|
|
11
|
+
}) => /* @__PURE__ */ jsx(Tooltip, { title: tooltipLabel, children: /* @__PURE__ */ jsx(RemoveIconWrapper, { "data-testid": "items-roll-remove-icon", children: /* @__PURE__ */ jsx(Icon, { className: "element-remove-icon", onClick: (event) => {
|
|
12
|
+
event.stopPropagation();
|
|
13
|
+
handleRemove(id, group);
|
|
14
|
+
}, component: /* @__PURE__ */ jsx(CloseS, {}), color: theme.palette["red-600"], size: 24 }) }) });
|
|
15
|
+
export {
|
|
16
|
+
RemoveIcon
|
|
17
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const RemoveIconWrapper: import(
|
|
1
|
+
export declare const RemoveIconWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
const RemoveIconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
3
3
|
displayName: "ItemRemoveIconstyles__RemoveIconWrapper",
|
|
4
4
|
componentId: "sc-1uw1dzt-0"
|
|
5
|
-
})(["opacity:0;transition:opacity 0.1s ease-in;"]);
|
|
5
|
+
})(["opacity:0;transition:opacity 0.1s ease-in;"]);
|
|
6
|
+
export {
|
|
7
|
+
RemoveIconWrapper
|
|
8
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ItemRollElement } from '../ItemsRoll.types';
|
|
3
|
+
import { ListProps } from './List.types';
|
|
4
4
|
export declare const itemsInGroup: (group: string, items: ItemRollElement[]) => ItemRollElement[];
|
|
5
5
|
declare const List: ({ groups, onItemClick, onItemRemove, noResultsLabel, removeTooltipLabel, searchValue, visibleItems, }: ListProps) => React.JSX.Element;
|
|
6
6
|
export default List;
|
|
@@ -1,56 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return groupItems.length > 0 ? /*#__PURE__*/React.createElement(GroupItem, {
|
|
23
|
-
key: group,
|
|
24
|
-
title: group
|
|
25
|
-
}, groupItems.map(function (item) {
|
|
26
|
-
return /*#__PURE__*/React.createElement(ItemElement, {
|
|
27
|
-
group: group,
|
|
28
|
-
key: item.id,
|
|
29
|
-
highlight: searchValue,
|
|
30
|
-
onItemClick: onItemClick,
|
|
31
|
-
onItemRemove: onItemRemove,
|
|
32
|
-
item: item,
|
|
33
|
-
removeTooltipLabel: removeTooltipLabel
|
|
34
|
-
});
|
|
35
|
-
})) : null;
|
|
36
|
-
}));
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import Icon, { InformationNoSearchResultL } from "@synerise/ds-icon";
|
|
4
|
+
import { GroupItem, ListContextProvider } from "@synerise/ds-list-item";
|
|
5
|
+
import { NoResults, NoResultIconWrapper, ListWrapper } from "../ItemsRoll.styles.js";
|
|
6
|
+
import ItemElement from "./ListItem.js";
|
|
7
|
+
const itemsInGroup = (group, items) => items.filter((item) => item.group === group);
|
|
8
|
+
const List = ({
|
|
9
|
+
groups,
|
|
10
|
+
onItemClick,
|
|
11
|
+
onItemRemove,
|
|
12
|
+
noResultsLabel,
|
|
13
|
+
removeTooltipLabel,
|
|
14
|
+
searchValue,
|
|
15
|
+
visibleItems
|
|
16
|
+
}) => {
|
|
17
|
+
const groupedList = useMemo(() => {
|
|
18
|
+
return /* @__PURE__ */ jsx(Fragment, { children: groups?.map((group) => {
|
|
19
|
+
const groupItems = itemsInGroup(group, visibleItems);
|
|
20
|
+
return groupItems.length > 0 ? /* @__PURE__ */ jsx(GroupItem, { title: group, children: groupItems.map((item) => /* @__PURE__ */ jsx(ItemElement, { group, highlight: searchValue, onItemClick, onItemRemove, item, removeTooltipLabel }, item.id)) }, group) : null;
|
|
21
|
+
}) });
|
|
37
22
|
}, [groups, onItemClick, onItemRemove, removeTooltipLabel, searchValue, visibleItems]);
|
|
38
|
-
|
|
39
|
-
return
|
|
40
|
-
return /*#__PURE__*/React.createElement(ItemElement, {
|
|
41
|
-
key: item.id,
|
|
42
|
-
highlight: searchValue,
|
|
43
|
-
item: item,
|
|
44
|
-
onItemClick: onItemClick,
|
|
45
|
-
onItemRemove: onItemRemove,
|
|
46
|
-
removeTooltipLabel: removeTooltipLabel
|
|
47
|
-
});
|
|
48
|
-
}));
|
|
23
|
+
const standardList = useMemo(() => {
|
|
24
|
+
return /* @__PURE__ */ jsx(Fragment, { children: visibleItems.map((item) => /* @__PURE__ */ jsx(ItemElement, { highlight: searchValue, item, onItemClick, onItemRemove, removeTooltipLabel }, item.id)) });
|
|
49
25
|
}, [onItemClick, onItemRemove, removeTooltipLabel, searchValue, visibleItems]);
|
|
50
|
-
|
|
51
|
-
return visibleItems.length === 0 ?
|
|
52
|
-
component:
|
|
53
|
-
|
|
54
|
-
})
|
|
26
|
+
const finalItems = groups ? groupedList : standardList;
|
|
27
|
+
return visibleItems.length === 0 ? /* @__PURE__ */ jsxs(NoResults, { children: [
|
|
28
|
+
/* @__PURE__ */ jsx(NoResultIconWrapper, { children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(InformationNoSearchResultL, {}), size: 48 }) }),
|
|
29
|
+
noResultsLabel
|
|
30
|
+
] }) : /* @__PURE__ */ jsx(ListContextProvider, { children: /* @__PURE__ */ jsx(ListWrapper, { children: finalItems }) });
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
List as default,
|
|
34
|
+
itemsInGroup
|
|
55
35
|
};
|
|
56
|
-
export default List;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ItemRollElement, ItemsRollProps } from '../ItemsRoll.types';
|
|
3
3
|
export type ListProps = Pick<ItemsRollProps, 'groups' | 'items' | 'onItemClick' | 'onItemRemove' | 'searchValue' | 'useVirtualizedList' | 'virtualizedRowHeight' | 'virtualizedRowWidth'> & {
|
|
4
4
|
noResultsLabel: ReactNode;
|
|
5
5
|
removeTooltipLabel: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ItemElementProps } from './ListItem.types';
|
|
3
3
|
declare const ItemElement: ({ item, group, highlight, onItemClick, onItemRemove, removeTooltipLabel, }: ItemElementProps) => React.JSX.Element;
|
|
4
4
|
export default ItemElement;
|
|
@@ -1,32 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { RemoveIcon } from
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return /*#__PURE__*/React.createElement(S.SuffixelWrapper, null, renderSuffixElement(hovered) || null, onItemRemove && /*#__PURE__*/React.createElement(RemoveIcon, {
|
|
23
|
-
id: item.id,
|
|
24
|
-
handleRemove: onItemRemove,
|
|
25
|
-
tooltipLabel: removeTooltipLabel,
|
|
26
|
-
group: group
|
|
27
|
-
}));
|
|
28
|
-
},
|
|
29
|
-
onClick: onClick
|
|
30
|
-
}), item.text);
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { RemoveIcon } from "./ItemRemoveIcon.js";
|
|
4
|
+
import { ListItem, SuffixelWrapper } from "./ListItem.styles.js";
|
|
5
|
+
const ItemElement = ({
|
|
6
|
+
item,
|
|
7
|
+
group,
|
|
8
|
+
highlight,
|
|
9
|
+
onItemClick,
|
|
10
|
+
onItemRemove,
|
|
11
|
+
removeTooltipLabel
|
|
12
|
+
}) => {
|
|
13
|
+
const onClick = useCallback(() => onItemClick && onItemClick(item.id, group), [onItemClick, item.id, group]);
|
|
14
|
+
const renderSuffixElement = (hovered) => item.suffixel instanceof Function ? item.suffixel(hovered) : item.suffixel;
|
|
15
|
+
return /* @__PURE__ */ jsx(ListItem, { ...item, className: "items-roll-list-item", highlight, suffixel: (hovered) => /* @__PURE__ */ jsxs(SuffixelWrapper, { children: [
|
|
16
|
+
renderSuffixElement(hovered) || null,
|
|
17
|
+
onItemRemove && /* @__PURE__ */ jsx(RemoveIcon, { id: item.id, handleRemove: onItemRemove, tooltipLabel: removeTooltipLabel, group })
|
|
18
|
+
] }), onClick, children: item.text });
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
ItemElement as default
|
|
31
22
|
};
|
|
32
|
-
export default ItemElement;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StyledListItem } from '@synerise/ds-list-item';
|
|
2
2
|
export declare const ListItem: StyledListItem;
|
|
3
|
-
export declare const SuffixelWrapper: import(
|
|
3
|
+
export declare const SuffixelWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import DSListItem from
|
|
3
|
-
import { RemoveIconWrapper } from
|
|
4
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import DSListItem from "@synerise/ds-list-item";
|
|
3
|
+
import { RemoveIconWrapper } from "./ItemRemoveIcon.styles.js";
|
|
4
|
+
const ListItem = /* @__PURE__ */ styled(DSListItem).withConfig({
|
|
5
5
|
displayName: "ListItemstyles__ListItem",
|
|
6
6
|
componentId: "sc-x6qavm-0"
|
|
7
7
|
})(["&{", "{opacity:0;display:none;}}&:hover{", "{opacity:1;display:flex;}}"], RemoveIconWrapper, RemoveIconWrapper);
|
|
8
|
-
|
|
8
|
+
const SuffixelWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
9
9
|
displayName: "ListItemstyles__SuffixelWrapper",
|
|
10
10
|
componentId: "sc-x6qavm-1"
|
|
11
|
-
})(["display:flex;align-items:center;"]);
|
|
11
|
+
})(["display:flex;align-items:center;"]);
|
|
12
|
+
export {
|
|
13
|
+
ListItem,
|
|
14
|
+
SuffixelWrapper
|
|
15
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ItemRollElement, ItemsRollGroup } from '../ItemsRoll.types';
|
|
3
3
|
export type ItemElementProps = {
|
|
4
4
|
highlight?: string;
|
|
5
5
|
item: ItemRollElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { default as default2 } from "./Footer.js";
|
|
2
|
+
import { default as default3 } from "./Header.js";
|
|
3
|
+
import { default as default4 } from "./List.js";
|
|
4
|
+
export {
|
|
5
|
+
default2 as Footer,
|
|
6
|
+
default3 as Header,
|
|
7
|
+
default4 as List
|
|
8
|
+
};
|