@@ -30,8 +30,8 @@ const TITLE_AREA_REGION_ORDER = {
3030 Actions : 5 ,
3131}
3232
33- // Types that are shared between sub components
34- export type sharedPropTypes = {
33+ // Types that are shared between PageHeader children components
34+ export type ChildrenPropTypes = {
3535 hidden ?: boolean | ResponsiveValue < boolean >
3636} & SxProp
3737
@@ -54,7 +54,7 @@ const hiddenOnNarrow = {
5454export type PageHeaderProps = {
5555 'aria-label' ?: React . AriaAttributes [ 'aria-label' ]
5656 as ?: React . ElementType | 'header' | 'div'
57- } & sharedPropTypes
57+ } & SxProp
5858
5959const Root : React . FC < React . PropsWithChildren < PageHeaderProps > > = ( { children, sx = { } , as = 'div' } ) => {
6060 const rootStyles = {
@@ -74,7 +74,7 @@ const Root: React.FC<React.PropsWithChildren<PageHeaderProps>> = ({children, sx
7474// to manage their custom visibility but consumers should be careful if they choose to hide this on narrow viewports.
7575// PageHeader.ContextArea Sub Components: PageHeader.ParentLink, PageHeader.ContextBar, PageHeader.ContextAreaActions
7676// ---------------------------------------------------------------------
77- const ContextArea : React . FC < React . PropsWithChildren < PageHeaderProps > > = ( {
77+ const ContextArea : React . FC < React . PropsWithChildren < ChildrenPropTypes > > = ( {
7878 children,
7979 hidden = hiddenOnRegularAndWide ,
8080 sx = { } ,
@@ -95,8 +95,10 @@ const ContextArea: React.FC<React.PropsWithChildren<PageHeaderProps>> = ({
9595type LinkProps = Pick <
9696 React . AnchorHTMLAttributes < HTMLAnchorElement > & BaseLinkProps ,
9797 'download' | 'href' | 'hrefLang' | 'media' | 'ping' | 'rel' | 'target' | 'type' | 'referrerPolicy' | 'as'
98- >
99- export type ParentLinkProps = React . PropsWithChildren < PageHeaderProps & LinkProps >
98+ > & {
99+ 'aria-label' ?: React . AriaAttributes [ 'aria-label' ]
100+ }
101+ export type ParentLinkProps = React . PropsWithChildren < ChildrenPropTypes & LinkProps >
100102
101103const ParentLink = React . forwardRef < HTMLAnchorElement , ParentLinkProps > (
102104 ( { children, sx = { } , href, 'aria-label' : ariaLabel , as = 'a' , hidden = hiddenOnRegularAndWide } , ref ) => {
@@ -133,7 +135,7 @@ const ParentLink = React.forwardRef<HTMLAnchorElement, ParentLinkProps>(
133135// Generic slot for any component above the title region. Use it for custom breadcrumbs and other navigation elements instead of ParentLink.
134136// ---------------------------------------------------------------------
135137
136- const ContextBar : React . FC < React . PropsWithChildren < PageHeaderProps > > = ( {
138+ const ContextBar : React . FC < React . PropsWithChildren < ChildrenPropTypes > > = ( {
137139 children,
138140 sx = { } ,
139141 hidden = hiddenOnRegularAndWide ,
@@ -158,7 +160,7 @@ const ContextBar: React.FC<React.PropsWithChildren<PageHeaderProps>> = ({
158160
159161// ContextAreaActions
160162// ---------------------------------------------------------------------
161- const ContextAreaActions : React . FC < React . PropsWithChildren < PageHeaderProps > > = ( {
163+ const ContextAreaActions : React . FC < React . PropsWithChildren < ChildrenPropTypes > > = ( {
162164 children,
163165 sx = { } ,
164166 hidden = hiddenOnRegularAndWide ,
@@ -199,7 +201,7 @@ const TitleAreaContext = React.createContext<{
199201
200202type TitleAreaProps = {
201203 variant ?: 'subtitle' | 'medium' | 'large' | ResponsiveValue < 'subtitle' | 'medium' | 'large' >
202- } & PageHeaderProps
204+ } & ChildrenPropTypes
203205// PageHeader.TitleArea: The main title area of the page. Visible on all viewports.
204206// PageHeader.TitleArea Sub Components: PageHeader.LeadingAction, PageHeader.LeadingVisual, PageHeader.Title, PageTitle.TrailingVisual, PageHeader.TrailingAction, PageHeader.Actions
205207// PageHeader.LeadingAction and PageHeader.TrailingAction are only visible on regular viewports therefore they come as visible on narrow viewports and their visibility can be managed by their exposed `visible` prop
@@ -236,7 +238,7 @@ const TitleArea: React.FC<React.PropsWithChildren<TitleAreaProps>> = ({
236238 )
237239}
238240
239- const LeadingAction : React . FC < React . PropsWithChildren < PageHeaderProps > > = ( {
241+ const LeadingAction : React . FC < React . PropsWithChildren < ChildrenPropTypes > > = ( {
240242 children,
241243 sx = { } ,
242244 hidden = hiddenOnNarrow ,
@@ -263,7 +265,7 @@ const LeadingAction: React.FC<React.PropsWithChildren<PageHeaderProps>> = ({
263265 )
264266}
265267
266- const LeadingVisual : React . FC < React . PropsWithChildren < PageHeaderProps > > = ( { children, sx = { } , hidden = false } ) => {
268+ const LeadingVisual : React . FC < React . PropsWithChildren < ChildrenPropTypes > > = ( { children, sx = { } , hidden = false } ) => {
267269 const { titleAreaHeight} = React . useContext ( TitleAreaContext )
268270 return (
269271 < Box
@@ -288,7 +290,7 @@ const LeadingVisual: React.FC<React.PropsWithChildren<PageHeaderProps>> = ({chil
288290export type TitleProps = {
289291 // Check if we need responsive values for heading is so should we update as prop's type for Heading component?
290292 as ?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
291- } & PageHeaderProps
293+ } & ChildrenPropTypes
292294
293295const Title : React . FC < React . PropsWithChildren < TitleProps > > = ( { children, sx = { } , hidden = false , as = 'h3' } ) => {
294296 const { titleVariant} = React . useContext ( TitleAreaContext )
@@ -326,7 +328,7 @@ const Title: React.FC<React.PropsWithChildren<TitleProps>> = ({children, sx = {}
326328 </ Heading >
327329 )
328330}
329- const TrailingVisual : React . FC < React . PropsWithChildren < PageHeaderProps > > = ( { children, sx = { } , hidden = false } ) => {
331+ const TrailingVisual : React . FC < React . PropsWithChildren < ChildrenPropTypes > > = ( { children, sx = { } , hidden = false } ) => {
330332 const { titleAreaHeight} = React . useContext ( TitleAreaContext )
331333
332334 return (
@@ -349,7 +351,7 @@ const TrailingVisual: React.FC<React.PropsWithChildren<PageHeaderProps>> = ({chi
349351 )
350352}
351353
352- const TrailingAction : React . FC < React . PropsWithChildren < PageHeaderProps > > = ( {
354+ const TrailingAction : React . FC < React . PropsWithChildren < ChildrenPropTypes > > = ( {
353355 children,
354356 sx = { } ,
355357 hidden = hiddenOnNarrow ,
@@ -376,7 +378,7 @@ const TrailingAction: React.FC<React.PropsWithChildren<PageHeaderProps>> = ({
376378 )
377379}
378380
379- const Actions : React . FC < React . PropsWithChildren < PageHeaderProps > > = ( { children, sx = { } , hidden = false } ) => {
381+ const Actions : React . FC < React . PropsWithChildren < ChildrenPropTypes > > = ( { children, sx = { } , hidden = false } ) => {
380382 const { titleAreaHeight} = React . useContext ( TitleAreaContext )
381383 return (
382384 < Box
@@ -403,7 +405,7 @@ const Actions: React.FC<React.PropsWithChildren<PageHeaderProps>> = ({children,
403405}
404406
405407// PageHeader.Description: The description area of the header. Visible on all viewports
406- const Description : React . FC < React . PropsWithChildren < PageHeaderProps > > = ( { children, sx = { } , hidden = false } ) => {
408+ const Description : React . FC < React . PropsWithChildren < ChildrenPropTypes > > = ( { children, sx = { } , hidden = false } ) => {
407409 return (
408410 < Box
409411 sx = { merge < BetterSystemStyleObject > (
@@ -429,7 +431,7 @@ export type NavigationProps = {
429431 as ?: 'nav' | 'div'
430432 'aria-label' ?: React . AriaAttributes [ 'aria-label' ]
431433 'aria-labelledby' ?: React . AriaAttributes [ 'aria-labelledby' ]
432- } & PageHeaderProps
434+ } & ChildrenPropTypes
433435
434436// PageHeader.Navigation: The local navigation area of the header. Visible on all viewports
435437const Navigation : React . FC < React . PropsWithChildren < NavigationProps > > = ( {
0 commit comments