@synerise/ds-items-roll 1.5.10 → 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.
Files changed (40) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +11 -6
  3. package/dist/Extras/Extras.d.ts +3 -3
  4. package/dist/Extras/Extras.js +13 -21
  5. package/dist/Extras/index.js +4 -1
  6. package/dist/ItemsRoll.d.ts +2 -2
  7. package/dist/ItemsRoll.js +71 -101
  8. package/dist/ItemsRoll.styles.d.ts +14 -14
  9. package/dist/ItemsRoll.styles.js +78 -77
  10. package/dist/ItemsRoll.types.d.ts +5 -5
  11. package/dist/ItemsRoll.types.js +1 -1
  12. package/dist/ItemsRollComponents/Footer.d.ts +2 -2
  13. package/dist/ItemsRollComponents/Footer.js +60 -92
  14. package/dist/ItemsRollComponents/Footer.types.d.ts +2 -2
  15. package/dist/ItemsRollComponents/Footer.types.js +1 -1
  16. package/dist/ItemsRollComponents/Header.d.ts +2 -2
  17. package/dist/ItemsRollComponents/Header.js +41 -47
  18. package/dist/ItemsRollComponents/Header.types.d.ts +4 -4
  19. package/dist/ItemsRollComponents/Header.types.js +1 -1
  20. package/dist/ItemsRollComponents/ItemRemoveIcon.d.ts +2 -2
  21. package/dist/ItemsRollComponents/ItemRemoveIcon.js +17 -25
  22. package/dist/ItemsRollComponents/ItemRemoveIcon.styles.d.ts +1 -1
  23. package/dist/ItemsRollComponents/ItemRemoveIcon.styles.js +6 -3
  24. package/dist/ItemsRollComponents/ItemRemoveIcon.types.d.ts +2 -2
  25. package/dist/ItemsRollComponents/ItemRemoveIcon.types.js +1 -1
  26. package/dist/ItemsRollComponents/List.d.ts +3 -3
  27. package/dist/ItemsRollComponents/List.js +32 -53
  28. package/dist/ItemsRollComponents/List.types.d.ts +2 -2
  29. package/dist/ItemsRollComponents/List.types.js +1 -1
  30. package/dist/ItemsRollComponents/ListItem.d.ts +2 -2
  31. package/dist/ItemsRollComponents/ListItem.js +21 -31
  32. package/dist/ItemsRollComponents/ListItem.styles.d.ts +2 -2
  33. package/dist/ItemsRollComponents/ListItem.styles.js +10 -6
  34. package/dist/ItemsRollComponents/ListItem.types.d.ts +2 -2
  35. package/dist/ItemsRollComponents/ListItem.types.js +1 -1
  36. package/dist/ItemsRollComponents/index.js +8 -3
  37. package/dist/index.js +4 -1
  38. package/dist/modules.d.js +1 -1
  39. package/dist/modules.d.ts +0 -0
  40. package/package.json +16 -15
@@ -1,100 +1,68 @@
1
- import React, { useMemo } from 'react';
2
- import Icon, { ArrowDownCircleM, ArrowUpCircleM, CloseS, WarningFillM } from '@synerise/ds-icon';
3
- import Popconfirm from '@synerise/ds-popconfirm';
4
- import * as S from '../ItemsRoll.styles';
5
- var ShowLessButton = function ShowLessButton(_ref) {
6
- var showDefaultItemsAmount = _ref.showDefaultItemsAmount,
7
- showLessLabel = _ref.showLessLabel;
8
- return /*#__PURE__*/React.createElement(S.ShowButton, {
9
- type: "ghost",
10
- mode: "icon-label",
11
- onClick: showDefaultItemsAmount
12
- }, /*#__PURE__*/React.createElement(S.ArrowIcon, {
13
- component: /*#__PURE__*/React.createElement(ArrowUpCircleM, null),
14
- size: 20
15
- }), /*#__PURE__*/React.createElement("span", {
16
- className: "bold-label"
17
- }, showLessLabel));
18
- };
19
- var ShowMoreButton = function ShowMoreButton(_ref2) {
20
- var showLabel = _ref2.showLabel,
21
- moreLabel = _ref2.moreLabel,
22
- showAdditionalItems = _ref2.showAdditionalItems,
23
- getShowMoreNumber = _ref2.getShowMoreNumber;
24
- return /*#__PURE__*/React.createElement(S.ShowButton, {
25
- type: "ghost",
26
- mode: "icon-label",
27
- onClick: showAdditionalItems
28
- }, /*#__PURE__*/React.createElement(S.ArrowIcon, {
29
- component: /*#__PURE__*/React.createElement(ArrowDownCircleM, null),
30
- size: 20
31
- }), /*#__PURE__*/React.createElement(S.ShowButtonLabel, null, showLabel, " ", /*#__PURE__*/React.createElement("span", {
32
- className: "bold-label"
33
- }, getShowMoreNumber), " ", moreLabel));
34
- };
35
- var Footer = function Footer(_ref3) {
36
- var allTexts = _ref3.allTexts,
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 () {
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
- var buttonsConfiguration = useMemo(function () {
43
+ const buttonsConfiguration = useMemo(() => {
54
44
  if (visibleItemsCount === itemsCount) {
55
- return /*#__PURE__*/React.createElement(ShowLessButton, {
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 /*#__PURE__*/React.createElement(ShowMoreButton, {
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 /*#__PURE__*/React.createElement(S.ShowButtonsWrapper, null, /*#__PURE__*/React.createElement(ShowMoreButton, {
69
- getShowMoreNumber: getShowMoreNumber,
70
- moreLabel: allTexts.moreLabel,
71
- showLabel: allTexts.showLabel,
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 ? /*#__PURE__*/React.createElement(React.Fragment, null, showDivider && /*#__PURE__*/React.createElement(S.Divider, {
79
- dashed: true,
80
- footer: true
81
- }), /*#__PURE__*/React.createElement(S.ContainerSpaceBetween, {
82
- "data-testid": "items-roll-footer"
83
- }, itemsCount > maxToShowItems && buttonsConfiguration, onClearAll && !searchMode && /*#__PURE__*/React.createElement(Popconfirm, {
84
- onConfirm: onClearAll,
85
- icon: /*#__PURE__*/React.createElement(S.WarningIcon, {
86
- component: /*#__PURE__*/React.createElement(WarningFillM, null)
87
- }),
88
- cancelText: allTexts.popconfirmNoLabel,
89
- okText: allTexts.popconfirmYesLabel,
90
- title: allTexts.popconfirmTitleLabel
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 type { ReactNode } from 'react';
2
- import type { ItemsRollProps, Texts } from '../ItemsRoll.types';
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
- export {};
1
+
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { type HeaderProps } from './Header.types';
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
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { 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';
8
- import * as S from '../ItemsRoll.styles';
9
- var Header = function Header(_ref) {
10
- var actions = _ref.actions,
11
- allTexts = _ref.allTexts,
12
- _ref$changeSelectionI = _ref.changeSelectionIcon,
13
- ChangeSelectionIcon = _ref$changeSelectionI === void 0 ? EditM : _ref$changeSelectionI,
14
- changeSelectionDropdownProps = _ref.changeSelectionDropdownProps,
15
- customSidebarActions = _ref.customSidebarActions,
16
- hideSearch = _ref.hideSearch,
17
- itemsCount = _ref.itemsCount,
18
- onChangeSelection = _ref.onChangeSelection,
19
- onSearch = _ref.onSearch,
20
- searchValue = _ref.searchValue,
21
- onSearchClear = _ref.onSearchClear,
22
- searchPlaceholder = _ref.searchPlaceholder;
23
- var ChangeSelectionButton = useMemo(function () {
24
- return /*#__PURE__*/React.createElement(S.ChangeSelection, {
25
- type: "ghost",
26
- mode: "icon-label",
27
- onClick: onChangeSelection
28
- }, /*#__PURE__*/React.createElement(Icon, {
29
- component: /*#__PURE__*/React.createElement(ChangeSelectionIcon, null),
30
- size: 24
31
- }), allTexts.changeSelectionLabel);
32
- }, [ChangeSelectionIcon, onChangeSelection, allTexts.changeSelectionLabel]);
33
- 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, _extends({}, changeSelectionDropdownProps, {
34
- popoverProps: _extends({
35
- testId: 'items-roll-change-selection'
36
- }, changeSelectionDropdownProps == null ? void 0 : changeSelectionDropdownProps.popoverProps)
37
- }), ChangeSelectionButton) : ChangeSelectionButton), !hideSearch && /*#__PURE__*/React.createElement(S.SearchWrapper, null, /*#__PURE__*/React.createElement(SearchInput, {
38
- clearTooltip: allTexts.searchClearTooltipLabel,
39
- onClear: onSearchClear || NOOP,
40
- onChange: onSearch || NOOP,
41
- placeholder: searchPlaceholder,
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 type { ReactNode } from 'react';
2
- import { type ListItemProps } from '@synerise/ds-list-item';
3
- import { type MenuItemProps } from '@synerise/ds-menu';
4
- import type { ItemsRollProps, Texts } from '../ItemsRoll.types';
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
- export {};
1
+
@@ -1,3 +1,3 @@
1
- import React from 'react';
2
- import { type RemoveIconProps } from './ItemRemoveIcon.types';
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 React from 'react';
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';
6
- export var RemoveIcon = function RemoveIcon(_ref) {
7
- var id = _ref.id,
8
- handleRemove = _ref.handleRemove,
9
- tooltipLabel = _ref.tooltipLabel,
10
- group = _ref.group;
11
- return /*#__PURE__*/React.createElement(Tooltip, {
12
- title: tooltipLabel
13
- }, /*#__PURE__*/React.createElement(RemoveIconWrapper, {
14
- "data-testid": "items-roll-remove-icon"
15
- }, /*#__PURE__*/React.createElement(Icon, {
16
- className: "element-remove-icon",
17
- onClick: function onClick(event) {
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("styled-components").StyledComponent<"div", any, {}, never>;
1
+ export declare const RemoveIconWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
@@ -1,5 +1,8 @@
1
- import styled from 'styled-components';
2
- export var RemoveIconWrapper = styled.div.withConfig({
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,5 +1,5 @@
1
- import type { ReactNode } from 'react';
2
- import type { ItemsRollGroup } from '../ItemsRoll.types';
1
+ import { ReactNode } from 'react';
2
+ import { ItemsRollGroup } from '../ItemsRoll.types';
3
3
  export type RemoveIconProps = {
4
4
  id: string;
5
5
  group?: ItemsRollGroup;
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { type ItemRollElement } from '../ItemsRoll.types';
3
- import { type ListProps } from './List.types';
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 React, { useMemo } from 'react';
2
- import Icon, { InformationNoSearchResultL } from '@synerise/ds-icon';
3
- import { GroupItem, ListContextProvider } from '@synerise/ds-list-item';
4
- import * as S from '../ItemsRoll.styles';
5
- import ItemElement from './ListItem';
6
- export var itemsInGroup = function itemsInGroup(group, items) {
7
- return items.filter(function (item) {
8
- return item.group === group;
9
- });
10
- };
11
- var List = function List(_ref) {
12
- var groups = _ref.groups,
13
- onItemClick = _ref.onItemClick,
14
- onItemRemove = _ref.onItemRemove,
15
- noResultsLabel = _ref.noResultsLabel,
16
- removeTooltipLabel = _ref.removeTooltipLabel,
17
- searchValue = _ref.searchValue,
18
- visibleItems = _ref.visibleItems;
19
- var groupedList = useMemo(function () {
20
- return /*#__PURE__*/React.createElement(React.Fragment, null, groups == null ? void 0 : groups.map(function (group) {
21
- var groupItems = itemsInGroup(group, visibleItems);
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
- var standardList = useMemo(function () {
39
- return /*#__PURE__*/React.createElement(React.Fragment, null, visibleItems.map(function (item) {
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
- var finalItems = groups ? groupedList : standardList;
51
- return visibleItems.length === 0 ? /*#__PURE__*/React.createElement(S.NoResults, null, /*#__PURE__*/React.createElement(S.NoResultIconWrapper, null, /*#__PURE__*/React.createElement(Icon, {
52
- component: /*#__PURE__*/React.createElement(InformationNoSearchResultL, null),
53
- size: 48
54
- })), noResultsLabel) : /*#__PURE__*/React.createElement(ListContextProvider, null, /*#__PURE__*/React.createElement(S.ListWrapper, null, finalItems));
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 type { ReactNode } from 'react';
2
- import type { ItemRollElement, ItemsRollProps } from '../ItemsRoll.types';
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
- export {};
1
+
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import type { ItemElementProps } from './ListItem.types';
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
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useCallback } from 'react';
3
- import { RemoveIcon } from './ItemRemoveIcon';
4
- import * as S from './ListItem.styles';
5
- var ItemElement = function ItemElement(_ref) {
6
- var item = _ref.item,
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 () {
13
- return onItemClick && onItemClick(item.id, group);
14
- }, [onItemClick, item.id, group]);
15
- var renderSuffixElement = function renderSuffixElement(hovered) {
16
- return item.suffixel instanceof Function ? item.suffixel(hovered) : item.suffixel;
17
- };
18
- return /*#__PURE__*/React.createElement(S.ListItem, _extends({}, item, {
19
- className: "items-roll-list-item",
20
- highlight: highlight,
21
- suffixel: function suffixel(hovered) {
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 { type StyledListItem } from '@synerise/ds-list-item';
1
+ import { StyledListItem } from '@synerise/ds-list-item';
2
2
  export declare const ListItem: StyledListItem;
3
- export declare const SuffixelWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const SuffixelWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
@@ -1,11 +1,15 @@
1
- import styled from 'styled-components';
2
- import DSListItem from '@synerise/ds-list-item';
3
- import { RemoveIconWrapper } from './ItemRemoveIcon.styles';
4
- export var ListItem = styled(DSListItem).withConfig({
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
- export var SuffixelWrapper = styled.div.withConfig({
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 type { ReactNode } from 'react';
2
- import type { ItemRollElement, ItemsRollGroup } from '../ItemsRoll.types';
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
- export {};
1
+
@@ -1,3 +1,8 @@
1
- export { default as Footer } from './Footer';
2
- export { default as Header } from './Header';
3
- export { default as List } from './List';
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
+ };