UNPKG

1.09 kBJavaScriptView Raw
1import { __rest } from "tslib";
2import * as React from 'react';
3import { css } from '@patternfly/react-styles';
4import styles from '@patternfly/react-styles/css/components/ToggleGroup/toggle-group';
5import { ToggleGroupItem } from './ToggleGroupItem';
6export const ToggleGroup = (_a) => {
7 var { className, children, isCompact = false, areAllGroupsDisabled = false, 'aria-label': ariaLabel } = _a, props = __rest(_a, ["className", "children", "isCompact", "areAllGroupsDisabled", 'aria-label']);
8 const toggleGroupItemList = React.Children.map(children, child => {
9 const childCompName = child.type.name;
10 return childCompName !== ToggleGroupItem.name
11 ? child
12 : React.cloneElement(child, areAllGroupsDisabled ? { isDisabled: true } : {});
13 });
14 return (React.createElement("div", Object.assign({ className: css(styles.toggleGroup, isCompact && styles.modifiers.compact, className), role: "group", "aria-label": ariaLabel }, props), toggleGroupItemList));
15};
16ToggleGroup.displayName = 'ToggleGroup';
17//# sourceMappingURL=ToggleGroup.js.map
\No newline at end of file