1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.UncontrolledTooltip = exports.UncontrolledNavDropdown = exports.UncontrolledDropdown = exports.UncontrolledButtonDropdown = exports.UncontrolledAlert = undefined;
|
7 |
|
8 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
9 |
|
10 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
11 |
|
12 | var _react = require('react');
|
13 |
|
14 | var _react2 = _interopRequireDefault(_react);
|
15 |
|
16 | var _Alert = require('./Alert');
|
17 |
|
18 | var _Alert2 = _interopRequireDefault(_Alert);
|
19 |
|
20 | var _ButtonDropdown = require('./ButtonDropdown');
|
21 |
|
22 | var _ButtonDropdown2 = _interopRequireDefault(_ButtonDropdown);
|
23 |
|
24 | var _Dropdown = require('./Dropdown');
|
25 |
|
26 | var _Dropdown2 = _interopRequireDefault(_Dropdown);
|
27 |
|
28 | var _NavDropdown = require('./NavDropdown');
|
29 |
|
30 | var _NavDropdown2 = _interopRequireDefault(_NavDropdown);
|
31 |
|
32 | var _Tooltip = require('./Tooltip');
|
33 |
|
34 | var _Tooltip2 = _interopRequireDefault(_Tooltip);
|
35 |
|
36 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
37 |
|
38 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
39 |
|
40 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
41 |
|
42 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
43 |
|
44 | var components = {
|
45 | UncontrolledAlert: _Alert2.default,
|
46 | UncontrolledButtonDropdown: _ButtonDropdown2.default,
|
47 | UncontrolledDropdown: _Dropdown2.default,
|
48 | UncontrolledNavDropdown: _NavDropdown2.default,
|
49 | UncontrolledTooltip: _Tooltip2.default
|
50 | };
|
51 |
|
52 | Object.keys(components).forEach(function (key) {
|
53 | var Tag = components[key];
|
54 | var defaultValue = Tag === _Alert2.default;
|
55 |
|
56 | var Uncontrolled = function (_Component) {
|
57 | _inherits(Uncontrolled, _Component);
|
58 |
|
59 | function Uncontrolled(props) {
|
60 | _classCallCheck(this, Uncontrolled);
|
61 |
|
62 | var _this = _possibleConstructorReturn(this, (Uncontrolled.__proto__ || Object.getPrototypeOf(Uncontrolled)).call(this, props));
|
63 |
|
64 | _this.state = { isOpen: defaultValue };
|
65 |
|
66 | _this.toggle = _this.toggle.bind(_this);
|
67 | return _this;
|
68 | }
|
69 |
|
70 | _createClass(Uncontrolled, [{
|
71 | key: 'toggle',
|
72 | value: function toggle() {
|
73 | this.setState({ isOpen: !this.state.isOpen });
|
74 | }
|
75 | }, {
|
76 | key: 'render',
|
77 | value: function render() {
|
78 | return _react2.default.createElement(Tag, _extends({ isOpen: this.state.isOpen, toggle: this.toggle }, this.props));
|
79 | }
|
80 | }]);
|
81 |
|
82 | return Uncontrolled;
|
83 | }(_react.Component);
|
84 |
|
85 | Uncontrolled.displayName = key;
|
86 |
|
87 | components[key] = Uncontrolled;
|
88 | });
|
89 |
|
90 | var UncontrolledAlert = components.UncontrolledAlert;
|
91 | var UncontrolledButtonDropdown = components.UncontrolledButtonDropdown;
|
92 | var UncontrolledDropdown = components.UncontrolledDropdown;
|
93 | var UncontrolledNavDropdown = components.UncontrolledNavDropdown;
|
94 | var UncontrolledTooltip = components.UncontrolledTooltip;
|
95 |
|
96 | exports.UncontrolledAlert = UncontrolledAlert;
|
97 | exports.UncontrolledButtonDropdown = UncontrolledButtonDropdown;
|
98 | exports.UncontrolledDropdown = UncontrolledDropdown;
|
99 | exports.UncontrolledNavDropdown = UncontrolledNavDropdown;
|
100 | exports.UncontrolledTooltip = UncontrolledTooltip; |
\ | No newline at end of file |