Skip to content

Commit

Permalink
Fix #5379: Accordion tab header passthrough errors (#5381)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Nov 23, 2023
1 parent 3278705 commit 118df19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions components/lib/accordion/Accordion.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import * as React from 'react';
import { ariaLabel } from '../api/Api';
import { ariaLabel, PrimeReactContext } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { CSSTransition } from '../csstransition/CSSTransition';
import { useMountEffect } from '../hooks/Hooks';
import { ChevronDownIcon } from '../icons/chevrondown';
import { ChevronRightIcon } from '../icons/chevronright';
import { classNames, IconUtils, mergeProps, ObjectUtils, UniqueComponentId } from '../utils/Utils';
import { AccordionBase, AccordionTabBase } from './AccordionBase';
import { ChevronRightIcon } from '../icons/chevronright';
import { ChevronDownIcon } from '../icons/chevrondown';
import { PrimeReactContext } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';

export const AccordionTab = () => {};

Expand Down Expand Up @@ -113,7 +112,8 @@ export const Accordion = React.forwardRef((inProps, ref) => {
},
getTabPT(tab, 'headertitle', index)
);
const header = getTabProp(tab, 'headerTemplate') ? ObjectUtils.getJSXElement(getTabProp(tab, 'headerTemplate'), AccordionTabBase.getCProps(tab)) : <span {...headerTitleProps}>{getTabProp(tab, 'header')}</span>;
const tabCProps = AccordionTabBase.getCProps(tab);
const header = getTabProp(tab, 'headerTemplate') ? ObjectUtils.getJSXElement(getTabProp(tab, 'headerTemplate'), tabCProps) : <span {...headerTitleProps}>{ObjectUtils.getJSXElement(getTabProp(tab, 'header'), tabCProps)}</span>;
const headerIconProps = mergeProps(
{
className: cx('tab.headericon')
Expand All @@ -130,7 +130,7 @@ export const Accordion = React.forwardRef((inProps, ref) => {
'data-p-highlight': selected,
'data-p-disabled': getTabProp(tab, 'disabled')
},
getTabPT(tab, 'header', index)
getTabPT(tab, 'tab.header', index)
);

const headerActionProps = mergeProps(
Expand Down
2 changes: 1 addition & 1 deletion components/lib/accordion/accordion.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ interface AccordionTabProps {
/**
* Used to define the header of the tab.
*/
header?: React.ReactNode | undefined;
header?: React.ReactNode | ((props: AccordionTabProps) => React.ReactNode) | undefined;
/**
* Style class of the tab header.
*/
Expand Down

0 comments on commit 118df19

Please sign in to comment.