@synerise/ds-list-item 1.4.12 → 1.4.13
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 +6 -0
- package/README.md +83 -0
- package/dist/components/GroupItem/GroupItem.js +1 -1
- package/dist/components/HoverableSuffix/HoverableSuffix.d.ts +3 -0
- package/dist/components/HoverableSuffix/HoverableSuffix.js +18 -0
- package/dist/components/HoverableSuffix/HoverableSuffix.styles.d.ts +4 -0
- package/dist/components/HoverableSuffix/HoverableSuffix.styles.js +13 -0
- package/dist/components/HoverableSuffix/HoverableSuffix.types.d.ts +6 -0
- package/dist/components/Select/Select.js +1 -2
- package/dist/components/Text/Text.styles.js +1 -1
- package/dist/hooks/useTemporaryLabel.js +4 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +8 -6
- package/dist/ListItem.styles.d.ts +0 -0
- /package/dist/{ListItem.styles.js → components/HoverableSuffix/HoverableSuffix.types.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.4.13](https://github.com/Synerise/synerise-design/compare/@synerise/ds-list-item@1.4.12...@synerise/ds-list-item@1.4.13) (2026-04-14)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **list-item:** new feature second suffix on hover only ([a9cac69](https://github.com/Synerise/synerise-design/commit/a9cac69e748f6e3912c9e4249b4ee324a50cfb90))
|
|
11
|
+
|
|
6
12
|
## [1.4.12](https://github.com/Synerise/synerise-design/compare/@synerise/ds-list-item@1.4.11...@synerise/ds-list-item@1.4.12) (2026-04-10)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @synerise/ds-list-item
|
package/README.md
CHANGED
|
@@ -95,3 +95,86 @@ prop passed to onClick and onItemHover handlers
|
|
|
95
95
|
| key | item key | string |
|
|
96
96
|
| item | clicked / hovered item data | Partial<BasicItemProps> |
|
|
97
97
|
| domEvent | Event triggered | `MouseEvent<HTMLDivElement>` |
|
|
98
|
+
|
|
99
|
+
### HoverableSuffix
|
|
100
|
+
|
|
101
|
+
A wrapper component that swaps suffix content based on hover state. Use it inside `suffixel` with the `AddonRenderer` pattern to show different content at rest vs on hover.
|
|
102
|
+
|
|
103
|
+
| Property | Description | Type | Default |
|
|
104
|
+
| -------------- | ------------------------------------------- | ----------- | --------- |
|
|
105
|
+
| hovered | Whether the parent list item is hovered | `boolean` | - |
|
|
106
|
+
| hoverContent | Content displayed when hovered | `ReactNode` | - |
|
|
107
|
+
| defaultContent | Content displayed at rest (optional) | `ReactNode` | - |
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import ListItem, { HoverableSuffix } from '@synerise/ds-list-item';
|
|
111
|
+
|
|
112
|
+
<ListItem
|
|
113
|
+
suffixel={(hovered) => (
|
|
114
|
+
<HoverableSuffix
|
|
115
|
+
hovered={hovered}
|
|
116
|
+
defaultContent={<Icon component={<WarningFillM />} />}
|
|
117
|
+
hoverContent={<Button>Delete</Button>}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
Item with hoverable suffix
|
|
122
|
+
</ListItem>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### ListWrapper
|
|
126
|
+
|
|
127
|
+
Container that provides shared `ListContext` (including a shared `onClick` handler) to all descendant `ListItem` components.
|
|
128
|
+
|
|
129
|
+
| Property | Description | Type | Default |
|
|
130
|
+
| -------- | ------------------------------------ | -------------------- | ------- |
|
|
131
|
+
| onClick | Shared click handler for all items | `ListItemEventHandler` | - |
|
|
132
|
+
| children | ListItem nodes | `ReactNode` | - |
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
import ListItem, { ListWrapper } from '@synerise/ds-list-item';
|
|
136
|
+
|
|
137
|
+
<ListWrapper onClick={(itemData) => console.log(itemData)}>
|
|
138
|
+
<ListItem itemKey="a">Option A</ListItem>
|
|
139
|
+
<ListItem itemKey="b">Option B</ListItem>
|
|
140
|
+
</ListWrapper>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### GroupItem
|
|
144
|
+
|
|
145
|
+
Groups a title with a list of items.
|
|
146
|
+
|
|
147
|
+
| Property | Description | Type | Default |
|
|
148
|
+
| -------- | ------------------- | ----------------- | ------- |
|
|
149
|
+
| title | Section label | `ReactNode` | - |
|
|
150
|
+
| items | Array of list items | `ListItemProps[]` | - |
|
|
151
|
+
| children | Additional content | `ReactNode` | - |
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import ListItem, { GroupItem } from '@synerise/ds-list-item';
|
|
155
|
+
|
|
156
|
+
<GroupItem title="Section A" items={[
|
|
157
|
+
{ children: 'Item 1', itemKey: '1' },
|
|
158
|
+
{ children: 'Item 2', itemKey: '2' },
|
|
159
|
+
]} />
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### ListContextProvider
|
|
163
|
+
|
|
164
|
+
Low-level provider for `ListContext`. Use when building custom list containers that need shared click handling or custom popover delay.
|
|
165
|
+
|
|
166
|
+
| Property | Description | Type | Default |
|
|
167
|
+
| ------------ | ------------------------------------- | -------------------- | ------------------------------ |
|
|
168
|
+
| onClick | Shared click handler | `ListItemEventHandler` | - |
|
|
169
|
+
| popoverDelay | Hover tooltip open/close delay config | `DelayConfig` | `{ open: 100, close: 400 }` |
|
|
170
|
+
| children | Content | `ReactNode` | - |
|
|
171
|
+
|
|
172
|
+
### useListContext
|
|
173
|
+
|
|
174
|
+
Hook to read `ListContext` values. Returns `undefined` when used outside a provider.
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
import { useListContext } from '@synerise/ds-list-item';
|
|
178
|
+
|
|
179
|
+
const context = useListContext();
|
|
180
|
+
```
|
|
@@ -8,7 +8,7 @@ const GroupItem = ({
|
|
|
8
8
|
}) => {
|
|
9
9
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10
10
|
/* @__PURE__ */ jsx(Title, { children: title }),
|
|
11
|
-
items?.map(ListItem),
|
|
11
|
+
items?.map((item, index) => /* @__PURE__ */ jsx(ListItem, { ...item }, item.itemKey ?? item.key ?? index)),
|
|
12
12
|
children
|
|
13
13
|
] });
|
|
14
14
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Slot, Container } from "./HoverableSuffix.styles.js";
|
|
3
|
+
const HoverableSuffix = ({
|
|
4
|
+
hovered,
|
|
5
|
+
hoverContent,
|
|
6
|
+
defaultContent
|
|
7
|
+
}) => {
|
|
8
|
+
if (!defaultContent) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Slot, { visible: hovered, children: hoverContent });
|
|
10
|
+
}
|
|
11
|
+
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
12
|
+
/* @__PURE__ */ jsx(Slot, { visible: !hovered, children: defaultContent }),
|
|
13
|
+
/* @__PURE__ */ jsx(Slot, { visible: hovered, children: hoverContent })
|
|
14
|
+
] });
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
HoverableSuffix
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
3
|
+
displayName: "HoverableSuffixstyles__Container",
|
|
4
|
+
componentId: "sc-178aunw-0"
|
|
5
|
+
})(["display:grid;"]);
|
|
6
|
+
const Slot = /* @__PURE__ */ styled.div.withConfig({
|
|
7
|
+
displayName: "HoverableSuffixstyles__Slot",
|
|
8
|
+
componentId: "sc-178aunw-1"
|
|
9
|
+
})(["grid-area:1 / 1;display:flex;align-items:center;justify-content:flex-end;transition:opacity 0.15s ease;", ";"], (props) => props.visible ? css(["opacity:1;pointer-events:auto;"]) : css(["opacity:0;pointer-events:none;"]));
|
|
10
|
+
export {
|
|
11
|
+
Container,
|
|
12
|
+
Slot
|
|
13
|
+
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { v4 } from "uuid";
|
|
4
3
|
import { SelectItem } from "./Select.styles.js";
|
|
5
4
|
const Select = forwardRef(({
|
|
6
5
|
children,
|
|
7
6
|
...rest
|
|
8
7
|
}, ref) => {
|
|
9
|
-
return /* @__PURE__ */ jsx(SelectItem, { ref, ...rest, children }
|
|
8
|
+
return /* @__PURE__ */ jsx(SelectItem, { ref, ...rest, children });
|
|
10
9
|
});
|
|
11
10
|
export {
|
|
12
11
|
Select as default
|
|
@@ -8,7 +8,7 @@ const visibleElementStyle = () => css(["opacity:1;pointer-events:all;"]);
|
|
|
8
8
|
const SuffixWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
9
9
|
displayName: "Textstyles__SuffixWrapper",
|
|
10
10
|
componentId: "sc-1j4eogh-0"
|
|
11
|
-
})(["display:flex;order:10;justify-content:flex-end;", ";"], (props) => props.visible ? visibleElementStyle() : hiddenElementStyle());
|
|
11
|
+
})(["display:flex;order:10;justify-content:flex-end;transition:opacity ", ";", ";"], TRANSITION_FN, (props) => props.visible ? visibleElementStyle() : hiddenElementStyle());
|
|
12
12
|
const PrefixWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
13
13
|
displayName: "Textstyles__PrefixWrapper",
|
|
14
14
|
componentId: "sc-1j4eogh-1"
|
|
@@ -2,11 +2,14 @@ import { useState, useEffect } from "react";
|
|
|
2
2
|
const useTemporaryLabel = (duration) => {
|
|
3
3
|
const [temporaryLabel, setTemporaryLabel] = useState(false);
|
|
4
4
|
useEffect(() => {
|
|
5
|
+
if (!temporaryLabel) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
5
8
|
const timer = setTimeout(() => setTemporaryLabel(false), duration);
|
|
6
9
|
return () => {
|
|
7
10
|
clearTimeout(timer);
|
|
8
11
|
};
|
|
9
|
-
});
|
|
12
|
+
}, [temporaryLabel, duration]);
|
|
10
13
|
return {
|
|
11
14
|
temporaryLabel,
|
|
12
15
|
setTemporaryLabel
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { default } from './ListItem';
|
|
2
2
|
export { HoverTooltip, GroupItem } from './components';
|
|
3
|
+
export { HoverableSuffix } from './components/HoverableSuffix/HoverableSuffix';
|
|
4
|
+
export { type HoverableSuffixProps } from './components/HoverableSuffix/HoverableSuffix.types';
|
|
3
5
|
export { ListWrapper, type ListWrapperProps, } from './components/ListWrapper/ListWrapper';
|
|
4
6
|
export { useListContext } from './components/ListContext/ListContext';
|
|
5
7
|
export { ListContextProvider } from './components/ListContext/ListContextProvider';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import "./components/Select/Select.js";
|
|
|
4
4
|
import "./components/Text/Text.js";
|
|
5
5
|
import { default as default3 } from "./components/HoverTooltip/HoverTooltip.js";
|
|
6
6
|
import { GroupItem } from "./components/GroupItem/GroupItem.js";
|
|
7
|
+
import { HoverableSuffix } from "./components/HoverableSuffix/HoverableSuffix.js";
|
|
7
8
|
import { ListWrapper } from "./components/ListWrapper/ListWrapper.js";
|
|
8
9
|
import { useListContext } from "./components/ListContext/ListContext.js";
|
|
9
10
|
import { ListContextProvider } from "./components/ListContext/ListContextProvider.js";
|
|
@@ -12,6 +13,7 @@ import { LIST_ITEM_SIZE_MAPPING } from "./ListItem.const.js";
|
|
|
12
13
|
export {
|
|
13
14
|
GroupItem,
|
|
14
15
|
default3 as HoverTooltip,
|
|
16
|
+
HoverableSuffix,
|
|
15
17
|
LIST_ITEM_SIZE_MAPPING,
|
|
16
18
|
ListContextProvider,
|
|
17
19
|
ListWrapper,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-list-item",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.13",
|
|
4
4
|
"description": "ListItem UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -38,15 +38,17 @@
|
|
|
38
38
|
"@synerise/ds-popover": "^1.5.4",
|
|
39
39
|
"@synerise/ds-tooltip": "^1.4.12",
|
|
40
40
|
"@synerise/ds-utils": "^1.8.0",
|
|
41
|
-
"classnames": "^2.5.1"
|
|
42
|
-
"uuid": "^8.3.2"
|
|
41
|
+
"classnames": "^2.5.1"
|
|
43
42
|
},
|
|
44
43
|
"peerDependencies": {
|
|
45
44
|
"@synerise/ds-core": "*",
|
|
46
45
|
"copy-to-clipboard": "^3.3.1",
|
|
47
46
|
"react": ">=16.9.0 <= 18.3.1",
|
|
48
|
-
"styled-components": "^5.3.3"
|
|
49
|
-
"vitest": "4"
|
|
47
|
+
"styled-components": "^5.3.3"
|
|
50
48
|
},
|
|
51
|
-
"
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@testing-library/react": "^14.0.0",
|
|
51
|
+
"vitest": "^4.0.0"
|
|
52
|
+
},
|
|
53
|
+
"gitHead": "f5437b2141f3dbad7319626fe5812bbb3488191a"
|
|
52
54
|
}
|
|
File without changes
|
|
File without changes
|