@synerise/ds-editable-items-list 1.1.0 → 1.1.2
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 +8 -0
- package/README.md +5 -5
- package/dist/EditableItemsList.d.ts +2 -2
- package/dist/EditableItemsList.js +42 -46
- package/dist/EditableItemsList.style.d.ts +2 -2
- package/dist/EditableItemsList.style.js +8 -4
- package/dist/EditableItemsList.types.d.ts +2 -2
- package/dist/EditableItemsList.types.js +1 -1
- package/dist/index.js +4 -1
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.1.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-editable-items-list@1.1.1...@synerise/ds-editable-items-list@1.1.2) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-editable-items-list
|
|
9
|
+
|
|
10
|
+
## [1.1.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-editable-items-list@1.1.0...@synerise/ds-editable-items-list@1.1.1) (2026-03-20)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-editable-items-list
|
|
13
|
+
|
|
6
14
|
# [1.1.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-editable-items-list@1.0.44...@synerise/ds-editable-items-list@1.1.0) (2026-03-09)
|
|
7
15
|
|
|
8
16
|
### Features
|
package/README.md
CHANGED
|
@@ -30,13 +30,13 @@ import EditableItemsList from '@synerise/ds-editable-items-list'
|
|
|
30
30
|
|
|
31
31
|
| Property | Description | Type | Default |
|
|
32
32
|
| ---------------- | ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------- | ------- |
|
|
33
|
-
| renderRowElement | Function to render each row. Invoked with item index and item object. | (index: number, item: T) => ReactElement | -
|
|
34
|
-
| items | Array of items to be rendered, each should have a unique id. | T[] |
|
|
33
|
+
| renderRowElement | Function to render each row. Invoked with item index and item object. | (index: number, item: T) => ReactElement \| null | - |
|
|
34
|
+
| items | Array of items to be rendered, each should have a unique id. | T[] | `[]` |
|
|
35
35
|
| addButtonLabel | Text or custom component for the "Add" button. | string \| ReactNode | - |
|
|
36
|
-
| addButtonIcon | Custom icon for the "Add" button. |
|
|
36
|
+
| addButtonIcon | Custom icon for the "Add" button. | ReactNode | - |
|
|
37
37
|
| addButtonProps | Additional props for the "Add" button. It can override default style. | Partial<ButtonProps> | - |
|
|
38
|
-
| onAdd | Callback function called when the "Add" button is clicked. |
|
|
39
|
-
| minRowLength | The minimum number of rows to display.
|
|
38
|
+
| onAdd | Callback function called when the "Add" button is clicked. | MouseEventHandler<HTMLElement> | - |
|
|
39
|
+
| minRowLength | The minimum number of rows to display. Delete button hidden while at or below this count. | number | 1 |
|
|
40
40
|
| maxRowLength | The maximum number of rows allowed. | number | - |
|
|
41
41
|
| deleteTooltip | Tooltip text for the delete button. | string | - |
|
|
42
42
|
| onDelete | Callback function called when a row's delete button is clicked. It receives the ID and index of the row to delete. | (id: string, index: number) => void | - |
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { EditableItemsListProps } from './EditableItemsList.types';
|
|
3
3
|
declare const EditableItemsList: <T extends {
|
|
4
4
|
id: string;
|
|
5
5
|
}>({ renderRowElement, items, addButtonLabel, addButtonIcon, addButtonProps, onAdd, minRowLength, maxRowLength, deleteTooltip, onDelete, }: EditableItemsListProps<T>) => React.JSX.Element;
|
|
@@ -1,50 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type: 'ghost-primary',
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import Button from "@synerise/ds-button";
|
|
3
|
+
import { theme } from "@synerise/ds-core";
|
|
4
|
+
import Cruds from "@synerise/ds-cruds";
|
|
5
|
+
import Icon, { Add3M } from "@synerise/ds-icon";
|
|
6
|
+
import { RowWrapper, CrudWrapper } from "./EditableItemsList.style.js";
|
|
7
|
+
const DEFAULT_ADD_BUTTON_PROPS = {
|
|
8
|
+
type: "ghost-primary",
|
|
10
9
|
style: {
|
|
11
|
-
transition:
|
|
10
|
+
transition: "none"
|
|
12
11
|
}
|
|
13
12
|
};
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
color: theme.palette['blue-600']
|
|
48
|
-
}), addButtonLabel));
|
|
13
|
+
const EditableItemsList = ({
|
|
14
|
+
renderRowElement,
|
|
15
|
+
items = [],
|
|
16
|
+
addButtonLabel,
|
|
17
|
+
addButtonIcon,
|
|
18
|
+
addButtonProps,
|
|
19
|
+
onAdd,
|
|
20
|
+
minRowLength = 1,
|
|
21
|
+
maxRowLength,
|
|
22
|
+
deleteTooltip,
|
|
23
|
+
onDelete
|
|
24
|
+
}) => {
|
|
25
|
+
const mergedAddButtonProps = {
|
|
26
|
+
...DEFAULT_ADD_BUTTON_PROPS,
|
|
27
|
+
...addButtonProps,
|
|
28
|
+
style: {
|
|
29
|
+
...DEFAULT_ADD_BUTTON_PROPS.style,
|
|
30
|
+
...addButtonProps?.style
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
+
items.map((item, index) => /* @__PURE__ */ jsxs(RowWrapper, { "data-testid": `item-${item.id}`, children: [
|
|
35
|
+
renderRowElement(index, item),
|
|
36
|
+
items.length > minRowLength && /* @__PURE__ */ jsx(CrudWrapper, { children: /* @__PURE__ */ jsx(Cruds, { onRemove: onDelete ? () => onDelete(item.id, index) : void 0, removeTooltip: deleteTooltip, "data-testid": `remove-button-${item.id}` }) })
|
|
37
|
+
] }, item.id)),
|
|
38
|
+
/* @__PURE__ */ jsxs(Button, { ...mergedAddButtonProps, onClick: onAdd, disabled: maxRowLength !== void 0 && items.length >= maxRowLength, children: [
|
|
39
|
+
addButtonIcon || /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Add3M, {}), size: 24, color: theme.palette["blue-600"] }),
|
|
40
|
+
addButtonLabel
|
|
41
|
+
] })
|
|
42
|
+
] });
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
EditableItemsList as default
|
|
49
46
|
};
|
|
50
|
-
export default EditableItemsList;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CrudWrapper: import(
|
|
2
|
-
export declare const RowWrapper: import(
|
|
1
|
+
export declare const CrudWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const RowWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
const CrudWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
3
3
|
displayName: "EditableItemsListstyle__CrudWrapper",
|
|
4
4
|
componentId: "sc-a71i6b-0"
|
|
5
5
|
})(["padding-left:4px;visibility:hidden;margin-top:0;"]);
|
|
6
|
-
|
|
6
|
+
const RowWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
7
7
|
displayName: "EditableItemsListstyle__RowWrapper",
|
|
8
8
|
componentId: "sc-a71i6b-1"
|
|
9
|
-
})(["display:flex;justify-content:space-between;align-items:center;padding:0 0 16px 0;&:hover{", "{visibility:visible;}}& > *:not(:last-child){margin-right:12px;}"], CrudWrapper);
|
|
9
|
+
})(["display:flex;justify-content:space-between;align-items:center;padding:0 0 16px 0;&:hover{", "{visibility:visible;}}& > *:not(:last-child){margin-right:12px;}"], CrudWrapper);
|
|
10
|
+
export {
|
|
11
|
+
CrudWrapper,
|
|
12
|
+
RowWrapper
|
|
13
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { MouseEventHandler, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '@synerise/ds-button';
|
|
3
3
|
export type EditableItemsListProps<T extends {
|
|
4
4
|
id: string;
|
|
5
5
|
}> = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
package/dist/index.js
CHANGED
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-editable-items-list",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "EditableItemsList UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "vite build",
|
|
20
20
|
"build:css": "node ../../../scripts/style/less.js",
|
|
21
21
|
"build:js": "babel --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
-
"build:watch": "
|
|
22
|
+
"build:watch": "vite build --watch",
|
|
23
23
|
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
24
|
"pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
|
|
25
25
|
"prepublish": "pnpm run build",
|
|
26
|
-
"test": "vitest",
|
|
27
|
-
"test:watch": "
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest",
|
|
28
28
|
"types": "tsc --noEmit",
|
|
29
29
|
"check:circular-dependencies": "madge --circular --extensions ts,tsx,js,jsx --ts-config tsconfig.json src/ --exclude '/dist/'",
|
|
30
30
|
"upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
],
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@synerise/ds-button": "^1.5.
|
|
39
|
-
"@synerise/ds-cruds": "^1.1.
|
|
40
|
-
"@synerise/ds-icon": "^1.
|
|
38
|
+
"@synerise/ds-button": "^1.5.18",
|
|
39
|
+
"@synerise/ds-cruds": "^1.1.2",
|
|
40
|
+
"@synerise/ds-icon": "^1.15.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"vitest": "4"
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"react": ">=16.9.0 <= 18.3.1",
|
|
48
48
|
"styled-components": "^5.3.3"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
|
|
51
51
|
}
|