Skip to content

Commit

Permalink
Fix primefaces#5546: AccordionTab Tailwind issues
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Dec 7, 2023
1 parent 3190cab commit 9354a6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions components/lib/accordion/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const Accordion = React.forwardRef((inProps, ref) => {
}
};

return mergeProps(ptm(`accordiontab.${key}`, { accordiontab: tabMetaData }), ptm(`accordiontab.${key}`, tabMetaData), ptmo(tab.props, key, tabMetaData));
return mergeProps(ptm(`accordion.${key}`, { tab: tabMetaData }), ptm(`accordiontab.${key}`, { accordiontab: tabMetaData }), ptm(`accordiontab.${key}`, tabMetaData), ptmo(getTabProp(tab, 'pt'), key, tabMetaData));
};

const getTabProp = (tab, name) => AccordionTabBase.getCProp(tab, name);
Expand Down Expand Up @@ -108,15 +108,15 @@ export const Accordion = React.forwardRef((inProps, ref) => {
const tabIndex = getTabProp(tab, 'disabled') ? -1 : getTabProp(tab, 'tabIndex');
const headerTitleProps = mergeProps(
{
className: cx('tab.headertitle')
className: cx('accordiontab.headertitle')
},
getTabPT(tab, 'headertitle', index)
);
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')
className: cx('accordiontab.headericon')
},
getTabPT(tab, 'headericon', index)
);
Expand All @@ -125,7 +125,7 @@ export const Accordion = React.forwardRef((inProps, ref) => {
const label = selected ? ariaLabel('collapseLabel') : ariaLabel('expandLabel');
const headerProps = mergeProps(
{
className: classNames(getTabProp(tab, 'headerClassName'), getTabProp(tab, 'className'), cx('tab.header', { selected, getTabProp, tab })),
className: classNames(getTabProp(tab, 'headerClassName'), getTabProp(tab, 'className'), cx('accordiontab.header', { selected, getTabProp, tab })),
style,
'data-p-highlight': selected,
'data-p-disabled': getTabProp(tab, 'disabled')
Expand All @@ -137,7 +137,7 @@ export const Accordion = React.forwardRef((inProps, ref) => {
{
id: headerId,
href: '#' + ariaControls,
className: cx('tab.headeraction'),
className: cx('accordiontab.headeraction'),
role: 'tab',
tabIndex,
onClick: (e) => onTabHeaderClick(e, tab, index),
Expand Down Expand Up @@ -167,7 +167,7 @@ export const Accordion = React.forwardRef((inProps, ref) => {
{
id: contentId,
ref: contentRef,
className: classNames(getTabProp(tab, 'contentClassName'), getTabProp(tab, 'className'), cx('tab.toggleablecontent')),
className: classNames(getTabProp(tab, 'contentClassName'), getTabProp(tab, 'className'), cx('accordiontab.toggleablecontent')),
style,
role: 'region',
'aria-labelledby': ariaLabelledby
Expand All @@ -177,14 +177,14 @@ export const Accordion = React.forwardRef((inProps, ref) => {

const contentProps = mergeProps(
{
className: cx('tab.content')
className: cx('accordiontab.content')
},
getTabPT(tab, 'content', index)
);

const transitionProps = mergeProps(
{
classNames: cx('tab.transition'),
classNames: cx('accordiontab.transition'),
timeout: { enter: 1000, exit: 450 },
in: selected,
unmountOnExit: true,
Expand Down Expand Up @@ -212,7 +212,7 @@ export const Accordion = React.forwardRef((inProps, ref) => {
const rootProps = mergeProps(
{
key,
className: cx('tab.root', { selected })
className: cx('accordiontab.root', { selected })
},
AccordionTabBase.getCOtherProps(tab),
getTabPT(tab, 'root', index)
Expand Down
2 changes: 1 addition & 1 deletion components/lib/accordion/AccordionBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ObjectUtils, classNames } from '../utils/Utils';

const classes = {
root: 'p-accordion p-component',
tab: {
accordiontab: {
root: ({ selected }) =>
classNames('p-accordion-tab', {
'p-accordion-tab-active': selected
Expand Down

0 comments on commit 9354a6a

Please sign in to comment.