@synerise/ds-step-card 1.2.56 → 1.2.57
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 +4 -0
- package/CLAUDE.md +126 -0
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.57](https://github.com/Synerise/synerise-design/compare/@synerise/ds-step-card@1.2.56...@synerise/ds-step-card@1.2.57) (2026-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-step-card
|
|
9
|
+
|
|
6
10
|
## [1.2.56](https://github.com/Synerise/synerise-design/compare/@synerise/ds-step-card@1.2.55...@synerise/ds-step-card@1.2.56) (2026-07-16)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @synerise/ds-step-card
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# StepCard (`@synerise/ds-step-card`)
|
|
2
|
+
|
|
3
|
+
> A filter/condition step card component with a header (matching toggle, cruds: move up/down/delete/duplicate), a body for condition content, optional additional fields, and a footer. Supports drag-and-drop via props from `@synerise/ds-sortable`.
|
|
4
|
+
|
|
5
|
+
## Package structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/
|
|
9
|
+
StepCard.tsx — main component; forwardRef; REORDER_THROTTLE=1000ms exported
|
|
10
|
+
StepCard.types.ts — StepCardProps, StepCardTexts
|
|
11
|
+
StepCard.styles.ts — all styled-components (Container, Header, Body, Footer, etc.)
|
|
12
|
+
hooks/
|
|
13
|
+
useDefaultTexts.ts — merges user texts with react-intl defaults
|
|
14
|
+
__specs__/
|
|
15
|
+
StepCard.spec.tsx — Vitest tests
|
|
16
|
+
index.ts — public exports
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Public exports
|
|
20
|
+
|
|
21
|
+
### `StepCard` (default export)
|
|
22
|
+
|
|
23
|
+
`forwardRef<HTMLDivElement, StepCardProps>` — ref targets the root container.
|
|
24
|
+
|
|
25
|
+
| Prop | Type | Default | Description |
|
|
26
|
+
|------|------|---------|-------------|
|
|
27
|
+
| `matching` | `boolean` | — | **Required.** Current matching state; shown via `Matching` toggle |
|
|
28
|
+
| `onMove` | `(index: number, offset: number) => void` | — | **Required.** Called after `REORDER_THROTTLE` (1000ms) debounce with current index and cumulative offset |
|
|
29
|
+
| `expressionIndex` | `number` | — | **Required.** Current position in the list |
|
|
30
|
+
| `expressionCount` | `number` | — | **Required.** Total number of steps; used to disable move up/down at boundaries |
|
|
31
|
+
| `name` | `string` | — | Step name (currently not rendered in header — unused display) |
|
|
32
|
+
| `children` | `ReactNode` | — | Condition content rendered in the body |
|
|
33
|
+
| `footer` | `ReactNode` | — | Content rendered in the footer section |
|
|
34
|
+
| `onChangeMatching` | `(matching: boolean) => void` | — | Called when the matching toggle is clicked |
|
|
35
|
+
| `onDelete` | `() => void` | — | Called when delete icon is clicked |
|
|
36
|
+
| `onDuplicate` | `() => void` | — | Called when duplicate icon is clicked |
|
|
37
|
+
| `texts` | `Partial<StepCardTexts>` | — | Override any subset of i18n strings |
|
|
38
|
+
| `isHeaderVisible` | `boolean` | `true` | Whether to render the header section |
|
|
39
|
+
| `isDraggable` | `boolean` | `true` | Shows drag handle icon and enables drag cursor |
|
|
40
|
+
| `readOnly` | `boolean` | `false` | Hides cruds, drag handle, and disables matching toggle |
|
|
41
|
+
| `singleStepCondition` | `boolean` | `false` | Removes bottom padding from body |
|
|
42
|
+
| `headerRightSide` | `ReactNode` | — | Static content in the header right slot |
|
|
43
|
+
| `renderHeaderRightSide` | `(index: number, options?: { placeholder?: boolean }) => ReactNode` | — | Dynamic right-side renderer; also called in drag placeholder with `placeholder: true` |
|
|
44
|
+
| `getMoveByLabel` | `(moveByOffset: number) => string` | — | Custom accessible label for the pending move |
|
|
45
|
+
| `dropLabel` | `ReactNode` | — | Content shown in the drag placeholder (blue dashed area) |
|
|
46
|
+
| `additionalFields` | `JSX.Element` | — | Extra content rendered between body and footer, separated by a border |
|
|
47
|
+
| `expressionMoved` | `boolean` | — | Set `true` to show a success "Moved" alert for 2000ms |
|
|
48
|
+
| `dragHandleProps` | `DragHandlePropType` | — | dnd-kit drag handle attributes/listeners (from `@synerise/ds-sortable`) |
|
|
49
|
+
| `isDragged` | `boolean` | — | When `true`, hides body content and shows the blue dashed placeholder |
|
|
50
|
+
| `isDragOverlay` | `boolean` | — | When `true`, renders a compact preview (76px, no footer, no right side) |
|
|
51
|
+
| `dragIndex` | `number` | — | Index passed to `renderHeaderRightSide` during drag overlay rendering |
|
|
52
|
+
|
|
53
|
+
### `REORDER_THROTTLE`
|
|
54
|
+
|
|
55
|
+
Exported constant (`1000` ms) — the debounce delay before `onMove` fires after keyboard move clicks.
|
|
56
|
+
|
|
57
|
+
### `StepCardTexts`
|
|
58
|
+
|
|
59
|
+
| Key | Default |
|
|
60
|
+
|-----|---------|
|
|
61
|
+
| `matching` | `'Performed'` |
|
|
62
|
+
| `notMatching` | `'Not performed'` |
|
|
63
|
+
| `conditionType` | `'event'` |
|
|
64
|
+
| `notConditionType` | `'event'` |
|
|
65
|
+
| `namePlaceholder` | `'Name'` |
|
|
66
|
+
| `moveTooltip` | `'Move'` |
|
|
67
|
+
| `moveUpTooltip` | `'Move Up'` |
|
|
68
|
+
| `moveDownTooltip` | `'Move Down'` |
|
|
69
|
+
| `deleteTooltip` | `'Delete'` |
|
|
70
|
+
| `duplicateTooltip` | `'Duplicate'` |
|
|
71
|
+
|
|
72
|
+
### `StepCardProps`
|
|
73
|
+
|
|
74
|
+
Full props type, re-exported as a named type.
|
|
75
|
+
|
|
76
|
+
## Usage patterns
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
import StepCard from '@synerise/ds-step-card';
|
|
80
|
+
|
|
81
|
+
<StepCard
|
|
82
|
+
matching={true}
|
|
83
|
+
onChangeMatching={setMatching}
|
|
84
|
+
name="Step 1"
|
|
85
|
+
onMove={(index, offset) => reorder(index, offset)}
|
|
86
|
+
expressionIndex={0}
|
|
87
|
+
expressionCount={3}
|
|
88
|
+
onDuplicate={() => duplicate()}
|
|
89
|
+
onDelete={() => remove()}
|
|
90
|
+
texts={{ matching: 'Matching', notMatching: 'Not matching' }}
|
|
91
|
+
footer={<Button>Add condition</Button>}
|
|
92
|
+
>
|
|
93
|
+
<ConditionContent />
|
|
94
|
+
</StepCard>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Custom hooks
|
|
98
|
+
|
|
99
|
+
### `useDefaultTexts`
|
|
100
|
+
|
|
101
|
+
Merges user-provided `Partial<StepCardTexts>` with `react-intl` defaults via `useMemo`. Returns a complete `StepCardTexts`. Requires an `IntlProvider` ancestor.
|
|
102
|
+
|
|
103
|
+
## Styling
|
|
104
|
+
|
|
105
|
+
Styles in `StepCard.styles.ts`. Key states:
|
|
106
|
+
- `isDragged`: body hidden (`visibility: hidden`), placeholder shown with blue dashed overlay (`border: 1px dashed blue-300; background: blue-050`). Height collapses to 100px.
|
|
107
|
+
- `isDragOverlay`: content height fixed at 76px, body/footer hidden, cursor `grabbing`.
|
|
108
|
+
- Cruds (delete/duplicate) are hidden by default (`opacity: 0; visibility: hidden`) and revealed on header hover.
|
|
109
|
+
|
|
110
|
+
## Key dependencies
|
|
111
|
+
|
|
112
|
+
- `@synerise/ds-logic` — `Matching` toggle component
|
|
113
|
+
- `@synerise/ds-cruds` — move up/down, delete, duplicate icons with tooltips
|
|
114
|
+
- `@synerise/ds-alert` — `InlineAlert` for "Moved" success feedback
|
|
115
|
+
- `@synerise/ds-icon` — `DragHandleM`
|
|
116
|
+
- `@synerise/ds-typography` — `Title` for condition type label
|
|
117
|
+
- `@synerise/ds-sortable` — `DragHandlePropType` (dev dependency only)
|
|
118
|
+
- `react-intl` — i18n defaults in `useDefaultTexts` (peer dependency)
|
|
119
|
+
|
|
120
|
+
## Implementation notes
|
|
121
|
+
|
|
122
|
+
- **`onMove` is debounced at 1000ms**: clicks on move up/down accumulate `moveByOffset`; after 1s the single `onMove(expressionIndex, moveByOffset)` fires. A countdown SVG spinner animates the delay. Mouse-over the header cancels the pending move feedback display (`resetMoveSuccess`).
|
|
123
|
+
- **`name` prop is accepted but not rendered** in the current header — it was presumably planned for a name input but `onChangeName` is absent from the current types.
|
|
124
|
+
- **`react-intl` is a peer dependency** — component throws at runtime without an `IntlProvider` ancestor.
|
|
125
|
+
- **README prop table has multiple errors**: `matching` type shown as `MatchingProps` (should be `boolean`), `readonly` (should be `readOnly`); many props missing entirely.
|
|
126
|
+
- **Uses Vitest** for testing.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-step-card",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.57",
|
|
4
4
|
"description": "StepCard 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,14 +42,14 @@
|
|
|
41
42
|
],
|
|
42
43
|
"types": "dist/index.d.ts",
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@synerise/ds-alert": "^1.1.
|
|
45
|
-
"@synerise/ds-cruds": "^1.1.
|
|
46
|
-
"@synerise/ds-icon": "^1.18.
|
|
47
|
-
"@synerise/ds-logic": "^1.1.
|
|
48
|
-
"@synerise/ds-typography": "^1.1.
|
|
45
|
+
"@synerise/ds-alert": "^1.1.62",
|
|
46
|
+
"@synerise/ds-cruds": "^1.1.16",
|
|
47
|
+
"@synerise/ds-icon": "^1.18.5",
|
|
48
|
+
"@synerise/ds-logic": "^1.1.46",
|
|
49
|
+
"@synerise/ds-typography": "^1.1.27"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@synerise/ds-sortable": "^1.3.
|
|
52
|
+
"@synerise/ds-sortable": "^1.3.21"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
54
55
|
"@synerise/ds-core": "*",
|
|
@@ -57,5 +58,5 @@
|
|
|
57
58
|
"styled-components": "^5.3.3",
|
|
58
59
|
"vitest": "4"
|
|
59
60
|
},
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "d0a43cc43d8528a36f105aceea52ab470edb71d9"
|
|
61
62
|
}
|