Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"tslib": "^2.6.2"
},
"devDependencies": {
"@patternfly/patternfly": "6.0.0-alpha.210",
"@patternfly/patternfly": "6.0.0-alpha.226",
"case-anything": "^2.1.13",
"css": "^3.0.0",
"fs-extra": "^11.2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-i
import { PickOptional } from '../../helpers/typeUtils';
import { debounce, getUniqueId } from '../../helpers/util';
import { getResizeObserver } from '../../helpers/resizeObserver';
import { Button } from '../Button';

export enum ExpandableSectionVariant {
default = 'default',
Expand Down Expand Up @@ -228,21 +229,25 @@ class ExpandableSection extends React.Component<ExpandableSectionProps, Expandab
);

const expandableToggle = !isDetached && (
<button
className={css(styles.expandableSectionToggle)}
type="button"
aria-expanded={propOrStateIsExpanded}
aria-controls={uniqueContentId}
id={uniqueToggleId}
onClick={(event) => onToggle(event, !propOrStateIsExpanded)}
>
{variant !== ExpandableSectionVariant.truncate && (
<span className={css(styles.expandableSectionToggleIcon)}>
<AngleRightIcon aria-hidden />
</span>
)}
<span className={css(styles.expandableSectionToggleText)}>{toggleContent || computedToggleText}</span>
</button>
<div className={`${styles.expandableSection}__toggle`}>
<Button
variant="link"
{...(variant === ExpandableSectionVariant.truncate && { isInline: true })}
aria-expanded={propOrStateIsExpanded}
aria-controls={uniqueContentId}
id={uniqueToggleId}
onClick={(event) => onToggle(event, !propOrStateIsExpanded)}
{...(variant !== ExpandableSectionVariant.truncate && {
icon: (
<span className={css(styles.expandableSectionToggleIcon)}>
<AngleRightIcon aria-hidden />
</span>
)
})}
>
{toggleContent || computedToggleText}
</Button>
</div>
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import styles from '@patternfly/react-styles/css/components/ExpandableSection/expandable-section';
import { css } from '@patternfly/react-styles';
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
import { Button } from '../Button';

/** Acts as the toggle sub-component when the main expandable section component has the isDetached
* property passed in. Allows for more custom control over the expandable section's toggle.
Expand Down Expand Up @@ -50,26 +51,30 @@ export const ExpandableSectionToggle: React.FunctionComponent<ExpandableSectionT
)}
{...props}
>
<button
className={css(styles.expandableSectionToggle)}
type="button"
aria-expanded={isExpanded}
aria-controls={contentId}
onClick={() => onToggle(!isExpanded)}
id={toggleId}
>
{!hasTruncatedContent && (
<span
className={css(
styles.expandableSectionToggleIcon,
isExpanded && direction === 'up' && styles.modifiers.expandTop
)}
>
<AngleRightIcon aria-hidden />
</span>
)}
<span className={css(styles.expandableSectionToggleText)}>{children}</span>
</button>
<div className={`${styles.expandableSection}__toggle`}>
<Button
variant="link"
{...(hasTruncatedContent && { isInline: true })}
aria-expanded={isExpanded}
aria-controls={contentId}
onClick={() => onToggle(!isExpanded)}
id={toggleId}
{...(!hasTruncatedContent && {
icon: (
<span
className={css(
styles.expandableSectionToggleIcon,
isExpanded && direction === 'up' && styles.modifiers.expandTop
)}
>
<AngleRightIcon aria-hidden />
</span>
)
})}
>
{children}
</Button>
</div>
</div>
);

Expand Down
Loading