@synerise/ds-editable-items-list 1.1.17 → 1.1.19

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,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.19](https://github.com/Synerise/synerise-design/compare/@synerise/ds-editable-items-list@1.1.18...@synerise/ds-editable-items-list@1.1.19) (2026-07-23)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-editable-items-list
9
+
10
+ ## [1.1.18](https://github.com/Synerise/synerise-design/compare/@synerise/ds-editable-items-list@1.1.17...@synerise/ds-editable-items-list@1.1.18) (2026-07-16)
11
+
12
+ **Note:** Version bump only for package @synerise/ds-editable-items-list
13
+
6
14
  ## [1.1.17](https://github.com/Synerise/synerise-design/compare/@synerise/ds-editable-items-list@1.1.16...@synerise/ds-editable-items-list@1.1.17) (2026-06-17)
7
15
 
8
16
  **Note:** Version bump only for package @synerise/ds-editable-items-list
package/CLAUDE.md ADDED
@@ -0,0 +1,78 @@
1
+ # EditableItemsList (`@synerise/ds-editable-items-list`)
2
+
3
+ > Generic list component where each row is caller-rendered, with a hover-revealed delete icon and an "Add" button at the bottom.
4
+
5
+ ## Package structure
6
+
7
+ ```
8
+ src/
9
+ EditableItemsList.tsx — main generic component
10
+ EditableItemsList.types.ts — EditableItemsListProps<T>
11
+ EditableItemsList.style.ts — RowWrapper + CrudWrapper styled-components
12
+ index.ts — public exports
13
+ __specs__/
14
+ EditableItemsList.spec.tsx — Vitest tests
15
+ ```
16
+
17
+ ## Public exports
18
+
19
+ ### `EditableItemsList` (default export)
20
+
21
+ Generic component: `EditableItemsList<T extends { id: string }>`. Not a `forwardRef`.
22
+
23
+ | Prop | Type | Default | Description |
24
+ |------|------|---------|-------------|
25
+ | `renderRowElement` | `(index: number, data: T) => ReactElement \| null` | — | **Required.** Renders content for each row |
26
+ | `items` | `T[]` | `[]` | Items to display. Each must have a unique `id: string` |
27
+ | `addButtonLabel` | `string \| ReactNode` | — | **Required.** Label for the Add button |
28
+ | `addButtonIcon` | `ReactNode` | `undefined` | Custom icon for the Add button. Defaults to `<Add3M />` in blue |
29
+ | `addButtonProps` | `Partial<ButtonProps>` | `undefined` | Overrides for the Add button. Merged on top of `{ type: 'ghost-primary', style: { transition: 'none' } }` |
30
+ | `onAdd` | `MouseEventHandler<HTMLElement>` | — | **Required.** Called when Add button is clicked |
31
+ | `minRowLength` | `number` | `1` | Delete button is hidden while `items.length <= minRowLength` |
32
+ | `maxRowLength` | `number` | `undefined` | Add button is disabled once `items.length >= maxRowLength` |
33
+ | `deleteTooltip` | `string` | `undefined` | Tooltip on the delete icon |
34
+ | `onDelete` | `(id: string, index: number) => void` | — | **Required.** Called with item `id` and `index` when delete is clicked |
35
+
36
+ ### `EditableItemsListProps` (type export)
37
+
38
+ The props interface above, parameterised as `EditableItemsListProps<T extends { id: string }>`.
39
+
40
+ ## Usage patterns
41
+
42
+ ```tsx
43
+ import EditableItemsList from '@synerise/ds-editable-items-list';
44
+
45
+ type Rule = { id: string; value: string };
46
+
47
+ <EditableItemsList<Rule>
48
+ items={rules}
49
+ renderRowElement={(index, item) => (
50
+ <input value={item.value} onChange={e => updateRule(index, e.target.value)} />
51
+ )}
52
+ addButtonLabel="Add rule"
53
+ onAdd={() => addRule()}
54
+ onDelete={(id, index) => removeRule(index)}
55
+ minRowLength={1}
56
+ maxRowLength={10}
57
+ deleteTooltip="Remove rule"
58
+ />
59
+ ```
60
+
61
+ ## Styling
62
+
63
+ Styles in `EditableItemsList.style.ts`. No design-system tokens — layout only:
64
+ - `RowWrapper`: flex row with `padding-bottom: 16px`; child delete button hidden by default, revealed on `:hover`
65
+ - `CrudWrapper`: `visibility: hidden` by default, `visibility: visible` on parent hover
66
+
67
+ ## Key dependencies
68
+
69
+ - `@synerise/ds-cruds` — provides the delete icon button (`onRemove` + `removeTooltip`). Only the remove action is used; edit/other Cruds operations are not wired.
70
+ - `@synerise/ds-button` — Add button, defaulting to `type="ghost-primary"`
71
+
72
+ ## Implementation notes
73
+
74
+ - **Delete visibility:** The delete (`CrudWrapper`) is rendered in the DOM at all times but hidden via `visibility: hidden`. It only becomes visible on hover — and only when `items.length > minRowLength`. At or below the minimum, the `CrudWrapper` is not rendered at all.
75
+ - **Add button defaults:** A `DEFAULT_ADD_BUTTON_PROPS` constant sets `type: 'ghost-primary'` and `style: { transition: 'none' }`. `addButtonProps.style` is shallow-merged (not replaced), so individual style keys override but others persist.
76
+ - **Generic constraint:** `T` must extend `{ id: string }`. Item identity for `key` and for `onDelete` is taken from `item.id`.
77
+ - **Row key:** Rows are keyed by `item.id` — duplicate IDs will cause React reconciliation issues.
78
+ - **No state:** Fully controlled — `items` array managed by the caller; this component has no internal list state.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-editable-items-list",
3
- "version": "1.1.17",
3
+ "version": "1.1.19",
4
4
  "description": "EditableItemsList UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -17,6 +17,7 @@
17
17
  "files": [
18
18
  "/dist",
19
19
  "CHANGELOG.md",
20
+ "CLAUDE.md",
20
21
  "README.md",
21
22
  "package.json",
22
23
  "LICENSE.md"
@@ -41,9 +42,9 @@
41
42
  ],
42
43
  "types": "dist/index.d.ts",
43
44
  "dependencies": {
44
- "@synerise/ds-button": "^1.5.33",
45
- "@synerise/ds-cruds": "^1.1.15",
46
- "@synerise/ds-icon": "^1.18.4"
45
+ "@synerise/ds-button": "^1.5.35",
46
+ "@synerise/ds-cruds": "^1.1.16",
47
+ "@synerise/ds-icon": "^1.18.5"
47
48
  },
48
49
  "devDependencies": {
49
50
  "vitest": "4"
@@ -53,5 +54,5 @@
53
54
  "react": ">=16.9.0 <= 18.3.1",
54
55
  "styled-components": "^5.3.3"
55
56
  },
56
- "gitHead": "d8c64070f58f14e3fb1bfbcbf00d1e3b8fd51eb8"
57
+ "gitHead": "d0a43cc43d8528a36f105aceea52ab470edb71d9"
57
58
  }