1 | import { __rest } from "tslib";
|
2 | import * as React from 'react';
|
3 | import styles from '@patternfly/react-styles/css/components/ContextSelector/context-selector';
|
4 | import { css } from '@patternfly/react-styles';
|
5 | export class ContextSelectorMenuList extends React.Component {
|
6 | constructor() {
|
7 | super(...arguments);
|
8 | this.refsCollection = [];
|
9 | this.sendRef = (index, ref) => {
|
10 | this.refsCollection[index] = ref;
|
11 | };
|
12 | this.render = () => {
|
13 |
|
14 | const _a = this.props, { className, isOpen, children } = _a, props = __rest(_a, ["className", "isOpen", "children"]);
|
15 | return (React.createElement("ul", Object.assign({ className: css(styles.contextSelectorMenuList, className), hidden: !isOpen, role: "menu" }, props), this.extendChildren()));
|
16 | };
|
17 | }
|
18 | extendChildren() {
|
19 | return React.Children.map(this.props.children, (child, index) => React.cloneElement(child, {
|
20 | sendRef: this.sendRef,
|
21 | index
|
22 | }));
|
23 | }
|
24 | }
|
25 | ContextSelectorMenuList.displayName = 'ContextSelectorMenuList';
|
26 | ContextSelectorMenuList.defaultProps = {
|
27 | children: null,
|
28 | className: '',
|
29 | isOpen: true
|
30 | };
|
31 |
|
\ | No newline at end of file |