Debian Codegraph @

node/@patternfly/react-core/dist/esm/components/ExpandableSection/ExpandableSectionToggle.js

raw
1 import { __rest } from "tslib";
2 import { jsx as _jsx } from "react/jsx-runtime";
3 import styles from '@patternfly/react-styles/css/components/ExpandableSection/expandable-section.mjs';
4 import { css } from '@patternfly/react-styles';
5 import RhMicronsCaretDownIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-down-icon';
6 import { Button } from '../Button';
7 export const ExpandableSectionToggle = (_a) => {
8 var { children, className = '', isExpanded = false, onToggle, contentId, toggleId, direction = 'down', hasTruncatedContent = false, isDetached, toggleAriaLabel, toggleAriaLabelledBy, toggleWrapper = 'div' } = _a, props = __rest(_a, ["children", "className", "isExpanded", "onToggle", "contentId", "toggleId", "direction", "hasTruncatedContent", "isDetached", "toggleAriaLabel", "toggleAriaLabelledBy", "toggleWrapper"]);
9 const ToggleWrapper = toggleWrapper;
10 return (_jsx("div", Object.assign({ className: css(styles.expandableSection, isExpanded && styles.modifiers.expanded, hasTruncatedContent && styles.modifiers.truncate, isDetached && 'pf-m-detached', className) }, props, { children: _jsx(ToggleWrapper, { className: `${styles.expandableSection}__toggle`, children: _jsx(Button, Object.assign({ variant: "link" }, (hasTruncatedContent && { isInline: true }), { "aria-expanded": isExpanded, "aria-controls": contentId, onClick: () => onToggle(!isExpanded), id: toggleId }, (!hasTruncatedContent && {
11 icon: (_jsx("span", { className: css(styles.expandableSectionToggleIcon, isExpanded && direction === 'up' && styles.modifiers.expandTop // TODO: next breaking change move this class to the outer styles.expandableSection wrapper
12 ), children: _jsx(RhMicronsCaretDownIcon, {}) }))
13 }), { "aria-label": toggleAriaLabel, "aria-labelledby": toggleAriaLabelledBy, children: children })) }) })));
14 };
15 ExpandableSectionToggle.displayName = 'ExpandableSectionToggle';
16 //# sourceMappingURL=ExpandableSectionToggle.js.map