Debian Codegraph @

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

raw
1 import { __rest } from "tslib";
2 import { jsx as _jsx } from "react/jsx-runtime";
3 import { Children, cloneElement, isValidElement } from 'react';
4 import { css } from '@patternfly/react-styles';
5 import styles from '@patternfly/react-styles/css/components/ToggleGroup/toggle-group.mjs';
6 import { ToggleGroupItem } from './ToggleGroupItem';
7 export const ToggleGroup = (_a) => {
8 var { className, children, isCompact = false, isFill = false, areAllGroupsDisabled = false, 'aria-label': ariaLabel } = _a, props = __rest(_a, ["className", "children", "isCompact", "isFill", "areAllGroupsDisabled", 'aria-label']);
9 const toggleGroupItemList = Children.map(children, (child) => !(isValidElement(child) && child.type === ToggleGroupItem)
10 ? child
11 : cloneElement(child, areAllGroupsDisabled ? { isDisabled: true } : {}));
12 return (_jsx("div", Object.assign({ className: css(styles.toggleGroup, isCompact && styles.modifiers.compact, isFill && styles.modifiers.fill, className), role: "group", "aria-label": ariaLabel }, props, { children: toggleGroupItemList })));
13 };
14 ToggleGroup.displayName = 'ToggleGroup';
15 //# sourceMappingURL=ToggleGroup.js.map