1
1
import classNames from 'classnames' ;
2
2
3
3
import styles from './SequenceVisualizer.module.css' ;
4
- import type { SequenceChild } from '../../../../src/types' ;
4
+ import type { DeepPartial , SequenceChild } from '../../../../src/types' ;
5
5
6
6
type SequenceVisualizerProps < T > = {
7
- data : T ;
8
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
7
+ data : DeepPartial < T > ;
9
8
currentPage : SequenceChild < T , any , any > ;
10
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
11
9
pages : SequenceChild < T , any , any > [ ] ;
12
- idPrefix ?: string ;
13
10
goToPage : ( page : string ) => void ;
14
11
} ;
15
12
@@ -18,7 +15,6 @@ export function SequenceVisualizer<T>({
18
15
currentPage,
19
16
pages,
20
17
goToPage,
21
- idPrefix = '' ,
22
18
} : SequenceVisualizerProps < T > ) {
23
19
return (
24
20
< div className = { styles . visualizer } >
@@ -28,13 +24,14 @@ export function SequenceVisualizer<T>({
28
24
isRequired && 'isComplete' in page && page . isComplete ( data ) ;
29
25
const isForm = 'Component' in page ;
30
26
const clickHandler = isForm
31
- ? ( ) => goToPage ( ` ${ idPrefix } ${ page . id } ` )
27
+ ? ( ) => goToPage ( page . id )
32
28
: undefined ;
33
29
return (
34
30
< div
35
31
className = { classNames (
36
32
styles . page ,
37
- `${ idPrefix } ${ page . id } ` === currentPage . id &&
33
+ ! ( 'pages' in page ) &&
34
+ page . id === currentPage . id &&
38
35
styles . currentPage ,
39
36
isRequired && isComplete && styles . complete ,
40
37
! isRequired && styles . notNeeded ,
@@ -55,7 +52,6 @@ export function SequenceVisualizer<T>({
55
52
data = { data }
56
53
currentPage = { currentPage }
57
54
pages = { page . pages }
58
- idPrefix = { `${ idPrefix } ${ page . id } .` }
59
55
goToPage = { goToPage }
60
56
/>
61
57
) }
0 commit comments