Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

5264 wiersze
155 KiB

  1. import React, { Component } from 'react';
  2. import PropTypes from 'prop-types';
  3. import classNames from 'classnames';
  4. import isFunction from 'lodash.isfunction';
  5. import isobject from 'lodash.isobject';
  6. import ReactDOM from 'react-dom';
  7. import { Manager, Popper, Target, Arrow } from 'react-popper';
  8. import { Transition } from 'react-transition-group';
  9. import toNumber from 'lodash.tonumber';
  10. import { polyfill } from 'react-lifecycles-compat';
  11. function _extends() {
  12. _extends = Object.assign || function (target) {
  13. for (var i = 1; i < arguments.length; i++) {
  14. var source = arguments[i];
  15. for (var key in source) {
  16. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17. target[key] = source[key];
  18. }
  19. }
  20. }
  21. return target;
  22. };
  23. return _extends.apply(this, arguments);
  24. }
  25. function _inheritsLoose(subClass, superClass) {
  26. subClass.prototype = Object.create(superClass.prototype);
  27. subClass.prototype.constructor = subClass;
  28. subClass.__proto__ = superClass;
  29. }
  30. function _objectWithoutPropertiesLoose(source, excluded) {
  31. if (source == null) return {};
  32. var target = {};
  33. var sourceKeys = Object.keys(source);
  34. var key, i;
  35. for (i = 0; i < sourceKeys.length; i++) {
  36. key = sourceKeys[i];
  37. if (excluded.indexOf(key) >= 0) continue;
  38. target[key] = source[key];
  39. }
  40. return target;
  41. }
  42. function _assertThisInitialized(self) {
  43. if (self === void 0) {
  44. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  45. }
  46. return self;
  47. }
  48. function getScrollbarWidth() {
  49. var scrollDiv = document.createElement('div'); // .modal-scrollbar-measure styles // https://github.com/twbs/bootstrap/blob/v4.0.0-alpha.4/scss/_modal.scss#L106-L113
  50. scrollDiv.style.position = 'absolute';
  51. scrollDiv.style.top = '-9999px';
  52. scrollDiv.style.width = '50px';
  53. scrollDiv.style.height = '50px';
  54. scrollDiv.style.overflow = 'scroll';
  55. document.body.appendChild(scrollDiv);
  56. var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
  57. document.body.removeChild(scrollDiv);
  58. return scrollbarWidth;
  59. }
  60. function setScrollbarWidth(padding) {
  61. document.body.style.paddingRight = padding > 0 ? padding + "px" : null;
  62. }
  63. function isBodyOverflowing() {
  64. return document.body.clientWidth < window.innerWidth;
  65. }
  66. function getOriginalBodyPadding() {
  67. var style = window.getComputedStyle(document.body, null);
  68. return parseInt(style && style.getPropertyValue('padding-right') || 0, 10);
  69. }
  70. function conditionallyUpdateScrollbar() {
  71. var scrollbarWidth = getScrollbarWidth(); // https://github.com/twbs/bootstrap/blob/v4.0.0-alpha.6/js/src/modal.js#L433
  72. var fixedContent = document.querySelectorAll('.fixed-top, .fixed-bottom, .is-fixed, .sticky-top')[0];
  73. var bodyPadding = fixedContent ? parseInt(fixedContent.style.paddingRight || 0, 10) : 0;
  74. if (isBodyOverflowing()) {
  75. setScrollbarWidth(bodyPadding + scrollbarWidth);
  76. }
  77. }
  78. var globalCssModule;
  79. function setGlobalCssModule(cssModule) {
  80. globalCssModule = cssModule;
  81. }
  82. function mapToCssModules(className, cssModule) {
  83. if (className === void 0) {
  84. className = '';
  85. }
  86. if (cssModule === void 0) {
  87. cssModule = globalCssModule;
  88. }
  89. if (!cssModule) return className;
  90. return className.split(' ').map(function (c) {
  91. return cssModule[c] || c;
  92. }).join(' ');
  93. }
  94. /**
  95. * Returns a new object with the key/value pairs from `obj` that are not in the array `omitKeys`.
  96. */
  97. function omit(obj, omitKeys) {
  98. var result = {};
  99. Object.keys(obj).forEach(function (key) {
  100. if (omitKeys.indexOf(key) === -1) {
  101. result[key] = obj[key];
  102. }
  103. });
  104. return result;
  105. }
  106. /**
  107. * Returns a filtered copy of an object with only the specified keys.
  108. */
  109. function pick(obj, keys) {
  110. var pickKeys = Array.isArray(keys) ? keys : [keys];
  111. var length = pickKeys.length;
  112. var key;
  113. var result = {};
  114. while (length > 0) {
  115. length -= 1;
  116. key = pickKeys[length];
  117. result[key] = obj[key];
  118. }
  119. return result;
  120. }
  121. var warned = {};
  122. function warnOnce(message) {
  123. if (!warned[message]) {
  124. /* istanbul ignore else */
  125. if (typeof console !== 'undefined') {
  126. console.error(message); // eslint-disable-line no-console
  127. }
  128. warned[message] = true;
  129. }
  130. }
  131. function deprecated(propType, explanation) {
  132. return function validate(props, propName, componentName) {
  133. if (props[propName] !== null && typeof props[propName] !== 'undefined') {
  134. warnOnce("\"" + propName + "\" property of \"" + componentName + "\" has been deprecated.\n" + explanation);
  135. }
  136. for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  137. rest[_key - 3] = arguments[_key];
  138. }
  139. return propType.apply(void 0, [props, propName, componentName].concat(rest));
  140. };
  141. }
  142. function DOMElement(props, propName, componentName) {
  143. if (!(props[propName] instanceof Element)) {
  144. return new Error('Invalid prop `' + propName + '` supplied to `' + componentName + '`. Expected prop to be an instance of Element. Validation failed.');
  145. }
  146. }
  147. var targetPropType = PropTypes.oneOfType([PropTypes.string, PropTypes.func, DOMElement, PropTypes.shape({
  148. current: PropTypes.any
  149. })]);
  150. var tagPropType = PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.shape({
  151. $$typeof: PropTypes.symbol,
  152. render: PropTypes.func
  153. }), PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.shape({
  154. $$typeof: PropTypes.symbol,
  155. render: PropTypes.func
  156. })]))]);
  157. /* eslint key-spacing: ["error", { afterColon: true, align: "value" }] */
  158. // These are all setup to match what is in the bootstrap _variables.scss
  159. // https://github.com/twbs/bootstrap/blob/v4-dev/scss/_variables.scss
  160. var TransitionTimeouts = {
  161. Fade: 150,
  162. // $transition-fade
  163. Collapse: 350,
  164. // $transition-collapse
  165. Modal: 300,
  166. // $modal-transition
  167. Carousel: 600 // $carousel-transition
  168. }; // Duplicated Transition.propType keys to ensure that Reactstrap builds
  169. // for distribution properly exclude these keys for nested child HTML attributes
  170. // since `react-transition-group` removes propTypes in production builds.
  171. var TransitionPropTypeKeys = ['in', 'mountOnEnter', 'unmountOnExit', 'appear', 'enter', 'exit', 'timeout', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'];
  172. var TransitionStatuses = {
  173. ENTERING: 'entering',
  174. ENTERED: 'entered',
  175. EXITING: 'exiting',
  176. EXITED: 'exited'
  177. };
  178. var keyCodes = {
  179. esc: 27,
  180. space: 32,
  181. enter: 13,
  182. tab: 9,
  183. up: 38,
  184. down: 40,
  185. home: 36,
  186. end: 35,
  187. n: 78,
  188. p: 80
  189. };
  190. var PopperPlacements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
  191. var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
  192. function isReactRefObj(target) {
  193. if (target && typeof target === 'object') {
  194. return 'current' in target;
  195. }
  196. return false;
  197. }
  198. function findDOMElements(target) {
  199. if (isReactRefObj(target)) {
  200. return target.current;
  201. }
  202. if (isFunction(target)) {
  203. return target();
  204. }
  205. if (typeof target === 'string' && canUseDOM) {
  206. var selection = document.querySelectorAll(target);
  207. if (!selection.length) {
  208. selection = document.querySelectorAll("#" + target);
  209. }
  210. if (!selection.length) {
  211. throw new Error("The target '" + target + "' could not be identified in the dom, tip: check spelling");
  212. }
  213. return selection;
  214. }
  215. return target;
  216. }
  217. function isArrayOrNodeList(els) {
  218. if (els === null) {
  219. return false;
  220. }
  221. return Array.isArray(els) || canUseDOM && typeof els.length === 'number';
  222. }
  223. function getTarget(target) {
  224. var els = findDOMElements(target);
  225. if (isArrayOrNodeList(els)) {
  226. return els[0];
  227. }
  228. return els;
  229. }
  230. var defaultToggleEvents = ['touchstart', 'click'];
  231. function addMultipleEventListeners(_els, handler, _events, useCapture) {
  232. var els = _els;
  233. if (!isArrayOrNodeList(els)) {
  234. els = [els];
  235. }
  236. var events = _events;
  237. if (typeof events === 'string') {
  238. events = events.split(/\s+/);
  239. }
  240. if (!isArrayOrNodeList(els) || typeof handler !== 'function' || !Array.isArray(events)) {
  241. throw new Error("\n The first argument of this function must be DOM node or an array on DOM nodes or NodeList.\n The second must be a function.\n The third is a string or an array of strings that represents DOM events\n ");
  242. }
  243. Array.prototype.forEach.call(events, function (event) {
  244. Array.prototype.forEach.call(els, function (el) {
  245. el.addEventListener(event, handler, useCapture);
  246. });
  247. });
  248. return function removeEvents() {
  249. Array.prototype.forEach.call(events, function (event) {
  250. Array.prototype.forEach.call(els, function (el) {
  251. el.removeEventListener(event, handler, useCapture);
  252. });
  253. });
  254. };
  255. }
  256. var focusableElements = ['a[href]', 'area[href]', 'input:not([disabled]):not([type=hidden])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'object', 'embed', '[tabindex]:not(.modal)', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])'];
  257. var utils = /*#__PURE__*/Object.freeze({
  258. getScrollbarWidth: getScrollbarWidth,
  259. setScrollbarWidth: setScrollbarWidth,
  260. isBodyOverflowing: isBodyOverflowing,
  261. getOriginalBodyPadding: getOriginalBodyPadding,
  262. conditionallyUpdateScrollbar: conditionallyUpdateScrollbar,
  263. setGlobalCssModule: setGlobalCssModule,
  264. mapToCssModules: mapToCssModules,
  265. omit: omit,
  266. pick: pick,
  267. warnOnce: warnOnce,
  268. deprecated: deprecated,
  269. DOMElement: DOMElement,
  270. targetPropType: targetPropType,
  271. tagPropType: tagPropType,
  272. TransitionTimeouts: TransitionTimeouts,
  273. TransitionPropTypeKeys: TransitionPropTypeKeys,
  274. TransitionStatuses: TransitionStatuses,
  275. keyCodes: keyCodes,
  276. PopperPlacements: PopperPlacements,
  277. canUseDOM: canUseDOM,
  278. isReactRefObj: isReactRefObj,
  279. findDOMElements: findDOMElements,
  280. isArrayOrNodeList: isArrayOrNodeList,
  281. getTarget: getTarget,
  282. defaultToggleEvents: defaultToggleEvents,
  283. addMultipleEventListeners: addMultipleEventListeners,
  284. focusableElements: focusableElements
  285. });
  286. var propTypes = {
  287. tag: tagPropType,
  288. fluid: PropTypes.bool,
  289. className: PropTypes.string,
  290. cssModule: PropTypes.object
  291. };
  292. var defaultProps = {
  293. tag: 'div'
  294. };
  295. var Container = function Container(props) {
  296. var className = props.className,
  297. cssModule = props.cssModule,
  298. fluid = props.fluid,
  299. Tag = props.tag,
  300. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "fluid", "tag"]);
  301. var classes = mapToCssModules(classNames(className, fluid ? 'container-fluid' : 'container'), cssModule);
  302. return React.createElement(Tag, _extends({}, attributes, {
  303. className: classes
  304. }));
  305. };
  306. Container.propTypes = propTypes;
  307. Container.defaultProps = defaultProps;
  308. var propTypes$1 = {
  309. tag: tagPropType,
  310. noGutters: PropTypes.bool,
  311. className: PropTypes.string,
  312. cssModule: PropTypes.object,
  313. form: PropTypes.bool
  314. };
  315. var defaultProps$1 = {
  316. tag: 'div'
  317. };
  318. var Row = function Row(props) {
  319. var className = props.className,
  320. cssModule = props.cssModule,
  321. noGutters = props.noGutters,
  322. Tag = props.tag,
  323. form = props.form,
  324. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "noGutters", "tag", "form"]);
  325. var classes = mapToCssModules(classNames(className, noGutters ? 'no-gutters' : null, form ? 'form-row' : 'row'), cssModule);
  326. return React.createElement(Tag, _extends({}, attributes, {
  327. className: classes
  328. }));
  329. };
  330. Row.propTypes = propTypes$1;
  331. Row.defaultProps = defaultProps$1;
  332. var colWidths = ['xs', 'sm', 'md', 'lg', 'xl'];
  333. var stringOrNumberProp = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
  334. var columnProps = PropTypes.oneOfType([PropTypes.bool, PropTypes.number, PropTypes.string, PropTypes.shape({
  335. size: PropTypes.oneOfType([PropTypes.bool, PropTypes.number, PropTypes.string]),
  336. push: deprecated(stringOrNumberProp, 'Please use the prop "order"'),
  337. pull: deprecated(stringOrNumberProp, 'Please use the prop "order"'),
  338. order: stringOrNumberProp,
  339. offset: stringOrNumberProp
  340. })]);
  341. var propTypes$2 = {
  342. tag: tagPropType,
  343. xs: columnProps,
  344. sm: columnProps,
  345. md: columnProps,
  346. lg: columnProps,
  347. xl: columnProps,
  348. className: PropTypes.string,
  349. cssModule: PropTypes.object,
  350. widths: PropTypes.array
  351. };
  352. var defaultProps$2 = {
  353. tag: 'div',
  354. widths: colWidths
  355. };
  356. var getColumnSizeClass = function getColumnSizeClass(isXs, colWidth, colSize) {
  357. if (colSize === true || colSize === '') {
  358. return isXs ? 'col' : "col-" + colWidth;
  359. } else if (colSize === 'auto') {
  360. return isXs ? 'col-auto' : "col-" + colWidth + "-auto";
  361. }
  362. return isXs ? "col-" + colSize : "col-" + colWidth + "-" + colSize;
  363. };
  364. var Col = function Col(props) {
  365. var className = props.className,
  366. cssModule = props.cssModule,
  367. widths = props.widths,
  368. Tag = props.tag,
  369. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "widths", "tag"]);
  370. var colClasses = [];
  371. widths.forEach(function (colWidth, i) {
  372. var columnProp = props[colWidth];
  373. delete attributes[colWidth];
  374. if (!columnProp && columnProp !== '') {
  375. return;
  376. }
  377. var isXs = !i;
  378. if (isobject(columnProp)) {
  379. var _classNames;
  380. var colSizeInterfix = isXs ? '-' : "-" + colWidth + "-";
  381. var colClass = getColumnSizeClass(isXs, colWidth, columnProp.size);
  382. colClasses.push(mapToCssModules(classNames((_classNames = {}, _classNames[colClass] = columnProp.size || columnProp.size === '', _classNames["order" + colSizeInterfix + columnProp.order] = columnProp.order || columnProp.order === 0, _classNames["offset" + colSizeInterfix + columnProp.offset] = columnProp.offset || columnProp.offset === 0, _classNames)), cssModule));
  383. } else {
  384. var _colClass = getColumnSizeClass(isXs, colWidth, columnProp);
  385. colClasses.push(_colClass);
  386. }
  387. });
  388. if (!colClasses.length) {
  389. colClasses.push('col');
  390. }
  391. var classes = mapToCssModules(classNames(className, colClasses), cssModule);
  392. return React.createElement(Tag, _extends({}, attributes, {
  393. className: classes
  394. }));
  395. };
  396. Col.propTypes = propTypes$2;
  397. Col.defaultProps = defaultProps$2;
  398. var propTypes$3 = {
  399. light: PropTypes.bool,
  400. dark: PropTypes.bool,
  401. inverse: deprecated(PropTypes.bool, 'Please use the prop "dark"'),
  402. full: PropTypes.bool,
  403. fixed: PropTypes.string,
  404. sticky: PropTypes.string,
  405. color: PropTypes.string,
  406. role: PropTypes.string,
  407. tag: tagPropType,
  408. className: PropTypes.string,
  409. cssModule: PropTypes.object,
  410. toggleable: deprecated(PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), 'Please use the prop "expand"'),
  411. expand: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
  412. };
  413. var defaultProps$3 = {
  414. tag: 'nav',
  415. expand: false
  416. };
  417. var getExpandClass = function getExpandClass(expand) {
  418. if (expand === false) {
  419. return false;
  420. } else if (expand === true || expand === 'xs') {
  421. return 'navbar-expand';
  422. }
  423. return "navbar-expand-" + expand;
  424. }; // To better maintain backwards compatibility while toggleable is deprecated.
  425. // We must map breakpoints to the next breakpoint so that toggleable and expand do the same things at the same breakpoint.
  426. var toggleableToExpand = {
  427. xs: 'sm',
  428. sm: 'md',
  429. md: 'lg',
  430. lg: 'xl'
  431. };
  432. var getToggleableClass = function getToggleableClass(toggleable) {
  433. if (toggleable === undefined || toggleable === 'xl') {
  434. return false;
  435. } else if (toggleable === false) {
  436. return 'navbar-expand';
  437. }
  438. return "navbar-expand-" + (toggleable === true ? 'sm' : toggleableToExpand[toggleable] || toggleable);
  439. };
  440. var Navbar = function Navbar(props) {
  441. var _classNames;
  442. var toggleable = props.toggleable,
  443. expand = props.expand,
  444. className = props.className,
  445. cssModule = props.cssModule,
  446. light = props.light,
  447. dark = props.dark,
  448. inverse = props.inverse,
  449. fixed = props.fixed,
  450. sticky = props.sticky,
  451. color = props.color,
  452. Tag = props.tag,
  453. attributes = _objectWithoutPropertiesLoose(props, ["toggleable", "expand", "className", "cssModule", "light", "dark", "inverse", "fixed", "sticky", "color", "tag"]);
  454. var classes = mapToCssModules(classNames(className, 'navbar', getExpandClass(expand) || getToggleableClass(toggleable), (_classNames = {
  455. 'navbar-light': light,
  456. 'navbar-dark': inverse || dark
  457. }, _classNames["bg-" + color] = color, _classNames["fixed-" + fixed] = fixed, _classNames["sticky-" + sticky] = sticky, _classNames)), cssModule);
  458. return React.createElement(Tag, _extends({}, attributes, {
  459. className: classes
  460. }));
  461. };
  462. Navbar.propTypes = propTypes$3;
  463. Navbar.defaultProps = defaultProps$3;
  464. var propTypes$4 = {
  465. tag: tagPropType,
  466. className: PropTypes.string,
  467. cssModule: PropTypes.object
  468. };
  469. var defaultProps$4 = {
  470. tag: 'a'
  471. };
  472. var NavbarBrand = function NavbarBrand(props) {
  473. var className = props.className,
  474. cssModule = props.cssModule,
  475. Tag = props.tag,
  476. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  477. var classes = mapToCssModules(classNames(className, 'navbar-brand'), cssModule);
  478. return React.createElement(Tag, _extends({}, attributes, {
  479. className: classes
  480. }));
  481. };
  482. NavbarBrand.propTypes = propTypes$4;
  483. NavbarBrand.defaultProps = defaultProps$4;
  484. var propTypes$5 = {
  485. tag: tagPropType,
  486. type: PropTypes.string,
  487. className: PropTypes.string,
  488. cssModule: PropTypes.object,
  489. children: PropTypes.node
  490. };
  491. var defaultProps$5 = {
  492. tag: 'button',
  493. type: 'button'
  494. };
  495. var NavbarToggler = function NavbarToggler(props) {
  496. var className = props.className,
  497. cssModule = props.cssModule,
  498. children = props.children,
  499. Tag = props.tag,
  500. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "children", "tag"]);
  501. var classes = mapToCssModules(classNames(className, 'navbar-toggler'), cssModule);
  502. return React.createElement(Tag, _extends({}, attributes, {
  503. className: classes
  504. }), children || React.createElement("span", {
  505. className: mapToCssModules('navbar-toggler-icon', cssModule)
  506. }));
  507. };
  508. NavbarToggler.propTypes = propTypes$5;
  509. NavbarToggler.defaultProps = defaultProps$5;
  510. var propTypes$6 = {
  511. tabs: PropTypes.bool,
  512. pills: PropTypes.bool,
  513. vertical: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
  514. horizontal: PropTypes.string,
  515. justified: PropTypes.bool,
  516. fill: PropTypes.bool,
  517. navbar: PropTypes.bool,
  518. card: PropTypes.bool,
  519. tag: tagPropType,
  520. className: PropTypes.string,
  521. cssModule: PropTypes.object
  522. };
  523. var defaultProps$6 = {
  524. tag: 'ul',
  525. vertical: false
  526. };
  527. var getVerticalClass = function getVerticalClass(vertical) {
  528. if (vertical === false) {
  529. return false;
  530. } else if (vertical === true || vertical === 'xs') {
  531. return 'flex-column';
  532. }
  533. return "flex-" + vertical + "-column";
  534. };
  535. var Nav = function Nav(props) {
  536. var className = props.className,
  537. cssModule = props.cssModule,
  538. tabs = props.tabs,
  539. pills = props.pills,
  540. vertical = props.vertical,
  541. horizontal = props.horizontal,
  542. justified = props.justified,
  543. fill = props.fill,
  544. navbar = props.navbar,
  545. card = props.card,
  546. Tag = props.tag,
  547. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tabs", "pills", "vertical", "horizontal", "justified", "fill", "navbar", "card", "tag"]);
  548. var classes = mapToCssModules(classNames(className, navbar ? 'navbar-nav' : 'nav', horizontal ? "justify-content-" + horizontal : false, getVerticalClass(vertical), {
  549. 'nav-tabs': tabs,
  550. 'card-header-tabs': card && tabs,
  551. 'nav-pills': pills,
  552. 'card-header-pills': card && pills,
  553. 'nav-justified': justified,
  554. 'nav-fill': fill
  555. }), cssModule);
  556. return React.createElement(Tag, _extends({}, attributes, {
  557. className: classes
  558. }));
  559. };
  560. Nav.propTypes = propTypes$6;
  561. Nav.defaultProps = defaultProps$6;
  562. var propTypes$7 = {
  563. tag: tagPropType,
  564. active: PropTypes.bool,
  565. className: PropTypes.string,
  566. cssModule: PropTypes.object
  567. };
  568. var defaultProps$7 = {
  569. tag: 'li'
  570. };
  571. var NavItem = function NavItem(props) {
  572. var className = props.className,
  573. cssModule = props.cssModule,
  574. active = props.active,
  575. Tag = props.tag,
  576. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "active", "tag"]);
  577. var classes = mapToCssModules(classNames(className, 'nav-item', active ? 'active' : false), cssModule);
  578. return React.createElement(Tag, _extends({}, attributes, {
  579. className: classes
  580. }));
  581. };
  582. NavItem.propTypes = propTypes$7;
  583. NavItem.defaultProps = defaultProps$7;
  584. var propTypes$8 = {
  585. disabled: PropTypes.bool,
  586. dropup: deprecated(PropTypes.bool, 'Please use the prop "direction" with the value "up".'),
  587. direction: PropTypes.oneOf(['up', 'down', 'left', 'right']),
  588. group: PropTypes.bool,
  589. isOpen: PropTypes.bool,
  590. nav: PropTypes.bool,
  591. active: PropTypes.bool,
  592. addonType: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['prepend', 'append'])]),
  593. size: PropTypes.string,
  594. tag: tagPropType,
  595. toggle: PropTypes.func,
  596. children: PropTypes.node,
  597. className: PropTypes.string,
  598. cssModule: PropTypes.object,
  599. inNavbar: PropTypes.bool,
  600. setActiveFromChild: PropTypes.bool
  601. };
  602. var defaultProps$8 = {
  603. isOpen: false,
  604. direction: 'down',
  605. nav: false,
  606. active: false,
  607. addonType: false,
  608. inNavbar: false,
  609. setActiveFromChild: false
  610. };
  611. var childContextTypes = {
  612. toggle: PropTypes.func.isRequired,
  613. isOpen: PropTypes.bool.isRequired,
  614. direction: PropTypes.oneOf(['up', 'down', 'left', 'right']).isRequired,
  615. inNavbar: PropTypes.bool.isRequired
  616. };
  617. var Dropdown =
  618. /*#__PURE__*/
  619. function (_React$Component) {
  620. _inheritsLoose(Dropdown, _React$Component);
  621. function Dropdown(props) {
  622. var _this;
  623. _this = _React$Component.call(this, props) || this;
  624. _this.addEvents = _this.addEvents.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  625. _this.handleDocumentClick = _this.handleDocumentClick.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  626. _this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  627. _this.removeEvents = _this.removeEvents.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  628. _this.toggle = _this.toggle.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  629. return _this;
  630. }
  631. var _proto = Dropdown.prototype;
  632. _proto.getChildContext = function getChildContext() {
  633. return {
  634. toggle: this.props.toggle,
  635. isOpen: this.props.isOpen,
  636. direction: this.props.direction === 'down' && this.props.dropup ? 'up' : this.props.direction,
  637. inNavbar: this.props.inNavbar
  638. };
  639. };
  640. _proto.componentDidMount = function componentDidMount() {
  641. this.handleProps();
  642. };
  643. _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
  644. if (this.props.isOpen !== prevProps.isOpen) {
  645. this.handleProps();
  646. }
  647. };
  648. _proto.componentWillUnmount = function componentWillUnmount() {
  649. this.removeEvents();
  650. };
  651. _proto.getContainer = function getContainer() {
  652. if (this._$container) return this._$container;
  653. this._$container = ReactDOM.findDOMNode(this);
  654. return ReactDOM.findDOMNode(this);
  655. };
  656. _proto.getMenuCtrl = function getMenuCtrl() {
  657. if (this._$menuCtrl) return this._$menuCtrl;
  658. this._$menuCtrl = this.getContainer().querySelector('[aria-expanded]');
  659. return this._$menuCtrl;
  660. };
  661. _proto.getMenuItems = function getMenuItems() {
  662. return [].slice.call(this.getContainer().querySelectorAll('[role="menuitem"]'));
  663. };
  664. _proto.addEvents = function addEvents() {
  665. var _this2 = this;
  666. ['click', 'touchstart', 'keyup'].forEach(function (event) {
  667. return document.addEventListener(event, _this2.handleDocumentClick, true);
  668. });
  669. };
  670. _proto.removeEvents = function removeEvents() {
  671. var _this3 = this;
  672. ['click', 'touchstart', 'keyup'].forEach(function (event) {
  673. return document.removeEventListener(event, _this3.handleDocumentClick, true);
  674. });
  675. };
  676. _proto.handleDocumentClick = function handleDocumentClick(e) {
  677. if (e && (e.which === 3 || e.type === 'keyup' && e.which !== keyCodes.tab)) return;
  678. var container = this.getContainer();
  679. if (container.contains(e.target) && container !== e.target && (e.type !== 'keyup' || e.which === keyCodes.tab)) {
  680. return;
  681. }
  682. this.toggle(e);
  683. };
  684. _proto.handleKeyDown = function handleKeyDown(e) {
  685. var _this4 = this;
  686. if (/input|textarea/i.test(e.target.tagName) || keyCodes.tab === e.which && e.target.getAttribute('role') !== 'menuitem') {
  687. return;
  688. }
  689. e.preventDefault();
  690. if (this.props.disabled) return;
  691. if (this.getMenuCtrl() === e.target) {
  692. if (!this.props.isOpen && [keyCodes.space, keyCodes.enter, keyCodes.up, keyCodes.down].indexOf(e.which) > -1) {
  693. this.toggle(e);
  694. setTimeout(function () {
  695. return _this4.getMenuItems()[0].focus();
  696. });
  697. }
  698. }
  699. if (this.props.isOpen && e.target.getAttribute('role') === 'menuitem') {
  700. if ([keyCodes.tab, keyCodes.esc].indexOf(e.which) > -1) {
  701. this.toggle(e);
  702. this.getMenuCtrl().focus();
  703. } else if ([keyCodes.space, keyCodes.enter].indexOf(e.which) > -1) {
  704. e.target.click();
  705. this.getMenuCtrl().focus();
  706. } else if ([keyCodes.down, keyCodes.up].indexOf(e.which) > -1 || [keyCodes.n, keyCodes.p].indexOf(e.which) > -1 && e.ctrlKey) {
  707. var $menuitems = this.getMenuItems();
  708. var index = $menuitems.indexOf(e.target);
  709. if (keyCodes.up === e.which || keyCodes.p === e.which && e.ctrlKey) {
  710. index = index !== 0 ? index - 1 : $menuitems.length - 1;
  711. } else if (keyCodes.down === e.which || keyCodes.n === e.which && e.ctrlKey) {
  712. index = index === $menuitems.length - 1 ? 0 : index + 1;
  713. }
  714. $menuitems[index].focus();
  715. } else if (keyCodes.end === e.which) {
  716. var _$menuitems = this.getMenuItems();
  717. _$menuitems[_$menuitems.length - 1].focus();
  718. } else if (keyCodes.home === e.which) {
  719. var _$menuitems2 = this.getMenuItems();
  720. _$menuitems2[0].focus();
  721. } else if (e.which >= 48 && e.which <= 90) {
  722. var _$menuitems3 = this.getMenuItems();
  723. var charPressed = String.fromCharCode(e.which).toLowerCase();
  724. for (var i = 0; i < _$menuitems3.length; i += 1) {
  725. var firstLetter = _$menuitems3[i].textContent && _$menuitems3[i].textContent[0].toLowerCase();
  726. if (firstLetter === charPressed) {
  727. _$menuitems3[i].focus();
  728. break;
  729. }
  730. }
  731. }
  732. }
  733. };
  734. _proto.handleProps = function handleProps() {
  735. if (this.props.isOpen) {
  736. this.addEvents();
  737. } else {
  738. this.removeEvents();
  739. }
  740. };
  741. _proto.toggle = function toggle(e) {
  742. if (this.props.disabled) {
  743. return e && e.preventDefault();
  744. }
  745. return this.props.toggle(e);
  746. };
  747. _proto.render = function render() {
  748. var _classNames;
  749. var _omit = omit(this.props, ['toggle', 'disabled', 'inNavbar', 'direction']),
  750. className = _omit.className,
  751. cssModule = _omit.cssModule,
  752. dropup = _omit.dropup,
  753. isOpen = _omit.isOpen,
  754. group = _omit.group,
  755. size = _omit.size,
  756. nav = _omit.nav,
  757. setActiveFromChild = _omit.setActiveFromChild,
  758. active = _omit.active,
  759. addonType = _omit.addonType,
  760. attrs = _objectWithoutPropertiesLoose(_omit, ["className", "cssModule", "dropup", "isOpen", "group", "size", "nav", "setActiveFromChild", "active", "addonType"]);
  761. var direction = this.props.direction === 'down' && dropup ? 'up' : this.props.direction;
  762. attrs.tag = attrs.tag || (nav ? 'li' : 'div');
  763. var subItemIsActive = false;
  764. if (setActiveFromChild) {
  765. React.Children.map(this.props.children[1].props.children, function (dropdownItem) {
  766. if (dropdownItem && dropdownItem.props.active) subItemIsActive = true;
  767. });
  768. }
  769. var classes = mapToCssModules(classNames(className, direction !== 'down' && "drop" + direction, nav && active ? 'active' : false, setActiveFromChild && subItemIsActive ? 'active' : false, (_classNames = {}, _classNames["input-group-" + addonType] = addonType, _classNames['btn-group'] = group, _classNames["btn-group-" + size] = !!size, _classNames.dropdown = !group && !addonType, _classNames.show = isOpen, _classNames['nav-item'] = nav, _classNames)), cssModule);
  770. return React.createElement(Manager, _extends({}, attrs, {
  771. className: classes,
  772. onKeyDown: this.handleKeyDown
  773. }));
  774. };
  775. return Dropdown;
  776. }(React.Component);
  777. Dropdown.propTypes = propTypes$8;
  778. Dropdown.defaultProps = defaultProps$8;
  779. Dropdown.childContextTypes = childContextTypes;
  780. function NavDropdown(props) {
  781. warnOnce('The "NavDropdown" component has been deprecated.\nPlease use component "Dropdown" with nav prop.');
  782. return React.createElement(Dropdown, _extends({
  783. nav: true
  784. }, props));
  785. }
  786. var propTypes$9 = {
  787. tag: tagPropType,
  788. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
  789. disabled: PropTypes.bool,
  790. active: PropTypes.bool,
  791. className: PropTypes.string,
  792. cssModule: PropTypes.object,
  793. onClick: PropTypes.func,
  794. href: PropTypes.any
  795. };
  796. var defaultProps$9 = {
  797. tag: 'a'
  798. };
  799. var NavLink =
  800. /*#__PURE__*/
  801. function (_React$Component) {
  802. _inheritsLoose(NavLink, _React$Component);
  803. function NavLink(props) {
  804. var _this;
  805. _this = _React$Component.call(this, props) || this;
  806. _this.onClick = _this.onClick.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  807. return _this;
  808. }
  809. var _proto = NavLink.prototype;
  810. _proto.onClick = function onClick(e) {
  811. if (this.props.disabled) {
  812. e.preventDefault();
  813. return;
  814. }
  815. if (this.props.href === '#') {
  816. e.preventDefault();
  817. }
  818. if (this.props.onClick) {
  819. this.props.onClick(e);
  820. }
  821. };
  822. _proto.render = function render() {
  823. var _this$props = this.props,
  824. className = _this$props.className,
  825. cssModule = _this$props.cssModule,
  826. active = _this$props.active,
  827. Tag = _this$props.tag,
  828. innerRef = _this$props.innerRef,
  829. attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "cssModule", "active", "tag", "innerRef"]);
  830. var classes = mapToCssModules(classNames(className, 'nav-link', {
  831. disabled: attributes.disabled,
  832. active: active
  833. }), cssModule);
  834. return React.createElement(Tag, _extends({}, attributes, {
  835. ref: innerRef,
  836. onClick: this.onClick,
  837. className: classes
  838. }));
  839. };
  840. return NavLink;
  841. }(React.Component);
  842. NavLink.propTypes = propTypes$9;
  843. NavLink.defaultProps = defaultProps$9;
  844. var propTypes$a = {
  845. tag: tagPropType,
  846. listTag: tagPropType,
  847. className: PropTypes.string,
  848. listClassName: PropTypes.string,
  849. cssModule: PropTypes.object,
  850. children: PropTypes.node,
  851. 'aria-label': PropTypes.string
  852. };
  853. var defaultProps$a = {
  854. tag: 'nav',
  855. listTag: 'ol',
  856. 'aria-label': 'breadcrumb'
  857. };
  858. var Breadcrumb = function Breadcrumb(props) {
  859. var className = props.className,
  860. listClassName = props.listClassName,
  861. cssModule = props.cssModule,
  862. children = props.children,
  863. Tag = props.tag,
  864. ListTag = props.listTag,
  865. label = props['aria-label'],
  866. attributes = _objectWithoutPropertiesLoose(props, ["className", "listClassName", "cssModule", "children", "tag", "listTag", "aria-label"]);
  867. var classes = mapToCssModules(classNames(className), cssModule);
  868. var listClasses = mapToCssModules(classNames('breadcrumb', listClassName), cssModule);
  869. return React.createElement(Tag, _extends({}, attributes, {
  870. className: classes,
  871. "aria-label": label
  872. }), React.createElement(ListTag, {
  873. className: listClasses
  874. }, children));
  875. };
  876. Breadcrumb.propTypes = propTypes$a;
  877. Breadcrumb.defaultProps = defaultProps$a;
  878. var propTypes$b = {
  879. tag: tagPropType,
  880. active: PropTypes.bool,
  881. className: PropTypes.string,
  882. cssModule: PropTypes.object
  883. };
  884. var defaultProps$b = {
  885. tag: 'li'
  886. };
  887. var BreadcrumbItem = function BreadcrumbItem(props) {
  888. var className = props.className,
  889. cssModule = props.cssModule,
  890. active = props.active,
  891. Tag = props.tag,
  892. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "active", "tag"]);
  893. var classes = mapToCssModules(classNames(className, active ? 'active' : false, 'breadcrumb-item'), cssModule);
  894. return React.createElement(Tag, _extends({}, attributes, {
  895. className: classes,
  896. "aria-current": active ? 'page' : undefined
  897. }));
  898. };
  899. BreadcrumbItem.propTypes = propTypes$b;
  900. BreadcrumbItem.defaultProps = defaultProps$b;
  901. var propTypes$c = {
  902. active: PropTypes.bool,
  903. 'aria-label': PropTypes.string,
  904. block: PropTypes.bool,
  905. color: PropTypes.string,
  906. disabled: PropTypes.bool,
  907. outline: PropTypes.bool,
  908. tag: tagPropType,
  909. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
  910. onClick: PropTypes.func,
  911. size: PropTypes.string,
  912. children: PropTypes.node,
  913. className: PropTypes.string,
  914. cssModule: PropTypes.object,
  915. close: PropTypes.bool
  916. };
  917. var defaultProps$c = {
  918. color: 'secondary',
  919. tag: 'button'
  920. };
  921. var Button =
  922. /*#__PURE__*/
  923. function (_React$Component) {
  924. _inheritsLoose(Button, _React$Component);
  925. function Button(props) {
  926. var _this;
  927. _this = _React$Component.call(this, props) || this;
  928. _this.onClick = _this.onClick.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  929. return _this;
  930. }
  931. var _proto = Button.prototype;
  932. _proto.onClick = function onClick(e) {
  933. if (this.props.disabled) {
  934. e.preventDefault();
  935. return;
  936. }
  937. if (this.props.onClick) {
  938. this.props.onClick(e);
  939. }
  940. };
  941. _proto.render = function render() {
  942. var _this$props = this.props,
  943. active = _this$props.active,
  944. ariaLabel = _this$props['aria-label'],
  945. block = _this$props.block,
  946. className = _this$props.className,
  947. close = _this$props.close,
  948. cssModule = _this$props.cssModule,
  949. color = _this$props.color,
  950. outline = _this$props.outline,
  951. size = _this$props.size,
  952. Tag = _this$props.tag,
  953. innerRef = _this$props.innerRef,
  954. attributes = _objectWithoutPropertiesLoose(_this$props, ["active", "aria-label", "block", "className", "close", "cssModule", "color", "outline", "size", "tag", "innerRef"]);
  955. if (close && typeof attributes.children === 'undefined') {
  956. attributes.children = React.createElement("span", {
  957. "aria-hidden": true
  958. }, "\xD7");
  959. }
  960. var btnOutlineColor = "btn" + (outline ? '-outline' : '') + "-" + color;
  961. var classes = mapToCssModules(classNames(className, {
  962. close: close
  963. }, close || 'btn', close || btnOutlineColor, size ? "btn-" + size : false, block ? 'btn-block' : false, {
  964. active: active,
  965. disabled: this.props.disabled
  966. }), cssModule);
  967. if (attributes.href && Tag === 'button') {
  968. Tag = 'a';
  969. }
  970. var defaultAriaLabel = close ? 'Close' : null;
  971. return React.createElement(Tag, _extends({
  972. type: Tag === 'button' && attributes.onClick ? 'button' : undefined
  973. }, attributes, {
  974. className: classes,
  975. ref: innerRef,
  976. onClick: this.onClick,
  977. "aria-label": ariaLabel || defaultAriaLabel
  978. }));
  979. };
  980. return Button;
  981. }(React.Component);
  982. Button.propTypes = propTypes$c;
  983. Button.defaultProps = defaultProps$c;
  984. var propTypes$d = {
  985. children: PropTypes.node
  986. };
  987. var ButtonDropdown = function ButtonDropdown(props) {
  988. return React.createElement(Dropdown, _extends({
  989. group: true
  990. }, props));
  991. };
  992. ButtonDropdown.propTypes = propTypes$d;
  993. var propTypes$e = {
  994. tag: tagPropType,
  995. 'aria-label': PropTypes.string,
  996. className: PropTypes.string,
  997. cssModule: PropTypes.object,
  998. role: PropTypes.string,
  999. size: PropTypes.string,
  1000. vertical: PropTypes.bool
  1001. };
  1002. var defaultProps$d = {
  1003. tag: 'div',
  1004. role: 'group'
  1005. };
  1006. var ButtonGroup = function ButtonGroup(props) {
  1007. var className = props.className,
  1008. cssModule = props.cssModule,
  1009. size = props.size,
  1010. vertical = props.vertical,
  1011. Tag = props.tag,
  1012. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "size", "vertical", "tag"]);
  1013. var classes = mapToCssModules(classNames(className, size ? 'btn-group-' + size : false, vertical ? 'btn-group-vertical' : 'btn-group'), cssModule);
  1014. return React.createElement(Tag, _extends({}, attributes, {
  1015. className: classes
  1016. }));
  1017. };
  1018. ButtonGroup.propTypes = propTypes$e;
  1019. ButtonGroup.defaultProps = defaultProps$d;
  1020. var propTypes$f = {
  1021. tag: tagPropType,
  1022. 'aria-label': PropTypes.string,
  1023. className: PropTypes.string,
  1024. cssModule: PropTypes.object,
  1025. role: PropTypes.string
  1026. };
  1027. var defaultProps$e = {
  1028. tag: 'div',
  1029. role: 'toolbar'
  1030. };
  1031. var ButtonToolbar = function ButtonToolbar(props) {
  1032. var className = props.className,
  1033. cssModule = props.cssModule,
  1034. Tag = props.tag,
  1035. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  1036. var classes = mapToCssModules(classNames(className, 'btn-toolbar'), cssModule);
  1037. return React.createElement(Tag, _extends({}, attributes, {
  1038. className: classes
  1039. }));
  1040. };
  1041. ButtonToolbar.propTypes = propTypes$f;
  1042. ButtonToolbar.defaultProps = defaultProps$e;
  1043. var propTypes$g = {
  1044. children: PropTypes.node,
  1045. active: PropTypes.bool,
  1046. disabled: PropTypes.bool,
  1047. divider: PropTypes.bool,
  1048. tag: tagPropType,
  1049. header: PropTypes.bool,
  1050. onClick: PropTypes.func,
  1051. className: PropTypes.string,
  1052. cssModule: PropTypes.object,
  1053. toggle: PropTypes.bool
  1054. };
  1055. var contextTypes = {
  1056. toggle: PropTypes.func
  1057. };
  1058. var defaultProps$f = {
  1059. tag: 'button',
  1060. toggle: true
  1061. };
  1062. var DropdownItem =
  1063. /*#__PURE__*/
  1064. function (_React$Component) {
  1065. _inheritsLoose(DropdownItem, _React$Component);
  1066. function DropdownItem(props) {
  1067. var _this;
  1068. _this = _React$Component.call(this, props) || this;
  1069. _this.onClick = _this.onClick.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1070. _this.getTabIndex = _this.getTabIndex.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1071. return _this;
  1072. }
  1073. var _proto = DropdownItem.prototype;
  1074. _proto.onClick = function onClick(e) {
  1075. if (this.props.disabled || this.props.header || this.props.divider) {
  1076. e.preventDefault();
  1077. return;
  1078. }
  1079. if (this.props.onClick) {
  1080. this.props.onClick(e);
  1081. }
  1082. if (this.props.toggle) {
  1083. this.context.toggle(e);
  1084. }
  1085. };
  1086. _proto.getTabIndex = function getTabIndex() {
  1087. if (this.props.disabled || this.props.header || this.props.divider) {
  1088. return '-1';
  1089. }
  1090. return '0';
  1091. };
  1092. _proto.render = function render() {
  1093. var tabIndex = this.getTabIndex();
  1094. var role = tabIndex > -1 ? 'menuitem' : undefined;
  1095. var _omit = omit(this.props, ['toggle']),
  1096. className = _omit.className,
  1097. cssModule = _omit.cssModule,
  1098. divider = _omit.divider,
  1099. Tag = _omit.tag,
  1100. header = _omit.header,
  1101. active = _omit.active,
  1102. props = _objectWithoutPropertiesLoose(_omit, ["className", "cssModule", "divider", "tag", "header", "active"]);
  1103. var classes = mapToCssModules(classNames(className, {
  1104. disabled: props.disabled,
  1105. 'dropdown-item': !divider && !header,
  1106. active: active,
  1107. 'dropdown-header': header,
  1108. 'dropdown-divider': divider
  1109. }), cssModule);
  1110. if (Tag === 'button') {
  1111. if (header) {
  1112. Tag = 'h6';
  1113. } else if (divider) {
  1114. Tag = 'div';
  1115. } else if (props.href) {
  1116. Tag = 'a';
  1117. }
  1118. }
  1119. return React.createElement(Tag, _extends({
  1120. type: Tag === 'button' && (props.onClick || this.props.toggle) ? 'button' : undefined
  1121. }, props, {
  1122. tabIndex: tabIndex,
  1123. role: role,
  1124. className: classes,
  1125. onClick: this.onClick
  1126. }));
  1127. };
  1128. return DropdownItem;
  1129. }(React.Component);
  1130. DropdownItem.propTypes = propTypes$g;
  1131. DropdownItem.defaultProps = defaultProps$f;
  1132. DropdownItem.contextTypes = contextTypes;
  1133. var propTypes$h = {
  1134. tag: tagPropType,
  1135. children: PropTypes.node.isRequired,
  1136. right: PropTypes.bool,
  1137. flip: PropTypes.bool,
  1138. modifiers: PropTypes.object,
  1139. className: PropTypes.string,
  1140. cssModule: PropTypes.object,
  1141. persist: PropTypes.bool
  1142. };
  1143. var defaultProps$g = {
  1144. tag: 'div',
  1145. flip: true
  1146. };
  1147. var contextTypes$1 = {
  1148. isOpen: PropTypes.bool.isRequired,
  1149. direction: PropTypes.oneOf(['up', 'down', 'left', 'right']).isRequired,
  1150. inNavbar: PropTypes.bool.isRequired
  1151. };
  1152. var noFlipModifier = {
  1153. flip: {
  1154. enabled: false
  1155. }
  1156. };
  1157. var directionPositionMap = {
  1158. up: 'top',
  1159. left: 'left',
  1160. right: 'right',
  1161. down: 'bottom'
  1162. };
  1163. var DropdownMenu = function DropdownMenu(props, context) {
  1164. var className = props.className,
  1165. cssModule = props.cssModule,
  1166. right = props.right,
  1167. tag = props.tag,
  1168. flip = props.flip,
  1169. modifiers = props.modifiers,
  1170. persist = props.persist,
  1171. attrs = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "right", "tag", "flip", "modifiers", "persist"]);
  1172. var classes = mapToCssModules(classNames(className, 'dropdown-menu', {
  1173. 'dropdown-menu-right': right,
  1174. show: context.isOpen
  1175. }), cssModule);
  1176. var Tag = tag;
  1177. if (persist || context.isOpen && !context.inNavbar) {
  1178. Tag = Popper;
  1179. var position1 = directionPositionMap[context.direction] || 'bottom';
  1180. var position2 = right ? 'end' : 'start';
  1181. attrs.placement = position1 + "-" + position2;
  1182. attrs.component = tag;
  1183. attrs.modifiers = !flip ? _extends({}, modifiers, noFlipModifier) : modifiers;
  1184. }
  1185. return React.createElement(Tag, _extends({
  1186. tabIndex: "-1",
  1187. role: "menu"
  1188. }, attrs, {
  1189. "aria-hidden": !context.isOpen,
  1190. className: classes,
  1191. "x-placement": attrs.placement
  1192. }));
  1193. };
  1194. DropdownMenu.propTypes = propTypes$h;
  1195. DropdownMenu.defaultProps = defaultProps$g;
  1196. DropdownMenu.contextTypes = contextTypes$1;
  1197. var propTypes$i = {
  1198. caret: PropTypes.bool,
  1199. color: PropTypes.string,
  1200. children: PropTypes.node,
  1201. className: PropTypes.string,
  1202. cssModule: PropTypes.object,
  1203. disabled: PropTypes.bool,
  1204. onClick: PropTypes.func,
  1205. 'aria-haspopup': PropTypes.bool,
  1206. split: PropTypes.bool,
  1207. tag: tagPropType,
  1208. nav: PropTypes.bool
  1209. };
  1210. var defaultProps$h = {
  1211. 'aria-haspopup': true,
  1212. color: 'secondary'
  1213. };
  1214. var contextTypes$2 = {
  1215. isOpen: PropTypes.bool.isRequired,
  1216. toggle: PropTypes.func.isRequired,
  1217. inNavbar: PropTypes.bool.isRequired
  1218. };
  1219. var DropdownToggle =
  1220. /*#__PURE__*/
  1221. function (_React$Component) {
  1222. _inheritsLoose(DropdownToggle, _React$Component);
  1223. function DropdownToggle(props) {
  1224. var _this;
  1225. _this = _React$Component.call(this, props) || this;
  1226. _this.onClick = _this.onClick.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1227. return _this;
  1228. }
  1229. var _proto = DropdownToggle.prototype;
  1230. _proto.onClick = function onClick(e) {
  1231. if (this.props.disabled) {
  1232. e.preventDefault();
  1233. return;
  1234. }
  1235. if (this.props.nav && !this.props.tag) {
  1236. e.preventDefault();
  1237. }
  1238. if (this.props.onClick) {
  1239. this.props.onClick(e);
  1240. }
  1241. this.context.toggle(e);
  1242. };
  1243. _proto.render = function render() {
  1244. var _this$props = this.props,
  1245. className = _this$props.className,
  1246. color = _this$props.color,
  1247. cssModule = _this$props.cssModule,
  1248. caret = _this$props.caret,
  1249. split = _this$props.split,
  1250. nav = _this$props.nav,
  1251. tag = _this$props.tag,
  1252. props = _objectWithoutPropertiesLoose(_this$props, ["className", "color", "cssModule", "caret", "split", "nav", "tag"]);
  1253. var ariaLabel = props['aria-label'] || 'Toggle Dropdown';
  1254. var classes = mapToCssModules(classNames(className, {
  1255. 'dropdown-toggle': caret || split,
  1256. 'dropdown-toggle-split': split,
  1257. 'nav-link': nav
  1258. }), cssModule);
  1259. var children = props.children || React.createElement("span", {
  1260. className: "sr-only"
  1261. }, ariaLabel);
  1262. var Tag;
  1263. if (nav && !tag) {
  1264. Tag = 'a';
  1265. props.href = '#';
  1266. } else if (!tag) {
  1267. Tag = Button;
  1268. props.color = color;
  1269. props.cssModule = cssModule;
  1270. } else {
  1271. Tag = tag;
  1272. }
  1273. if (this.context.inNavbar) {
  1274. return React.createElement(Tag, _extends({}, props, {
  1275. className: classes,
  1276. onClick: this.onClick,
  1277. "aria-expanded": this.context.isOpen,
  1278. children: children
  1279. }));
  1280. }
  1281. return React.createElement(Target, _extends({}, props, {
  1282. className: classes,
  1283. component: Tag,
  1284. onClick: this.onClick,
  1285. "aria-expanded": this.context.isOpen,
  1286. children: children
  1287. }));
  1288. };
  1289. return DropdownToggle;
  1290. }(React.Component);
  1291. DropdownToggle.propTypes = propTypes$i;
  1292. DropdownToggle.defaultProps = defaultProps$h;
  1293. DropdownToggle.contextTypes = contextTypes$2;
  1294. var propTypes$j = _extends({}, Transition.propTypes, {
  1295. children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
  1296. tag: tagPropType,
  1297. baseClass: PropTypes.string,
  1298. baseClassActive: PropTypes.string,
  1299. className: PropTypes.string,
  1300. cssModule: PropTypes.object,
  1301. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
  1302. });
  1303. var defaultProps$i = _extends({}, Transition.defaultProps, {
  1304. tag: 'div',
  1305. baseClass: 'fade',
  1306. baseClassActive: 'show',
  1307. timeout: TransitionTimeouts.Fade,
  1308. appear: true,
  1309. enter: true,
  1310. exit: true,
  1311. in: true
  1312. });
  1313. function Fade(props) {
  1314. var Tag = props.tag,
  1315. baseClass = props.baseClass,
  1316. baseClassActive = props.baseClassActive,
  1317. className = props.className,
  1318. cssModule = props.cssModule,
  1319. children = props.children,
  1320. innerRef = props.innerRef,
  1321. otherProps = _objectWithoutPropertiesLoose(props, ["tag", "baseClass", "baseClassActive", "className", "cssModule", "children", "innerRef"]);
  1322. var transitionProps = pick(otherProps, TransitionPropTypeKeys);
  1323. var childProps = omit(otherProps, TransitionPropTypeKeys);
  1324. return React.createElement(Transition, transitionProps, function (status) {
  1325. var isActive = status === 'entered';
  1326. var classes = mapToCssModules(classNames(className, baseClass, isActive && baseClassActive), cssModule);
  1327. return React.createElement(Tag, _extends({
  1328. className: classes
  1329. }, childProps, {
  1330. ref: innerRef
  1331. }), children);
  1332. });
  1333. }
  1334. Fade.propTypes = propTypes$j;
  1335. Fade.defaultProps = defaultProps$i;
  1336. var propTypes$k = {
  1337. color: PropTypes.string,
  1338. pill: PropTypes.bool,
  1339. tag: tagPropType,
  1340. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
  1341. children: PropTypes.node,
  1342. className: PropTypes.string,
  1343. cssModule: PropTypes.object
  1344. };
  1345. var defaultProps$j = {
  1346. color: 'secondary',
  1347. pill: false,
  1348. tag: 'span'
  1349. };
  1350. var Badge = function Badge(props) {
  1351. var className = props.className,
  1352. cssModule = props.cssModule,
  1353. color = props.color,
  1354. innerRef = props.innerRef,
  1355. pill = props.pill,
  1356. Tag = props.tag,
  1357. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "color", "innerRef", "pill", "tag"]);
  1358. var classes = mapToCssModules(classNames(className, 'badge', 'badge-' + color, pill ? 'badge-pill' : false), cssModule);
  1359. if (attributes.href && Tag === 'span') {
  1360. Tag = 'a';
  1361. }
  1362. return React.createElement(Tag, _extends({}, attributes, {
  1363. className: classes,
  1364. ref: innerRef
  1365. }));
  1366. };
  1367. Badge.propTypes = propTypes$k;
  1368. Badge.defaultProps = defaultProps$j;
  1369. var propTypes$l = {
  1370. tag: tagPropType,
  1371. inverse: PropTypes.bool,
  1372. color: PropTypes.string,
  1373. block: deprecated(PropTypes.bool, 'Please use the props "body"'),
  1374. body: PropTypes.bool,
  1375. outline: PropTypes.bool,
  1376. className: PropTypes.string,
  1377. cssModule: PropTypes.object,
  1378. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
  1379. };
  1380. var defaultProps$k = {
  1381. tag: 'div'
  1382. };
  1383. var Card = function Card(props) {
  1384. var className = props.className,
  1385. cssModule = props.cssModule,
  1386. color = props.color,
  1387. block = props.block,
  1388. body = props.body,
  1389. inverse = props.inverse,
  1390. outline = props.outline,
  1391. Tag = props.tag,
  1392. innerRef = props.innerRef,
  1393. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "color", "block", "body", "inverse", "outline", "tag", "innerRef"]);
  1394. var classes = mapToCssModules(classNames(className, 'card', inverse ? 'text-white' : false, block || body ? 'card-body' : false, color ? (outline ? 'border' : 'bg') + "-" + color : false), cssModule);
  1395. return React.createElement(Tag, _extends({}, attributes, {
  1396. className: classes,
  1397. ref: innerRef
  1398. }));
  1399. };
  1400. Card.propTypes = propTypes$l;
  1401. Card.defaultProps = defaultProps$k;
  1402. var propTypes$m = {
  1403. tag: tagPropType,
  1404. className: PropTypes.string,
  1405. cssModule: PropTypes.object
  1406. };
  1407. var defaultProps$l = {
  1408. tag: 'div'
  1409. };
  1410. var CardGroup = function CardGroup(props) {
  1411. var className = props.className,
  1412. cssModule = props.cssModule,
  1413. Tag = props.tag,
  1414. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  1415. var classes = mapToCssModules(classNames(className, 'card-group'), cssModule);
  1416. return React.createElement(Tag, _extends({}, attributes, {
  1417. className: classes
  1418. }));
  1419. };
  1420. CardGroup.propTypes = propTypes$m;
  1421. CardGroup.defaultProps = defaultProps$l;
  1422. var propTypes$n = {
  1423. tag: tagPropType,
  1424. className: PropTypes.string,
  1425. cssModule: PropTypes.object
  1426. };
  1427. var defaultProps$m = {
  1428. tag: 'div'
  1429. };
  1430. var CardDeck = function CardDeck(props) {
  1431. var className = props.className,
  1432. cssModule = props.cssModule,
  1433. Tag = props.tag,
  1434. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  1435. var classes = mapToCssModules(classNames(className, 'card-deck'), cssModule);
  1436. return React.createElement(Tag, _extends({}, attributes, {
  1437. className: classes
  1438. }));
  1439. };
  1440. CardDeck.propTypes = propTypes$n;
  1441. CardDeck.defaultProps = defaultProps$m;
  1442. var propTypes$o = {
  1443. tag: tagPropType,
  1444. className: PropTypes.string,
  1445. cssModule: PropTypes.object
  1446. };
  1447. var defaultProps$n = {
  1448. tag: 'div'
  1449. };
  1450. var CardColumns = function CardColumns(props) {
  1451. var className = props.className,
  1452. cssModule = props.cssModule,
  1453. Tag = props.tag,
  1454. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  1455. var classes = mapToCssModules(classNames(className, 'card-columns'), cssModule);
  1456. return React.createElement(Tag, _extends({}, attributes, {
  1457. className: classes
  1458. }));
  1459. };
  1460. CardColumns.propTypes = propTypes$o;
  1461. CardColumns.defaultProps = defaultProps$n;
  1462. var propTypes$p = {
  1463. tag: tagPropType,
  1464. className: PropTypes.string,
  1465. cssModule: PropTypes.object,
  1466. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
  1467. };
  1468. var defaultProps$o = {
  1469. tag: 'div'
  1470. };
  1471. var CardBody = function CardBody(props) {
  1472. var className = props.className,
  1473. cssModule = props.cssModule,
  1474. innerRef = props.innerRef,
  1475. Tag = props.tag,
  1476. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "innerRef", "tag"]);
  1477. var classes = mapToCssModules(classNames(className, 'card-body'), cssModule);
  1478. return React.createElement(Tag, _extends({}, attributes, {
  1479. className: classes,
  1480. ref: innerRef
  1481. }));
  1482. };
  1483. CardBody.propTypes = propTypes$p;
  1484. CardBody.defaultProps = defaultProps$o;
  1485. function CardBlock(props) {
  1486. warnOnce('The "CardBlock" component has been deprecated.\nPlease use component "CardBody".');
  1487. return React.createElement(CardBody, props);
  1488. }
  1489. var propTypes$q = {
  1490. tag: tagPropType,
  1491. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
  1492. className: PropTypes.string,
  1493. cssModule: PropTypes.object
  1494. };
  1495. var defaultProps$p = {
  1496. tag: 'a'
  1497. };
  1498. var CardLink = function CardLink(props) {
  1499. var className = props.className,
  1500. cssModule = props.cssModule,
  1501. Tag = props.tag,
  1502. innerRef = props.innerRef,
  1503. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "innerRef"]);
  1504. var classes = mapToCssModules(classNames(className, 'card-link'), cssModule);
  1505. return React.createElement(Tag, _extends({}, attributes, {
  1506. ref: innerRef,
  1507. className: classes
  1508. }));
  1509. };
  1510. CardLink.propTypes = propTypes$q;
  1511. CardLink.defaultProps = defaultProps$p;
  1512. var propTypes$r = {
  1513. tag: tagPropType,
  1514. className: PropTypes.string,
  1515. cssModule: PropTypes.object
  1516. };
  1517. var defaultProps$q = {
  1518. tag: 'div'
  1519. };
  1520. var CardFooter = function CardFooter(props) {
  1521. var className = props.className,
  1522. cssModule = props.cssModule,
  1523. Tag = props.tag,
  1524. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  1525. var classes = mapToCssModules(classNames(className, 'card-footer'), cssModule);
  1526. return React.createElement(Tag, _extends({}, attributes, {
  1527. className: classes
  1528. }));
  1529. };
  1530. CardFooter.propTypes = propTypes$r;
  1531. CardFooter.defaultProps = defaultProps$q;
  1532. var propTypes$s = {
  1533. tag: tagPropType,
  1534. className: PropTypes.string,
  1535. cssModule: PropTypes.object
  1536. };
  1537. var defaultProps$r = {
  1538. tag: 'div'
  1539. };
  1540. var CardHeader = function CardHeader(props) {
  1541. var className = props.className,
  1542. cssModule = props.cssModule,
  1543. Tag = props.tag,
  1544. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  1545. var classes = mapToCssModules(classNames(className, 'card-header'), cssModule);
  1546. return React.createElement(Tag, _extends({}, attributes, {
  1547. className: classes
  1548. }));
  1549. };
  1550. CardHeader.propTypes = propTypes$s;
  1551. CardHeader.defaultProps = defaultProps$r;
  1552. var propTypes$t = {
  1553. tag: tagPropType,
  1554. top: PropTypes.bool,
  1555. bottom: PropTypes.bool,
  1556. className: PropTypes.string,
  1557. cssModule: PropTypes.object
  1558. };
  1559. var defaultProps$s = {
  1560. tag: 'img'
  1561. };
  1562. var CardImg = function CardImg(props) {
  1563. var className = props.className,
  1564. cssModule = props.cssModule,
  1565. top = props.top,
  1566. bottom = props.bottom,
  1567. Tag = props.tag,
  1568. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "top", "bottom", "tag"]);
  1569. var cardImgClassName = 'card-img';
  1570. if (top) {
  1571. cardImgClassName = 'card-img-top';
  1572. }
  1573. if (bottom) {
  1574. cardImgClassName = 'card-img-bottom';
  1575. }
  1576. var classes = mapToCssModules(classNames(className, cardImgClassName), cssModule);
  1577. return React.createElement(Tag, _extends({}, attributes, {
  1578. className: classes
  1579. }));
  1580. };
  1581. CardImg.propTypes = propTypes$t;
  1582. CardImg.defaultProps = defaultProps$s;
  1583. var propTypes$u = {
  1584. tag: tagPropType,
  1585. className: PropTypes.string,
  1586. cssModule: PropTypes.object
  1587. };
  1588. var defaultProps$t = {
  1589. tag: 'div'
  1590. };
  1591. var CardImgOverlay = function CardImgOverlay(props) {
  1592. var className = props.className,
  1593. cssModule = props.cssModule,
  1594. Tag = props.tag,
  1595. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  1596. var classes = mapToCssModules(classNames(className, 'card-img-overlay'), cssModule);
  1597. return React.createElement(Tag, _extends({}, attributes, {
  1598. className: classes
  1599. }));
  1600. };
  1601. CardImgOverlay.propTypes = propTypes$u;
  1602. CardImgOverlay.defaultProps = defaultProps$t;
  1603. var CarouselItem =
  1604. /*#__PURE__*/
  1605. function (_React$Component) {
  1606. _inheritsLoose(CarouselItem, _React$Component);
  1607. function CarouselItem(props) {
  1608. var _this;
  1609. _this = _React$Component.call(this, props) || this;
  1610. _this.state = {
  1611. startAnimation: false
  1612. };
  1613. _this.onEnter = _this.onEnter.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1614. _this.onEntering = _this.onEntering.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1615. _this.onExit = _this.onExit.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1616. _this.onExiting = _this.onExiting.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1617. _this.onExited = _this.onExited.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1618. return _this;
  1619. }
  1620. var _proto = CarouselItem.prototype;
  1621. _proto.onEnter = function onEnter(node, isAppearing) {
  1622. this.setState({
  1623. startAnimation: false
  1624. });
  1625. this.props.onEnter(node, isAppearing);
  1626. };
  1627. _proto.onEntering = function onEntering(node, isAppearing) {
  1628. // getting this variable triggers a reflow
  1629. var offsetHeight = node.offsetHeight;
  1630. this.setState({
  1631. startAnimation: true
  1632. });
  1633. this.props.onEntering(node, isAppearing);
  1634. return offsetHeight;
  1635. };
  1636. _proto.onExit = function onExit(node) {
  1637. this.setState({
  1638. startAnimation: false
  1639. });
  1640. this.props.onExit(node);
  1641. };
  1642. _proto.onExiting = function onExiting(node) {
  1643. this.setState({
  1644. startAnimation: true
  1645. });
  1646. node.dispatchEvent(new CustomEvent('slide.bs.carousel'));
  1647. this.props.onExiting(node);
  1648. };
  1649. _proto.onExited = function onExited(node) {
  1650. node.dispatchEvent(new CustomEvent('slid.bs.carousel'));
  1651. this.props.onExited(node);
  1652. };
  1653. _proto.render = function render() {
  1654. var _this2 = this;
  1655. var _this$props = this.props,
  1656. isIn = _this$props.in,
  1657. children = _this$props.children,
  1658. cssModule = _this$props.cssModule,
  1659. slide = _this$props.slide,
  1660. Tag = _this$props.tag,
  1661. className = _this$props.className,
  1662. transitionProps = _objectWithoutPropertiesLoose(_this$props, ["in", "children", "cssModule", "slide", "tag", "className"]);
  1663. return React.createElement(Transition, _extends({}, transitionProps, {
  1664. enter: slide,
  1665. exit: slide,
  1666. in: isIn,
  1667. onEnter: this.onEnter,
  1668. onEntering: this.onEntering,
  1669. onExit: this.onExit,
  1670. onExiting: this.onExiting,
  1671. onExited: this.onExited
  1672. }), function (status) {
  1673. var direction = _this2.context.direction;
  1674. var isActive = status === TransitionStatuses.ENTERED || status === TransitionStatuses.EXITING;
  1675. var directionClassName = (status === TransitionStatuses.ENTERING || status === TransitionStatuses.EXITING) && _this2.state.startAnimation && (direction === 'right' ? 'carousel-item-left' : 'carousel-item-right');
  1676. var orderClassName = status === TransitionStatuses.ENTERING && (direction === 'right' ? 'carousel-item-next' : 'carousel-item-prev');
  1677. var itemClasses = mapToCssModules(classNames(className, 'carousel-item', isActive && 'active', directionClassName, orderClassName), cssModule);
  1678. return React.createElement(Tag, {
  1679. className: itemClasses
  1680. }, children);
  1681. });
  1682. };
  1683. return CarouselItem;
  1684. }(React.Component);
  1685. CarouselItem.propTypes = _extends({}, Transition.propTypes, {
  1686. tag: tagPropType,
  1687. in: PropTypes.bool,
  1688. cssModule: PropTypes.object,
  1689. children: PropTypes.node,
  1690. slide: PropTypes.bool,
  1691. className: PropTypes.string
  1692. });
  1693. CarouselItem.defaultProps = _extends({}, Transition.defaultProps, {
  1694. tag: 'div',
  1695. timeout: TransitionTimeouts.Carousel,
  1696. slide: true
  1697. });
  1698. CarouselItem.contextTypes = {
  1699. direction: PropTypes.string
  1700. };
  1701. var Carousel =
  1702. /*#__PURE__*/
  1703. function (_React$Component) {
  1704. _inheritsLoose(Carousel, _React$Component);
  1705. function Carousel(props) {
  1706. var _this;
  1707. _this = _React$Component.call(this, props) || this;
  1708. _this.handleKeyPress = _this.handleKeyPress.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1709. _this.renderItems = _this.renderItems.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1710. _this.hoverStart = _this.hoverStart.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1711. _this.hoverEnd = _this.hoverEnd.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1712. _this.state = {
  1713. direction: 'right',
  1714. indicatorClicked: false
  1715. };
  1716. return _this;
  1717. }
  1718. var _proto = Carousel.prototype;
  1719. _proto.getChildContext = function getChildContext() {
  1720. return {
  1721. direction: this.state.direction
  1722. };
  1723. };
  1724. _proto.componentDidMount = function componentDidMount() {
  1725. // Set up the cycle
  1726. if (this.props.ride === 'carousel') {
  1727. this.setInterval();
  1728. } // TODO: move this to the specific carousel like bootstrap. Currently it will trigger ALL carousels on the page.
  1729. document.addEventListener('keyup', this.handleKeyPress);
  1730. };
  1731. _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
  1732. this.setInterval(nextProps); // Calculate the direction to turn
  1733. if (this.props.activeIndex + 1 === nextProps.activeIndex) {
  1734. this.setState({
  1735. direction: 'right'
  1736. });
  1737. } else if (this.props.activeIndex - 1 === nextProps.activeIndex) {
  1738. this.setState({
  1739. direction: 'left'
  1740. });
  1741. } else if (this.props.activeIndex > nextProps.activeIndex) {
  1742. this.setState({
  1743. direction: this.state.indicatorClicked ? 'left' : 'right'
  1744. });
  1745. } else if (this.props.activeIndex !== nextProps.activeIndex) {
  1746. this.setState({
  1747. direction: this.state.indicatorClicked ? 'right' : 'left'
  1748. });
  1749. }
  1750. this.setState({
  1751. indicatorClicked: false
  1752. });
  1753. };
  1754. _proto.componentWillUnmount = function componentWillUnmount() {
  1755. this.clearInterval();
  1756. document.removeEventListener('keyup', this.handleKeyPress);
  1757. };
  1758. _proto.setInterval = function (_setInterval) {
  1759. function setInterval() {
  1760. return _setInterval.apply(this, arguments);
  1761. }
  1762. setInterval.toString = function () {
  1763. return _setInterval.toString();
  1764. };
  1765. return setInterval;
  1766. }(function (props) {
  1767. if (props === void 0) {
  1768. props = this.props;
  1769. }
  1770. // make sure not to have multiple intervals going...
  1771. this.clearInterval();
  1772. if (props.interval) {
  1773. this.cycleInterval = setInterval(function () {
  1774. props.next();
  1775. }, parseInt(props.interval, 10));
  1776. }
  1777. });
  1778. _proto.clearInterval = function (_clearInterval) {
  1779. function clearInterval() {
  1780. return _clearInterval.apply(this, arguments);
  1781. }
  1782. clearInterval.toString = function () {
  1783. return _clearInterval.toString();
  1784. };
  1785. return clearInterval;
  1786. }(function () {
  1787. clearInterval(this.cycleInterval);
  1788. });
  1789. _proto.hoverStart = function hoverStart() {
  1790. if (this.props.pause === 'hover') {
  1791. this.clearInterval();
  1792. }
  1793. if (this.props.mouseEnter) {
  1794. var _this$props;
  1795. (_this$props = this.props).mouseEnter.apply(_this$props, arguments);
  1796. }
  1797. };
  1798. _proto.hoverEnd = function hoverEnd() {
  1799. if (this.props.pause === 'hover') {
  1800. this.setInterval();
  1801. }
  1802. if (this.props.mouseLeave) {
  1803. var _this$props2;
  1804. (_this$props2 = this.props).mouseLeave.apply(_this$props2, arguments);
  1805. }
  1806. };
  1807. _proto.handleKeyPress = function handleKeyPress(evt) {
  1808. if (this.props.keyboard) {
  1809. if (evt.keyCode === 37) {
  1810. this.props.previous();
  1811. } else if (evt.keyCode === 39) {
  1812. this.props.next();
  1813. }
  1814. }
  1815. };
  1816. _proto.renderItems = function renderItems(carouselItems, className) {
  1817. var _this2 = this;
  1818. var slide = this.props.slide;
  1819. return React.createElement("div", {
  1820. role: "listbox",
  1821. className: className
  1822. }, carouselItems.map(function (item, index) {
  1823. var isIn = index === _this2.props.activeIndex;
  1824. return React.cloneElement(item, {
  1825. in: isIn,
  1826. slide: slide
  1827. });
  1828. }));
  1829. };
  1830. _proto.render = function render() {
  1831. var _this3 = this;
  1832. var _this$props3 = this.props,
  1833. cssModule = _this$props3.cssModule,
  1834. slide = _this$props3.slide,
  1835. className = _this$props3.className;
  1836. var outerClasses = mapToCssModules(classNames(className, 'carousel', slide && 'slide'), cssModule);
  1837. var innerClasses = mapToCssModules(classNames('carousel-inner'), cssModule); // filter out booleans, null, or undefined
  1838. var children = this.props.children.filter(function (child) {
  1839. return child !== null && child !== undefined && typeof child !== 'boolean';
  1840. });
  1841. var slidesOnly = children.every(function (child) {
  1842. return child.type === CarouselItem;
  1843. }); // Rendering only slides
  1844. if (slidesOnly) {
  1845. return React.createElement("div", {
  1846. className: outerClasses,
  1847. onMouseEnter: this.hoverStart,
  1848. onMouseLeave: this.hoverEnd
  1849. }, this.renderItems(children, innerClasses));
  1850. } // Rendering slides and controls
  1851. if (children[0] instanceof Array) {
  1852. var _carouselItems = children[0];
  1853. var _controlLeft = children[1];
  1854. var _controlRight = children[2];
  1855. return React.createElement("div", {
  1856. className: outerClasses,
  1857. onMouseEnter: this.hoverStart,
  1858. onMouseLeave: this.hoverEnd
  1859. }, this.renderItems(_carouselItems, innerClasses), _controlLeft, _controlRight);
  1860. } // Rendering indicators, slides and controls
  1861. var indicators = children[0];
  1862. var wrappedOnClick = function wrappedOnClick(e) {
  1863. if (typeof indicators.props.onClickHandler === 'function') {
  1864. _this3.setState({
  1865. indicatorClicked: true
  1866. }, function () {
  1867. return indicators.props.onClickHandler(e);
  1868. });
  1869. }
  1870. };
  1871. var wrappedIndicators = React.cloneElement(indicators, {
  1872. onClickHandler: wrappedOnClick
  1873. });
  1874. var carouselItems = children[1];
  1875. var controlLeft = children[2];
  1876. var controlRight = children[3];
  1877. return React.createElement("div", {
  1878. className: outerClasses,
  1879. onMouseEnter: this.hoverStart,
  1880. onMouseLeave: this.hoverEnd
  1881. }, wrappedIndicators, this.renderItems(carouselItems, innerClasses), controlLeft, controlRight);
  1882. };
  1883. return Carousel;
  1884. }(React.Component);
  1885. Carousel.propTypes = {
  1886. // the current active slide of the carousel
  1887. activeIndex: PropTypes.number,
  1888. // a function which should advance the carousel to the next slide (via activeIndex)
  1889. next: PropTypes.func.isRequired,
  1890. // a function which should advance the carousel to the previous slide (via activeIndex)
  1891. previous: PropTypes.func.isRequired,
  1892. // controls if the left and right arrow keys should control the carousel
  1893. keyboard: PropTypes.bool,
  1894. /* If set to "hover", pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on
  1895. * mouseleave. If set to false, hovering over the carousel won't pause it. (default: "hover")
  1896. */
  1897. pause: PropTypes.oneOf(['hover', false]),
  1898. // Autoplays the carousel after the user manually cycles the first item. If "carousel", autoplays the carousel on load.
  1899. // This is how bootstrap defines it... I would prefer a bool named autoplay or something...
  1900. ride: PropTypes.oneOf(['carousel']),
  1901. // the interval at which the carousel automatically cycles (default: 5000)
  1902. // eslint-disable-next-line react/no-unused-prop-types
  1903. interval: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.bool]),
  1904. children: PropTypes.array,
  1905. // called when the mouse enters the Carousel
  1906. mouseEnter: PropTypes.func,
  1907. // called when the mouse exits the Carousel
  1908. mouseLeave: PropTypes.func,
  1909. // controls whether the slide animation on the Carousel works or not
  1910. slide: PropTypes.bool,
  1911. cssModule: PropTypes.object,
  1912. className: PropTypes.string
  1913. };
  1914. Carousel.defaultProps = {
  1915. interval: 5000,
  1916. pause: 'hover',
  1917. keyboard: true,
  1918. slide: true
  1919. };
  1920. Carousel.childContextTypes = {
  1921. direction: PropTypes.string
  1922. };
  1923. var CarouselControl = function CarouselControl(props) {
  1924. var direction = props.direction,
  1925. onClickHandler = props.onClickHandler,
  1926. cssModule = props.cssModule,
  1927. directionText = props.directionText,
  1928. className = props.className;
  1929. var anchorClasses = mapToCssModules(classNames(className, "carousel-control-" + direction), cssModule);
  1930. var iconClasses = mapToCssModules(classNames("carousel-control-" + direction + "-icon"), cssModule);
  1931. var screenReaderClasses = mapToCssModules(classNames('sr-only'), cssModule);
  1932. return React.createElement("a", {
  1933. className: anchorClasses,
  1934. role: "button",
  1935. tabIndex: "0",
  1936. onClick: function onClick(e) {
  1937. e.preventDefault();
  1938. onClickHandler();
  1939. }
  1940. }, React.createElement("span", {
  1941. className: iconClasses,
  1942. "aria-hidden": "true"
  1943. }), React.createElement("span", {
  1944. className: screenReaderClasses
  1945. }, directionText || direction));
  1946. };
  1947. CarouselControl.propTypes = {
  1948. direction: PropTypes.oneOf(['prev', 'next']).isRequired,
  1949. onClickHandler: PropTypes.func.isRequired,
  1950. cssModule: PropTypes.object,
  1951. directionText: PropTypes.string,
  1952. className: PropTypes.string
  1953. };
  1954. var CarouselIndicators = function CarouselIndicators(props) {
  1955. var items = props.items,
  1956. activeIndex = props.activeIndex,
  1957. cssModule = props.cssModule,
  1958. onClickHandler = props.onClickHandler,
  1959. className = props.className;
  1960. var listClasses = mapToCssModules(classNames(className, 'carousel-indicators'), cssModule);
  1961. var indicators = items.map(function (item, idx) {
  1962. var indicatorClasses = mapToCssModules(classNames({
  1963. active: activeIndex === idx
  1964. }), cssModule);
  1965. return React.createElement("li", {
  1966. key: "" + (item.key || Object.values(item).join('')),
  1967. onClick: function onClick(e) {
  1968. e.preventDefault();
  1969. onClickHandler(idx);
  1970. },
  1971. className: indicatorClasses
  1972. });
  1973. });
  1974. return React.createElement("ol", {
  1975. className: listClasses
  1976. }, indicators);
  1977. };
  1978. CarouselIndicators.propTypes = {
  1979. items: PropTypes.array.isRequired,
  1980. activeIndex: PropTypes.number.isRequired,
  1981. cssModule: PropTypes.object,
  1982. onClickHandler: PropTypes.func.isRequired,
  1983. className: PropTypes.string
  1984. };
  1985. var CarouselCaption = function CarouselCaption(props) {
  1986. var captionHeader = props.captionHeader,
  1987. captionText = props.captionText,
  1988. cssModule = props.cssModule,
  1989. className = props.className;
  1990. var classes = mapToCssModules(classNames(className, 'carousel-caption', 'd-none', 'd-md-block'), cssModule);
  1991. return React.createElement("div", {
  1992. className: classes
  1993. }, React.createElement("h3", null, captionHeader), React.createElement("p", null, captionText));
  1994. };
  1995. CarouselCaption.propTypes = {
  1996. captionHeader: PropTypes.string,
  1997. captionText: PropTypes.string.isRequired,
  1998. cssModule: PropTypes.object,
  1999. className: PropTypes.string
  2000. };
  2001. var propTypes$v = {
  2002. items: PropTypes.array.isRequired,
  2003. indicators: PropTypes.bool,
  2004. controls: PropTypes.bool,
  2005. autoPlay: PropTypes.bool,
  2006. defaultActiveIndex: PropTypes.number,
  2007. activeIndex: PropTypes.number,
  2008. next: PropTypes.func,
  2009. previous: PropTypes.func,
  2010. goToIndex: PropTypes.func
  2011. };
  2012. var UncontrolledCarousel =
  2013. /*#__PURE__*/
  2014. function (_Component) {
  2015. _inheritsLoose(UncontrolledCarousel, _Component);
  2016. function UncontrolledCarousel(props) {
  2017. var _this;
  2018. _this = _Component.call(this, props) || this;
  2019. _this.animating = false;
  2020. _this.state = {
  2021. activeIndex: props.defaultActiveIndex || 0
  2022. };
  2023. _this.next = _this.next.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2024. _this.previous = _this.previous.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2025. _this.goToIndex = _this.goToIndex.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2026. _this.onExiting = _this.onExiting.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2027. _this.onExited = _this.onExited.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2028. return _this;
  2029. }
  2030. var _proto = UncontrolledCarousel.prototype;
  2031. _proto.onExiting = function onExiting() {
  2032. this.animating = true;
  2033. };
  2034. _proto.onExited = function onExited() {
  2035. this.animating = false;
  2036. };
  2037. _proto.next = function next() {
  2038. if (this.animating) return;
  2039. var nextIndex = this.state.activeIndex === this.props.items.length - 1 ? 0 : this.state.activeIndex + 1;
  2040. this.setState({
  2041. activeIndex: nextIndex
  2042. });
  2043. };
  2044. _proto.previous = function previous() {
  2045. if (this.animating) return;
  2046. var nextIndex = this.state.activeIndex === 0 ? this.props.items.length - 1 : this.state.activeIndex - 1;
  2047. this.setState({
  2048. activeIndex: nextIndex
  2049. });
  2050. };
  2051. _proto.goToIndex = function goToIndex(newIndex) {
  2052. if (this.animating) return;
  2053. this.setState({
  2054. activeIndex: newIndex
  2055. });
  2056. };
  2057. _proto.render = function render() {
  2058. var _this2 = this;
  2059. var _this$props = this.props,
  2060. defaultActiveIndex = _this$props.defaultActiveIndex,
  2061. autoPlay = _this$props.autoPlay,
  2062. indicators = _this$props.indicators,
  2063. controls = _this$props.controls,
  2064. items = _this$props.items,
  2065. goToIndex = _this$props.goToIndex,
  2066. props = _objectWithoutPropertiesLoose(_this$props, ["defaultActiveIndex", "autoPlay", "indicators", "controls", "items", "goToIndex"]);
  2067. var activeIndex = this.state.activeIndex;
  2068. var slides = items.map(function (item) {
  2069. return React.createElement(CarouselItem, {
  2070. onExiting: _this2.onExiting,
  2071. onExited: _this2.onExited,
  2072. key: item.src
  2073. }, React.createElement("img", {
  2074. className: "d-block w-100",
  2075. src: item.src,
  2076. alt: item.altText
  2077. }), React.createElement(CarouselCaption, {
  2078. captionText: item.caption,
  2079. captionHeader: item.header || item.caption
  2080. }));
  2081. });
  2082. return React.createElement(Carousel, _extends({
  2083. activeIndex: activeIndex,
  2084. next: this.next,
  2085. previous: this.previous,
  2086. ride: autoPlay ? 'carousel' : undefined
  2087. }, props), indicators && React.createElement(CarouselIndicators, {
  2088. items: items,
  2089. activeIndex: props.activeIndex || activeIndex,
  2090. onClickHandler: goToIndex || this.goToIndex
  2091. }), slides, controls && React.createElement(CarouselControl, {
  2092. direction: "prev",
  2093. directionText: "Previous",
  2094. onClickHandler: props.previous || this.previous
  2095. }), controls && React.createElement(CarouselControl, {
  2096. direction: "next",
  2097. directionText: "Next",
  2098. onClickHandler: props.next || this.next
  2099. }));
  2100. };
  2101. return UncontrolledCarousel;
  2102. }(Component);
  2103. UncontrolledCarousel.propTypes = propTypes$v;
  2104. UncontrolledCarousel.defaultProps = {
  2105. controls: true,
  2106. indicators: true,
  2107. autoPlay: true
  2108. };
  2109. var propTypes$w = {
  2110. tag: tagPropType,
  2111. className: PropTypes.string,
  2112. cssModule: PropTypes.object
  2113. };
  2114. var defaultProps$u = {
  2115. tag: 'div'
  2116. };
  2117. var CardSubtitle = function CardSubtitle(props) {
  2118. var className = props.className,
  2119. cssModule = props.cssModule,
  2120. Tag = props.tag,
  2121. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  2122. var classes = mapToCssModules(classNames(className, 'card-subtitle'), cssModule);
  2123. return React.createElement(Tag, _extends({}, attributes, {
  2124. className: classes
  2125. }));
  2126. };
  2127. CardSubtitle.propTypes = propTypes$w;
  2128. CardSubtitle.defaultProps = defaultProps$u;
  2129. var propTypes$x = {
  2130. tag: tagPropType,
  2131. className: PropTypes.string,
  2132. cssModule: PropTypes.object
  2133. };
  2134. var defaultProps$v = {
  2135. tag: 'p'
  2136. };
  2137. var CardText = function CardText(props) {
  2138. var className = props.className,
  2139. cssModule = props.cssModule,
  2140. Tag = props.tag,
  2141. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  2142. var classes = mapToCssModules(classNames(className, 'card-text'), cssModule);
  2143. return React.createElement(Tag, _extends({}, attributes, {
  2144. className: classes
  2145. }));
  2146. };
  2147. CardText.propTypes = propTypes$x;
  2148. CardText.defaultProps = defaultProps$v;
  2149. var propTypes$y = {
  2150. tag: tagPropType,
  2151. className: PropTypes.string,
  2152. cssModule: PropTypes.object
  2153. };
  2154. var defaultProps$w = {
  2155. tag: 'div'
  2156. };
  2157. var CardTitle = function CardTitle(props) {
  2158. var className = props.className,
  2159. cssModule = props.cssModule,
  2160. Tag = props.tag,
  2161. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  2162. var classes = mapToCssModules(classNames(className, 'card-title'), cssModule);
  2163. return React.createElement(Tag, _extends({}, attributes, {
  2164. className: classes
  2165. }));
  2166. };
  2167. CardTitle.propTypes = propTypes$y;
  2168. CardTitle.defaultProps = defaultProps$w;
  2169. var propTypes$z = {
  2170. className: PropTypes.string,
  2171. id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
  2172. type: PropTypes.string.isRequired,
  2173. label: PropTypes.node,
  2174. inline: PropTypes.bool,
  2175. valid: PropTypes.bool,
  2176. invalid: PropTypes.bool,
  2177. bsSize: PropTypes.string,
  2178. cssModule: PropTypes.object,
  2179. children: PropTypes.oneOfType([PropTypes.node, PropTypes.array, PropTypes.func]),
  2180. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
  2181. };
  2182. function CustomInput(props) {
  2183. var className = props.className,
  2184. label = props.label,
  2185. inline = props.inline,
  2186. valid = props.valid,
  2187. invalid = props.invalid,
  2188. cssModule = props.cssModule,
  2189. children = props.children,
  2190. bsSize = props.bsSize,
  2191. innerRef = props.innerRef,
  2192. attributes = _objectWithoutPropertiesLoose(props, ["className", "label", "inline", "valid", "invalid", "cssModule", "children", "bsSize", "innerRef"]);
  2193. var type = attributes.type;
  2194. var customClass = mapToCssModules(classNames(className, "custom-" + type, bsSize ? "custom-" + type + "-" + bsSize : false), cssModule);
  2195. var validationClassNames = mapToCssModules(classNames(invalid && 'is-invalid', valid && 'is-valid'), cssModule);
  2196. if (type === 'select') {
  2197. return React.createElement("select", _extends({}, attributes, {
  2198. ref: innerRef,
  2199. className: classNames(validationClassNames, customClass)
  2200. }), children);
  2201. }
  2202. if (type === 'file') {
  2203. return React.createElement("div", {
  2204. className: customClass
  2205. }, React.createElement("input", _extends({}, attributes, {
  2206. ref: innerRef,
  2207. className: classNames(validationClassNames, mapToCssModules('custom-file-input', cssModule))
  2208. })), React.createElement("label", {
  2209. className: mapToCssModules('custom-file-label', cssModule),
  2210. htmlFor: attributes.id
  2211. }, label || 'Choose file'));
  2212. }
  2213. if (type !== 'checkbox' && type !== 'radio' && type !== 'switch') {
  2214. return React.createElement("input", _extends({}, attributes, {
  2215. ref: innerRef,
  2216. className: classNames(validationClassNames, customClass)
  2217. }));
  2218. }
  2219. var wrapperClasses = classNames(customClass, mapToCssModules(classNames('custom-control', {
  2220. 'custom-control-inline': inline
  2221. }), cssModule));
  2222. return React.createElement("div", {
  2223. className: wrapperClasses
  2224. }, React.createElement("input", _extends({}, attributes, {
  2225. type: type === 'switch' ? 'checkbox' : type,
  2226. ref: innerRef,
  2227. className: classNames(validationClassNames, mapToCssModules('custom-control-input', cssModule))
  2228. })), React.createElement("label", {
  2229. className: mapToCssModules('custom-control-label', cssModule),
  2230. htmlFor: attributes.id
  2231. }, label), children);
  2232. }
  2233. CustomInput.propTypes = propTypes$z;
  2234. var propTypes$A = {
  2235. children: PropTypes.node.isRequired,
  2236. className: PropTypes.string,
  2237. placement: PropTypes.string,
  2238. placementPrefix: PropTypes.string,
  2239. arrowClassName: PropTypes.string,
  2240. hideArrow: PropTypes.bool,
  2241. tag: tagPropType,
  2242. isOpen: PropTypes.bool.isRequired,
  2243. cssModule: PropTypes.object,
  2244. offset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  2245. fallbackPlacement: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
  2246. flip: PropTypes.bool,
  2247. container: targetPropType,
  2248. target: targetPropType.isRequired,
  2249. modifiers: PropTypes.object,
  2250. boundariesElement: PropTypes.oneOfType([PropTypes.string, DOMElement])
  2251. };
  2252. var defaultProps$x = {
  2253. boundariesElement: 'scrollParent',
  2254. placement: 'auto',
  2255. hideArrow: false,
  2256. isOpen: false,
  2257. offset: 0,
  2258. fallbackPlacement: 'flip',
  2259. flip: true,
  2260. container: 'body',
  2261. modifiers: {}
  2262. };
  2263. var childContextTypes$1 = {
  2264. popperManager: PropTypes.object.isRequired
  2265. };
  2266. var PopperContent =
  2267. /*#__PURE__*/
  2268. function (_React$Component) {
  2269. _inheritsLoose(PopperContent, _React$Component);
  2270. function PopperContent(props) {
  2271. var _this;
  2272. _this = _React$Component.call(this, props) || this;
  2273. _this.handlePlacementChange = _this.handlePlacementChange.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2274. _this.setTargetNode = _this.setTargetNode.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2275. _this.getTargetNode = _this.getTargetNode.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2276. _this.getRef = _this.getRef.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2277. _this.state = {};
  2278. return _this;
  2279. }
  2280. var _proto = PopperContent.prototype;
  2281. _proto.getChildContext = function getChildContext() {
  2282. return {
  2283. popperManager: {
  2284. setTargetNode: this.setTargetNode,
  2285. getTargetNode: this.getTargetNode
  2286. }
  2287. };
  2288. };
  2289. _proto.componentDidUpdate = function componentDidUpdate() {
  2290. if (this._element && this._element.childNodes && this._element.childNodes[0] && this._element.childNodes[0].focus) {
  2291. this._element.childNodes[0].focus();
  2292. }
  2293. };
  2294. _proto.setTargetNode = function setTargetNode(node) {
  2295. this.targetNode = node;
  2296. };
  2297. _proto.getTargetNode = function getTargetNode() {
  2298. return this.targetNode;
  2299. };
  2300. _proto.getContainerNode = function getContainerNode() {
  2301. return getTarget(this.props.container);
  2302. };
  2303. _proto.getRef = function getRef(ref) {
  2304. this._element = ref;
  2305. };
  2306. _proto.handlePlacementChange = function handlePlacementChange(data) {
  2307. if (this.state.placement !== data.placement) {
  2308. this.setState({
  2309. placement: data.placement
  2310. });
  2311. }
  2312. return data;
  2313. };
  2314. _proto.renderChildren = function renderChildren() {
  2315. var _this$props = this.props,
  2316. cssModule = _this$props.cssModule,
  2317. children = _this$props.children,
  2318. isOpen = _this$props.isOpen,
  2319. flip = _this$props.flip,
  2320. target = _this$props.target,
  2321. offset = _this$props.offset,
  2322. fallbackPlacement = _this$props.fallbackPlacement,
  2323. placementPrefix = _this$props.placementPrefix,
  2324. _arrowClassName = _this$props.arrowClassName,
  2325. hideArrow = _this$props.hideArrow,
  2326. className = _this$props.className,
  2327. tag = _this$props.tag,
  2328. container = _this$props.container,
  2329. modifiers = _this$props.modifiers,
  2330. boundariesElement = _this$props.boundariesElement,
  2331. attrs = _objectWithoutPropertiesLoose(_this$props, ["cssModule", "children", "isOpen", "flip", "target", "offset", "fallbackPlacement", "placementPrefix", "arrowClassName", "hideArrow", "className", "tag", "container", "modifiers", "boundariesElement"]);
  2332. var arrowClassName = mapToCssModules(classNames('arrow', _arrowClassName), cssModule);
  2333. var placement = (this.state.placement || attrs.placement).split('-')[0];
  2334. var popperClassName = mapToCssModules(classNames(className, placementPrefix ? placementPrefix + "-" + placement : placement), this.props.cssModule);
  2335. var extendedModifiers = _extends({
  2336. offset: {
  2337. offset: offset
  2338. },
  2339. flip: {
  2340. enabled: flip,
  2341. behavior: fallbackPlacement
  2342. },
  2343. preventOverflow: {
  2344. boundariesElement: boundariesElement
  2345. },
  2346. update: {
  2347. enabled: true,
  2348. order: 950,
  2349. fn: this.handlePlacementChange
  2350. }
  2351. }, modifiers);
  2352. return React.createElement(Popper, _extends({
  2353. modifiers: extendedModifiers
  2354. }, attrs, {
  2355. component: tag,
  2356. className: popperClassName,
  2357. "x-placement": this.state.placement || attrs.placement
  2358. }), children, !hideArrow && React.createElement(Arrow, {
  2359. className: arrowClassName
  2360. }));
  2361. };
  2362. _proto.render = function render() {
  2363. this.setTargetNode(getTarget(this.props.target));
  2364. if (this.props.isOpen) {
  2365. return this.props.container === 'inline' ? this.renderChildren() : ReactDOM.createPortal(React.createElement("div", {
  2366. ref: this.getRef
  2367. }, this.renderChildren()), this.getContainerNode());
  2368. }
  2369. return null;
  2370. };
  2371. return PopperContent;
  2372. }(React.Component);
  2373. PopperContent.propTypes = propTypes$A;
  2374. PopperContent.defaultProps = defaultProps$x;
  2375. PopperContent.childContextTypes = childContextTypes$1;
  2376. var PopperTargetHelper = function PopperTargetHelper(props, context) {
  2377. context.popperManager.setTargetNode(getTarget(props.target));
  2378. return null;
  2379. };
  2380. PopperTargetHelper.contextTypes = {
  2381. popperManager: PropTypes.object.isRequired
  2382. };
  2383. PopperTargetHelper.propTypes = {
  2384. target: targetPropType.isRequired
  2385. };
  2386. var propTypes$B = {
  2387. placement: PropTypes.oneOf(PopperPlacements),
  2388. target: targetPropType.isRequired,
  2389. container: targetPropType,
  2390. isOpen: PropTypes.bool,
  2391. disabled: PropTypes.bool,
  2392. hideArrow: PropTypes.bool,
  2393. boundariesElement: PropTypes.oneOfType([PropTypes.string, DOMElement]),
  2394. className: PropTypes.string,
  2395. innerClassName: PropTypes.string,
  2396. arrowClassName: PropTypes.string,
  2397. cssModule: PropTypes.object,
  2398. toggle: PropTypes.func,
  2399. autohide: PropTypes.bool,
  2400. placementPrefix: PropTypes.string,
  2401. delay: PropTypes.oneOfType([PropTypes.shape({
  2402. show: PropTypes.number,
  2403. hide: PropTypes.number
  2404. }), PropTypes.number]),
  2405. modifiers: PropTypes.object,
  2406. offset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  2407. innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.object]),
  2408. trigger: PropTypes.string
  2409. };
  2410. var DEFAULT_DELAYS = {
  2411. show: 0,
  2412. hide: 250
  2413. };
  2414. var defaultProps$y = {
  2415. isOpen: false,
  2416. hideArrow: false,
  2417. autohide: false,
  2418. delay: DEFAULT_DELAYS,
  2419. toggle: function toggle() {},
  2420. trigger: 'click'
  2421. };
  2422. function isInDOMSubtree(element, subtreeRoot) {
  2423. return subtreeRoot && (element === subtreeRoot || subtreeRoot.contains(element));
  2424. }
  2425. var TooltipPopoverWrapper =
  2426. /*#__PURE__*/
  2427. function (_React$Component) {
  2428. _inheritsLoose(TooltipPopoverWrapper, _React$Component);
  2429. function TooltipPopoverWrapper(props) {
  2430. var _this;
  2431. _this = _React$Component.call(this, props) || this;
  2432. _this._target = null;
  2433. _this.addTargetEvents = _this.addTargetEvents.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2434. _this.handleDocumentClick = _this.handleDocumentClick.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2435. _this.removeTargetEvents = _this.removeTargetEvents.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2436. _this.toggle = _this.toggle.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2437. _this.showWithDelay = _this.showWithDelay.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2438. _this.hideWithDelay = _this.hideWithDelay.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2439. _this.onMouseOverTooltipContent = _this.onMouseOverTooltipContent.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2440. _this.onMouseLeaveTooltipContent = _this.onMouseLeaveTooltipContent.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2441. _this.show = _this.show.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2442. _this.hide = _this.hide.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2443. _this.onEscKeyDown = _this.onEscKeyDown.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2444. _this.getRef = _this.getRef.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2445. return _this;
  2446. }
  2447. var _proto = TooltipPopoverWrapper.prototype;
  2448. _proto.componentDidMount = function componentDidMount() {
  2449. this.updateTarget();
  2450. };
  2451. _proto.componentWillUnmount = function componentWillUnmount() {
  2452. this.removeTargetEvents();
  2453. };
  2454. _proto.onMouseOverTooltipContent = function onMouseOverTooltipContent() {
  2455. if (this.props.trigger.indexOf('hover') > -1 && !this.props.autohide) {
  2456. if (this._hideTimeout) {
  2457. this.clearHideTimeout();
  2458. }
  2459. }
  2460. };
  2461. _proto.onMouseLeaveTooltipContent = function onMouseLeaveTooltipContent(e) {
  2462. if (this.props.trigger.indexOf('hover') > -1 && !this.props.autohide) {
  2463. if (this._showTimeout) {
  2464. this.clearShowTimeout();
  2465. }
  2466. e.persist();
  2467. this._hideTimeout = setTimeout(this.hide.bind(this, e), this.getDelay('hide'));
  2468. }
  2469. };
  2470. _proto.onEscKeyDown = function onEscKeyDown(e) {
  2471. if (e.key === 'Escape') {
  2472. this.hide(e);
  2473. }
  2474. };
  2475. _proto.getRef = function getRef(ref) {
  2476. var innerRef = this.props.innerRef;
  2477. if (innerRef) {
  2478. if (typeof innerRef === 'function') {
  2479. innerRef(ref);
  2480. } else if (typeof innerRef === 'object') {
  2481. innerRef.current = ref;
  2482. }
  2483. }
  2484. this._popover = ref;
  2485. };
  2486. _proto.getDelay = function getDelay(key) {
  2487. var delay = this.props.delay;
  2488. if (typeof delay === 'object') {
  2489. return isNaN(delay[key]) ? DEFAULT_DELAYS[key] : delay[key];
  2490. }
  2491. return delay;
  2492. };
  2493. _proto.show = function show(e) {
  2494. if (!this.props.isOpen) {
  2495. this.clearShowTimeout();
  2496. this.toggle(e);
  2497. }
  2498. };
  2499. _proto.showWithDelay = function showWithDelay(e) {
  2500. if (this._hideTimeout) {
  2501. this.clearHideTimeout();
  2502. }
  2503. this._showTimeout = setTimeout(this.show.bind(this, e), this.getDelay('show'));
  2504. };
  2505. _proto.hide = function hide(e) {
  2506. if (this.props.isOpen) {
  2507. this.clearHideTimeout();
  2508. this.toggle(e);
  2509. }
  2510. };
  2511. _proto.hideWithDelay = function hideWithDelay(e) {
  2512. if (this._showTimeout) {
  2513. this.clearShowTimeout();
  2514. }
  2515. this._hideTimeout = setTimeout(this.hide.bind(this, e), this.getDelay('hide'));
  2516. };
  2517. _proto.clearShowTimeout = function clearShowTimeout() {
  2518. clearTimeout(this._showTimeout);
  2519. this._showTimeout = undefined;
  2520. };
  2521. _proto.clearHideTimeout = function clearHideTimeout() {
  2522. clearTimeout(this._hideTimeout);
  2523. this._hideTimeout = undefined;
  2524. };
  2525. _proto.handleDocumentClick = function handleDocumentClick(e) {
  2526. var triggers = this.props.trigger.split(' ');
  2527. if (triggers.indexOf('legacy') > -1 && (this.props.isOpen || isInDOMSubtree(e.target, this._target))) {
  2528. if (this._hideTimeout) {
  2529. this.clearHideTimeout();
  2530. }
  2531. if (this.props.isOpen && !isInDOMSubtree(e.target, this._popover)) {
  2532. this.hideWithDelay(e);
  2533. } else {
  2534. this.showWithDelay(e);
  2535. }
  2536. } else if (triggers.indexOf('click') > -1 && isInDOMSubtree(e.target, this._target)) {
  2537. if (this._hideTimeout) {
  2538. this.clearHideTimeout();
  2539. }
  2540. if (!this.props.isOpen) {
  2541. this.showWithDelay(e);
  2542. } else {
  2543. this.hideWithDelay(e);
  2544. }
  2545. }
  2546. };
  2547. _proto.addTargetEvents = function addTargetEvents() {
  2548. var _this2 = this;
  2549. if (this.props.trigger) {
  2550. var triggers = this.props.trigger.split(' ');
  2551. if (triggers.indexOf('manual') === -1) {
  2552. if (triggers.indexOf('click') > -1 || triggers.indexOf('legacy') > -1) {
  2553. ['click', 'touchstart'].forEach(function (event) {
  2554. return document.addEventListener(event, _this2.handleDocumentClick, true);
  2555. });
  2556. }
  2557. if (this._target) {
  2558. if (triggers.indexOf('hover') > -1) {
  2559. this._target.addEventListener('mouseover', this.showWithDelay, true);
  2560. this._target.addEventListener('mouseout', this.hideWithDelay, true);
  2561. }
  2562. if (triggers.indexOf('focus') > -1) {
  2563. this._target.addEventListener('focusin', this.show, true);
  2564. this._target.addEventListener('focusout', this.hide, true);
  2565. }
  2566. this._target.addEventListener('keydown', this.onEscKeyDown, true);
  2567. }
  2568. }
  2569. }
  2570. };
  2571. _proto.removeTargetEvents = function removeTargetEvents() {
  2572. var _this3 = this;
  2573. if (this._target) {
  2574. this._target.removeEventListener('mouseover', this.showWithDelay, true);
  2575. this._target.removeEventListener('mouseout', this.hideWithDelay, true);
  2576. this._target.removeEventListener('keydown', this.onEscKeyDown, true);
  2577. this._target.removeEventListener('focusin', this.show, true);
  2578. this._target.removeEventListener('focusout', this.hide, true);
  2579. }
  2580. ['click', 'touchstart'].forEach(function (event) {
  2581. return document.removeEventListener(event, _this3.handleDocumentClick, true);
  2582. });
  2583. };
  2584. _proto.updateTarget = function updateTarget() {
  2585. var newTarget = getTarget(this.props.target);
  2586. if (newTarget !== this._target) {
  2587. this.removeTargetEvents();
  2588. this._target = newTarget;
  2589. this.addTargetEvents();
  2590. }
  2591. };
  2592. _proto.toggle = function toggle(e) {
  2593. if (this.props.disabled) {
  2594. return e && e.preventDefault();
  2595. }
  2596. return this.props.toggle(e);
  2597. };
  2598. _proto.render = function render() {
  2599. if (!this.props.isOpen) {
  2600. return null;
  2601. }
  2602. this.updateTarget();
  2603. var _this$props = this.props,
  2604. className = _this$props.className,
  2605. cssModule = _this$props.cssModule,
  2606. innerClassName = _this$props.innerClassName,
  2607. target = _this$props.target,
  2608. isOpen = _this$props.isOpen,
  2609. hideArrow = _this$props.hideArrow,
  2610. boundariesElement = _this$props.boundariesElement,
  2611. placement = _this$props.placement,
  2612. placementPrefix = _this$props.placementPrefix,
  2613. arrowClassName = _this$props.arrowClassName,
  2614. container = _this$props.container,
  2615. modifiers = _this$props.modifiers,
  2616. offset = _this$props.offset;
  2617. var attributes = omit(this.props, Object.keys(propTypes$B));
  2618. var popperClasses = mapToCssModules(className, cssModule);
  2619. var classes = mapToCssModules(innerClassName, cssModule);
  2620. return React.createElement(PopperContent, {
  2621. className: popperClasses,
  2622. target: target,
  2623. isOpen: isOpen,
  2624. hideArrow: hideArrow,
  2625. boundariesElement: boundariesElement,
  2626. placement: placement,
  2627. placementPrefix: placementPrefix,
  2628. arrowClassName: arrowClassName,
  2629. container: container,
  2630. modifiers: modifiers,
  2631. offset: offset,
  2632. cssModule: cssModule
  2633. }, React.createElement("div", _extends({}, attributes, {
  2634. ref: this.getRef,
  2635. className: classes,
  2636. role: "tooltip",
  2637. "aria-hidden": isOpen,
  2638. onMouseOver: this.onMouseOverTooltipContent,
  2639. onMouseLeave: this.onMouseLeaveTooltipContent,
  2640. onKeyDown: this.onEscKeyDown
  2641. })));
  2642. };
  2643. return TooltipPopoverWrapper;
  2644. }(React.Component);
  2645. TooltipPopoverWrapper.propTypes = propTypes$B;
  2646. TooltipPopoverWrapper.defaultProps = defaultProps$y;
  2647. var defaultProps$z = {
  2648. placement: 'right',
  2649. placementPrefix: 'bs-popover',
  2650. trigger: 'click'
  2651. };
  2652. var Popover = function Popover(props) {
  2653. var popperClasses = classNames('popover', 'show', props.className);
  2654. var classes = classNames('popover-inner', props.innerClassName);
  2655. return React.createElement(TooltipPopoverWrapper, _extends({}, props, {
  2656. className: popperClasses,
  2657. innerClassName: classes
  2658. }));
  2659. };
  2660. Popover.propTypes = propTypes$B;
  2661. Popover.defaultProps = defaultProps$z;
  2662. var omitKeys = ['defaultOpen'];
  2663. var UncontrolledPopover =
  2664. /*#__PURE__*/
  2665. function (_Component) {
  2666. _inheritsLoose(UncontrolledPopover, _Component);
  2667. function UncontrolledPopover(props) {
  2668. var _this;
  2669. _this = _Component.call(this, props) || this;
  2670. _this.state = {
  2671. isOpen: props.defaultOpen || false
  2672. };
  2673. _this.toggle = _this.toggle.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2674. return _this;
  2675. }
  2676. var _proto = UncontrolledPopover.prototype;
  2677. _proto.toggle = function toggle() {
  2678. this.setState({
  2679. isOpen: !this.state.isOpen
  2680. });
  2681. };
  2682. _proto.render = function render() {
  2683. return React.createElement(Popover, _extends({
  2684. isOpen: this.state.isOpen,
  2685. toggle: this.toggle
  2686. }, omit(this.props, omitKeys)));
  2687. };
  2688. return UncontrolledPopover;
  2689. }(Component);
  2690. UncontrolledPopover.propTypes = _extends({
  2691. defaultOpen: PropTypes.bool
  2692. }, Popover.propTypes);
  2693. var propTypes$C = {
  2694. tag: tagPropType,
  2695. className: PropTypes.string,
  2696. cssModule: PropTypes.object
  2697. };
  2698. var defaultProps$A = {
  2699. tag: 'h3'
  2700. };
  2701. var PopoverHeader = function PopoverHeader(props) {
  2702. var className = props.className,
  2703. cssModule = props.cssModule,
  2704. Tag = props.tag,
  2705. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  2706. var classes = mapToCssModules(classNames(className, 'popover-header'), cssModule);
  2707. return React.createElement(Tag, _extends({}, attributes, {
  2708. className: classes
  2709. }));
  2710. };
  2711. PopoverHeader.propTypes = propTypes$C;
  2712. PopoverHeader.defaultProps = defaultProps$A;
  2713. function PopoverTitle(props) {
  2714. warnOnce('The "PopoverTitle" component has been deprecated.\nPlease use component "PopoverHeader".');
  2715. return React.createElement(PopoverHeader, props);
  2716. }
  2717. var propTypes$D = {
  2718. tag: tagPropType,
  2719. className: PropTypes.string,
  2720. cssModule: PropTypes.object
  2721. };
  2722. var defaultProps$B = {
  2723. tag: 'div'
  2724. };
  2725. var PopoverBody = function PopoverBody(props) {
  2726. var className = props.className,
  2727. cssModule = props.cssModule,
  2728. Tag = props.tag,
  2729. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  2730. var classes = mapToCssModules(classNames(className, 'popover-body'), cssModule);
  2731. return React.createElement(Tag, _extends({}, attributes, {
  2732. className: classes
  2733. }));
  2734. };
  2735. PopoverBody.propTypes = propTypes$D;
  2736. PopoverBody.defaultProps = defaultProps$B;
  2737. function PopoverContent(props) {
  2738. warnOnce('The "PopoverContent" component has been deprecated.\nPlease use component "PopoverBody".');
  2739. return React.createElement(PopoverBody, props);
  2740. }
  2741. var propTypes$E = {
  2742. children: PropTypes.node,
  2743. bar: PropTypes.bool,
  2744. multi: PropTypes.bool,
  2745. tag: tagPropType,
  2746. value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  2747. max: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  2748. animated: PropTypes.bool,
  2749. striped: PropTypes.bool,
  2750. color: PropTypes.string,
  2751. className: PropTypes.string,
  2752. barClassName: PropTypes.string,
  2753. cssModule: PropTypes.object
  2754. };
  2755. var defaultProps$C = {
  2756. tag: 'div',
  2757. value: 0,
  2758. max: 100
  2759. };
  2760. var Progress = function Progress(props) {
  2761. var children = props.children,
  2762. className = props.className,
  2763. barClassName = props.barClassName,
  2764. cssModule = props.cssModule,
  2765. value = props.value,
  2766. max = props.max,
  2767. animated = props.animated,
  2768. striped = props.striped,
  2769. color = props.color,
  2770. bar = props.bar,
  2771. multi = props.multi,
  2772. Tag = props.tag,
  2773. attributes = _objectWithoutPropertiesLoose(props, ["children", "className", "barClassName", "cssModule", "value", "max", "animated", "striped", "color", "bar", "multi", "tag"]);
  2774. var percent = toNumber(value) / toNumber(max) * 100;
  2775. var progressClasses = mapToCssModules(classNames(className, 'progress'), cssModule);
  2776. var progressBarClasses = mapToCssModules(classNames('progress-bar', bar ? className || barClassName : barClassName, animated ? 'progress-bar-animated' : null, color ? "bg-" + color : null, striped || animated ? 'progress-bar-striped' : null), cssModule);
  2777. var ProgressBar = multi ? children : React.createElement("div", {
  2778. className: progressBarClasses,
  2779. style: {
  2780. width: percent + "%"
  2781. },
  2782. role: "progressbar",
  2783. "aria-valuenow": value,
  2784. "aria-valuemin": "0",
  2785. "aria-valuemax": max,
  2786. children: children
  2787. });
  2788. if (bar) {
  2789. return ProgressBar;
  2790. }
  2791. return React.createElement(Tag, _extends({}, attributes, {
  2792. className: progressClasses,
  2793. children: ProgressBar
  2794. }));
  2795. };
  2796. Progress.propTypes = propTypes$E;
  2797. Progress.defaultProps = defaultProps$C;
  2798. var propTypes$F = {
  2799. children: PropTypes.node.isRequired,
  2800. node: PropTypes.any
  2801. };
  2802. var Portal =
  2803. /*#__PURE__*/
  2804. function (_React$Component) {
  2805. _inheritsLoose(Portal, _React$Component);
  2806. function Portal() {
  2807. return _React$Component.apply(this, arguments) || this;
  2808. }
  2809. var _proto = Portal.prototype;
  2810. _proto.componentWillUnmount = function componentWillUnmount() {
  2811. if (this.defaultNode) {
  2812. document.body.removeChild(this.defaultNode);
  2813. }
  2814. this.defaultNode = null;
  2815. };
  2816. _proto.render = function render() {
  2817. if (!canUseDOM) {
  2818. return null;
  2819. }
  2820. if (!this.props.node && !this.defaultNode) {
  2821. this.defaultNode = document.createElement('div');
  2822. document.body.appendChild(this.defaultNode);
  2823. }
  2824. return ReactDOM.createPortal(this.props.children, this.props.node || this.defaultNode);
  2825. };
  2826. return Portal;
  2827. }(React.Component);
  2828. Portal.propTypes = propTypes$F;
  2829. function noop() {}
  2830. var FadePropTypes = PropTypes.shape(Fade.propTypes);
  2831. var propTypes$G = {
  2832. isOpen: PropTypes.bool,
  2833. autoFocus: PropTypes.bool,
  2834. centered: PropTypes.bool,
  2835. size: PropTypes.string,
  2836. toggle: PropTypes.func,
  2837. keyboard: PropTypes.bool,
  2838. role: PropTypes.string,
  2839. labelledBy: PropTypes.string,
  2840. backdrop: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['static'])]),
  2841. onEnter: PropTypes.func,
  2842. onExit: PropTypes.func,
  2843. onOpened: PropTypes.func,
  2844. onClosed: PropTypes.func,
  2845. children: PropTypes.node,
  2846. className: PropTypes.string,
  2847. wrapClassName: PropTypes.string,
  2848. modalClassName: PropTypes.string,
  2849. backdropClassName: PropTypes.string,
  2850. contentClassName: PropTypes.string,
  2851. external: PropTypes.node,
  2852. fade: PropTypes.bool,
  2853. cssModule: PropTypes.object,
  2854. zIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
  2855. backdropTransition: FadePropTypes,
  2856. modalTransition: FadePropTypes,
  2857. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
  2858. };
  2859. var propsToOmit = Object.keys(propTypes$G);
  2860. var defaultProps$D = {
  2861. isOpen: false,
  2862. autoFocus: true,
  2863. centered: false,
  2864. role: 'dialog',
  2865. backdrop: true,
  2866. keyboard: true,
  2867. zIndex: 1050,
  2868. fade: true,
  2869. onOpened: noop,
  2870. onClosed: noop,
  2871. modalTransition: {
  2872. timeout: TransitionTimeouts.Modal
  2873. },
  2874. backdropTransition: {
  2875. mountOnEnter: true,
  2876. timeout: TransitionTimeouts.Fade // uses standard fade transition
  2877. }
  2878. };
  2879. var Modal =
  2880. /*#__PURE__*/
  2881. function (_React$Component) {
  2882. _inheritsLoose(Modal, _React$Component);
  2883. function Modal(props) {
  2884. var _this;
  2885. _this = _React$Component.call(this, props) || this;
  2886. _this._element = null;
  2887. _this._originalBodyPadding = null;
  2888. _this.getFocusableChildren = _this.getFocusableChildren.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2889. _this.handleBackdropClick = _this.handleBackdropClick.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2890. _this.handleBackdropMouseDown = _this.handleBackdropMouseDown.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2891. _this.handleEscape = _this.handleEscape.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2892. _this.handleTab = _this.handleTab.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2893. _this.onOpened = _this.onOpened.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2894. _this.onClosed = _this.onClosed.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  2895. _this.state = {
  2896. isOpen: props.isOpen
  2897. };
  2898. if (props.isOpen) {
  2899. _this.init();
  2900. }
  2901. return _this;
  2902. }
  2903. var _proto = Modal.prototype;
  2904. _proto.componentDidMount = function componentDidMount() {
  2905. if (this.props.onEnter) {
  2906. this.props.onEnter();
  2907. }
  2908. if (this.state.isOpen && this.props.autoFocus) {
  2909. this.setFocus();
  2910. }
  2911. this._isMounted = true;
  2912. };
  2913. _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
  2914. if (nextProps.isOpen && !this.props.isOpen) {
  2915. this.setState({
  2916. isOpen: nextProps.isOpen
  2917. });
  2918. }
  2919. };
  2920. _proto.componentWillUpdate = function componentWillUpdate(nextProps, nextState) {
  2921. if (nextState.isOpen && !this.state.isOpen) {
  2922. this.init();
  2923. }
  2924. };
  2925. _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
  2926. if (this.props.autoFocus && this.state.isOpen && !prevState.isOpen) {
  2927. this.setFocus();
  2928. }
  2929. if (this._element && prevProps.zIndex !== this.props.zIndex) {
  2930. this._element.style.zIndex = this.props.zIndex;
  2931. }
  2932. };
  2933. _proto.componentWillUnmount = function componentWillUnmount() {
  2934. if (this.props.onExit) {
  2935. this.props.onExit();
  2936. }
  2937. if (this.state.isOpen) {
  2938. this.destroy();
  2939. }
  2940. this._isMounted = false;
  2941. };
  2942. _proto.onOpened = function onOpened(node, isAppearing) {
  2943. this.props.onOpened();
  2944. (this.props.modalTransition.onEntered || noop)(node, isAppearing);
  2945. };
  2946. _proto.onClosed = function onClosed(node) {
  2947. // so all methods get called before it is unmounted
  2948. this.props.onClosed();
  2949. (this.props.modalTransition.onExited || noop)(node);
  2950. this.destroy();
  2951. if (this._isMounted) {
  2952. this.setState({
  2953. isOpen: false
  2954. });
  2955. }
  2956. };
  2957. _proto.setFocus = function setFocus() {
  2958. if (this._dialog && this._dialog.parentNode && typeof this._dialog.parentNode.focus === 'function') {
  2959. this._dialog.parentNode.focus();
  2960. }
  2961. };
  2962. _proto.getFocusableChildren = function getFocusableChildren() {
  2963. return this._element.querySelectorAll(focusableElements.join(', '));
  2964. };
  2965. _proto.getFocusedChild = function getFocusedChild() {
  2966. var currentFocus;
  2967. var focusableChildren = this.getFocusableChildren();
  2968. try {
  2969. currentFocus = document.activeElement;
  2970. } catch (err) {
  2971. currentFocus = focusableChildren[0];
  2972. }
  2973. return currentFocus;
  2974. } // not mouseUp because scrollbar fires it, shouldn't close when user scrolls
  2975. ;
  2976. _proto.handleBackdropClick = function handleBackdropClick(e) {
  2977. if (e.target === this._mouseDownElement) {
  2978. e.stopPropagation();
  2979. if (!this.props.isOpen || this.props.backdrop !== true) return;
  2980. var backdrop = this._dialog ? this._dialog.parentNode : null;
  2981. if (backdrop && e.target === backdrop && this.props.toggle) {
  2982. this.props.toggle(e);
  2983. }
  2984. }
  2985. };
  2986. _proto.handleTab = function handleTab(e) {
  2987. if (e.which !== 9) return;
  2988. var focusableChildren = this.getFocusableChildren();
  2989. var totalFocusable = focusableChildren.length;
  2990. var currentFocus = this.getFocusedChild();
  2991. var focusedIndex = 0;
  2992. for (var i = 0; i < totalFocusable; i += 1) {
  2993. if (focusableChildren[i] === currentFocus) {
  2994. focusedIndex = i;
  2995. break;
  2996. }
  2997. }
  2998. if (e.shiftKey && focusedIndex === 0) {
  2999. e.preventDefault();
  3000. focusableChildren[totalFocusable - 1].focus();
  3001. } else if (!e.shiftKey && focusedIndex === totalFocusable - 1) {
  3002. e.preventDefault();
  3003. focusableChildren[0].focus();
  3004. }
  3005. };
  3006. _proto.handleBackdropMouseDown = function handleBackdropMouseDown(e) {
  3007. this._mouseDownElement = e.target;
  3008. };
  3009. _proto.handleEscape = function handleEscape(e) {
  3010. if (this.props.isOpen && this.props.keyboard && e.keyCode === 27 && this.props.toggle) {
  3011. e.preventDefault();
  3012. e.stopPropagation();
  3013. this.props.toggle(e);
  3014. }
  3015. };
  3016. _proto.init = function init() {
  3017. try {
  3018. this._triggeringElement = document.activeElement;
  3019. } catch (err) {
  3020. this._triggeringElement = null;
  3021. }
  3022. this._element = document.createElement('div');
  3023. this._element.setAttribute('tabindex', '-1');
  3024. this._element.style.position = 'relative';
  3025. this._element.style.zIndex = this.props.zIndex;
  3026. this._originalBodyPadding = getOriginalBodyPadding();
  3027. conditionallyUpdateScrollbar();
  3028. document.body.appendChild(this._element);
  3029. if (Modal.openCount === 0) {
  3030. document.body.className = classNames(document.body.className, mapToCssModules('modal-open', this.props.cssModule));
  3031. }
  3032. Modal.openCount += 1;
  3033. };
  3034. _proto.destroy = function destroy() {
  3035. if (this._element) {
  3036. document.body.removeChild(this._element);
  3037. this._element = null;
  3038. }
  3039. if (this._triggeringElement) {
  3040. if (this._triggeringElement.focus) this._triggeringElement.focus();
  3041. this._triggeringElement = null;
  3042. }
  3043. if (Modal.openCount <= 1) {
  3044. var modalOpenClassName = mapToCssModules('modal-open', this.props.cssModule); // Use regex to prevent matching `modal-open` as part of a different class, e.g. `my-modal-opened`
  3045. var modalOpenClassNameRegex = new RegExp("(^| )" + modalOpenClassName + "( |$)");
  3046. document.body.className = document.body.className.replace(modalOpenClassNameRegex, ' ').trim();
  3047. }
  3048. Modal.openCount -= 1;
  3049. setScrollbarWidth(this._originalBodyPadding);
  3050. };
  3051. _proto.renderModalDialog = function renderModalDialog() {
  3052. var _classNames,
  3053. _this2 = this;
  3054. var attributes = omit(this.props, propsToOmit);
  3055. var dialogBaseClass = 'modal-dialog';
  3056. return React.createElement("div", _extends({}, attributes, {
  3057. className: mapToCssModules(classNames(dialogBaseClass, this.props.className, (_classNames = {}, _classNames["modal-" + this.props.size] = this.props.size, _classNames[dialogBaseClass + "-centered"] = this.props.centered, _classNames)), this.props.cssModule),
  3058. role: "document",
  3059. ref: function ref(c) {
  3060. _this2._dialog = c;
  3061. }
  3062. }), React.createElement("div", {
  3063. className: mapToCssModules(classNames('modal-content', this.props.contentClassName), this.props.cssModule)
  3064. }, this.props.children));
  3065. };
  3066. _proto.render = function render() {
  3067. if (this.state.isOpen) {
  3068. var _this$props = this.props,
  3069. wrapClassName = _this$props.wrapClassName,
  3070. modalClassName = _this$props.modalClassName,
  3071. backdropClassName = _this$props.backdropClassName,
  3072. cssModule = _this$props.cssModule,
  3073. isOpen = _this$props.isOpen,
  3074. backdrop = _this$props.backdrop,
  3075. role = _this$props.role,
  3076. labelledBy = _this$props.labelledBy,
  3077. external = _this$props.external,
  3078. innerRef = _this$props.innerRef;
  3079. var modalAttributes = {
  3080. onClick: this.handleBackdropClick,
  3081. onMouseDown: this.handleBackdropMouseDown,
  3082. onKeyUp: this.handleEscape,
  3083. onKeyDown: this.handleTab,
  3084. style: {
  3085. display: 'block'
  3086. },
  3087. 'aria-labelledby': labelledBy,
  3088. role: role,
  3089. tabIndex: '-1'
  3090. };
  3091. var hasTransition = this.props.fade;
  3092. var modalTransition = _extends({}, Fade.defaultProps, this.props.modalTransition, {
  3093. baseClass: hasTransition ? this.props.modalTransition.baseClass : '',
  3094. timeout: hasTransition ? this.props.modalTransition.timeout : 0
  3095. });
  3096. var backdropTransition = _extends({}, Fade.defaultProps, this.props.backdropTransition, {
  3097. baseClass: hasTransition ? this.props.backdropTransition.baseClass : '',
  3098. timeout: hasTransition ? this.props.backdropTransition.timeout : 0
  3099. });
  3100. var Backdrop = backdrop && (hasTransition ? React.createElement(Fade, _extends({}, backdropTransition, {
  3101. in: isOpen && !!backdrop,
  3102. cssModule: cssModule,
  3103. className: mapToCssModules(classNames('modal-backdrop', backdropClassName), cssModule)
  3104. })) : React.createElement("div", {
  3105. className: mapToCssModules(classNames('modal-backdrop', 'show', backdropClassName), cssModule)
  3106. }));
  3107. return React.createElement(Portal, {
  3108. node: this._element
  3109. }, React.createElement("div", {
  3110. className: mapToCssModules(wrapClassName)
  3111. }, React.createElement(Fade, _extends({}, modalAttributes, modalTransition, {
  3112. in: isOpen,
  3113. onEntered: this.onOpened,
  3114. onExited: this.onClosed,
  3115. cssModule: cssModule,
  3116. className: mapToCssModules(classNames('modal', modalClassName), cssModule),
  3117. innerRef: innerRef
  3118. }), external, this.renderModalDialog()), Backdrop));
  3119. }
  3120. return null;
  3121. };
  3122. return Modal;
  3123. }(React.Component);
  3124. Modal.propTypes = propTypes$G;
  3125. Modal.defaultProps = defaultProps$D;
  3126. Modal.openCount = 0;
  3127. var propTypes$H = {
  3128. tag: tagPropType,
  3129. wrapTag: tagPropType,
  3130. toggle: PropTypes.func,
  3131. className: PropTypes.string,
  3132. cssModule: PropTypes.object,
  3133. children: PropTypes.node,
  3134. closeAriaLabel: PropTypes.string,
  3135. charCode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  3136. close: PropTypes.object
  3137. };
  3138. var defaultProps$E = {
  3139. tag: 'h5',
  3140. wrapTag: 'div',
  3141. closeAriaLabel: 'Close',
  3142. charCode: 215
  3143. };
  3144. var ModalHeader = function ModalHeader(props) {
  3145. var closeButton;
  3146. var className = props.className,
  3147. cssModule = props.cssModule,
  3148. children = props.children,
  3149. toggle = props.toggle,
  3150. Tag = props.tag,
  3151. WrapTag = props.wrapTag,
  3152. closeAriaLabel = props.closeAriaLabel,
  3153. charCode = props.charCode,
  3154. close = props.close,
  3155. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "children", "toggle", "tag", "wrapTag", "closeAriaLabel", "charCode", "close"]);
  3156. var classes = mapToCssModules(classNames(className, 'modal-header'), cssModule);
  3157. if (!close && toggle) {
  3158. var closeIcon = typeof charCode === 'number' ? String.fromCharCode(charCode) : charCode;
  3159. closeButton = React.createElement("button", {
  3160. type: "button",
  3161. onClick: toggle,
  3162. className: mapToCssModules('close', cssModule),
  3163. "aria-label": closeAriaLabel
  3164. }, React.createElement("span", {
  3165. "aria-hidden": "true"
  3166. }, closeIcon));
  3167. }
  3168. return React.createElement(WrapTag, _extends({}, attributes, {
  3169. className: classes
  3170. }), React.createElement(Tag, {
  3171. className: mapToCssModules('modal-title', cssModule)
  3172. }, children), close || closeButton);
  3173. };
  3174. ModalHeader.propTypes = propTypes$H;
  3175. ModalHeader.defaultProps = defaultProps$E;
  3176. var propTypes$I = {
  3177. tag: tagPropType,
  3178. className: PropTypes.string,
  3179. cssModule: PropTypes.object
  3180. };
  3181. var defaultProps$F = {
  3182. tag: 'div'
  3183. };
  3184. var ModalBody = function ModalBody(props) {
  3185. var className = props.className,
  3186. cssModule = props.cssModule,
  3187. Tag = props.tag,
  3188. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  3189. var classes = mapToCssModules(classNames(className, 'modal-body'), cssModule);
  3190. return React.createElement(Tag, _extends({}, attributes, {
  3191. className: classes
  3192. }));
  3193. };
  3194. ModalBody.propTypes = propTypes$I;
  3195. ModalBody.defaultProps = defaultProps$F;
  3196. var propTypes$J = {
  3197. tag: tagPropType,
  3198. className: PropTypes.string,
  3199. cssModule: PropTypes.object
  3200. };
  3201. var defaultProps$G = {
  3202. tag: 'div'
  3203. };
  3204. var ModalFooter = function ModalFooter(props) {
  3205. var className = props.className,
  3206. cssModule = props.cssModule,
  3207. Tag = props.tag,
  3208. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  3209. var classes = mapToCssModules(classNames(className, 'modal-footer'), cssModule);
  3210. return React.createElement(Tag, _extends({}, attributes, {
  3211. className: classes
  3212. }));
  3213. };
  3214. ModalFooter.propTypes = propTypes$J;
  3215. ModalFooter.defaultProps = defaultProps$G;
  3216. var defaultProps$H = {
  3217. placement: 'top',
  3218. autohide: true,
  3219. placementPrefix: 'bs-tooltip',
  3220. trigger: 'click hover focus'
  3221. };
  3222. var Tooltip = function Tooltip(props) {
  3223. var popperClasses = classNames('tooltip', 'show', props.className);
  3224. var classes = classNames('tooltip-inner', props.innerClassName);
  3225. return React.createElement(TooltipPopoverWrapper, _extends({}, props, {
  3226. className: popperClasses,
  3227. innerClassName: classes
  3228. }));
  3229. };
  3230. Tooltip.propTypes = propTypes$B;
  3231. Tooltip.defaultProps = defaultProps$H;
  3232. var propTypes$K = {
  3233. className: PropTypes.string,
  3234. cssModule: PropTypes.object,
  3235. size: PropTypes.string,
  3236. bordered: PropTypes.bool,
  3237. borderless: PropTypes.bool,
  3238. striped: PropTypes.bool,
  3239. inverse: deprecated(PropTypes.bool, 'Please use the prop "dark"'),
  3240. dark: PropTypes.bool,
  3241. hover: PropTypes.bool,
  3242. responsive: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
  3243. tag: tagPropType,
  3244. responsiveTag: tagPropType,
  3245. innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.object])
  3246. };
  3247. var defaultProps$I = {
  3248. tag: 'table',
  3249. responsiveTag: 'div'
  3250. };
  3251. var Table = function Table(props) {
  3252. var className = props.className,
  3253. cssModule = props.cssModule,
  3254. size = props.size,
  3255. bordered = props.bordered,
  3256. borderless = props.borderless,
  3257. striped = props.striped,
  3258. inverse = props.inverse,
  3259. dark = props.dark,
  3260. hover = props.hover,
  3261. responsive = props.responsive,
  3262. Tag = props.tag,
  3263. ResponsiveTag = props.responsiveTag,
  3264. innerRef = props.innerRef,
  3265. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "size", "bordered", "borderless", "striped", "inverse", "dark", "hover", "responsive", "tag", "responsiveTag", "innerRef"]);
  3266. var classes = mapToCssModules(classNames(className, 'table', size ? 'table-' + size : false, bordered ? 'table-bordered' : false, borderless ? 'table-borderless' : false, striped ? 'table-striped' : false, dark || inverse ? 'table-dark' : false, hover ? 'table-hover' : false), cssModule);
  3267. var table = React.createElement(Tag, _extends({}, attributes, {
  3268. ref: innerRef,
  3269. className: classes
  3270. }));
  3271. if (responsive) {
  3272. var responsiveClassName = responsive === true ? 'table-responsive' : "table-responsive-" + responsive;
  3273. return React.createElement(ResponsiveTag, {
  3274. className: responsiveClassName
  3275. }, table);
  3276. }
  3277. return table;
  3278. };
  3279. Table.propTypes = propTypes$K;
  3280. Table.defaultProps = defaultProps$I;
  3281. var propTypes$L = {
  3282. tag: tagPropType,
  3283. flush: PropTypes.bool,
  3284. className: PropTypes.string,
  3285. cssModule: PropTypes.object
  3286. };
  3287. var defaultProps$J = {
  3288. tag: 'ul'
  3289. };
  3290. var ListGroup = function ListGroup(props) {
  3291. var className = props.className,
  3292. cssModule = props.cssModule,
  3293. Tag = props.tag,
  3294. flush = props.flush,
  3295. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "flush"]);
  3296. var classes = mapToCssModules(classNames(className, 'list-group', flush ? 'list-group-flush' : false), cssModule);
  3297. return React.createElement(Tag, _extends({}, attributes, {
  3298. className: classes
  3299. }));
  3300. };
  3301. ListGroup.propTypes = propTypes$L;
  3302. ListGroup.defaultProps = defaultProps$J;
  3303. var propTypes$M = {
  3304. children: PropTypes.node,
  3305. inline: PropTypes.bool,
  3306. tag: tagPropType,
  3307. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
  3308. className: PropTypes.string,
  3309. cssModule: PropTypes.object
  3310. };
  3311. var defaultProps$K = {
  3312. tag: 'form'
  3313. };
  3314. var Form =
  3315. /*#__PURE__*/
  3316. function (_Component) {
  3317. _inheritsLoose(Form, _Component);
  3318. function Form(props) {
  3319. var _this;
  3320. _this = _Component.call(this, props) || this;
  3321. _this.getRef = _this.getRef.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  3322. _this.submit = _this.submit.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  3323. return _this;
  3324. }
  3325. var _proto = Form.prototype;
  3326. _proto.getRef = function getRef(ref) {
  3327. if (this.props.innerRef) {
  3328. this.props.innerRef(ref);
  3329. }
  3330. this.ref = ref;
  3331. };
  3332. _proto.submit = function submit() {
  3333. if (this.ref) {
  3334. this.ref.submit();
  3335. }
  3336. };
  3337. _proto.render = function render() {
  3338. var _this$props = this.props,
  3339. className = _this$props.className,
  3340. cssModule = _this$props.cssModule,
  3341. inline = _this$props.inline,
  3342. Tag = _this$props.tag,
  3343. innerRef = _this$props.innerRef,
  3344. attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "cssModule", "inline", "tag", "innerRef"]);
  3345. var classes = mapToCssModules(classNames(className, inline ? 'form-inline' : false), cssModule);
  3346. return React.createElement(Tag, _extends({}, attributes, {
  3347. ref: innerRef,
  3348. className: classes
  3349. }));
  3350. };
  3351. return Form;
  3352. }(Component);
  3353. Form.propTypes = propTypes$M;
  3354. Form.defaultProps = defaultProps$K;
  3355. var propTypes$N = {
  3356. children: PropTypes.node,
  3357. tag: tagPropType,
  3358. className: PropTypes.string,
  3359. cssModule: PropTypes.object,
  3360. valid: PropTypes.bool,
  3361. tooltip: PropTypes.bool
  3362. };
  3363. var defaultProps$L = {
  3364. tag: 'div',
  3365. valid: undefined
  3366. };
  3367. var FormFeedback = function FormFeedback(props) {
  3368. var className = props.className,
  3369. cssModule = props.cssModule,
  3370. valid = props.valid,
  3371. tooltip = props.tooltip,
  3372. Tag = props.tag,
  3373. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "valid", "tooltip", "tag"]);
  3374. var validMode = tooltip ? 'tooltip' : 'feedback';
  3375. var classes = mapToCssModules(classNames(className, valid ? "valid-" + validMode : "invalid-" + validMode), cssModule);
  3376. return React.createElement(Tag, _extends({}, attributes, {
  3377. className: classes
  3378. }));
  3379. };
  3380. FormFeedback.propTypes = propTypes$N;
  3381. FormFeedback.defaultProps = defaultProps$L;
  3382. var propTypes$O = {
  3383. children: PropTypes.node,
  3384. row: PropTypes.bool,
  3385. check: PropTypes.bool,
  3386. inline: PropTypes.bool,
  3387. disabled: PropTypes.bool,
  3388. tag: tagPropType,
  3389. className: PropTypes.string,
  3390. cssModule: PropTypes.object
  3391. };
  3392. var defaultProps$M = {
  3393. tag: 'div'
  3394. };
  3395. var FormGroup = function FormGroup(props) {
  3396. var className = props.className,
  3397. cssModule = props.cssModule,
  3398. row = props.row,
  3399. disabled = props.disabled,
  3400. check = props.check,
  3401. inline = props.inline,
  3402. Tag = props.tag,
  3403. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "row", "disabled", "check", "inline", "tag"]);
  3404. var classes = mapToCssModules(classNames(className, row ? 'row' : false, check ? 'form-check' : 'form-group', check && inline ? 'form-check-inline' : false, check && disabled ? 'disabled' : false), cssModule);
  3405. return React.createElement(Tag, _extends({}, attributes, {
  3406. className: classes
  3407. }));
  3408. };
  3409. FormGroup.propTypes = propTypes$O;
  3410. FormGroup.defaultProps = defaultProps$M;
  3411. var propTypes$P = {
  3412. children: PropTypes.node,
  3413. inline: PropTypes.bool,
  3414. tag: tagPropType,
  3415. color: PropTypes.string,
  3416. className: PropTypes.string,
  3417. cssModule: PropTypes.object
  3418. };
  3419. var defaultProps$N = {
  3420. tag: 'small',
  3421. color: 'muted'
  3422. };
  3423. var FormText = function FormText(props) {
  3424. var className = props.className,
  3425. cssModule = props.cssModule,
  3426. inline = props.inline,
  3427. color = props.color,
  3428. Tag = props.tag,
  3429. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "inline", "color", "tag"]);
  3430. var classes = mapToCssModules(classNames(className, !inline ? 'form-text' : false, color ? "text-" + color : false), cssModule);
  3431. return React.createElement(Tag, _extends({}, attributes, {
  3432. className: classes
  3433. }));
  3434. };
  3435. FormText.propTypes = propTypes$P;
  3436. FormText.defaultProps = defaultProps$N;
  3437. var propTypes$Q = {
  3438. children: PropTypes.node,
  3439. type: PropTypes.string,
  3440. size: PropTypes.string,
  3441. bsSize: PropTypes.string,
  3442. state: deprecated(PropTypes.string, 'Please use the props "valid" and "invalid" to indicate the state.'),
  3443. valid: PropTypes.bool,
  3444. invalid: PropTypes.bool,
  3445. tag: tagPropType,
  3446. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
  3447. static: deprecated(PropTypes.bool, 'Please use the prop "plaintext"'),
  3448. plaintext: PropTypes.bool,
  3449. addon: PropTypes.bool,
  3450. className: PropTypes.string,
  3451. cssModule: PropTypes.object
  3452. };
  3453. var defaultProps$O = {
  3454. type: 'text'
  3455. };
  3456. var Input =
  3457. /*#__PURE__*/
  3458. function (_React$Component) {
  3459. _inheritsLoose(Input, _React$Component);
  3460. function Input(props) {
  3461. var _this;
  3462. _this = _React$Component.call(this, props) || this;
  3463. _this.getRef = _this.getRef.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  3464. _this.focus = _this.focus.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  3465. return _this;
  3466. }
  3467. var _proto = Input.prototype;
  3468. _proto.getRef = function getRef(ref) {
  3469. if (this.props.innerRef) {
  3470. this.props.innerRef(ref);
  3471. }
  3472. this.ref = ref;
  3473. };
  3474. _proto.focus = function focus() {
  3475. if (this.ref) {
  3476. this.ref.focus();
  3477. }
  3478. };
  3479. _proto.render = function render() {
  3480. var _this$props = this.props,
  3481. className = _this$props.className,
  3482. cssModule = _this$props.cssModule,
  3483. type = _this$props.type,
  3484. bsSize = _this$props.bsSize,
  3485. state = _this$props.state,
  3486. valid = _this$props.valid,
  3487. invalid = _this$props.invalid,
  3488. tag = _this$props.tag,
  3489. addon = _this$props.addon,
  3490. staticInput = _this$props.static,
  3491. plaintext = _this$props.plaintext,
  3492. innerRef = _this$props.innerRef,
  3493. attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "cssModule", "type", "bsSize", "state", "valid", "invalid", "tag", "addon", "static", "plaintext", "innerRef"]);
  3494. var checkInput = ['radio', 'checkbox'].indexOf(type) > -1;
  3495. var isNotaNumber = new RegExp('\\D', 'g');
  3496. var fileInput = type === 'file';
  3497. var textareaInput = type === 'textarea';
  3498. var selectInput = type === 'select';
  3499. var Tag = tag || (selectInput || textareaInput ? type : 'input');
  3500. var formControlClass = 'form-control';
  3501. if (plaintext || staticInput) {
  3502. formControlClass = formControlClass + "-plaintext";
  3503. Tag = tag || 'input';
  3504. } else if (fileInput) {
  3505. formControlClass = formControlClass + "-file";
  3506. } else if (checkInput) {
  3507. if (addon) {
  3508. formControlClass = null;
  3509. } else {
  3510. formControlClass = 'form-check-input';
  3511. }
  3512. }
  3513. if (state && typeof valid === 'undefined' && typeof invalid === 'undefined') {
  3514. if (state === 'danger') {
  3515. invalid = true;
  3516. } else if (state === 'success') {
  3517. valid = true;
  3518. }
  3519. }
  3520. if (attributes.size && isNotaNumber.test(attributes.size)) {
  3521. warnOnce('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.');
  3522. bsSize = attributes.size;
  3523. delete attributes.size;
  3524. }
  3525. var classes = mapToCssModules(classNames(className, invalid && 'is-invalid', valid && 'is-valid', bsSize ? "form-control-" + bsSize : false, formControlClass), cssModule);
  3526. if (Tag === 'input' || tag && typeof tag === 'function') {
  3527. attributes.type = type;
  3528. }
  3529. if (attributes.children && !(plaintext || staticInput || type === 'select' || typeof Tag !== 'string' || Tag === 'select')) {
  3530. warnOnce("Input with a type of \"" + type + "\" cannot have children. Please use \"value\"/\"defaultValue\" instead.");
  3531. delete attributes.children;
  3532. }
  3533. return React.createElement(Tag, _extends({}, attributes, {
  3534. ref: innerRef,
  3535. className: classes
  3536. }));
  3537. };
  3538. return Input;
  3539. }(React.Component);
  3540. Input.propTypes = propTypes$Q;
  3541. Input.defaultProps = defaultProps$O;
  3542. var propTypes$R = {
  3543. tag: tagPropType,
  3544. size: PropTypes.string,
  3545. className: PropTypes.string,
  3546. cssModule: PropTypes.object
  3547. };
  3548. var defaultProps$P = {
  3549. tag: 'div'
  3550. };
  3551. var InputGroup = function InputGroup(props) {
  3552. var className = props.className,
  3553. cssModule = props.cssModule,
  3554. Tag = props.tag,
  3555. size = props.size,
  3556. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "size"]);
  3557. var classes = mapToCssModules(classNames(className, 'input-group', size ? "input-group-" + size : null), cssModule);
  3558. return React.createElement(Tag, _extends({}, attributes, {
  3559. className: classes
  3560. }));
  3561. };
  3562. InputGroup.propTypes = propTypes$R;
  3563. InputGroup.defaultProps = defaultProps$P;
  3564. var propTypes$S = {
  3565. tag: tagPropType,
  3566. className: PropTypes.string,
  3567. cssModule: PropTypes.object
  3568. };
  3569. var defaultProps$Q = {
  3570. tag: 'span'
  3571. };
  3572. var InputGroupText = function InputGroupText(props) {
  3573. var className = props.className,
  3574. cssModule = props.cssModule,
  3575. Tag = props.tag,
  3576. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  3577. var classes = mapToCssModules(classNames(className, 'input-group-text'), cssModule);
  3578. return React.createElement(Tag, _extends({}, attributes, {
  3579. className: classes
  3580. }));
  3581. };
  3582. InputGroupText.propTypes = propTypes$S;
  3583. InputGroupText.defaultProps = defaultProps$Q;
  3584. var propTypes$T = {
  3585. tag: tagPropType,
  3586. addonType: PropTypes.oneOf(['prepend', 'append']).isRequired,
  3587. children: PropTypes.node,
  3588. className: PropTypes.string,
  3589. cssModule: PropTypes.object
  3590. };
  3591. var defaultProps$R = {
  3592. tag: 'div'
  3593. };
  3594. var InputGroupAddon = function InputGroupAddon(props) {
  3595. var className = props.className,
  3596. cssModule = props.cssModule,
  3597. Tag = props.tag,
  3598. addonType = props.addonType,
  3599. children = props.children,
  3600. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "addonType", "children"]);
  3601. var classes = mapToCssModules(classNames(className, 'input-group-' + addonType), cssModule); // Convenience to assist with transition
  3602. if (typeof children === 'string') {
  3603. return React.createElement(Tag, _extends({}, attributes, {
  3604. className: classes
  3605. }), React.createElement(InputGroupText, {
  3606. children: children
  3607. }));
  3608. }
  3609. return React.createElement(Tag, _extends({}, attributes, {
  3610. className: classes,
  3611. children: children
  3612. }));
  3613. };
  3614. InputGroupAddon.propTypes = propTypes$T;
  3615. InputGroupAddon.defaultProps = defaultProps$R;
  3616. var propTypes$U = {
  3617. tag: tagPropType,
  3618. addonType: PropTypes.oneOf(['prepend', 'append']).isRequired,
  3619. children: PropTypes.node,
  3620. groupClassName: PropTypes.string,
  3621. groupAttributes: PropTypes.object,
  3622. className: PropTypes.string,
  3623. cssModule: PropTypes.object
  3624. };
  3625. var InputGroupButton = function InputGroupButton(props) {
  3626. warnOnce('The "InputGroupButton" component has been deprecated.\nPlease use component "InputGroupAddon".');
  3627. var children = props.children,
  3628. groupClassName = props.groupClassName,
  3629. groupAttributes = props.groupAttributes,
  3630. propsWithoutGroup = _objectWithoutPropertiesLoose(props, ["children", "groupClassName", "groupAttributes"]);
  3631. if (typeof children === 'string') {
  3632. var cssModule = propsWithoutGroup.cssModule,
  3633. tag = propsWithoutGroup.tag,
  3634. addonType = propsWithoutGroup.addonType,
  3635. attributes = _objectWithoutPropertiesLoose(propsWithoutGroup, ["cssModule", "tag", "addonType"]);
  3636. var allGroupAttributes = _extends({}, groupAttributes, {
  3637. cssModule: cssModule,
  3638. tag: tag,
  3639. addonType: addonType
  3640. });
  3641. return React.createElement(InputGroupAddon, _extends({}, allGroupAttributes, {
  3642. className: groupClassName
  3643. }), React.createElement(Button, _extends({}, attributes, {
  3644. children: children
  3645. })));
  3646. }
  3647. return React.createElement(InputGroupAddon, _extends({}, props, {
  3648. children: children
  3649. }));
  3650. };
  3651. InputGroupButton.propTypes = propTypes$U;
  3652. var propTypes$V = {
  3653. addonType: PropTypes.oneOf(['prepend', 'append']).isRequired,
  3654. children: PropTypes.node
  3655. };
  3656. var InputGroupButtonDropdown = function InputGroupButtonDropdown(props) {
  3657. return React.createElement(Dropdown, props);
  3658. };
  3659. InputGroupButtonDropdown.propTypes = propTypes$V;
  3660. var colWidths$1 = ['xs', 'sm', 'md', 'lg', 'xl'];
  3661. var stringOrNumberProp$1 = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
  3662. var columnProps$1 = PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.shape({
  3663. size: stringOrNumberProp$1,
  3664. push: deprecated(stringOrNumberProp$1, 'Please use the prop "order"'),
  3665. pull: deprecated(stringOrNumberProp$1, 'Please use the prop "order"'),
  3666. order: stringOrNumberProp$1,
  3667. offset: stringOrNumberProp$1
  3668. })]);
  3669. var propTypes$W = {
  3670. children: PropTypes.node,
  3671. hidden: PropTypes.bool,
  3672. check: PropTypes.bool,
  3673. size: PropTypes.string,
  3674. for: PropTypes.string,
  3675. tag: tagPropType,
  3676. className: PropTypes.string,
  3677. cssModule: PropTypes.object,
  3678. xs: columnProps$1,
  3679. sm: columnProps$1,
  3680. md: columnProps$1,
  3681. lg: columnProps$1,
  3682. xl: columnProps$1,
  3683. widths: PropTypes.array
  3684. };
  3685. var defaultProps$S = {
  3686. tag: 'label',
  3687. widths: colWidths$1
  3688. };
  3689. var getColumnSizeClass$1 = function getColumnSizeClass(isXs, colWidth, colSize) {
  3690. if (colSize === true || colSize === '') {
  3691. return isXs ? 'col' : "col-" + colWidth;
  3692. } else if (colSize === 'auto') {
  3693. return isXs ? 'col-auto' : "col-" + colWidth + "-auto";
  3694. }
  3695. return isXs ? "col-" + colSize : "col-" + colWidth + "-" + colSize;
  3696. };
  3697. var Label = function Label(props) {
  3698. var className = props.className,
  3699. cssModule = props.cssModule,
  3700. hidden = props.hidden,
  3701. widths = props.widths,
  3702. Tag = props.tag,
  3703. check = props.check,
  3704. size = props.size,
  3705. htmlFor = props.for,
  3706. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "hidden", "widths", "tag", "check", "size", "for"]);
  3707. var colClasses = [];
  3708. widths.forEach(function (colWidth, i) {
  3709. var columnProp = props[colWidth];
  3710. delete attributes[colWidth];
  3711. if (!columnProp && columnProp !== '') {
  3712. return;
  3713. }
  3714. var isXs = !i;
  3715. var colClass;
  3716. if (isobject(columnProp)) {
  3717. var _classNames;
  3718. var colSizeInterfix = isXs ? '-' : "-" + colWidth + "-";
  3719. colClass = getColumnSizeClass$1(isXs, colWidth, columnProp.size);
  3720. colClasses.push(mapToCssModules(classNames((_classNames = {}, _classNames[colClass] = columnProp.size || columnProp.size === '', _classNames["order" + colSizeInterfix + columnProp.order] = columnProp.order || columnProp.order === 0, _classNames["offset" + colSizeInterfix + columnProp.offset] = columnProp.offset || columnProp.offset === 0, _classNames))), cssModule);
  3721. } else {
  3722. colClass = getColumnSizeClass$1(isXs, colWidth, columnProp);
  3723. colClasses.push(colClass);
  3724. }
  3725. });
  3726. var classes = mapToCssModules(classNames(className, hidden ? 'sr-only' : false, check ? 'form-check-label' : false, size ? "col-form-label-" + size : false, colClasses, colClasses.length ? 'col-form-label' : false), cssModule);
  3727. return React.createElement(Tag, _extends({
  3728. htmlFor: htmlFor
  3729. }, attributes, {
  3730. className: classes
  3731. }));
  3732. };
  3733. Label.propTypes = propTypes$W;
  3734. Label.defaultProps = defaultProps$S;
  3735. var propTypes$X = {
  3736. body: PropTypes.bool,
  3737. bottom: PropTypes.bool,
  3738. children: PropTypes.node,
  3739. className: PropTypes.string,
  3740. cssModule: PropTypes.object,
  3741. heading: PropTypes.bool,
  3742. left: PropTypes.bool,
  3743. list: PropTypes.bool,
  3744. middle: PropTypes.bool,
  3745. object: PropTypes.bool,
  3746. right: PropTypes.bool,
  3747. tag: tagPropType,
  3748. top: PropTypes.bool
  3749. };
  3750. var Media = function Media(props) {
  3751. var body = props.body,
  3752. bottom = props.bottom,
  3753. className = props.className,
  3754. cssModule = props.cssModule,
  3755. heading = props.heading,
  3756. left = props.left,
  3757. list = props.list,
  3758. middle = props.middle,
  3759. object = props.object,
  3760. right = props.right,
  3761. tag = props.tag,
  3762. top = props.top,
  3763. attributes = _objectWithoutPropertiesLoose(props, ["body", "bottom", "className", "cssModule", "heading", "left", "list", "middle", "object", "right", "tag", "top"]);
  3764. var defaultTag;
  3765. if (heading) {
  3766. defaultTag = 'h4';
  3767. } else if (attributes.href) {
  3768. defaultTag = 'a';
  3769. } else if (attributes.src || object) {
  3770. defaultTag = 'img';
  3771. } else if (list) {
  3772. defaultTag = 'ul';
  3773. } else {
  3774. defaultTag = 'div';
  3775. }
  3776. var Tag = tag || defaultTag;
  3777. var classes = mapToCssModules(classNames(className, {
  3778. 'media-body': body,
  3779. 'media-heading': heading,
  3780. 'media-left': left,
  3781. 'media-right': right,
  3782. 'media-top': top,
  3783. 'media-bottom': bottom,
  3784. 'media-middle': middle,
  3785. 'media-object': object,
  3786. 'media-list': list,
  3787. media: !body && !heading && !left && !right && !top && !bottom && !middle && !object && !list
  3788. }), cssModule);
  3789. return React.createElement(Tag, _extends({}, attributes, {
  3790. className: classes
  3791. }));
  3792. };
  3793. Media.propTypes = propTypes$X;
  3794. var propTypes$Y = {
  3795. children: PropTypes.node,
  3796. className: PropTypes.string,
  3797. listClassName: PropTypes.string,
  3798. cssModule: PropTypes.object,
  3799. size: PropTypes.string,
  3800. tag: tagPropType,
  3801. listTag: tagPropType,
  3802. 'aria-label': PropTypes.string
  3803. };
  3804. var defaultProps$T = {
  3805. tag: 'nav',
  3806. listTag: 'ul',
  3807. 'aria-label': 'pagination'
  3808. };
  3809. var Pagination = function Pagination(props) {
  3810. var _classNames;
  3811. var className = props.className,
  3812. listClassName = props.listClassName,
  3813. cssModule = props.cssModule,
  3814. size = props.size,
  3815. Tag = props.tag,
  3816. ListTag = props.listTag,
  3817. label = props['aria-label'],
  3818. attributes = _objectWithoutPropertiesLoose(props, ["className", "listClassName", "cssModule", "size", "tag", "listTag", "aria-label"]);
  3819. var classes = mapToCssModules(classNames(className), cssModule);
  3820. var listClasses = mapToCssModules(classNames(listClassName, 'pagination', (_classNames = {}, _classNames["pagination-" + size] = !!size, _classNames)), cssModule);
  3821. return React.createElement(Tag, {
  3822. className: classes,
  3823. "aria-label": label
  3824. }, React.createElement(ListTag, _extends({}, attributes, {
  3825. className: listClasses
  3826. })));
  3827. };
  3828. Pagination.propTypes = propTypes$Y;
  3829. Pagination.defaultProps = defaultProps$T;
  3830. var propTypes$Z = {
  3831. active: PropTypes.bool,
  3832. children: PropTypes.node,
  3833. className: PropTypes.string,
  3834. cssModule: PropTypes.object,
  3835. disabled: PropTypes.bool,
  3836. tag: tagPropType
  3837. };
  3838. var defaultProps$U = {
  3839. tag: 'li'
  3840. };
  3841. var PaginationItem = function PaginationItem(props) {
  3842. var active = props.active,
  3843. className = props.className,
  3844. cssModule = props.cssModule,
  3845. disabled = props.disabled,
  3846. Tag = props.tag,
  3847. attributes = _objectWithoutPropertiesLoose(props, ["active", "className", "cssModule", "disabled", "tag"]);
  3848. var classes = mapToCssModules(classNames(className, 'page-item', {
  3849. active: active,
  3850. disabled: disabled
  3851. }), cssModule);
  3852. return React.createElement(Tag, _extends({}, attributes, {
  3853. className: classes
  3854. }));
  3855. };
  3856. PaginationItem.propTypes = propTypes$Z;
  3857. PaginationItem.defaultProps = defaultProps$U;
  3858. var propTypes$_ = {
  3859. 'aria-label': PropTypes.string,
  3860. children: PropTypes.node,
  3861. className: PropTypes.string,
  3862. cssModule: PropTypes.object,
  3863. next: PropTypes.bool,
  3864. previous: PropTypes.bool,
  3865. tag: tagPropType
  3866. };
  3867. var defaultProps$V = {
  3868. tag: 'a'
  3869. };
  3870. var PaginationLink = function PaginationLink(props) {
  3871. var className = props.className,
  3872. cssModule = props.cssModule,
  3873. next = props.next,
  3874. previous = props.previous,
  3875. Tag = props.tag,
  3876. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "next", "previous", "tag"]);
  3877. var classes = mapToCssModules(classNames(className, 'page-link'), cssModule);
  3878. var defaultAriaLabel;
  3879. if (previous) {
  3880. defaultAriaLabel = 'Previous';
  3881. } else if (next) {
  3882. defaultAriaLabel = 'Next';
  3883. }
  3884. var ariaLabel = props['aria-label'] || defaultAriaLabel;
  3885. var defaultCaret;
  3886. if (previous) {
  3887. defaultCaret = "\xAB";
  3888. } else if (next) {
  3889. defaultCaret = "\xBB";
  3890. }
  3891. var children = props.children;
  3892. if (children && Array.isArray(children) && children.length === 0) {
  3893. children = null;
  3894. }
  3895. if (!attributes.href && Tag === 'a') {
  3896. Tag = 'button';
  3897. }
  3898. if (previous || next) {
  3899. children = [React.createElement("span", {
  3900. "aria-hidden": "true",
  3901. key: "caret"
  3902. }, children || defaultCaret), React.createElement("span", {
  3903. className: "sr-only",
  3904. key: "sr"
  3905. }, ariaLabel)];
  3906. }
  3907. return React.createElement(Tag, _extends({}, attributes, {
  3908. className: classes,
  3909. "aria-label": ariaLabel
  3910. }), children);
  3911. };
  3912. PaginationLink.propTypes = propTypes$_;
  3913. PaginationLink.defaultProps = defaultProps$V;
  3914. var propTypes$10 = {
  3915. tag: tagPropType,
  3916. activeTab: PropTypes.any,
  3917. className: PropTypes.string,
  3918. cssModule: PropTypes.object
  3919. };
  3920. var defaultProps$W = {
  3921. tag: 'div'
  3922. };
  3923. var childContextTypes$2 = {
  3924. activeTabId: PropTypes.any
  3925. };
  3926. var TabContent =
  3927. /*#__PURE__*/
  3928. function (_Component) {
  3929. _inheritsLoose(TabContent, _Component);
  3930. TabContent.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
  3931. if (prevState.activeTab !== nextProps.activeTab) {
  3932. return {
  3933. activeTab: nextProps.activeTab
  3934. };
  3935. }
  3936. return null;
  3937. };
  3938. function TabContent(props) {
  3939. var _this;
  3940. _this = _Component.call(this, props) || this;
  3941. _this.state = {
  3942. activeTab: _this.props.activeTab
  3943. };
  3944. return _this;
  3945. }
  3946. var _proto = TabContent.prototype;
  3947. _proto.getChildContext = function getChildContext() {
  3948. return {
  3949. activeTabId: this.state.activeTab
  3950. };
  3951. };
  3952. _proto.render = function render() {
  3953. var _this$props = this.props,
  3954. className = _this$props.className,
  3955. cssModule = _this$props.cssModule,
  3956. Tag = _this$props.tag;
  3957. var attributes = omit(this.props, Object.keys(propTypes$10));
  3958. var classes = mapToCssModules(classNames('tab-content', className), cssModule);
  3959. return React.createElement(Tag, _extends({}, attributes, {
  3960. className: classes
  3961. }));
  3962. };
  3963. return TabContent;
  3964. }(Component);
  3965. polyfill(TabContent);
  3966. TabContent.propTypes = propTypes$10;
  3967. TabContent.defaultProps = defaultProps$W;
  3968. TabContent.childContextTypes = childContextTypes$2;
  3969. var propTypes$11 = {
  3970. tag: tagPropType,
  3971. className: PropTypes.string,
  3972. cssModule: PropTypes.object,
  3973. tabId: PropTypes.any
  3974. };
  3975. var defaultProps$X = {
  3976. tag: 'div'
  3977. };
  3978. var contextTypes$3 = {
  3979. activeTabId: PropTypes.any
  3980. };
  3981. function TabPane(props, context) {
  3982. var className = props.className,
  3983. cssModule = props.cssModule,
  3984. tabId = props.tabId,
  3985. Tag = props.tag,
  3986. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tabId", "tag"]);
  3987. var classes = mapToCssModules(classNames('tab-pane', className, {
  3988. active: tabId === context.activeTabId
  3989. }), cssModule);
  3990. return React.createElement(Tag, _extends({}, attributes, {
  3991. className: classes
  3992. }));
  3993. }
  3994. TabPane.propTypes = propTypes$11;
  3995. TabPane.defaultProps = defaultProps$X;
  3996. TabPane.contextTypes = contextTypes$3;
  3997. var propTypes$12 = {
  3998. tag: tagPropType,
  3999. fluid: PropTypes.bool,
  4000. className: PropTypes.string,
  4001. cssModule: PropTypes.object
  4002. };
  4003. var defaultProps$Y = {
  4004. tag: 'div'
  4005. };
  4006. var Jumbotron = function Jumbotron(props) {
  4007. var className = props.className,
  4008. cssModule = props.cssModule,
  4009. Tag = props.tag,
  4010. fluid = props.fluid,
  4011. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "fluid"]);
  4012. var classes = mapToCssModules(classNames(className, 'jumbotron', fluid ? 'jumbotron-fluid' : false), cssModule);
  4013. return React.createElement(Tag, _extends({}, attributes, {
  4014. className: classes
  4015. }));
  4016. };
  4017. Jumbotron.propTypes = propTypes$12;
  4018. Jumbotron.defaultProps = defaultProps$Y;
  4019. var propTypes$13 = {
  4020. children: PropTypes.node,
  4021. className: PropTypes.string,
  4022. closeClassName: PropTypes.string,
  4023. closeAriaLabel: PropTypes.string,
  4024. cssModule: PropTypes.object,
  4025. color: PropTypes.string,
  4026. fade: PropTypes.bool,
  4027. isOpen: PropTypes.bool,
  4028. toggle: PropTypes.func,
  4029. tag: tagPropType,
  4030. transition: PropTypes.shape(Fade.propTypes),
  4031. innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
  4032. };
  4033. var defaultProps$Z = {
  4034. color: 'success',
  4035. isOpen: true,
  4036. tag: 'div',
  4037. closeAriaLabel: 'Close',
  4038. fade: true,
  4039. transition: _extends({}, Fade.defaultProps, {
  4040. unmountOnExit: true
  4041. })
  4042. };
  4043. function Alert(props) {
  4044. var className = props.className,
  4045. closeClassName = props.closeClassName,
  4046. closeAriaLabel = props.closeAriaLabel,
  4047. cssModule = props.cssModule,
  4048. Tag = props.tag,
  4049. color = props.color,
  4050. isOpen = props.isOpen,
  4051. toggle = props.toggle,
  4052. children = props.children,
  4053. transition = props.transition,
  4054. fade = props.fade,
  4055. innerRef = props.innerRef,
  4056. attributes = _objectWithoutPropertiesLoose(props, ["className", "closeClassName", "closeAriaLabel", "cssModule", "tag", "color", "isOpen", "toggle", "children", "transition", "fade", "innerRef"]);
  4057. var classes = mapToCssModules(classNames(className, 'alert', "alert-" + color, {
  4058. 'alert-dismissible': toggle
  4059. }), cssModule);
  4060. var closeClasses = mapToCssModules(classNames('close', closeClassName), cssModule);
  4061. var alertTransition = _extends({}, Fade.defaultProps, transition, {
  4062. baseClass: fade ? transition.baseClass : '',
  4063. timeout: fade ? transition.timeout : 0
  4064. });
  4065. return React.createElement(Fade, _extends({}, attributes, alertTransition, {
  4066. tag: Tag,
  4067. className: classes,
  4068. in: isOpen,
  4069. role: "alert",
  4070. innerRef: innerRef
  4071. }), toggle ? React.createElement("button", {
  4072. type: "button",
  4073. className: closeClasses,
  4074. "aria-label": closeAriaLabel,
  4075. onClick: toggle
  4076. }, React.createElement("span", {
  4077. "aria-hidden": "true"
  4078. }, "\xD7")) : null, children);
  4079. }
  4080. Alert.propTypes = propTypes$13;
  4081. Alert.defaultProps = defaultProps$Z;
  4082. var _transitionStatusToCl;
  4083. var propTypes$14 = _extends({}, Transition.propTypes, {
  4084. isOpen: PropTypes.bool,
  4085. children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
  4086. tag: tagPropType,
  4087. className: PropTypes.node,
  4088. navbar: PropTypes.bool,
  4089. cssModule: PropTypes.object,
  4090. innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.object])
  4091. });
  4092. var defaultProps$_ = _extends({}, Transition.defaultProps, {
  4093. isOpen: false,
  4094. appear: false,
  4095. enter: true,
  4096. exit: true,
  4097. tag: 'div',
  4098. timeout: TransitionTimeouts.Collapse
  4099. });
  4100. var transitionStatusToClassHash = (_transitionStatusToCl = {}, _transitionStatusToCl[TransitionStatuses.ENTERING] = 'collapsing', _transitionStatusToCl[TransitionStatuses.ENTERED] = 'collapse show', _transitionStatusToCl[TransitionStatuses.EXITING] = 'collapsing', _transitionStatusToCl[TransitionStatuses.EXITED] = 'collapse', _transitionStatusToCl);
  4101. function getTransitionClass(status) {
  4102. return transitionStatusToClassHash[status] || 'collapse';
  4103. }
  4104. function getHeight(node) {
  4105. return node.scrollHeight;
  4106. }
  4107. var Collapse =
  4108. /*#__PURE__*/
  4109. function (_Component) {
  4110. _inheritsLoose(Collapse, _Component);
  4111. function Collapse(props) {
  4112. var _this;
  4113. _this = _Component.call(this, props) || this;
  4114. _this.state = {
  4115. height: null
  4116. };
  4117. ['onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'].forEach(function (name) {
  4118. _this[name] = _this[name].bind(_assertThisInitialized(_assertThisInitialized(_this)));
  4119. });
  4120. return _this;
  4121. }
  4122. var _proto = Collapse.prototype;
  4123. _proto.onEntering = function onEntering(node, isAppearing) {
  4124. this.setState({
  4125. height: getHeight(node)
  4126. });
  4127. this.props.onEntering(node, isAppearing);
  4128. };
  4129. _proto.onEntered = function onEntered(node, isAppearing) {
  4130. this.setState({
  4131. height: null
  4132. });
  4133. this.props.onEntered(node, isAppearing);
  4134. };
  4135. _proto.onExit = function onExit(node) {
  4136. this.setState({
  4137. height: getHeight(node)
  4138. });
  4139. this.props.onExit(node);
  4140. };
  4141. _proto.onExiting = function onExiting(node) {
  4142. // getting this variable triggers a reflow
  4143. var _unused = node.offsetHeight; // eslint-disable-line no-unused-vars
  4144. this.setState({
  4145. height: 0
  4146. });
  4147. this.props.onExiting(node);
  4148. };
  4149. _proto.onExited = function onExited(node) {
  4150. this.setState({
  4151. height: null
  4152. });
  4153. this.props.onExited(node);
  4154. };
  4155. _proto.render = function render() {
  4156. var _this2 = this;
  4157. var _this$props = this.props,
  4158. Tag = _this$props.tag,
  4159. isOpen = _this$props.isOpen,
  4160. className = _this$props.className,
  4161. navbar = _this$props.navbar,
  4162. cssModule = _this$props.cssModule,
  4163. children = _this$props.children,
  4164. innerRef = _this$props.innerRef,
  4165. otherProps = _objectWithoutPropertiesLoose(_this$props, ["tag", "isOpen", "className", "navbar", "cssModule", "children", "innerRef"]);
  4166. var height = this.state.height;
  4167. var transitionProps = pick(otherProps, TransitionPropTypeKeys);
  4168. var childProps = omit(otherProps, TransitionPropTypeKeys);
  4169. return React.createElement(Transition, _extends({}, transitionProps, {
  4170. in: isOpen,
  4171. onEntering: this.onEntering,
  4172. onEntered: this.onEntered,
  4173. onExit: this.onExit,
  4174. onExiting: this.onExiting,
  4175. onExited: this.onExited
  4176. }), function (status) {
  4177. var collapseClass = getTransitionClass(status);
  4178. var classes = mapToCssModules(classNames(className, collapseClass, navbar && 'navbar-collapse'), cssModule);
  4179. var style = height === null ? null : {
  4180. height: height
  4181. };
  4182. return React.createElement(Tag, _extends({}, childProps, {
  4183. style: _extends({}, childProps.style, style),
  4184. className: classes,
  4185. ref: _this2.props.innerRef
  4186. }), children);
  4187. });
  4188. };
  4189. return Collapse;
  4190. }(Component);
  4191. Collapse.propTypes = propTypes$14;
  4192. Collapse.defaultProps = defaultProps$_;
  4193. var propTypes$15 = {
  4194. tag: tagPropType,
  4195. active: PropTypes.bool,
  4196. disabled: PropTypes.bool,
  4197. color: PropTypes.string,
  4198. action: PropTypes.bool,
  4199. className: PropTypes.any,
  4200. cssModule: PropTypes.object
  4201. };
  4202. var defaultProps$10 = {
  4203. tag: 'li'
  4204. };
  4205. var handleDisabledOnClick = function handleDisabledOnClick(e) {
  4206. e.preventDefault();
  4207. };
  4208. var ListGroupItem = function ListGroupItem(props) {
  4209. var className = props.className,
  4210. cssModule = props.cssModule,
  4211. Tag = props.tag,
  4212. active = props.active,
  4213. disabled = props.disabled,
  4214. action = props.action,
  4215. color = props.color,
  4216. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "active", "disabled", "action", "color"]);
  4217. var classes = mapToCssModules(classNames(className, active ? 'active' : false, disabled ? 'disabled' : false, action ? 'list-group-item-action' : false, color ? "list-group-item-" + color : false, 'list-group-item'), cssModule); // Prevent click event when disabled.
  4218. if (disabled) {
  4219. attributes.onClick = handleDisabledOnClick;
  4220. }
  4221. return React.createElement(Tag, _extends({}, attributes, {
  4222. className: classes
  4223. }));
  4224. };
  4225. ListGroupItem.propTypes = propTypes$15;
  4226. ListGroupItem.defaultProps = defaultProps$10;
  4227. var propTypes$16 = {
  4228. tag: tagPropType,
  4229. className: PropTypes.any,
  4230. cssModule: PropTypes.object
  4231. };
  4232. var defaultProps$11 = {
  4233. tag: 'h5'
  4234. };
  4235. var ListGroupItemHeading = function ListGroupItemHeading(props) {
  4236. var className = props.className,
  4237. cssModule = props.cssModule,
  4238. Tag = props.tag,
  4239. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  4240. var classes = mapToCssModules(classNames(className, 'list-group-item-heading'), cssModule);
  4241. return React.createElement(Tag, _extends({}, attributes, {
  4242. className: classes
  4243. }));
  4244. };
  4245. ListGroupItemHeading.propTypes = propTypes$16;
  4246. ListGroupItemHeading.defaultProps = defaultProps$11;
  4247. var propTypes$17 = {
  4248. tag: tagPropType,
  4249. className: PropTypes.any,
  4250. cssModule: PropTypes.object
  4251. };
  4252. var defaultProps$12 = {
  4253. tag: 'p'
  4254. };
  4255. var ListGroupItemText = function ListGroupItemText(props) {
  4256. var className = props.className,
  4257. cssModule = props.cssModule,
  4258. Tag = props.tag,
  4259. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
  4260. var classes = mapToCssModules(classNames(className, 'list-group-item-text'), cssModule);
  4261. return React.createElement(Tag, _extends({}, attributes, {
  4262. className: classes
  4263. }));
  4264. };
  4265. ListGroupItemText.propTypes = propTypes$17;
  4266. ListGroupItemText.defaultProps = defaultProps$12;
  4267. var UncontrolledAlert =
  4268. /*#__PURE__*/
  4269. function (_Component) {
  4270. _inheritsLoose(UncontrolledAlert, _Component);
  4271. function UncontrolledAlert(props) {
  4272. var _this;
  4273. _this = _Component.call(this, props) || this;
  4274. _this.state = {
  4275. isOpen: true
  4276. };
  4277. _this.toggle = _this.toggle.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  4278. return _this;
  4279. }
  4280. var _proto = UncontrolledAlert.prototype;
  4281. _proto.toggle = function toggle() {
  4282. this.setState({
  4283. isOpen: !this.state.isOpen
  4284. });
  4285. };
  4286. _proto.render = function render() {
  4287. return React.createElement(Alert, _extends({
  4288. isOpen: this.state.isOpen,
  4289. toggle: this.toggle
  4290. }, this.props));
  4291. };
  4292. return UncontrolledAlert;
  4293. }(Component);
  4294. var omitKeys$1 = ['defaultOpen'];
  4295. var UncontrolledButtonDropdown =
  4296. /*#__PURE__*/
  4297. function (_Component) {
  4298. _inheritsLoose(UncontrolledButtonDropdown, _Component);
  4299. function UncontrolledButtonDropdown(props) {
  4300. var _this;
  4301. _this = _Component.call(this, props) || this;
  4302. _this.state = {
  4303. isOpen: props.defaultOpen || false
  4304. };
  4305. _this.toggle = _this.toggle.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  4306. return _this;
  4307. }
  4308. var _proto = UncontrolledButtonDropdown.prototype;
  4309. _proto.toggle = function toggle() {
  4310. this.setState({
  4311. isOpen: !this.state.isOpen
  4312. });
  4313. };
  4314. _proto.render = function render() {
  4315. return React.createElement(ButtonDropdown, _extends({
  4316. isOpen: this.state.isOpen,
  4317. toggle: this.toggle
  4318. }, omit(this.props, omitKeys$1)));
  4319. };
  4320. return UncontrolledButtonDropdown;
  4321. }(Component);
  4322. UncontrolledButtonDropdown.propTypes = _extends({
  4323. defaultOpen: PropTypes.bool
  4324. }, ButtonDropdown.propTypes);
  4325. var omitKeys$2 = ['toggleEvents', 'defaultOpen'];
  4326. var propTypes$18 = {
  4327. defaultOpen: PropTypes.bool,
  4328. toggler: PropTypes.string.isRequired,
  4329. toggleEvents: PropTypes.arrayOf(PropTypes.string)
  4330. };
  4331. var defaultProps$13 = {
  4332. toggleEvents: defaultToggleEvents
  4333. };
  4334. var UncontrolledCollapse =
  4335. /*#__PURE__*/
  4336. function (_Component) {
  4337. _inheritsLoose(UncontrolledCollapse, _Component);
  4338. function UncontrolledCollapse(props) {
  4339. var _this;
  4340. _this = _Component.call(this, props) || this;
  4341. _this.togglers = null;
  4342. _this.removeEventListeners = null;
  4343. _this.toggle = _this.toggle.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  4344. _this.state = {
  4345. isOpen: props.defaultOpen || false
  4346. };
  4347. return _this;
  4348. }
  4349. var _proto = UncontrolledCollapse.prototype;
  4350. _proto.componentDidMount = function componentDidMount() {
  4351. this.togglers = findDOMElements(this.props.toggler);
  4352. if (this.togglers.length) {
  4353. this.removeEventListeners = addMultipleEventListeners(this.togglers, this.toggle, this.props.toggleEvents);
  4354. }
  4355. };
  4356. _proto.componentWillUnmount = function componentWillUnmount() {
  4357. if (this.togglers.length && this.removeEventListeners) {
  4358. this.removeEventListeners();
  4359. }
  4360. };
  4361. _proto.toggle = function toggle(e) {
  4362. this.setState(function (_ref) {
  4363. var isOpen = _ref.isOpen;
  4364. return {
  4365. isOpen: !isOpen
  4366. };
  4367. });
  4368. e.preventDefault();
  4369. };
  4370. _proto.render = function render() {
  4371. return React.createElement(Collapse, _extends({
  4372. isOpen: this.state.isOpen
  4373. }, omit(this.props, omitKeys$2)));
  4374. };
  4375. return UncontrolledCollapse;
  4376. }(Component);
  4377. UncontrolledCollapse.propTypes = propTypes$18;
  4378. UncontrolledCollapse.defaultProps = defaultProps$13;
  4379. var omitKeys$3 = ['defaultOpen'];
  4380. var UncontrolledDropdown =
  4381. /*#__PURE__*/
  4382. function (_Component) {
  4383. _inheritsLoose(UncontrolledDropdown, _Component);
  4384. function UncontrolledDropdown(props) {
  4385. var _this;
  4386. _this = _Component.call(this, props) || this;
  4387. _this.state = {
  4388. isOpen: props.defaultOpen || false
  4389. };
  4390. _this.toggle = _this.toggle.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  4391. return _this;
  4392. }
  4393. var _proto = UncontrolledDropdown.prototype;
  4394. _proto.toggle = function toggle() {
  4395. this.setState({
  4396. isOpen: !this.state.isOpen
  4397. });
  4398. };
  4399. _proto.render = function render() {
  4400. return React.createElement(Dropdown, _extends({
  4401. isOpen: this.state.isOpen,
  4402. toggle: this.toggle
  4403. }, omit(this.props, omitKeys$3)));
  4404. };
  4405. return UncontrolledDropdown;
  4406. }(Component);
  4407. UncontrolledDropdown.propTypes = _extends({
  4408. defaultOpen: PropTypes.bool
  4409. }, Dropdown.propTypes);
  4410. var UncontrolledNavDropdown = function UncontrolledNavDropdown(props) {
  4411. warnOnce('The "UncontrolledNavDropdown" component has been deprecated.\nPlease use component "UncontrolledDropdown" with nav prop.');
  4412. return React.createElement(UncontrolledDropdown, _extends({
  4413. nav: true
  4414. }, props));
  4415. };
  4416. var omitKeys$4 = ['defaultOpen'];
  4417. var UncontrolledTooltip =
  4418. /*#__PURE__*/
  4419. function (_Component) {
  4420. _inheritsLoose(UncontrolledTooltip, _Component);
  4421. function UncontrolledTooltip(props) {
  4422. var _this;
  4423. _this = _Component.call(this, props) || this;
  4424. _this.state = {
  4425. isOpen: props.defaultOpen || false
  4426. };
  4427. _this.toggle = _this.toggle.bind(_assertThisInitialized(_assertThisInitialized(_this)));
  4428. return _this;
  4429. }
  4430. var _proto = UncontrolledTooltip.prototype;
  4431. _proto.toggle = function toggle() {
  4432. this.setState({
  4433. isOpen: !this.state.isOpen
  4434. });
  4435. };
  4436. _proto.render = function render() {
  4437. return React.createElement(Tooltip, _extends({
  4438. isOpen: this.state.isOpen,
  4439. toggle: this.toggle
  4440. }, omit(this.props, omitKeys$4)));
  4441. };
  4442. return UncontrolledTooltip;
  4443. }(Component);
  4444. UncontrolledTooltip.propTypes = _extends({
  4445. defaultOpen: PropTypes.bool
  4446. }, Tooltip.propTypes);
  4447. var propTypes$19 = {
  4448. tag: tagPropType,
  4449. type: PropTypes.string,
  4450. size: PropTypes.string,
  4451. color: PropTypes.string,
  4452. className: PropTypes.string,
  4453. cssModule: PropTypes.object,
  4454. children: PropTypes.string
  4455. };
  4456. var defaultProps$14 = {
  4457. tag: 'div',
  4458. type: 'border',
  4459. children: 'Loading...'
  4460. };
  4461. var Spinner = function Spinner(props) {
  4462. var className = props.className,
  4463. cssModule = props.cssModule,
  4464. type = props.type,
  4465. size = props.size,
  4466. color = props.color,
  4467. children = props.children,
  4468. Tag = props.tag,
  4469. attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "type", "size", "color", "children", "tag"]);
  4470. var classes = mapToCssModules(classNames(className, size ? "spinner-" + type + "-" + size : false, "spinner-" + type, color ? "text-" + color : false), cssModule);
  4471. return React.createElement(Tag, _extends({
  4472. role: "status"
  4473. }, attributes, {
  4474. className: classes
  4475. }), children && React.createElement("span", {
  4476. className: mapToCssModules('sr-only', cssModule)
  4477. }, children));
  4478. };
  4479. Spinner.propTypes = propTypes$19;
  4480. Spinner.defaultProps = defaultProps$14;
  4481. export { Container, Row, Col, Navbar, NavbarBrand, NavbarToggler, Nav, NavItem, NavDropdown, NavLink, Breadcrumb, BreadcrumbItem, Button, ButtonDropdown, ButtonGroup, ButtonToolbar, Dropdown, DropdownItem, DropdownMenu, DropdownToggle, Fade, Badge, Card, CardGroup, CardDeck, CardColumns, CardBody, CardBlock, CardLink, CardFooter, CardHeader, CardImg, CardImgOverlay, Carousel, UncontrolledCarousel, CarouselControl, CarouselItem, CarouselIndicators, CarouselCaption, CardSubtitle, CardText, CardTitle, CustomInput, PopperContent, PopperTargetHelper, Popover, UncontrolledPopover, PopoverHeader, PopoverTitle, PopoverBody, PopoverContent, Progress, Modal, ModalHeader, ModalBody, ModalFooter, Tooltip, Table, ListGroup, Form, FormFeedback, FormGroup, FormText, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupButtonDropdown, InputGroupText, Label, Media, Pagination, PaginationItem, PaginationLink, TabContent, TabPane, Jumbotron, Alert, Collapse, ListGroupItem, ListGroupItemHeading, ListGroupItemText, UncontrolledAlert, UncontrolledButtonDropdown, UncontrolledCollapse, UncontrolledDropdown, UncontrolledNavDropdown, UncontrolledTooltip, Spinner, utils as Util };
  4482. //# sourceMappingURL=reactstrap.es.js.map