1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
3 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
4 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
5 | import _inherits from 'babel-runtime/helpers/inherits';
|
6 |
|
7 | var _class, _temp;
|
8 |
|
9 | import React, { Component } from 'react';
|
10 | import PropTypes from 'prop-types';
|
11 | import classNames from 'classnames';
|
12 | import Menu from '../menu';
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | var Group = (_temp = _class = function (_Component) {
|
19 | _inherits(Group, _Component);
|
20 |
|
21 | function Group() {
|
22 | _classCallCheck(this, Group);
|
23 |
|
24 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
25 | }
|
26 |
|
27 | Group.prototype.render = function render() {
|
28 | var _classNames;
|
29 |
|
30 | var _context = this.context,
|
31 | prefix = _context.prefix,
|
32 | iconOnly = _context.iconOnly;
|
33 |
|
34 | var _props = this.props,
|
35 | className = _props.className,
|
36 | children = _props.children,
|
37 | label = _props.label,
|
38 | others = _objectWithoutProperties(_props, ['className', 'children', 'label']);
|
39 |
|
40 | var newLabel = label;
|
41 | if (iconOnly) {
|
42 |
|
43 | newLabel = [React.createElement(
|
44 | 'span',
|
45 | { key: 'label' },
|
46 | label
|
47 | )];
|
48 | }
|
49 |
|
50 | var cls = classNames((_classNames = {}, _classNames[prefix + 'nav-group-label'] = true, _classNames[className] = !!className, _classNames));
|
51 |
|
52 | return React.createElement(
|
53 | Menu.Group,
|
54 | _extends({ className: cls, label: newLabel }, others),
|
55 | children
|
56 | );
|
57 | };
|
58 |
|
59 | return Group;
|
60 | }(Component), _class.menuChildType = 'group', _class.propTypes = {
|
61 | |
62 |
|
63 |
|
64 | className: PropTypes.string,
|
65 | |
66 |
|
67 |
|
68 | label: PropTypes.node,
|
69 | |
70 |
|
71 |
|
72 | children: PropTypes.node
|
73 | }, _class.contextTypes = {
|
74 | prefix: PropTypes.string,
|
75 | iconOnly: PropTypes.bool
|
76 | }, _temp);
|
77 | Group.displayName = 'Group';
|
78 |
|
79 |
|
80 | export default Group; |
\ | No newline at end of file |