@synerise/ds-form 1.2.20 → 1.2.22

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 (3) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/CLAUDE.md +115 -0
  3. package/package.json +10 -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.2.22](https://github.com/Synerise/synerise-design/compare/@synerise/ds-form@1.2.21...@synerise/ds-form@1.2.22) (2026-07-24)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-form
9
+
10
+ ## [1.2.21](https://github.com/Synerise/synerise-design/compare/@synerise/ds-form@1.2.20...@synerise/ds-form@1.2.21) (2026-07-23)
11
+
12
+ **Note:** Version bump only for package @synerise/ds-form
13
+
6
14
  ## [1.2.20](https://github.com/Synerise/synerise-design/compare/@synerise/ds-form@1.2.19...@synerise/ds-form@1.2.20) (2026-07-16)
7
15
 
8
16
  **Note:** Version bump only for package @synerise/ds-form
package/CLAUDE.md ADDED
@@ -0,0 +1,115 @@
1
+ # Form (`@synerise/ds-form`)
2
+
3
+ > **⚠️ Deprecated.** This entire package is deprecated in favour of `@synerise/ds-editable-items-list`. Do not add features; minimise changes.
4
+
5
+ ## Package structure
6
+
7
+ ```
8
+ src/
9
+ Form.tsx — class component namespace (only purpose: holds Form.FieldSet)
10
+ index.ts — public exports
11
+ Elements/
12
+ FieldSet/
13
+ FieldSet.tsx — @deprecated labelled section with heading + optional divider
14
+ FieldSet.types.ts — FieldSetProps
15
+ FieldSet.styles.ts — TopWrapper, Heading, Description (NOTE: Description = 'div', not styled)
16
+ __specs__/FieldSet.spec.tsx — Vitest tests (heading/description render, divider)
17
+ EditableList/
18
+ EditableList.tsx — editable key-value row list (Autocomplete + Input per row)
19
+ EditableList.types.ts — EditListProps, EditableParam, AddButtonConfigProps
20
+ EditableList.styles.tsx — row/wrapper styled components
21
+ __spec__/EditableList.spec.ts — all tests are it.todo() — no real tests
22
+ ```
23
+
24
+ ## Public exports
25
+
26
+ ### `Form` (default export)
27
+
28
+ Class component with no props. Its sole purpose is to expose `Form.FieldSet` as a static property. Do not render `<Form>` directly.
29
+
30
+ ### `Form.FieldSet` _(deprecated)_
31
+
32
+ `@deprecated — FieldSet component will no longer be supported.`
33
+
34
+ | Prop | Type | Default | Description |
35
+ |------|------|---------|-------------|
36
+ | `heading` | `ReactNode` | — (required) | Heading text rendered in h400 style |
37
+ | `description` | `ReactNode` | — | Subtitle below heading |
38
+ | `children` | `ReactNode` | — | Content below the heading block |
39
+ | `withLine` | `boolean` | `undefined` | Renders a `Divider` with `marginTop={18}` between heading and children |
40
+ | `className` | `string` | — | Applied to the `TopWrapper` div |
41
+
42
+ ### `EditableList` _(deprecated)_
43
+
44
+ A controlled list of editable key-value rows. Each row renders an `Autocomplete` (left) + `Input` (right) by default; every slot is replaceable via render props.
45
+
46
+ | Prop | Type | Default | Description |
47
+ |------|------|---------|-------------|
48
+ | `value` | `EditableParam[]` | — | Controlled rows array |
49
+ | `onChange` | `(params: EditableParam[]) => void` | — | Called after any name/value change |
50
+ | `leftColumnName` | `ReactNode` | — | Label shown above the first column (row 0 only) |
51
+ | `rightColumnName` | `ReactNode` | — | Label shown above the second column (row 0 only) |
52
+ | `autocompleteOptions` | `ReactNode` | — | Option children passed to the `Autocomplete` in each row |
53
+ | `onSearch` | `(query: string) => void` | — | Forwarded to `Autocomplete.onSearch` |
54
+ | `onClickDelete` | `DeleteHandler` | — | Custom delete handler; if absent, the row is removed from local state |
55
+ | `addButtonConfig` | `AddButtonConfigProps` | — | `{ textAddButton?, disableAddButton?, onClickAddRow? }` |
56
+ | `validation` | `{ validateLeftColumn?, validateRightColumn? }` | — | Return a `ReactNode` error message (or falsy) per field value |
57
+ | `firstInputProps` | `AutocompleteProps` | `{ style: { width: 350 } }` | Spread onto the Autocomplete; use to override width/style |
58
+ | `secondInputProps` | `InputProps` | `{ style: { width: 300 } }` | Spread onto the Input; use to override width/style |
59
+ | `renderAddButton` | `(params?) => JSX.Element` | — | Replaces the default "add row" button entirely |
60
+ | `renderLeftColumn` | `(param, index) => JSX.Element` | — | Replaces the Autocomplete for each row |
61
+ | `renderRightColumn` | `(param, index) => JSX.Element` | — | Replaces the Input for each row |
62
+ | `renderAdditionalColumn` | `(rows) => JSX.Element` | — | Appended after the two default columns in each row |
63
+ | `renderActions` | `boolean \| Function` | — | `true` = show a `Cruds` delete button; function = render custom actions |
64
+
65
+ ### `EditableParam`
66
+
67
+ `{ name: string; value: string }` — shape of a single row.
68
+
69
+ ### `EditListProps`
70
+
71
+ Full props type for `EditableList`.
72
+
73
+ ## Usage patterns
74
+
75
+ ```tsx
76
+ import Form, { EditableList } from '@synerise/ds-form';
77
+
78
+ // Form.FieldSet (deprecated)
79
+ <Form.FieldSet heading="Section" description="Details" withLine>
80
+ <MyFormFields />
81
+ </Form.FieldSet>
82
+
83
+ // EditableList (deprecated)
84
+ const [rows, setRows] = useState([{ name: '', value: '' }]);
85
+
86
+ <EditableList
87
+ value={rows}
88
+ onChange={setRows}
89
+ leftColumnName="Key"
90
+ rightColumnName="Value"
91
+ addButtonConfig={{ textAddButton: 'Add row' }}
92
+ renderActions
93
+ />
94
+ ```
95
+
96
+ ## Styling
97
+
98
+ - `FieldSet.styles.ts`: `Heading` uses `macro.heading` + `macro.h400` from `@synerise/ds-typography`. **`Description` is exported as the string `'div'`** (not a styled component) — this is intentional (renders a native `<div>`) but inconsistent with the rest of the pattern.
99
+ - `EditableList.styles.tsx`: plain flex wrappers, no theme tokens except `theme.palette['blue-600']` hardcoded in the add icon colour in `EditableList.tsx`.
100
+
101
+ ## Key dependencies
102
+
103
+ - `@synerise/ds-autocomplete` — left column input (with options)
104
+ - `@synerise/ds-input` — right column input
105
+ - `@synerise/ds-cruds` — delete action button when `renderActions={true}`
106
+ - `@synerise/ds-divider` — optional line in `Form.FieldSet`
107
+ - `@synerise/ds-typography` — `macro.heading` / `macro.h400` for FieldSet heading styles
108
+
109
+ ## Implementation notes
110
+
111
+ - **`Form` class renders nothing** — it exists only to provide the `Form.FieldSet` static property. Never render `<Form>` as a container.
112
+ - **`EditableList` is uncontrolled by default** — it maintains its own internal `params` state synced from `value` via `useEffect`. Changes propagate out via `onChange` but the component does not re-render from `value` alone unless the reference changes.
113
+ - **`renderActions={true}` vs function** — when `true`, uses `Cruds` delete button which calls `onClickDelete` if provided, otherwise removes the row from internal state. When a function, it receives `(param, idx, params, { onClickDelete })` and must return a `JSX.Element`.
114
+ - **No real tests** — `EditableList.__spec__/EditableList.spec.ts` contains only `it.todo()` entries.
115
+ - **Uses Vitest**.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-form",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
4
4
  "description": "Form 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,13 +42,13 @@
41
42
  ],
42
43
  "types": "dist/index.d.ts",
43
44
  "dependencies": {
44
- "@synerise/ds-autocomplete": "^1.2.50",
45
- "@synerise/ds-button": "^1.5.34",
46
- "@synerise/ds-cruds": "^1.1.15",
47
- "@synerise/ds-divider": "^1.3.15",
48
- "@synerise/ds-icon": "^1.18.4",
49
- "@synerise/ds-input": "^1.7.12",
50
- "@synerise/ds-typography": "^1.1.26"
45
+ "@synerise/ds-autocomplete": "^1.2.52",
46
+ "@synerise/ds-button": "^1.5.35",
47
+ "@synerise/ds-cruds": "^1.1.16",
48
+ "@synerise/ds-divider": "^1.3.16",
49
+ "@synerise/ds-icon": "^1.18.5",
50
+ "@synerise/ds-input": "^1.7.14",
51
+ "@synerise/ds-typography": "^1.1.27"
51
52
  },
52
53
  "peerDependencies": {
53
54
  "@synerise/ds-core": "*",
@@ -56,5 +57,5 @@
56
57
  "styled-components": "^5.3.3",
57
58
  "vitest": "4"
58
59
  },
59
- "gitHead": "a81ab6519d49a3dea9c0cfebcdc9104cbb4f4226"
60
+ "gitHead": "018414e0d7ffd102a07f8aa35fa2e2d3d4ed19e2"
60
61
  }