@synerise/ds-list-item 1.5.0 → 1.6.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 CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.6.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-list-item@1.5.1...@synerise/ds-list-item@1.6.0) (2026-07-09)
7
+
8
+ ### Features
9
+
10
+ - **list-item:** add maxToShowItems show-more/less toggle to ListWrapper ([2477e7f](https://github.com/Synerise/synerise-design/commit/2477e7f781e4f421a602f1e9e960b10b39240a93))
11
+
12
+ ## [1.5.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-list-item@1.5.0...@synerise/ds-list-item@1.5.1) (2026-06-17)
13
+
14
+ **Note:** Version bump only for package @synerise/ds-list-item
15
+
6
16
  # [1.5.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-list-item@1.4.22...@synerise/ds-list-item@1.5.0) (2026-06-11)
7
17
 
8
18
  ### Features
@@ -1,7 +1,13 @@
1
1
  import { default as React, ReactNode } from 'react';
2
2
  import { WithHTMLAttributes } from '@synerise/ds-utils';
3
3
  import { ListContextProps } from '../ListContext/ListContext';
4
+ export type ListWrapperTexts = {
5
+ showMore: ReactNode;
6
+ showLess: ReactNode;
7
+ };
4
8
  export type ListWrapperProps = WithHTMLAttributes<HTMLDivElement, ListContextProps & {
5
9
  children?: ReactNode;
10
+ maxToShowItems?: number;
11
+ texts?: Partial<ListWrapperTexts>;
6
12
  }>;
7
- export declare const ListWrapper: ({ children, onClick, ...htmlAttributes }: ListWrapperProps) => React.JSX.Element;
13
+ export declare const ListWrapper: ({ children, onClick, maxToShowItems, texts, ...htmlAttributes }: ListWrapperProps) => React.JSX.Element;
@@ -1,12 +1,42 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState, Children } from "react";
3
+ import { useIntl } from "react-intl";
4
+ import Button from "@synerise/ds-button";
5
+ import Icon, { ArrowUpCircleM, ArrowDownCircleM } from "@synerise/ds-icon";
2
6
  import { ListContextProvider } from "../ListContext/ListContextProvider.js";
3
- import { ListWrapperContainer } from "./ListWrapper.styles.js";
7
+ import { ListWrapperContainer, ToggleButtonWrapper } from "./ListWrapper.styles.js";
4
8
  const ListWrapper = ({
5
9
  children,
6
10
  onClick,
11
+ maxToShowItems,
12
+ texts,
7
13
  ...htmlAttributes
8
14
  }) => {
9
- return /* @__PURE__ */ jsx(ListWrapperContainer, { ...htmlAttributes, children: /* @__PURE__ */ jsx(ListContextProvider, { onClick, children }) });
15
+ const intl = useIntl();
16
+ const [allVisible, setAllVisible] = useState(false);
17
+ const resolvedTexts = {
18
+ showMore: intl.formatMessage({
19
+ id: "DS.LIST-ITEM.SHOW-MORE",
20
+ defaultMessage: "Show more"
21
+ }),
22
+ showLess: intl.formatMessage({
23
+ id: "DS.LIST-ITEM.SHOW-LESS",
24
+ defaultMessage: "Show less"
25
+ }),
26
+ ...texts
27
+ };
28
+ const isTogglable = maxToShowItems !== void 0;
29
+ const childrenArray = Children.toArray(children);
30
+ const hasItemsOverLimit = isTogglable && childrenArray.length > maxToShowItems;
31
+ const visibleChildren = !isTogglable ? children : allVisible ? childrenArray : childrenArray.slice(0, maxToShowItems);
32
+ const toggleButton = hasItemsOverLimit && /* @__PURE__ */ jsx(ToggleButtonWrapper, { children: /* @__PURE__ */ jsxs(Button, { onClick: () => setAllVisible((v) => !v), type: "ghost-primary", mode: "icon-label", "aria-expanded": allVisible, children: [
33
+ /* @__PURE__ */ jsx(Icon, { component: allVisible ? /* @__PURE__ */ jsx(ArrowUpCircleM, {}) : /* @__PURE__ */ jsx(ArrowDownCircleM, {}) }),
34
+ allVisible ? resolvedTexts.showLess : resolvedTexts.showMore
35
+ ] }) });
36
+ return /* @__PURE__ */ jsxs(ListWrapperContainer, { ...htmlAttributes, children: [
37
+ /* @__PURE__ */ jsx(ListContextProvider, { onClick, children: visibleChildren }),
38
+ toggleButton
39
+ ] });
10
40
  };
11
41
  export {
12
42
  ListWrapper
@@ -1 +1,2 @@
1
1
  export declare const ListWrapperContainer: import('styled-components').StyledComponent<"div", any, {}, never>;
2
+ export declare const ToggleButtonWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
@@ -3,6 +3,11 @@ const ListWrapperContainer = /* @__PURE__ */ styled.div.withConfig({
3
3
  displayName: "ListWrapperstyles__ListWrapperContainer",
4
4
  componentId: "sc-1f54kju-0"
5
5
  })(["padding:8px;background:", ";border-radius:3px;"], (props) => props.theme.palette.white);
6
+ const ToggleButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
7
+ displayName: "ListWrapperstyles__ToggleButtonWrapper",
8
+ componentId: "sc-1f54kju-1"
9
+ })(["padding:4px 8px;"]);
6
10
  export {
7
- ListWrapperContainer
11
+ ListWrapperContainer,
12
+ ToggleButtonWrapper
8
13
  };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { default } from './ListItem';
2
2
  export { HoverTooltip, GroupItem } from './components';
3
3
  export { HoverableSuffix } from './components/HoverableSuffix/HoverableSuffix';
4
4
  export { type HoverableSuffixProps } from './components/HoverableSuffix/HoverableSuffix.types';
5
- export { ListWrapper, type ListWrapperProps, } from './components/ListWrapper/ListWrapper';
5
+ export { ListWrapper, type ListWrapperProps, type ListWrapperTexts, } from './components/ListWrapper/ListWrapper';
6
6
  export { useListContext } from './components/ListContext/ListContext';
7
7
  export { ListContextProvider } from './components/ListContext/ListContextProvider';
8
8
  export { itemSizes, itemTypes, type ListItemProps, type BasicItemProps, type ItemSize, type ItemType, type ItemData, type StyledListItem, type ListItemEventHandler, } from './ListItem.types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-list-item",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "ListItem UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -42,11 +42,12 @@
42
42
  "types": "dist/index.d.ts",
43
43
  "dependencies": {
44
44
  "@floating-ui/react": "^0.27.16",
45
- "@synerise/ds-divider": "^1.3.14",
46
- "@synerise/ds-icon": "^1.18.3",
45
+ "@synerise/ds-button": "^1.5.33",
46
+ "@synerise/ds-divider": "^1.3.15",
47
+ "@synerise/ds-icon": "^1.18.4",
47
48
  "@synerise/ds-popover": "^1.6.1",
48
- "@synerise/ds-tooltip": "^1.5.2",
49
- "@synerise/ds-utils": "^1.10.0",
49
+ "@synerise/ds-tooltip": "^1.5.3",
50
+ "@synerise/ds-utils": "^1.10.1",
50
51
  "classnames": "^2.5.1"
51
52
  },
52
53
  "peerDependencies": {
@@ -59,5 +60,5 @@
59
60
  "@testing-library/react": "^14.0.0",
60
61
  "vitest": "^4.0.0"
61
62
  },
62
- "gitHead": "fe3379f50afdce6d8c61a2222ebbf03324107c95"
63
+ "gitHead": "70c23de84f26001a3555ac65f44e12eec30aaf8c"
63
64
  }