| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.ExpandableSectionToggle = void 0; |
| 4 |
const tslib_1 = require("tslib"); |
| 5 |
const jsx_runtime_1 = require("react/jsx-runtime"); |
| 6 |
const expandable_section_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/ExpandableSection/expandable-section")); |
| 7 |
const react_styles_1 = require("@patternfly/react-styles"); |
| 8 |
const rh_microns_caret_down_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/rh-microns-caret-down-icon')); |
| 9 |
const Button_1 = require("../Button"); |
| 10 |
const ExpandableSectionToggle = (_a) => { |
| 11 |
var { children, className = '', isExpanded = false, onToggle, contentId, toggleId, direction = 'down', hasTruncatedContent = false, isDetached, toggleAriaLabel, toggleAriaLabelledBy, toggleWrapper = 'div' } = _a, props = tslib_1.__rest(_a, ["children", "className", "isExpanded", "onToggle", "contentId", "toggleId", "direction", "hasTruncatedContent", "isDetached", "toggleAriaLabel", "toggleAriaLabelledBy", "toggleWrapper"]); |
| 12 |
const ToggleWrapper = toggleWrapper; |
| 13 |
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, react_styles_1.css)(expandable_section_1.default.expandableSection, isExpanded && expandable_section_1.default.modifiers.expanded, hasTruncatedContent && expandable_section_1.default.modifiers.truncate, isDetached && 'pf-m-detached', className) }, props, { children: (0, jsx_runtime_1.jsx)(ToggleWrapper, { className: `${expandable_section_1.default.expandableSection}__toggle`, children: (0, jsx_runtime_1.jsx)(Button_1.Button, Object.assign({ variant: "link" }, (hasTruncatedContent && { isInline: true }), { "aria-expanded": isExpanded, "aria-controls": contentId, onClick: () => onToggle(!isExpanded), id: toggleId }, (!hasTruncatedContent && { |
| 14 |
icon: ((0, jsx_runtime_1.jsx)("span", { className: (0, react_styles_1.css)(expandable_section_1.default.expandableSectionToggleIcon, isExpanded && direction === 'up' && expandable_section_1.default.modifiers.expandTop // TODO: next breaking change move this class to the outer styles.expandableSection wrapper |
| 15 |
), children: (0, jsx_runtime_1.jsx)(rh_microns_caret_down_icon_1.default, {}) })) |
| 16 |
}), { "aria-label": toggleAriaLabel, "aria-labelledby": toggleAriaLabelledBy, children: children })) }) }))); |
| 17 |
}; |
| 18 |
exports.ExpandableSectionToggle = ExpandableSectionToggle; |
| 19 |
exports.ExpandableSectionToggle.displayName = 'ExpandableSectionToggle'; |
| 20 |
//# sourceMappingURL=ExpandableSectionToggle.js.map |