| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.ToggleGroup = void 0; |
| 4 |
const tslib_1 = require("tslib"); |
| 5 |
const jsx_runtime_1 = require("react/jsx-runtime"); |
| 6 |
const react_1 = require("react"); |
| 7 |
const react_styles_1 = require("@patternfly/react-styles"); |
| 8 |
const toggle_group_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/ToggleGroup/toggle-group")); |
| 9 |
const ToggleGroupItem_1 = require("./ToggleGroupItem"); |
| 10 |
const ToggleGroup = (_a) => { |
| 11 |
var { className, children, isCompact = false, isFill = false, areAllGroupsDisabled = false, 'aria-label': ariaLabel } = _a, props = tslib_1.__rest(_a, ["className", "children", "isCompact", "isFill", "areAllGroupsDisabled", 'aria-label']); |
| 12 |
const toggleGroupItemList = react_1.Children.map(children, (child) => !((0, react_1.isValidElement)(child) && child.type === ToggleGroupItem_1.ToggleGroupItem) |
| 13 |
? child |
| 14 |
: (0, react_1.cloneElement)(child, areAllGroupsDisabled ? { isDisabled: true } : {})); |
| 15 |
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, react_styles_1.css)(toggle_group_1.default.toggleGroup, isCompact && toggle_group_1.default.modifiers.compact, isFill && toggle_group_1.default.modifiers.fill, className), role: "group", "aria-label": ariaLabel }, props, { children: toggleGroupItemList }))); |
| 16 |
}; |
| 17 |
exports.ToggleGroup = ToggleGroup; |
| 18 |
exports.ToggleGroup.displayName = 'ToggleGroup'; |
| 19 |
//# sourceMappingURL=ToggleGroup.js.map |