8
8
} from "react" ;
9
9
import { DragDropContext , DragStart , DragUpdate } from "@hello-pangea/dnd" ;
10
10
11
- import type { AppState , Config , Data } from "../../types/Config" ;
11
+ import type { AppState , Config , Data , UiState } from "../../types/Config" ;
12
12
import { Button } from "../Button" ;
13
13
14
14
import { Plugin } from "../../types/Plugin" ;
@@ -68,6 +68,7 @@ export function Puck({
68
68
children,
69
69
config,
70
70
data : initialData = { content : [ ] , root : { props : { title : "" } } } ,
71
+ ui : initialUi = defaultAppState . ui ,
71
72
onChange,
72
73
onPublish,
73
74
plugins = [ ] ,
@@ -80,6 +81,7 @@ export function Puck({
80
81
children ?: ReactNode ;
81
82
config : Config < any , any , any > ;
82
83
data : Data ;
84
+ ui ?: Partial < UiState > ;
83
85
onChange ?: ( data : Data ) => void ;
84
86
onPublish : ( data : Data ) => void ;
85
87
plugins ?: Plugin [ ] ;
@@ -107,6 +109,7 @@ export function Puck({
107
109
data : initialData ,
108
110
ui : {
109
111
...defaultAppState . ui ,
112
+ ...initialUi ,
110
113
// Store categories under componentList on state to allow render functions and plugins to modify
111
114
componentList : config . categories
112
115
? Object . entries ( config . categories ) . reduce (
@@ -422,7 +425,7 @@ export function Puck({
422
425
</ div >
423
426
< div className = { getClassName ( "headerTitle" ) } >
424
427
< Heading rank = { 2 } size = "xs" >
425
- { headerTitle || data . root . props . title || "Page" }
428
+ { headerTitle || rootProps . title || "Page" }
426
429
{ headerPath && (
427
430
< >
428
431
{ " " }
0 commit comments