1 | import React, { Component } from 'react';
|
2 | import PropTypes from 'prop-types';
|
3 | import classNames from 'classnames';
|
4 | import { Manager, Popper, Reference } from 'react-popper';
|
5 | import { Transition } from 'react-transition-group';
|
6 | import ReactDOM from 'react-dom';
|
7 | import { polyfill } from 'react-lifecycles-compat';
|
8 |
|
9 | function _extends() {
|
10 | _extends = Object.assign || function (target) {
|
11 | for (var i = 1; i < arguments.length; i++) {
|
12 | var source = arguments[i];
|
13 |
|
14 | for (var key in source) {
|
15 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
16 | target[key] = source[key];
|
17 | }
|
18 | }
|
19 | }
|
20 |
|
21 | return target;
|
22 | };
|
23 |
|
24 | return _extends.apply(this, arguments);
|
25 | }
|
26 |
|
27 | function _inheritsLoose(subClass, superClass) {
|
28 | subClass.prototype = Object.create(superClass.prototype);
|
29 | subClass.prototype.constructor = subClass;
|
30 | subClass.__proto__ = superClass;
|
31 | }
|
32 |
|
33 | function _objectWithoutPropertiesLoose(source, excluded) {
|
34 | if (source == null) return {};
|
35 | var target = {};
|
36 | var sourceKeys = Object.keys(source);
|
37 | var key, i;
|
38 |
|
39 | for (i = 0; i < sourceKeys.length; i++) {
|
40 | key = sourceKeys[i];
|
41 | if (excluded.indexOf(key) >= 0) continue;
|
42 | target[key] = source[key];
|
43 | }
|
44 |
|
45 | return target;
|
46 | }
|
47 |
|
48 | function _assertThisInitialized(self) {
|
49 | if (self === void 0) {
|
50 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
51 | }
|
52 |
|
53 | return self;
|
54 | }
|
55 |
|
56 | function getScrollbarWidth() {
|
57 | var scrollDiv = document.createElement('div');
|
58 |
|
59 | scrollDiv.style.position = 'absolute';
|
60 | scrollDiv.style.top = '-9999px';
|
61 | scrollDiv.style.width = '50px';
|
62 | scrollDiv.style.height = '50px';
|
63 | scrollDiv.style.overflow = 'scroll';
|
64 | document.body.appendChild(scrollDiv);
|
65 | var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
66 | document.body.removeChild(scrollDiv);
|
67 | return scrollbarWidth;
|
68 | }
|
69 | function setScrollbarWidth(padding) {
|
70 | document.body.style.paddingRight = padding > 0 ? padding + "px" : null;
|
71 | }
|
72 | function isBodyOverflowing() {
|
73 | return document.body.clientWidth < window.innerWidth;
|
74 | }
|
75 | function getOriginalBodyPadding() {
|
76 | var style = window.getComputedStyle(document.body, null);
|
77 | return parseInt(style && style.getPropertyValue('padding-right') || 0, 10);
|
78 | }
|
79 | function conditionallyUpdateScrollbar() {
|
80 | var scrollbarWidth = getScrollbarWidth();
|
81 |
|
82 | var fixedContent = document.querySelectorAll('.fixed-top, .fixed-bottom, .is-fixed, .sticky-top')[0];
|
83 | var bodyPadding = fixedContent ? parseInt(fixedContent.style.paddingRight || 0, 10) : 0;
|
84 |
|
85 | if (isBodyOverflowing()) {
|
86 | setScrollbarWidth(bodyPadding + scrollbarWidth);
|
87 | }
|
88 | }
|
89 | var globalCssModule;
|
90 | function setGlobalCssModule(cssModule) {
|
91 | globalCssModule = cssModule;
|
92 | }
|
93 | function mapToCssModules(className, cssModule) {
|
94 | if (className === void 0) {
|
95 | className = '';
|
96 | }
|
97 |
|
98 | if (cssModule === void 0) {
|
99 | cssModule = globalCssModule;
|
100 | }
|
101 |
|
102 | if (!cssModule) return className;
|
103 | return className.split(' ').map(function (c) {
|
104 | return cssModule[c] || c;
|
105 | }).join(' ');
|
106 | }
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | function omit(obj, omitKeys) {
|
112 | var result = {};
|
113 | Object.keys(obj).forEach(function (key) {
|
114 | if (omitKeys.indexOf(key) === -1) {
|
115 | result[key] = obj[key];
|
116 | }
|
117 | });
|
118 | return result;
|
119 | }
|
120 |
|
121 |
|
122 |
|
123 |
|
124 | function pick(obj, keys) {
|
125 | var pickKeys = Array.isArray(keys) ? keys : [keys];
|
126 | var length = pickKeys.length;
|
127 | var key;
|
128 | var result = {};
|
129 |
|
130 | while (length > 0) {
|
131 | length -= 1;
|
132 | key = pickKeys[length];
|
133 | result[key] = obj[key];
|
134 | }
|
135 |
|
136 | return result;
|
137 | }
|
138 | var warned = {};
|
139 | function warnOnce(message) {
|
140 | if (!warned[message]) {
|
141 |
|
142 | if (typeof console !== 'undefined') {
|
143 | console.error(message);
|
144 | }
|
145 |
|
146 | warned[message] = true;
|
147 | }
|
148 | }
|
149 | function deprecated(propType, explanation) {
|
150 | return function validate(props, propName, componentName) {
|
151 | if (props[propName] !== null && typeof props[propName] !== 'undefined') {
|
152 | warnOnce("\"" + propName + "\" property of \"" + componentName + "\" has been deprecated.\n" + explanation);
|
153 | }
|
154 |
|
155 | for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
156 | rest[_key - 3] = arguments[_key];
|
157 | }
|
158 |
|
159 | return propType.apply(void 0, [props, propName, componentName].concat(rest));
|
160 | };
|
161 | }
|
162 |
|
163 | var Element = typeof window === 'object' && window.Element || function () {};
|
164 |
|
165 | function DOMElement(props, propName, componentName) {
|
166 | if (!(props[propName] instanceof Element)) {
|
167 | return new Error('Invalid prop `' + propName + '` supplied to `' + componentName + '`. Expected prop to be an instance of Element. Validation failed.');
|
168 | }
|
169 | }
|
170 | var targetPropType = PropTypes.oneOfType([PropTypes.string, PropTypes.func, DOMElement, PropTypes.shape({
|
171 | current: PropTypes.any
|
172 | })]);
|
173 | var tagPropType = PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.shape({
|
174 | $$typeof: PropTypes.symbol,
|
175 | render: PropTypes.func
|
176 | }), PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.shape({
|
177 | $$typeof: PropTypes.symbol,
|
178 | render: PropTypes.func
|
179 | })]))]);
|
180 |
|
181 |
|
182 |
|
183 |
|
184 | var TransitionTimeouts = {
|
185 | Fade: 150,
|
186 |
|
187 | Collapse: 350,
|
188 |
|
189 | Modal: 300,
|
190 |
|
191 | Carousel: 600
|
192 |
|
193 | };
|
194 |
|
195 |
|
196 |
|
197 | var TransitionPropTypeKeys = ['in', 'mountOnEnter', 'unmountOnExit', 'appear', 'enter', 'exit', 'timeout', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'];
|
198 | var TransitionStatuses = {
|
199 | ENTERING: 'entering',
|
200 | ENTERED: 'entered',
|
201 | EXITING: 'exiting',
|
202 | EXITED: 'exited'
|
203 | };
|
204 | var keyCodes = {
|
205 | esc: 27,
|
206 | space: 32,
|
207 | enter: 13,
|
208 | tab: 9,
|
209 | up: 38,
|
210 | down: 40,
|
211 | home: 36,
|
212 | end: 35,
|
213 | n: 78,
|
214 | p: 80
|
215 | };
|
216 | 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'];
|
217 | var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
218 | function isReactRefObj(target) {
|
219 | if (target && typeof target === 'object') {
|
220 | return 'current' in target;
|
221 | }
|
222 |
|
223 | return false;
|
224 | }
|
225 |
|
226 | function getTag(value) {
|
227 | if (value == null) {
|
228 | return value === undefined ? '[object Undefined]' : '[object Null]';
|
229 | }
|
230 |
|
231 | return Object.prototype.toString.call(value);
|
232 | }
|
233 |
|
234 | function toNumber(value) {
|
235 | var type = typeof value;
|
236 | var NAN = 0 / 0;
|
237 |
|
238 | if (type === 'number') {
|
239 | return value;
|
240 | }
|
241 |
|
242 | if (type === 'symbol' || type === 'object' && getTag(value) === '[object Symbol]') {
|
243 | return NAN;
|
244 | }
|
245 |
|
246 | if (isObject(value)) {
|
247 | var other = typeof value.valueOf === 'function' ? value.valueOf() : value;
|
248 | value = isObject(other) ? "" + other : other;
|
249 | }
|
250 |
|
251 | if (type !== 'string') {
|
252 | return value === 0 ? value : +value;
|
253 | }
|
254 |
|
255 | value = value.replace(/^\s+|\s+$/g, '');
|
256 | var isBinary = /^0b[01]+$/i.test(value);
|
257 | return isBinary || /^0o[0-7]+$/i.test(value) ? parseInt(value.slice(2), isBinary ? 2 : 8) : /^[-+]0x[0-9a-f]+$/i.test(value) ? NAN : +value;
|
258 | }
|
259 | function isObject(value) {
|
260 | var type = typeof value;
|
261 | return value != null && (type === 'object' || type === 'function');
|
262 | }
|
263 | function isFunction(value) {
|
264 | if (!isObject(value)) {
|
265 | return false;
|
266 | }
|
267 |
|
268 | var tag = getTag(value);
|
269 | return tag === '[object Function]' || tag === '[object AsyncFunction]' || tag === '[object GeneratorFunction]' || tag === '[object Proxy]';
|
270 | }
|
271 | function findDOMElements(target) {
|
272 | if (isReactRefObj(target)) {
|
273 | return target.current;
|
274 | }
|
275 |
|
276 | if (isFunction(target)) {
|
277 | return target();
|
278 | }
|
279 |
|
280 | if (typeof target === 'string' && canUseDOM) {
|
281 | var selection = document.querySelectorAll(target);
|
282 |
|
283 | if (!selection.length) {
|
284 | selection = document.querySelectorAll("#" + target);
|
285 | }
|
286 |
|
287 | if (!selection.length) {
|
288 | throw new Error("The target '" + target + "' could not be identified in the dom, tip: check spelling");
|
289 | }
|
290 |
|
291 | return selection;
|
292 | }
|
293 |
|
294 | return target;
|
295 | }
|
296 | function isArrayOrNodeList(els) {
|
297 | if (els === null) {
|
298 | return false;
|
299 | }
|
300 |
|
301 | return Array.isArray(els) || canUseDOM && typeof els.length === 'number';
|
302 | }
|
303 | function getTarget(target, allElements) {
|
304 | var els = findDOMElements(target);
|
305 |
|
306 | if (allElements) {
|
307 | if (isArrayOrNodeList(els)) {
|
308 | return els;
|
309 | }
|
310 |
|
311 | if (els === null) {
|
312 | return [];
|
313 | }
|
314 |
|
315 | return [els];
|
316 | } else {
|
317 | if (isArrayOrNodeList(els)) {
|
318 | return els[0];
|
319 | }
|
320 |
|
321 | return els;
|
322 | }
|
323 | }
|
324 | var defaultToggleEvents = ['touchstart', 'click'];
|
325 | function addMultipleEventListeners(_els, handler, _events, useCapture) {
|
326 | var els = _els;
|
327 |
|
328 | if (!isArrayOrNodeList(els)) {
|
329 | els = [els];
|
330 | }
|
331 |
|
332 | var events = _events;
|
333 |
|
334 | if (typeof events === 'string') {
|
335 | events = events.split(/\s+/);
|
336 | }
|
337 |
|
338 | if (!isArrayOrNodeList(els) || typeof handler !== 'function' || !Array.isArray(events)) {
|
339 | 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 ");
|
340 | }
|
341 |
|
342 | Array.prototype.forEach.call(events, function (event) {
|
343 | Array.prototype.forEach.call(els, function (el) {
|
344 | el.addEventListener(event, handler, useCapture);
|
345 | });
|
346 | });
|
347 | return function removeEvents() {
|
348 | Array.prototype.forEach.call(events, function (event) {
|
349 | Array.prototype.forEach.call(els, function (el) {
|
350 | el.removeEventListener(event, handler, useCapture);
|
351 | });
|
352 | });
|
353 | };
|
354 | }
|
355 | 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"])'];
|
356 |
|
357 | var utils = Object.freeze({
|
358 | getScrollbarWidth: getScrollbarWidth,
|
359 | setScrollbarWidth: setScrollbarWidth,
|
360 | isBodyOverflowing: isBodyOverflowing,
|
361 | getOriginalBodyPadding: getOriginalBodyPadding,
|
362 | conditionallyUpdateScrollbar: conditionallyUpdateScrollbar,
|
363 | setGlobalCssModule: setGlobalCssModule,
|
364 | mapToCssModules: mapToCssModules,
|
365 | omit: omit,
|
366 | pick: pick,
|
367 | warnOnce: warnOnce,
|
368 | deprecated: deprecated,
|
369 | DOMElement: DOMElement,
|
370 | targetPropType: targetPropType,
|
371 | tagPropType: tagPropType,
|
372 | TransitionTimeouts: TransitionTimeouts,
|
373 | TransitionPropTypeKeys: TransitionPropTypeKeys,
|
374 | TransitionStatuses: TransitionStatuses,
|
375 | keyCodes: keyCodes,
|
376 | PopperPlacements: PopperPlacements,
|
377 | canUseDOM: canUseDOM,
|
378 | isReactRefObj: isReactRefObj,
|
379 | toNumber: toNumber,
|
380 | isObject: isObject,
|
381 | isFunction: isFunction,
|
382 | findDOMElements: findDOMElements,
|
383 | isArrayOrNodeList: isArrayOrNodeList,
|
384 | getTarget: getTarget,
|
385 | defaultToggleEvents: defaultToggleEvents,
|
386 | addMultipleEventListeners: addMultipleEventListeners,
|
387 | focusableElements: focusableElements
|
388 | });
|
389 |
|
390 | var propTypes = {
|
391 | tag: tagPropType,
|
392 | fluid: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
393 | className: PropTypes.string,
|
394 | cssModule: PropTypes.object
|
395 | };
|
396 | var defaultProps = {
|
397 | tag: 'div'
|
398 | };
|
399 |
|
400 | var Container = function Container(props) {
|
401 | var className = props.className,
|
402 | cssModule = props.cssModule,
|
403 | fluid = props.fluid,
|
404 | Tag = props.tag,
|
405 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "fluid", "tag"]);
|
406 |
|
407 | var containerClass = 'container';
|
408 |
|
409 | if (fluid === true) {
|
410 | containerClass = 'container-fluid';
|
411 | } else if (fluid) {
|
412 | containerClass = "container-" + fluid;
|
413 | }
|
414 |
|
415 | var classes = mapToCssModules(classNames(className, containerClass), cssModule);
|
416 | return React.createElement(Tag, _extends({}, attributes, {
|
417 | className: classes
|
418 | }));
|
419 | };
|
420 |
|
421 | Container.propTypes = propTypes;
|
422 | Container.defaultProps = defaultProps;
|
423 |
|
424 | var rowColWidths = ['xs', 'sm', 'md', 'lg', 'xl'];
|
425 | var rowColsPropType = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
|
426 | var propTypes$1 = {
|
427 | tag: tagPropType,
|
428 | noGutters: PropTypes.bool,
|
429 | className: PropTypes.string,
|
430 | cssModule: PropTypes.object,
|
431 | form: PropTypes.bool,
|
432 | xs: rowColsPropType,
|
433 | sm: rowColsPropType,
|
434 | md: rowColsPropType,
|
435 | lg: rowColsPropType,
|
436 | xl: rowColsPropType
|
437 | };
|
438 | var defaultProps$1 = {
|
439 | tag: 'div',
|
440 | widths: rowColWidths
|
441 | };
|
442 |
|
443 | var Row = function Row(props) {
|
444 | var className = props.className,
|
445 | cssModule = props.cssModule,
|
446 | noGutters = props.noGutters,
|
447 | Tag = props.tag,
|
448 | form = props.form,
|
449 | widths = props.widths,
|
450 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "noGutters", "tag", "form", "widths"]);
|
451 |
|
452 | var colClasses = [];
|
453 | widths.forEach(function (colWidth, i) {
|
454 | var colSize = props[colWidth];
|
455 | delete attributes[colWidth];
|
456 |
|
457 | if (!colSize) {
|
458 | return;
|
459 | }
|
460 |
|
461 | var isXs = !i;
|
462 | colClasses.push(isXs ? "row-cols-" + colSize : "row-cols-" + colWidth + "-" + colSize);
|
463 | });
|
464 | var classes = mapToCssModules(classNames(className, noGutters ? 'no-gutters' : null, form ? 'form-row' : 'row', colClasses), cssModule);
|
465 | return React.createElement(Tag, _extends({}, attributes, {
|
466 | className: classes
|
467 | }));
|
468 | };
|
469 |
|
470 | Row.propTypes = propTypes$1;
|
471 | Row.defaultProps = defaultProps$1;
|
472 |
|
473 | var colWidths = ['xs', 'sm', 'md', 'lg', 'xl'];
|
474 | var stringOrNumberProp = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
|
475 | var columnProps = PropTypes.oneOfType([PropTypes.bool, PropTypes.number, PropTypes.string, PropTypes.shape({
|
476 | size: PropTypes.oneOfType([PropTypes.bool, PropTypes.number, PropTypes.string]),
|
477 | order: stringOrNumberProp,
|
478 | offset: stringOrNumberProp
|
479 | })]);
|
480 | var propTypes$2 = {
|
481 | tag: tagPropType,
|
482 | xs: columnProps,
|
483 | sm: columnProps,
|
484 | md: columnProps,
|
485 | lg: columnProps,
|
486 | xl: columnProps,
|
487 | className: PropTypes.string,
|
488 | cssModule: PropTypes.object,
|
489 | widths: PropTypes.array
|
490 | };
|
491 | var defaultProps$2 = {
|
492 | tag: 'div',
|
493 | widths: colWidths
|
494 | };
|
495 |
|
496 | var getColumnSizeClass = function getColumnSizeClass(isXs, colWidth, colSize) {
|
497 | if (colSize === true || colSize === '') {
|
498 | return isXs ? 'col' : "col-" + colWidth;
|
499 | } else if (colSize === 'auto') {
|
500 | return isXs ? 'col-auto' : "col-" + colWidth + "-auto";
|
501 | }
|
502 |
|
503 | return isXs ? "col-" + colSize : "col-" + colWidth + "-" + colSize;
|
504 | };
|
505 |
|
506 | var Col = function Col(props) {
|
507 | var className = props.className,
|
508 | cssModule = props.cssModule,
|
509 | widths = props.widths,
|
510 | Tag = props.tag,
|
511 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "widths", "tag"]);
|
512 |
|
513 | var colClasses = [];
|
514 | widths.forEach(function (colWidth, i) {
|
515 | var columnProp = props[colWidth];
|
516 | delete attributes[colWidth];
|
517 |
|
518 | if (!columnProp && columnProp !== '') {
|
519 | return;
|
520 | }
|
521 |
|
522 | var isXs = !i;
|
523 |
|
524 | if (isObject(columnProp)) {
|
525 | var _classNames;
|
526 |
|
527 | var colSizeInterfix = isXs ? '-' : "-" + colWidth + "-";
|
528 | var colClass = getColumnSizeClass(isXs, colWidth, columnProp.size);
|
529 | 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));
|
530 | } else {
|
531 | var _colClass = getColumnSizeClass(isXs, colWidth, columnProp);
|
532 |
|
533 | colClasses.push(_colClass);
|
534 | }
|
535 | });
|
536 |
|
537 | if (!colClasses.length) {
|
538 | colClasses.push('col');
|
539 | }
|
540 |
|
541 | var classes = mapToCssModules(classNames(className, colClasses), cssModule);
|
542 | return React.createElement(Tag, _extends({}, attributes, {
|
543 | className: classes
|
544 | }));
|
545 | };
|
546 |
|
547 | Col.propTypes = propTypes$2;
|
548 | Col.defaultProps = defaultProps$2;
|
549 |
|
550 | var propTypes$3 = {
|
551 | light: PropTypes.bool,
|
552 | dark: PropTypes.bool,
|
553 | full: PropTypes.bool,
|
554 | fixed: PropTypes.string,
|
555 | sticky: PropTypes.string,
|
556 | color: PropTypes.string,
|
557 | role: PropTypes.string,
|
558 | tag: tagPropType,
|
559 | className: PropTypes.string,
|
560 | cssModule: PropTypes.object,
|
561 | expand: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
|
562 | };
|
563 | var defaultProps$3 = {
|
564 | tag: 'nav',
|
565 | expand: false
|
566 | };
|
567 |
|
568 | var getExpandClass = function getExpandClass(expand) {
|
569 | if (expand === false) {
|
570 | return false;
|
571 | } else if (expand === true || expand === 'xs') {
|
572 | return 'navbar-expand';
|
573 | }
|
574 |
|
575 | return "navbar-expand-" + expand;
|
576 | };
|
577 |
|
578 | var Navbar = function Navbar(props) {
|
579 | var _classNames;
|
580 |
|
581 | var expand = props.expand,
|
582 | className = props.className,
|
583 | cssModule = props.cssModule,
|
584 | light = props.light,
|
585 | dark = props.dark,
|
586 | fixed = props.fixed,
|
587 | sticky = props.sticky,
|
588 | color = props.color,
|
589 | Tag = props.tag,
|
590 | attributes = _objectWithoutPropertiesLoose(props, ["expand", "className", "cssModule", "light", "dark", "fixed", "sticky", "color", "tag"]);
|
591 |
|
592 | var classes = mapToCssModules(classNames(className, 'navbar', getExpandClass(expand), (_classNames = {
|
593 | 'navbar-light': light,
|
594 | 'navbar-dark': dark
|
595 | }, _classNames["bg-" + color] = color, _classNames["fixed-" + fixed] = fixed, _classNames["sticky-" + sticky] = sticky, _classNames)), cssModule);
|
596 | return React.createElement(Tag, _extends({}, attributes, {
|
597 | className: classes
|
598 | }));
|
599 | };
|
600 |
|
601 | Navbar.propTypes = propTypes$3;
|
602 | Navbar.defaultProps = defaultProps$3;
|
603 |
|
604 | var propTypes$4 = {
|
605 | tag: tagPropType,
|
606 | className: PropTypes.string,
|
607 | cssModule: PropTypes.object
|
608 | };
|
609 | var defaultProps$4 = {
|
610 | tag: 'a'
|
611 | };
|
612 |
|
613 | var NavbarBrand = function NavbarBrand(props) {
|
614 | var className = props.className,
|
615 | cssModule = props.cssModule,
|
616 | Tag = props.tag,
|
617 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
618 |
|
619 | var classes = mapToCssModules(classNames(className, 'navbar-brand'), cssModule);
|
620 | return React.createElement(Tag, _extends({}, attributes, {
|
621 | className: classes
|
622 | }));
|
623 | };
|
624 |
|
625 | NavbarBrand.propTypes = propTypes$4;
|
626 | NavbarBrand.defaultProps = defaultProps$4;
|
627 |
|
628 | var propTypes$5 = {
|
629 | tag: tagPropType,
|
630 | className: PropTypes.string,
|
631 | cssModule: PropTypes.object
|
632 | };
|
633 | var defaultProps$5 = {
|
634 | tag: 'span'
|
635 | };
|
636 |
|
637 | var NavbarText = function NavbarText(props) {
|
638 | var className = props.className,
|
639 | cssModule = props.cssModule,
|
640 | active = props.active,
|
641 | Tag = props.tag,
|
642 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "active", "tag"]);
|
643 |
|
644 | var classes = mapToCssModules(classNames(className, 'navbar-text'), cssModule);
|
645 | return React.createElement(Tag, _extends({}, attributes, {
|
646 | className: classes
|
647 | }));
|
648 | };
|
649 |
|
650 | NavbarText.propTypes = propTypes$5;
|
651 | NavbarText.defaultProps = defaultProps$5;
|
652 |
|
653 | var propTypes$6 = {
|
654 | tag: tagPropType,
|
655 | type: PropTypes.string,
|
656 | className: PropTypes.string,
|
657 | cssModule: PropTypes.object,
|
658 | children: PropTypes.node
|
659 | };
|
660 | var defaultProps$6 = {
|
661 | tag: 'button',
|
662 | type: 'button'
|
663 | };
|
664 |
|
665 | var NavbarToggler = function NavbarToggler(props) {
|
666 | var className = props.className,
|
667 | cssModule = props.cssModule,
|
668 | children = props.children,
|
669 | Tag = props.tag,
|
670 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "children", "tag"]);
|
671 |
|
672 | var classes = mapToCssModules(classNames(className, 'navbar-toggler'), cssModule);
|
673 | return React.createElement(Tag, _extends({
|
674 | "aria-label": "Toggle navigation"
|
675 | }, attributes, {
|
676 | className: classes
|
677 | }), children || React.createElement("span", {
|
678 | className: mapToCssModules('navbar-toggler-icon', cssModule)
|
679 | }));
|
680 | };
|
681 |
|
682 | NavbarToggler.propTypes = propTypes$6;
|
683 | NavbarToggler.defaultProps = defaultProps$6;
|
684 |
|
685 | var propTypes$7 = {
|
686 | tabs: PropTypes.bool,
|
687 | pills: PropTypes.bool,
|
688 | vertical: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
689 | horizontal: PropTypes.string,
|
690 | justified: PropTypes.bool,
|
691 | fill: PropTypes.bool,
|
692 | navbar: PropTypes.bool,
|
693 | card: PropTypes.bool,
|
694 | tag: tagPropType,
|
695 | className: PropTypes.string,
|
696 | cssModule: PropTypes.object
|
697 | };
|
698 | var defaultProps$7 = {
|
699 | tag: 'ul',
|
700 | vertical: false
|
701 | };
|
702 |
|
703 | var getVerticalClass = function getVerticalClass(vertical) {
|
704 | if (vertical === false) {
|
705 | return false;
|
706 | } else if (vertical === true || vertical === 'xs') {
|
707 | return 'flex-column';
|
708 | }
|
709 |
|
710 | return "flex-" + vertical + "-column";
|
711 | };
|
712 |
|
713 | var Nav = function Nav(props) {
|
714 | var className = props.className,
|
715 | cssModule = props.cssModule,
|
716 | tabs = props.tabs,
|
717 | pills = props.pills,
|
718 | vertical = props.vertical,
|
719 | horizontal = props.horizontal,
|
720 | justified = props.justified,
|
721 | fill = props.fill,
|
722 | navbar = props.navbar,
|
723 | card = props.card,
|
724 | Tag = props.tag,
|
725 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tabs", "pills", "vertical", "horizontal", "justified", "fill", "navbar", "card", "tag"]);
|
726 |
|
727 | var classes = mapToCssModules(classNames(className, navbar ? 'navbar-nav' : 'nav', horizontal ? "justify-content-" + horizontal : false, getVerticalClass(vertical), {
|
728 | 'nav-tabs': tabs,
|
729 | 'card-header-tabs': card && tabs,
|
730 | 'nav-pills': pills,
|
731 | 'card-header-pills': card && pills,
|
732 | 'nav-justified': justified,
|
733 | 'nav-fill': fill
|
734 | }), cssModule);
|
735 | return React.createElement(Tag, _extends({}, attributes, {
|
736 | className: classes
|
737 | }));
|
738 | };
|
739 |
|
740 | Nav.propTypes = propTypes$7;
|
741 | Nav.defaultProps = defaultProps$7;
|
742 |
|
743 | var propTypes$8 = {
|
744 | tag: tagPropType,
|
745 | active: PropTypes.bool,
|
746 | className: PropTypes.string,
|
747 | cssModule: PropTypes.object
|
748 | };
|
749 | var defaultProps$8 = {
|
750 | tag: 'li'
|
751 | };
|
752 |
|
753 | var NavItem = function NavItem(props) {
|
754 | var className = props.className,
|
755 | cssModule = props.cssModule,
|
756 | active = props.active,
|
757 | Tag = props.tag,
|
758 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "active", "tag"]);
|
759 |
|
760 | var classes = mapToCssModules(classNames(className, 'nav-item', active ? 'active' : false), cssModule);
|
761 | return React.createElement(Tag, _extends({}, attributes, {
|
762 | className: classes
|
763 | }));
|
764 | };
|
765 |
|
766 | NavItem.propTypes = propTypes$8;
|
767 | NavItem.defaultProps = defaultProps$8;
|
768 |
|
769 | var propTypes$9 = {
|
770 | tag: tagPropType,
|
771 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
|
772 | disabled: PropTypes.bool,
|
773 | active: PropTypes.bool,
|
774 | className: PropTypes.string,
|
775 | cssModule: PropTypes.object,
|
776 | onClick: PropTypes.func,
|
777 | href: PropTypes.any
|
778 | };
|
779 | var defaultProps$9 = {
|
780 | tag: 'a'
|
781 | };
|
782 |
|
783 | var NavLink =
|
784 |
|
785 | function (_React$Component) {
|
786 | _inheritsLoose(NavLink, _React$Component);
|
787 |
|
788 | function NavLink(props) {
|
789 | var _this;
|
790 |
|
791 | _this = _React$Component.call(this, props) || this;
|
792 | _this.onClick = _this.onClick.bind(_assertThisInitialized(_this));
|
793 | return _this;
|
794 | }
|
795 |
|
796 | var _proto = NavLink.prototype;
|
797 |
|
798 | _proto.onClick = function onClick(e) {
|
799 | if (this.props.disabled) {
|
800 | e.preventDefault();
|
801 | return;
|
802 | }
|
803 |
|
804 | if (this.props.href === '#') {
|
805 | e.preventDefault();
|
806 | }
|
807 |
|
808 | if (this.props.onClick) {
|
809 | this.props.onClick(e);
|
810 | }
|
811 | };
|
812 |
|
813 | _proto.render = function render() {
|
814 | var _this$props = this.props,
|
815 | className = _this$props.className,
|
816 | cssModule = _this$props.cssModule,
|
817 | active = _this$props.active,
|
818 | Tag = _this$props.tag,
|
819 | innerRef = _this$props.innerRef,
|
820 | attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "cssModule", "active", "tag", "innerRef"]);
|
821 |
|
822 | var classes = mapToCssModules(classNames(className, 'nav-link', {
|
823 | disabled: attributes.disabled,
|
824 | active: active
|
825 | }), cssModule);
|
826 | return React.createElement(Tag, _extends({}, attributes, {
|
827 | ref: innerRef,
|
828 | onClick: this.onClick,
|
829 | className: classes
|
830 | }));
|
831 | };
|
832 |
|
833 | return NavLink;
|
834 | }(React.Component);
|
835 |
|
836 | NavLink.propTypes = propTypes$9;
|
837 | NavLink.defaultProps = defaultProps$9;
|
838 |
|
839 | var propTypes$a = {
|
840 | tag: tagPropType,
|
841 | listTag: tagPropType,
|
842 | className: PropTypes.string,
|
843 | listClassName: PropTypes.string,
|
844 | cssModule: PropTypes.object,
|
845 | children: PropTypes.node,
|
846 | 'aria-label': PropTypes.string
|
847 | };
|
848 | var defaultProps$a = {
|
849 | tag: 'nav',
|
850 | listTag: 'ol',
|
851 | 'aria-label': 'breadcrumb'
|
852 | };
|
853 |
|
854 | var Breadcrumb = function Breadcrumb(props) {
|
855 | var className = props.className,
|
856 | listClassName = props.listClassName,
|
857 | cssModule = props.cssModule,
|
858 | children = props.children,
|
859 | Tag = props.tag,
|
860 | ListTag = props.listTag,
|
861 | label = props['aria-label'],
|
862 | attributes = _objectWithoutPropertiesLoose(props, ["className", "listClassName", "cssModule", "children", "tag", "listTag", "aria-label"]);
|
863 |
|
864 | var classes = mapToCssModules(classNames(className), cssModule);
|
865 | var listClasses = mapToCssModules(classNames('breadcrumb', listClassName), cssModule);
|
866 | return React.createElement(Tag, _extends({}, attributes, {
|
867 | className: classes,
|
868 | "aria-label": label
|
869 | }), React.createElement(ListTag, {
|
870 | className: listClasses
|
871 | }, children));
|
872 | };
|
873 |
|
874 | Breadcrumb.propTypes = propTypes$a;
|
875 | Breadcrumb.defaultProps = defaultProps$a;
|
876 |
|
877 | var propTypes$b = {
|
878 | tag: tagPropType,
|
879 | active: PropTypes.bool,
|
880 | className: PropTypes.string,
|
881 | cssModule: PropTypes.object
|
882 | };
|
883 | var defaultProps$b = {
|
884 | tag: 'li'
|
885 | };
|
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 |
|
894 | var classes = mapToCssModules(classNames(className, active ? 'active' : false, 'breadcrumb-item'), cssModule);
|
895 | return React.createElement(Tag, _extends({}, attributes, {
|
896 | className: classes,
|
897 | "aria-current": active ? 'page' : undefined
|
898 | }));
|
899 | };
|
900 |
|
901 | BreadcrumbItem.propTypes = propTypes$b;
|
902 | BreadcrumbItem.defaultProps = defaultProps$b;
|
903 |
|
904 | var propTypes$c = {
|
905 | active: PropTypes.bool,
|
906 | 'aria-label': PropTypes.string,
|
907 | block: PropTypes.bool,
|
908 | color: PropTypes.string,
|
909 | disabled: PropTypes.bool,
|
910 | outline: PropTypes.bool,
|
911 | tag: tagPropType,
|
912 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
|
913 | onClick: PropTypes.func,
|
914 | size: PropTypes.string,
|
915 | children: PropTypes.node,
|
916 | className: PropTypes.string,
|
917 | cssModule: PropTypes.object,
|
918 | close: PropTypes.bool
|
919 | };
|
920 | var defaultProps$c = {
|
921 | color: 'secondary',
|
922 | tag: 'button'
|
923 | };
|
924 |
|
925 | var Button =
|
926 |
|
927 | function (_React$Component) {
|
928 | _inheritsLoose(Button, _React$Component);
|
929 |
|
930 | function Button(props) {
|
931 | var _this;
|
932 |
|
933 | _this = _React$Component.call(this, props) || this;
|
934 | _this.onClick = _this.onClick.bind(_assertThisInitialized(_this));
|
935 | return _this;
|
936 | }
|
937 |
|
938 | var _proto = Button.prototype;
|
939 |
|
940 | _proto.onClick = function onClick(e) {
|
941 | if (this.props.disabled) {
|
942 | e.preventDefault();
|
943 | return;
|
944 | }
|
945 |
|
946 | if (this.props.onClick) {
|
947 | this.props.onClick(e);
|
948 | }
|
949 | };
|
950 |
|
951 | _proto.render = function render() {
|
952 | var _this$props = this.props,
|
953 | active = _this$props.active,
|
954 | ariaLabel = _this$props['aria-label'],
|
955 | block = _this$props.block,
|
956 | className = _this$props.className,
|
957 | close = _this$props.close,
|
958 | cssModule = _this$props.cssModule,
|
959 | color = _this$props.color,
|
960 | outline = _this$props.outline,
|
961 | size = _this$props.size,
|
962 | Tag = _this$props.tag,
|
963 | innerRef = _this$props.innerRef,
|
964 | attributes = _objectWithoutPropertiesLoose(_this$props, ["active", "aria-label", "block", "className", "close", "cssModule", "color", "outline", "size", "tag", "innerRef"]);
|
965 |
|
966 | if (close && typeof attributes.children === 'undefined') {
|
967 | attributes.children = React.createElement("span", {
|
968 | "aria-hidden": true
|
969 | }, "\xD7");
|
970 | }
|
971 |
|
972 | var btnOutlineColor = "btn" + (outline ? '-outline' : '') + "-" + color;
|
973 | var classes = mapToCssModules(classNames(className, {
|
974 | close: close
|
975 | }, close || 'btn', close || btnOutlineColor, size ? "btn-" + size : false, block ? 'btn-block' : false, {
|
976 | active: active,
|
977 | disabled: this.props.disabled
|
978 | }), cssModule);
|
979 |
|
980 | if (attributes.href && Tag === 'button') {
|
981 | Tag = 'a';
|
982 | }
|
983 |
|
984 | var defaultAriaLabel = close ? 'Close' : null;
|
985 | return React.createElement(Tag, _extends({
|
986 | type: Tag === 'button' && attributes.onClick ? 'button' : undefined
|
987 | }, attributes, {
|
988 | className: classes,
|
989 | ref: innerRef,
|
990 | onClick: this.onClick,
|
991 | "aria-label": ariaLabel || defaultAriaLabel
|
992 | }));
|
993 | };
|
994 |
|
995 | return Button;
|
996 | }(React.Component);
|
997 |
|
998 | Button.propTypes = propTypes$c;
|
999 | Button.defaultProps = defaultProps$c;
|
1000 |
|
1001 | var propTypes$d = {
|
1002 | onClick: PropTypes.func,
|
1003 | onBlur: PropTypes.func,
|
1004 | onFocus: PropTypes.func,
|
1005 | defaultValue: PropTypes.bool
|
1006 | };
|
1007 | var defaultProps$d = {
|
1008 | defaultValue: false
|
1009 | };
|
1010 |
|
1011 | var ButtonToggle =
|
1012 |
|
1013 | function (_React$Component) {
|
1014 | _inheritsLoose(ButtonToggle, _React$Component);
|
1015 |
|
1016 | function ButtonToggle(props) {
|
1017 | var _this;
|
1018 |
|
1019 | _this = _React$Component.call(this, props) || this;
|
1020 | _this.state = {
|
1021 | toggled: props.defaultValue,
|
1022 | focus: false
|
1023 | };
|
1024 | _this.onBlur = _this.onBlur.bind(_assertThisInitialized(_this));
|
1025 | _this.onFocus = _this.onFocus.bind(_assertThisInitialized(_this));
|
1026 | _this.onClick = _this.onClick.bind(_assertThisInitialized(_this));
|
1027 | return _this;
|
1028 | }
|
1029 |
|
1030 | var _proto = ButtonToggle.prototype;
|
1031 |
|
1032 | _proto.onBlur = function onBlur(e) {
|
1033 | if (this.props.onBlur) {
|
1034 | this.props.onBlur(e);
|
1035 | }
|
1036 |
|
1037 | this.setState({
|
1038 | focus: false
|
1039 | });
|
1040 | };
|
1041 |
|
1042 | _proto.onFocus = function onFocus(e) {
|
1043 | if (this.props.onFocus) {
|
1044 | this.props.onFocus(e);
|
1045 | }
|
1046 |
|
1047 | this.setState({
|
1048 | focus: true
|
1049 | });
|
1050 | };
|
1051 |
|
1052 | _proto.onClick = function onClick(e) {
|
1053 | if (this.props.onClick) {
|
1054 | this.props.onClick(e);
|
1055 | }
|
1056 |
|
1057 | this.setState(function (_ref) {
|
1058 | var toggled = _ref.toggled;
|
1059 | return {
|
1060 | toggled: !toggled
|
1061 | };
|
1062 | });
|
1063 | };
|
1064 |
|
1065 | _proto.render = function render() {
|
1066 | var _this$props = this.props,
|
1067 | className = _this$props.className,
|
1068 | attributes = _objectWithoutPropertiesLoose(_this$props, ["className"]);
|
1069 |
|
1070 | var classes = mapToCssModules(classNames(className, {
|
1071 | focus: this.state.focus
|
1072 | }), this.props.cssModule);
|
1073 | return React.createElement(Button, _extends({
|
1074 | active: this.state.toggled,
|
1075 | onBlur: this.onBlur,
|
1076 | onFocus: this.onFocus,
|
1077 | onClick: this.onClick,
|
1078 | className: classes
|
1079 | }, attributes));
|
1080 | };
|
1081 |
|
1082 | return ButtonToggle;
|
1083 | }(React.Component);
|
1084 |
|
1085 | ButtonToggle.propTypes = propTypes$d;
|
1086 | ButtonToggle.defaultProps = defaultProps$d;
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 | var DropdownContext = React.createContext({});
|
1100 |
|
1101 | var propTypes$e = {
|
1102 | a11y: PropTypes.bool,
|
1103 | disabled: PropTypes.bool,
|
1104 | direction: PropTypes.oneOf(['up', 'down', 'left', 'right']),
|
1105 | group: PropTypes.bool,
|
1106 | isOpen: PropTypes.bool,
|
1107 | nav: PropTypes.bool,
|
1108 | active: PropTypes.bool,
|
1109 | addonType: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['prepend', 'append'])]),
|
1110 | size: PropTypes.string,
|
1111 | tag: tagPropType,
|
1112 | toggle: PropTypes.func,
|
1113 | children: PropTypes.node,
|
1114 | className: PropTypes.string,
|
1115 | cssModule: PropTypes.object,
|
1116 | inNavbar: PropTypes.bool,
|
1117 | setActiveFromChild: PropTypes.bool
|
1118 | };
|
1119 | var defaultProps$e = {
|
1120 | a11y: true,
|
1121 | isOpen: false,
|
1122 | direction: 'down',
|
1123 | nav: false,
|
1124 | active: false,
|
1125 | addonType: false,
|
1126 | inNavbar: false,
|
1127 | setActiveFromChild: false
|
1128 | };
|
1129 | var preventDefaultKeys = [keyCodes.space, keyCodes.enter, keyCodes.up, keyCodes.down, keyCodes.end, keyCodes.home];
|
1130 |
|
1131 | var Dropdown =
|
1132 |
|
1133 | function (_React$Component) {
|
1134 | _inheritsLoose(Dropdown, _React$Component);
|
1135 |
|
1136 | function Dropdown(props) {
|
1137 | var _this;
|
1138 |
|
1139 | _this = _React$Component.call(this, props) || this;
|
1140 | _this.addEvents = _this.addEvents.bind(_assertThisInitialized(_this));
|
1141 | _this.handleDocumentClick = _this.handleDocumentClick.bind(_assertThisInitialized(_this));
|
1142 | _this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));
|
1143 | _this.removeEvents = _this.removeEvents.bind(_assertThisInitialized(_this));
|
1144 | _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
|
1145 | _this.containerRef = React.createRef();
|
1146 | return _this;
|
1147 | }
|
1148 |
|
1149 | var _proto = Dropdown.prototype;
|
1150 |
|
1151 | _proto.getContextValue = function getContextValue() {
|
1152 | return {
|
1153 | toggle: this.toggle,
|
1154 | isOpen: this.props.isOpen,
|
1155 | direction: this.props.direction === 'down' && this.props.dropup ? 'up' : this.props.direction,
|
1156 | inNavbar: this.props.inNavbar,
|
1157 | disabled: this.props.disabled
|
1158 | };
|
1159 | };
|
1160 |
|
1161 | _proto.componentDidMount = function componentDidMount() {
|
1162 | this.handleProps();
|
1163 | };
|
1164 |
|
1165 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
1166 | if (this.props.isOpen !== prevProps.isOpen) {
|
1167 | this.handleProps();
|
1168 | }
|
1169 | };
|
1170 |
|
1171 | _proto.componentWillUnmount = function componentWillUnmount() {
|
1172 | this.removeEvents();
|
1173 | };
|
1174 |
|
1175 | _proto.getContainer = function getContainer() {
|
1176 | return this.containerRef.current;
|
1177 | };
|
1178 |
|
1179 | _proto.getMenuCtrl = function getMenuCtrl() {
|
1180 | if (this._$menuCtrl) return this._$menuCtrl;
|
1181 | this._$menuCtrl = this.getContainer().querySelector('[aria-expanded]');
|
1182 | return this._$menuCtrl;
|
1183 | };
|
1184 |
|
1185 | _proto.getMenuItems = function getMenuItems() {
|
1186 | return [].slice.call(this.getContainer().querySelectorAll('[role="menuitem"]'));
|
1187 | };
|
1188 |
|
1189 | _proto.addEvents = function addEvents() {
|
1190 | var _this2 = this;
|
1191 |
|
1192 | ['click', 'touchstart', 'keyup'].forEach(function (event) {
|
1193 | return document.addEventListener(event, _this2.handleDocumentClick, true);
|
1194 | });
|
1195 | };
|
1196 |
|
1197 | _proto.removeEvents = function removeEvents() {
|
1198 | var _this3 = this;
|
1199 |
|
1200 | ['click', 'touchstart', 'keyup'].forEach(function (event) {
|
1201 | return document.removeEventListener(event, _this3.handleDocumentClick, true);
|
1202 | });
|
1203 | };
|
1204 |
|
1205 | _proto.handleDocumentClick = function handleDocumentClick(e) {
|
1206 | if (e && (e.which === 3 || e.type === 'keyup' && e.which !== keyCodes.tab)) return;
|
1207 | var container = this.getContainer();
|
1208 |
|
1209 | if (container.contains(e.target) && container !== e.target && (e.type !== 'keyup' || e.which === keyCodes.tab)) {
|
1210 | return;
|
1211 | }
|
1212 |
|
1213 | this.toggle(e);
|
1214 | };
|
1215 |
|
1216 | _proto.handleKeyDown = function handleKeyDown(e) {
|
1217 | var _this4 = this;
|
1218 |
|
1219 | if (/input|textarea/i.test(e.target.tagName) || keyCodes.tab === e.which && (e.target.getAttribute('role') !== 'menuitem' || !this.props.a11y)) {
|
1220 | return;
|
1221 | }
|
1222 |
|
1223 | if (preventDefaultKeys.indexOf(e.which) !== -1 || e.which >= 48 && e.which <= 90) {
|
1224 | e.preventDefault();
|
1225 | }
|
1226 |
|
1227 | if (this.props.disabled) return;
|
1228 |
|
1229 | if (this.getMenuCtrl() === e.target) {
|
1230 | if (!this.props.isOpen && [keyCodes.space, keyCodes.enter, keyCodes.up, keyCodes.down].indexOf(e.which) > -1) {
|
1231 | this.toggle(e);
|
1232 | setTimeout(function () {
|
1233 | return _this4.getMenuItems()[0].focus();
|
1234 | });
|
1235 | } else if (this.props.isOpen && e.which === keyCodes.esc) {
|
1236 | this.toggle(e);
|
1237 | }
|
1238 | }
|
1239 |
|
1240 | if (this.props.isOpen && e.target.getAttribute('role') === 'menuitem') {
|
1241 | if ([keyCodes.tab, keyCodes.esc].indexOf(e.which) > -1) {
|
1242 | this.toggle(e);
|
1243 | this.getMenuCtrl().focus();
|
1244 | } else if ([keyCodes.space, keyCodes.enter].indexOf(e.which) > -1) {
|
1245 | e.target.click();
|
1246 | this.getMenuCtrl().focus();
|
1247 | } else if ([keyCodes.down, keyCodes.up].indexOf(e.which) > -1 || [keyCodes.n, keyCodes.p].indexOf(e.which) > -1 && e.ctrlKey) {
|
1248 | var $menuitems = this.getMenuItems();
|
1249 | var index = $menuitems.indexOf(e.target);
|
1250 |
|
1251 | if (keyCodes.up === e.which || keyCodes.p === e.which && e.ctrlKey) {
|
1252 | index = index !== 0 ? index - 1 : $menuitems.length - 1;
|
1253 | } else if (keyCodes.down === e.which || keyCodes.n === e.which && e.ctrlKey) {
|
1254 | index = index === $menuitems.length - 1 ? 0 : index + 1;
|
1255 | }
|
1256 |
|
1257 | $menuitems[index].focus();
|
1258 | } else if (keyCodes.end === e.which) {
|
1259 | var _$menuitems = this.getMenuItems();
|
1260 |
|
1261 | _$menuitems[_$menuitems.length - 1].focus();
|
1262 | } else if (keyCodes.home === e.which) {
|
1263 | var _$menuitems2 = this.getMenuItems();
|
1264 |
|
1265 | _$menuitems2[0].focus();
|
1266 | } else if (e.which >= 48 && e.which <= 90) {
|
1267 | var _$menuitems3 = this.getMenuItems();
|
1268 |
|
1269 | var charPressed = String.fromCharCode(e.which).toLowerCase();
|
1270 |
|
1271 | for (var i = 0; i < _$menuitems3.length; i += 1) {
|
1272 | var firstLetter = _$menuitems3[i].textContent && _$menuitems3[i].textContent[0].toLowerCase();
|
1273 |
|
1274 | if (firstLetter === charPressed) {
|
1275 | _$menuitems3[i].focus();
|
1276 |
|
1277 | break;
|
1278 | }
|
1279 | }
|
1280 | }
|
1281 | }
|
1282 | };
|
1283 |
|
1284 | _proto.handleProps = function handleProps() {
|
1285 | if (this.props.isOpen) {
|
1286 | this.addEvents();
|
1287 | } else {
|
1288 | this.removeEvents();
|
1289 | }
|
1290 | };
|
1291 |
|
1292 | _proto.toggle = function toggle(e) {
|
1293 | if (this.props.disabled) {
|
1294 | return e && e.preventDefault();
|
1295 | }
|
1296 |
|
1297 | return this.props.toggle(e);
|
1298 | };
|
1299 |
|
1300 | _proto.render = function render() {
|
1301 | var _classNames, _ref;
|
1302 |
|
1303 | var _omit = omit(this.props, ['toggle', 'disabled', 'inNavbar', 'a11y']),
|
1304 | className = _omit.className,
|
1305 | cssModule = _omit.cssModule,
|
1306 | direction = _omit.direction,
|
1307 | isOpen = _omit.isOpen,
|
1308 | group = _omit.group,
|
1309 | size = _omit.size,
|
1310 | nav = _omit.nav,
|
1311 | setActiveFromChild = _omit.setActiveFromChild,
|
1312 | active = _omit.active,
|
1313 | addonType = _omit.addonType,
|
1314 | tag = _omit.tag,
|
1315 | attrs = _objectWithoutPropertiesLoose(_omit, ["className", "cssModule", "direction", "isOpen", "group", "size", "nav", "setActiveFromChild", "active", "addonType", "tag"]);
|
1316 |
|
1317 | var Tag = tag || (nav ? 'li' : 'div');
|
1318 | var subItemIsActive = false;
|
1319 |
|
1320 | if (setActiveFromChild) {
|
1321 | React.Children.map(this.props.children[1].props.children, function (dropdownItem) {
|
1322 | if (dropdownItem && dropdownItem.props.active) subItemIsActive = true;
|
1323 | });
|
1324 | }
|
1325 |
|
1326 | 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);
|
1327 | return React.createElement(DropdownContext.Provider, {
|
1328 | value: this.getContextValue()
|
1329 | }, React.createElement(Manager, null, React.createElement(Tag, _extends({}, attrs, (_ref = {}, _ref[typeof Tag === 'string' ? 'ref' : 'innerRef'] = this.containerRef, _ref), {
|
1330 | onKeyDown: this.handleKeyDown,
|
1331 | className: classes
|
1332 | }))));
|
1333 | };
|
1334 |
|
1335 | return Dropdown;
|
1336 | }(React.Component);
|
1337 |
|
1338 | Dropdown.propTypes = propTypes$e;
|
1339 | Dropdown.defaultProps = defaultProps$e;
|
1340 |
|
1341 | var propTypes$f = {
|
1342 | children: PropTypes.node
|
1343 | };
|
1344 |
|
1345 | var ButtonDropdown = function ButtonDropdown(props) {
|
1346 | return React.createElement(Dropdown, _extends({
|
1347 | group: true
|
1348 | }, props));
|
1349 | };
|
1350 |
|
1351 | ButtonDropdown.propTypes = propTypes$f;
|
1352 |
|
1353 | var propTypes$g = {
|
1354 | tag: tagPropType,
|
1355 | 'aria-label': PropTypes.string,
|
1356 | className: PropTypes.string,
|
1357 | cssModule: PropTypes.object,
|
1358 | role: PropTypes.string,
|
1359 | size: PropTypes.string,
|
1360 | vertical: PropTypes.bool
|
1361 | };
|
1362 | var defaultProps$f = {
|
1363 | tag: 'div',
|
1364 | role: 'group'
|
1365 | };
|
1366 |
|
1367 | var ButtonGroup = function ButtonGroup(props) {
|
1368 | var className = props.className,
|
1369 | cssModule = props.cssModule,
|
1370 | size = props.size,
|
1371 | vertical = props.vertical,
|
1372 | Tag = props.tag,
|
1373 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "size", "vertical", "tag"]);
|
1374 |
|
1375 | var classes = mapToCssModules(classNames(className, size ? 'btn-group-' + size : false, vertical ? 'btn-group-vertical' : 'btn-group'), cssModule);
|
1376 | return React.createElement(Tag, _extends({}, attributes, {
|
1377 | className: classes
|
1378 | }));
|
1379 | };
|
1380 |
|
1381 | ButtonGroup.propTypes = propTypes$g;
|
1382 | ButtonGroup.defaultProps = defaultProps$f;
|
1383 |
|
1384 | var propTypes$h = {
|
1385 | tag: tagPropType,
|
1386 | 'aria-label': PropTypes.string,
|
1387 | className: PropTypes.string,
|
1388 | cssModule: PropTypes.object,
|
1389 | role: PropTypes.string
|
1390 | };
|
1391 | var defaultProps$g = {
|
1392 | tag: 'div',
|
1393 | role: 'toolbar'
|
1394 | };
|
1395 |
|
1396 | var ButtonToolbar = function ButtonToolbar(props) {
|
1397 | var className = props.className,
|
1398 | cssModule = props.cssModule,
|
1399 | Tag = props.tag,
|
1400 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
1401 |
|
1402 | var classes = mapToCssModules(classNames(className, 'btn-toolbar'), cssModule);
|
1403 | return React.createElement(Tag, _extends({}, attributes, {
|
1404 | className: classes
|
1405 | }));
|
1406 | };
|
1407 |
|
1408 | ButtonToolbar.propTypes = propTypes$h;
|
1409 | ButtonToolbar.defaultProps = defaultProps$g;
|
1410 |
|
1411 | var propTypes$i = {
|
1412 | children: PropTypes.node,
|
1413 | active: PropTypes.bool,
|
1414 | disabled: PropTypes.bool,
|
1415 | divider: PropTypes.bool,
|
1416 | tag: tagPropType,
|
1417 | header: PropTypes.bool,
|
1418 | onClick: PropTypes.func,
|
1419 | className: PropTypes.string,
|
1420 | cssModule: PropTypes.object,
|
1421 | toggle: PropTypes.bool
|
1422 | };
|
1423 | var defaultProps$h = {
|
1424 | tag: 'button',
|
1425 | toggle: true
|
1426 | };
|
1427 |
|
1428 | var DropdownItem =
|
1429 |
|
1430 | function (_React$Component) {
|
1431 | _inheritsLoose(DropdownItem, _React$Component);
|
1432 |
|
1433 | function DropdownItem(props) {
|
1434 | var _this;
|
1435 |
|
1436 | _this = _React$Component.call(this, props) || this;
|
1437 | _this.onClick = _this.onClick.bind(_assertThisInitialized(_this));
|
1438 | _this.getTabIndex = _this.getTabIndex.bind(_assertThisInitialized(_this));
|
1439 | return _this;
|
1440 | }
|
1441 |
|
1442 | var _proto = DropdownItem.prototype;
|
1443 |
|
1444 | _proto.onClick = function onClick(e) {
|
1445 | if (this.props.disabled || this.props.header || this.props.divider) {
|
1446 | e.preventDefault();
|
1447 | return;
|
1448 | }
|
1449 |
|
1450 | if (this.props.onClick) {
|
1451 | this.props.onClick(e);
|
1452 | }
|
1453 |
|
1454 | if (this.props.toggle) {
|
1455 | this.context.toggle(e);
|
1456 | }
|
1457 | };
|
1458 |
|
1459 | _proto.getTabIndex = function getTabIndex() {
|
1460 | if (this.props.disabled || this.props.header || this.props.divider) {
|
1461 | return '-1';
|
1462 | }
|
1463 |
|
1464 | return '0';
|
1465 | };
|
1466 |
|
1467 | _proto.render = function render() {
|
1468 | var tabIndex = this.getTabIndex();
|
1469 | var role = tabIndex > -1 ? 'menuitem' : undefined;
|
1470 |
|
1471 | var _omit = omit(this.props, ['toggle']),
|
1472 | className = _omit.className,
|
1473 | cssModule = _omit.cssModule,
|
1474 | divider = _omit.divider,
|
1475 | Tag = _omit.tag,
|
1476 | header = _omit.header,
|
1477 | active = _omit.active,
|
1478 | props = _objectWithoutPropertiesLoose(_omit, ["className", "cssModule", "divider", "tag", "header", "active"]);
|
1479 |
|
1480 | var classes = mapToCssModules(classNames(className, {
|
1481 | disabled: props.disabled,
|
1482 | 'dropdown-item': !divider && !header,
|
1483 | active: active,
|
1484 | 'dropdown-header': header,
|
1485 | 'dropdown-divider': divider
|
1486 | }), cssModule);
|
1487 |
|
1488 | if (Tag === 'button') {
|
1489 | if (header) {
|
1490 | Tag = 'h6';
|
1491 | } else if (divider) {
|
1492 | Tag = 'div';
|
1493 | } else if (props.href) {
|
1494 | Tag = 'a';
|
1495 | }
|
1496 | }
|
1497 |
|
1498 | return React.createElement(Tag, _extends({
|
1499 | type: Tag === 'button' && (props.onClick || this.props.toggle) ? 'button' : undefined
|
1500 | }, props, {
|
1501 | tabIndex: tabIndex,
|
1502 | role: role,
|
1503 | className: classes,
|
1504 | onClick: this.onClick
|
1505 | }));
|
1506 | };
|
1507 |
|
1508 | return DropdownItem;
|
1509 | }(React.Component);
|
1510 |
|
1511 | DropdownItem.propTypes = propTypes$i;
|
1512 | DropdownItem.defaultProps = defaultProps$h;
|
1513 | DropdownItem.contextType = DropdownContext;
|
1514 |
|
1515 | var propTypes$j = {
|
1516 | tag: tagPropType,
|
1517 | children: PropTypes.node.isRequired,
|
1518 | right: PropTypes.bool,
|
1519 | flip: PropTypes.bool,
|
1520 | modifiers: PropTypes.object,
|
1521 | className: PropTypes.string,
|
1522 | cssModule: PropTypes.object,
|
1523 | persist: PropTypes.bool,
|
1524 | positionFixed: PropTypes.bool
|
1525 | };
|
1526 | var defaultProps$i = {
|
1527 | tag: 'div',
|
1528 | flip: true
|
1529 | };
|
1530 | var noFlipModifier = {
|
1531 | flip: {
|
1532 | enabled: false
|
1533 | }
|
1534 | };
|
1535 | var directionPositionMap = {
|
1536 | up: 'top',
|
1537 | left: 'left',
|
1538 | right: 'right',
|
1539 | down: 'bottom'
|
1540 | };
|
1541 |
|
1542 | var DropdownMenu =
|
1543 |
|
1544 | function (_React$Component) {
|
1545 | _inheritsLoose(DropdownMenu, _React$Component);
|
1546 |
|
1547 | function DropdownMenu() {
|
1548 | return _React$Component.apply(this, arguments) || this;
|
1549 | }
|
1550 |
|
1551 | var _proto = DropdownMenu.prototype;
|
1552 |
|
1553 | _proto.render = function render() {
|
1554 | var _this = this;
|
1555 |
|
1556 | var _this$props = this.props,
|
1557 | className = _this$props.className,
|
1558 | cssModule = _this$props.cssModule,
|
1559 | right = _this$props.right,
|
1560 | tag = _this$props.tag,
|
1561 | flip = _this$props.flip,
|
1562 | modifiers = _this$props.modifiers,
|
1563 | persist = _this$props.persist,
|
1564 | positionFixed = _this$props.positionFixed,
|
1565 | attrs = _objectWithoutPropertiesLoose(_this$props, ["className", "cssModule", "right", "tag", "flip", "modifiers", "persist", "positionFixed"]);
|
1566 |
|
1567 | var classes = mapToCssModules(classNames(className, 'dropdown-menu', {
|
1568 | 'dropdown-menu-right': right,
|
1569 | show: this.context.isOpen
|
1570 | }), cssModule);
|
1571 | var Tag = tag;
|
1572 |
|
1573 | if (persist || this.context.isOpen && !this.context.inNavbar) {
|
1574 | var position1 = directionPositionMap[this.context.direction] || 'bottom';
|
1575 | var position2 = right ? 'end' : 'start';
|
1576 | var poperPlacement = position1 + "-" + position2;
|
1577 | var poperModifiers = !flip ? _extends({}, modifiers, {}, noFlipModifier) : modifiers;
|
1578 | var popperPositionFixed = !!positionFixed;
|
1579 | return React.createElement(Popper, {
|
1580 | placement: poperPlacement,
|
1581 | modifiers: poperModifiers,
|
1582 | positionFixed: popperPositionFixed
|
1583 | }, function (_ref) {
|
1584 | var ref = _ref.ref,
|
1585 | style = _ref.style,
|
1586 | placement = _ref.placement;
|
1587 | return React.createElement(Tag, _extends({
|
1588 | tabIndex: "-1",
|
1589 | role: "menu",
|
1590 | ref: ref,
|
1591 | style: style
|
1592 | }, attrs, {
|
1593 | "aria-hidden": !_this.context.isOpen,
|
1594 | className: classes,
|
1595 | "x-placement": placement
|
1596 | }));
|
1597 | });
|
1598 | }
|
1599 |
|
1600 | return React.createElement(Tag, _extends({
|
1601 | tabIndex: "-1",
|
1602 | role: "menu"
|
1603 | }, attrs, {
|
1604 | "aria-hidden": !this.context.isOpen,
|
1605 | className: classes,
|
1606 | "x-placement": attrs.placement
|
1607 | }));
|
1608 | };
|
1609 |
|
1610 | return DropdownMenu;
|
1611 | }(React.Component);
|
1612 | DropdownMenu.propTypes = propTypes$j;
|
1613 | DropdownMenu.defaultProps = defaultProps$i;
|
1614 | DropdownMenu.contextType = DropdownContext;
|
1615 |
|
1616 | var propTypes$k = {
|
1617 | caret: PropTypes.bool,
|
1618 | color: PropTypes.string,
|
1619 | children: PropTypes.node,
|
1620 | className: PropTypes.string,
|
1621 | cssModule: PropTypes.object,
|
1622 | disabled: PropTypes.bool,
|
1623 | onClick: PropTypes.func,
|
1624 | 'aria-haspopup': PropTypes.bool,
|
1625 | split: PropTypes.bool,
|
1626 | tag: tagPropType,
|
1627 | nav: PropTypes.bool
|
1628 | };
|
1629 | var defaultProps$j = {
|
1630 | 'aria-haspopup': true,
|
1631 | color: 'secondary'
|
1632 | };
|
1633 |
|
1634 | var DropdownToggle =
|
1635 |
|
1636 | function (_React$Component) {
|
1637 | _inheritsLoose(DropdownToggle, _React$Component);
|
1638 |
|
1639 | function DropdownToggle(props) {
|
1640 | var _this;
|
1641 |
|
1642 | _this = _React$Component.call(this, props) || this;
|
1643 | _this.onClick = _this.onClick.bind(_assertThisInitialized(_this));
|
1644 | return _this;
|
1645 | }
|
1646 |
|
1647 | var _proto = DropdownToggle.prototype;
|
1648 |
|
1649 | _proto.onClick = function onClick(e) {
|
1650 | if (this.props.disabled || this.context.disabled) {
|
1651 | e.preventDefault();
|
1652 | return;
|
1653 | }
|
1654 |
|
1655 | if (this.props.nav && !this.props.tag) {
|
1656 | e.preventDefault();
|
1657 | }
|
1658 |
|
1659 | if (this.props.onClick) {
|
1660 | this.props.onClick(e);
|
1661 | }
|
1662 |
|
1663 | this.context.toggle(e);
|
1664 | };
|
1665 |
|
1666 | _proto.render = function render() {
|
1667 | var _this2 = this;
|
1668 |
|
1669 | var _this$props = this.props,
|
1670 | className = _this$props.className,
|
1671 | color = _this$props.color,
|
1672 | cssModule = _this$props.cssModule,
|
1673 | caret = _this$props.caret,
|
1674 | split = _this$props.split,
|
1675 | nav = _this$props.nav,
|
1676 | tag = _this$props.tag,
|
1677 | innerRef = _this$props.innerRef,
|
1678 | props = _objectWithoutPropertiesLoose(_this$props, ["className", "color", "cssModule", "caret", "split", "nav", "tag", "innerRef"]);
|
1679 |
|
1680 | var ariaLabel = props['aria-label'] || 'Toggle Dropdown';
|
1681 | var classes = mapToCssModules(classNames(className, {
|
1682 | 'dropdown-toggle': caret || split,
|
1683 | 'dropdown-toggle-split': split,
|
1684 | 'nav-link': nav
|
1685 | }), cssModule);
|
1686 | var children = props.children || React.createElement("span", {
|
1687 | className: "sr-only"
|
1688 | }, ariaLabel);
|
1689 | var Tag;
|
1690 |
|
1691 | if (nav && !tag) {
|
1692 | Tag = 'a';
|
1693 | props.href = '#';
|
1694 | } else if (!tag) {
|
1695 | Tag = Button;
|
1696 | props.color = color;
|
1697 | props.cssModule = cssModule;
|
1698 | } else {
|
1699 | Tag = tag;
|
1700 | }
|
1701 |
|
1702 | if (this.context.inNavbar) {
|
1703 | return React.createElement(Tag, _extends({}, props, {
|
1704 | className: classes,
|
1705 | onClick: this.onClick,
|
1706 | "aria-expanded": this.context.isOpen,
|
1707 | children: children
|
1708 | }));
|
1709 | }
|
1710 |
|
1711 | return React.createElement(Reference, {
|
1712 | innerRef: innerRef
|
1713 | }, function (_ref) {
|
1714 | var _ref2;
|
1715 |
|
1716 | var ref = _ref.ref;
|
1717 | return React.createElement(Tag, _extends({}, props, (_ref2 = {}, _ref2[typeof Tag === 'string' ? 'ref' : 'innerRef'] = ref, _ref2), {
|
1718 | className: classes,
|
1719 | onClick: _this2.onClick,
|
1720 | "aria-expanded": _this2.context.isOpen,
|
1721 | children: children
|
1722 | }));
|
1723 | });
|
1724 | };
|
1725 |
|
1726 | return DropdownToggle;
|
1727 | }(React.Component);
|
1728 |
|
1729 | DropdownToggle.propTypes = propTypes$k;
|
1730 | DropdownToggle.defaultProps = defaultProps$j;
|
1731 | DropdownToggle.contextType = DropdownContext;
|
1732 |
|
1733 | var propTypes$l = _extends({}, Transition.propTypes, {
|
1734 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
1735 | tag: tagPropType,
|
1736 | baseClass: PropTypes.string,
|
1737 | baseClassActive: PropTypes.string,
|
1738 | className: PropTypes.string,
|
1739 | cssModule: PropTypes.object,
|
1740 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
|
1741 | });
|
1742 |
|
1743 | var defaultProps$k = _extends({}, Transition.defaultProps, {
|
1744 | tag: 'div',
|
1745 | baseClass: 'fade',
|
1746 | baseClassActive: 'show',
|
1747 | timeout: TransitionTimeouts.Fade,
|
1748 | appear: true,
|
1749 | enter: true,
|
1750 | exit: true,
|
1751 | in: true
|
1752 | });
|
1753 |
|
1754 | function Fade(props) {
|
1755 | var Tag = props.tag,
|
1756 | baseClass = props.baseClass,
|
1757 | baseClassActive = props.baseClassActive,
|
1758 | className = props.className,
|
1759 | cssModule = props.cssModule,
|
1760 | children = props.children,
|
1761 | innerRef = props.innerRef,
|
1762 | otherProps = _objectWithoutPropertiesLoose(props, ["tag", "baseClass", "baseClassActive", "className", "cssModule", "children", "innerRef"]);
|
1763 |
|
1764 | var transitionProps = pick(otherProps, TransitionPropTypeKeys);
|
1765 | var childProps = omit(otherProps, TransitionPropTypeKeys);
|
1766 | return React.createElement(Transition, transitionProps, function (status) {
|
1767 | var isActive = status === 'entered';
|
1768 | var classes = mapToCssModules(classNames(className, baseClass, isActive && baseClassActive), cssModule);
|
1769 | return React.createElement(Tag, _extends({
|
1770 | className: classes
|
1771 | }, childProps, {
|
1772 | ref: innerRef
|
1773 | }), children);
|
1774 | });
|
1775 | }
|
1776 |
|
1777 | Fade.propTypes = propTypes$l;
|
1778 | Fade.defaultProps = defaultProps$k;
|
1779 |
|
1780 | var propTypes$m = {
|
1781 | color: PropTypes.string,
|
1782 | pill: PropTypes.bool,
|
1783 | tag: tagPropType,
|
1784 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
|
1785 | children: PropTypes.node,
|
1786 | className: PropTypes.string,
|
1787 | cssModule: PropTypes.object
|
1788 | };
|
1789 | var defaultProps$l = {
|
1790 | color: 'secondary',
|
1791 | pill: false,
|
1792 | tag: 'span'
|
1793 | };
|
1794 |
|
1795 | var Badge = function Badge(props) {
|
1796 | var className = props.className,
|
1797 | cssModule = props.cssModule,
|
1798 | color = props.color,
|
1799 | innerRef = props.innerRef,
|
1800 | pill = props.pill,
|
1801 | Tag = props.tag,
|
1802 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "color", "innerRef", "pill", "tag"]);
|
1803 |
|
1804 | var classes = mapToCssModules(classNames(className, 'badge', 'badge-' + color, pill ? 'badge-pill' : false), cssModule);
|
1805 |
|
1806 | if (attributes.href && Tag === 'span') {
|
1807 | Tag = 'a';
|
1808 | }
|
1809 |
|
1810 | return React.createElement(Tag, _extends({}, attributes, {
|
1811 | className: classes,
|
1812 | ref: innerRef
|
1813 | }));
|
1814 | };
|
1815 |
|
1816 | Badge.propTypes = propTypes$m;
|
1817 | Badge.defaultProps = defaultProps$l;
|
1818 |
|
1819 | var propTypes$n = {
|
1820 | tag: tagPropType,
|
1821 | inverse: PropTypes.bool,
|
1822 | color: PropTypes.string,
|
1823 | body: PropTypes.bool,
|
1824 | outline: PropTypes.bool,
|
1825 | className: PropTypes.string,
|
1826 | cssModule: PropTypes.object,
|
1827 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
|
1828 | };
|
1829 | var defaultProps$m = {
|
1830 | tag: 'div'
|
1831 | };
|
1832 |
|
1833 | var Card = function Card(props) {
|
1834 | var className = props.className,
|
1835 | cssModule = props.cssModule,
|
1836 | color = props.color,
|
1837 | body = props.body,
|
1838 | inverse = props.inverse,
|
1839 | outline = props.outline,
|
1840 | Tag = props.tag,
|
1841 | innerRef = props.innerRef,
|
1842 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "color", "body", "inverse", "outline", "tag", "innerRef"]);
|
1843 |
|
1844 | var classes = mapToCssModules(classNames(className, 'card', inverse ? 'text-white' : false, body ? 'card-body' : false, color ? (outline ? 'border' : 'bg') + "-" + color : false), cssModule);
|
1845 | return React.createElement(Tag, _extends({}, attributes, {
|
1846 | className: classes,
|
1847 | ref: innerRef
|
1848 | }));
|
1849 | };
|
1850 |
|
1851 | Card.propTypes = propTypes$n;
|
1852 | Card.defaultProps = defaultProps$m;
|
1853 |
|
1854 | var propTypes$o = {
|
1855 | tag: tagPropType,
|
1856 | className: PropTypes.string,
|
1857 | cssModule: PropTypes.object
|
1858 | };
|
1859 | var defaultProps$n = {
|
1860 | tag: 'div'
|
1861 | };
|
1862 |
|
1863 | var CardGroup = function CardGroup(props) {
|
1864 | var className = props.className,
|
1865 | cssModule = props.cssModule,
|
1866 | Tag = props.tag,
|
1867 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
1868 |
|
1869 | var classes = mapToCssModules(classNames(className, 'card-group'), cssModule);
|
1870 | return React.createElement(Tag, _extends({}, attributes, {
|
1871 | className: classes
|
1872 | }));
|
1873 | };
|
1874 |
|
1875 | CardGroup.propTypes = propTypes$o;
|
1876 | CardGroup.defaultProps = defaultProps$n;
|
1877 |
|
1878 | var propTypes$p = {
|
1879 | tag: tagPropType,
|
1880 | className: PropTypes.string,
|
1881 | cssModule: PropTypes.object
|
1882 | };
|
1883 | var defaultProps$o = {
|
1884 | tag: 'div'
|
1885 | };
|
1886 |
|
1887 | var CardDeck = function CardDeck(props) {
|
1888 | var className = props.className,
|
1889 | cssModule = props.cssModule,
|
1890 | Tag = props.tag,
|
1891 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
1892 |
|
1893 | var classes = mapToCssModules(classNames(className, 'card-deck'), cssModule);
|
1894 | return React.createElement(Tag, _extends({}, attributes, {
|
1895 | className: classes
|
1896 | }));
|
1897 | };
|
1898 |
|
1899 | CardDeck.propTypes = propTypes$p;
|
1900 | CardDeck.defaultProps = defaultProps$o;
|
1901 |
|
1902 | var propTypes$q = {
|
1903 | tag: tagPropType,
|
1904 | className: PropTypes.string,
|
1905 | cssModule: PropTypes.object
|
1906 | };
|
1907 | var defaultProps$p = {
|
1908 | tag: 'div'
|
1909 | };
|
1910 |
|
1911 | var CardColumns = function CardColumns(props) {
|
1912 | var className = props.className,
|
1913 | cssModule = props.cssModule,
|
1914 | Tag = props.tag,
|
1915 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
1916 |
|
1917 | var classes = mapToCssModules(classNames(className, 'card-columns'), cssModule);
|
1918 | return React.createElement(Tag, _extends({}, attributes, {
|
1919 | className: classes
|
1920 | }));
|
1921 | };
|
1922 |
|
1923 | CardColumns.propTypes = propTypes$q;
|
1924 | CardColumns.defaultProps = defaultProps$p;
|
1925 |
|
1926 | var propTypes$r = {
|
1927 | tag: tagPropType,
|
1928 | className: PropTypes.string,
|
1929 | cssModule: PropTypes.object,
|
1930 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
|
1931 | };
|
1932 | var defaultProps$q = {
|
1933 | tag: 'div'
|
1934 | };
|
1935 |
|
1936 | var CardBody = function CardBody(props) {
|
1937 | var className = props.className,
|
1938 | cssModule = props.cssModule,
|
1939 | innerRef = props.innerRef,
|
1940 | Tag = props.tag,
|
1941 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "innerRef", "tag"]);
|
1942 |
|
1943 | var classes = mapToCssModules(classNames(className, 'card-body'), cssModule);
|
1944 | return React.createElement(Tag, _extends({}, attributes, {
|
1945 | className: classes,
|
1946 | ref: innerRef
|
1947 | }));
|
1948 | };
|
1949 |
|
1950 | CardBody.propTypes = propTypes$r;
|
1951 | CardBody.defaultProps = defaultProps$q;
|
1952 |
|
1953 | var propTypes$s = {
|
1954 | tag: tagPropType,
|
1955 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
|
1956 | className: PropTypes.string,
|
1957 | cssModule: PropTypes.object
|
1958 | };
|
1959 | var defaultProps$r = {
|
1960 | tag: 'a'
|
1961 | };
|
1962 |
|
1963 | var CardLink = function CardLink(props) {
|
1964 | var className = props.className,
|
1965 | cssModule = props.cssModule,
|
1966 | Tag = props.tag,
|
1967 | innerRef = props.innerRef,
|
1968 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "innerRef"]);
|
1969 |
|
1970 | var classes = mapToCssModules(classNames(className, 'card-link'), cssModule);
|
1971 | return React.createElement(Tag, _extends({}, attributes, {
|
1972 | ref: innerRef,
|
1973 | className: classes
|
1974 | }));
|
1975 | };
|
1976 |
|
1977 | CardLink.propTypes = propTypes$s;
|
1978 | CardLink.defaultProps = defaultProps$r;
|
1979 |
|
1980 | var propTypes$t = {
|
1981 | tag: tagPropType,
|
1982 | className: PropTypes.string,
|
1983 | cssModule: PropTypes.object
|
1984 | };
|
1985 | var defaultProps$s = {
|
1986 | tag: 'div'
|
1987 | };
|
1988 |
|
1989 | var CardFooter = function CardFooter(props) {
|
1990 | var className = props.className,
|
1991 | cssModule = props.cssModule,
|
1992 | Tag = props.tag,
|
1993 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
1994 |
|
1995 | var classes = mapToCssModules(classNames(className, 'card-footer'), cssModule);
|
1996 | return React.createElement(Tag, _extends({}, attributes, {
|
1997 | className: classes
|
1998 | }));
|
1999 | };
|
2000 |
|
2001 | CardFooter.propTypes = propTypes$t;
|
2002 | CardFooter.defaultProps = defaultProps$s;
|
2003 |
|
2004 | var propTypes$u = {
|
2005 | tag: tagPropType,
|
2006 | className: PropTypes.string,
|
2007 | cssModule: PropTypes.object
|
2008 | };
|
2009 | var defaultProps$t = {
|
2010 | tag: 'div'
|
2011 | };
|
2012 |
|
2013 | var CardHeader = function CardHeader(props) {
|
2014 | var className = props.className,
|
2015 | cssModule = props.cssModule,
|
2016 | Tag = props.tag,
|
2017 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
2018 |
|
2019 | var classes = mapToCssModules(classNames(className, 'card-header'), cssModule);
|
2020 | return React.createElement(Tag, _extends({}, attributes, {
|
2021 | className: classes
|
2022 | }));
|
2023 | };
|
2024 |
|
2025 | CardHeader.propTypes = propTypes$u;
|
2026 | CardHeader.defaultProps = defaultProps$t;
|
2027 |
|
2028 | var propTypes$v = {
|
2029 | tag: tagPropType,
|
2030 | top: PropTypes.bool,
|
2031 | bottom: PropTypes.bool,
|
2032 | className: PropTypes.string,
|
2033 | cssModule: PropTypes.object
|
2034 | };
|
2035 | var defaultProps$u = {
|
2036 | tag: 'img'
|
2037 | };
|
2038 |
|
2039 | var CardImg = function CardImg(props) {
|
2040 | var className = props.className,
|
2041 | cssModule = props.cssModule,
|
2042 | top = props.top,
|
2043 | bottom = props.bottom,
|
2044 | Tag = props.tag,
|
2045 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "top", "bottom", "tag"]);
|
2046 |
|
2047 | var cardImgClassName = 'card-img';
|
2048 |
|
2049 | if (top) {
|
2050 | cardImgClassName = 'card-img-top';
|
2051 | }
|
2052 |
|
2053 | if (bottom) {
|
2054 | cardImgClassName = 'card-img-bottom';
|
2055 | }
|
2056 |
|
2057 | var classes = mapToCssModules(classNames(className, cardImgClassName), cssModule);
|
2058 | return React.createElement(Tag, _extends({}, attributes, {
|
2059 | className: classes
|
2060 | }));
|
2061 | };
|
2062 |
|
2063 | CardImg.propTypes = propTypes$v;
|
2064 | CardImg.defaultProps = defaultProps$u;
|
2065 |
|
2066 | var propTypes$w = {
|
2067 | tag: tagPropType,
|
2068 | className: PropTypes.string,
|
2069 | cssModule: PropTypes.object
|
2070 | };
|
2071 | var defaultProps$v = {
|
2072 | tag: 'div'
|
2073 | };
|
2074 |
|
2075 | var CardImgOverlay = function CardImgOverlay(props) {
|
2076 | var className = props.className,
|
2077 | cssModule = props.cssModule,
|
2078 | Tag = props.tag,
|
2079 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
2080 |
|
2081 | var classes = mapToCssModules(classNames(className, 'card-img-overlay'), cssModule);
|
2082 | return React.createElement(Tag, _extends({}, attributes, {
|
2083 | className: classes
|
2084 | }));
|
2085 | };
|
2086 |
|
2087 | CardImgOverlay.propTypes = propTypes$w;
|
2088 | CardImgOverlay.defaultProps = defaultProps$v;
|
2089 |
|
2090 | var CarouselItem =
|
2091 |
|
2092 | function (_React$Component) {
|
2093 | _inheritsLoose(CarouselItem, _React$Component);
|
2094 |
|
2095 | function CarouselItem(props) {
|
2096 | var _this;
|
2097 |
|
2098 | _this = _React$Component.call(this, props) || this;
|
2099 | _this.state = {
|
2100 | startAnimation: false
|
2101 | };
|
2102 | _this.onEnter = _this.onEnter.bind(_assertThisInitialized(_this));
|
2103 | _this.onEntering = _this.onEntering.bind(_assertThisInitialized(_this));
|
2104 | _this.onExit = _this.onExit.bind(_assertThisInitialized(_this));
|
2105 | _this.onExiting = _this.onExiting.bind(_assertThisInitialized(_this));
|
2106 | _this.onExited = _this.onExited.bind(_assertThisInitialized(_this));
|
2107 | return _this;
|
2108 | }
|
2109 |
|
2110 | var _proto = CarouselItem.prototype;
|
2111 |
|
2112 | _proto.onEnter = function onEnter(node, isAppearing) {
|
2113 | this.setState({
|
2114 | startAnimation: false
|
2115 | });
|
2116 | this.props.onEnter(node, isAppearing);
|
2117 | };
|
2118 |
|
2119 | _proto.onEntering = function onEntering(node, isAppearing) {
|
2120 |
|
2121 | var offsetHeight = node.offsetHeight;
|
2122 | this.setState({
|
2123 | startAnimation: true
|
2124 | });
|
2125 | this.props.onEntering(node, isAppearing);
|
2126 | return offsetHeight;
|
2127 | };
|
2128 |
|
2129 | _proto.onExit = function onExit(node) {
|
2130 | this.setState({
|
2131 | startAnimation: false
|
2132 | });
|
2133 | this.props.onExit(node);
|
2134 | };
|
2135 |
|
2136 | _proto.onExiting = function onExiting(node) {
|
2137 | this.setState({
|
2138 | startAnimation: true
|
2139 | });
|
2140 | node.dispatchEvent(new CustomEvent('slide.bs.carousel'));
|
2141 | this.props.onExiting(node);
|
2142 | };
|
2143 |
|
2144 | _proto.onExited = function onExited(node) {
|
2145 | node.dispatchEvent(new CustomEvent('slid.bs.carousel'));
|
2146 | this.props.onExited(node);
|
2147 | };
|
2148 |
|
2149 | _proto.render = function render() {
|
2150 | var _this2 = this;
|
2151 |
|
2152 | var _this$props = this.props,
|
2153 | isIn = _this$props.in,
|
2154 | children = _this$props.children,
|
2155 | cssModule = _this$props.cssModule,
|
2156 | slide = _this$props.slide,
|
2157 | Tag = _this$props.tag,
|
2158 | className = _this$props.className,
|
2159 | transitionProps = _objectWithoutPropertiesLoose(_this$props, ["in", "children", "cssModule", "slide", "tag", "className"]);
|
2160 |
|
2161 | return React.createElement(Transition, _extends({}, transitionProps, {
|
2162 | enter: slide,
|
2163 | exit: slide,
|
2164 | in: isIn,
|
2165 | onEnter: this.onEnter,
|
2166 | onEntering: this.onEntering,
|
2167 | onExit: this.onExit,
|
2168 | onExiting: this.onExiting,
|
2169 | onExited: this.onExited
|
2170 | }), function (status) {
|
2171 | var direction = _this2.context.direction;
|
2172 | var isActive = status === TransitionStatuses.ENTERED || status === TransitionStatuses.EXITING;
|
2173 | var directionClassName = (status === TransitionStatuses.ENTERING || status === TransitionStatuses.EXITING) && _this2.state.startAnimation && (direction === 'right' ? 'carousel-item-left' : 'carousel-item-right');
|
2174 | var orderClassName = status === TransitionStatuses.ENTERING && (direction === 'right' ? 'carousel-item-next' : 'carousel-item-prev');
|
2175 | var itemClasses = mapToCssModules(classNames(className, 'carousel-item', isActive && 'active', directionClassName, orderClassName), cssModule);
|
2176 | return React.createElement(Tag, {
|
2177 | className: itemClasses
|
2178 | }, children);
|
2179 | });
|
2180 | };
|
2181 |
|
2182 | return CarouselItem;
|
2183 | }(React.Component);
|
2184 |
|
2185 | CarouselItem.propTypes = _extends({}, Transition.propTypes, {
|
2186 | tag: tagPropType,
|
2187 | in: PropTypes.bool,
|
2188 | cssModule: PropTypes.object,
|
2189 | children: PropTypes.node,
|
2190 | slide: PropTypes.bool,
|
2191 | className: PropTypes.string
|
2192 | });
|
2193 | CarouselItem.defaultProps = _extends({}, Transition.defaultProps, {
|
2194 | tag: 'div',
|
2195 | timeout: TransitionTimeouts.Carousel,
|
2196 | slide: true
|
2197 | });
|
2198 | CarouselItem.contextTypes = {
|
2199 | direction: PropTypes.string
|
2200 | };
|
2201 |
|
2202 | var SWIPE_THRESHOLD = 40;
|
2203 |
|
2204 | var Carousel =
|
2205 |
|
2206 | function (_React$Component) {
|
2207 | _inheritsLoose(Carousel, _React$Component);
|
2208 |
|
2209 | function Carousel(props) {
|
2210 | var _this;
|
2211 |
|
2212 | _this = _React$Component.call(this, props) || this;
|
2213 | _this.handleKeyPress = _this.handleKeyPress.bind(_assertThisInitialized(_this));
|
2214 | _this.renderItems = _this.renderItems.bind(_assertThisInitialized(_this));
|
2215 | _this.hoverStart = _this.hoverStart.bind(_assertThisInitialized(_this));
|
2216 | _this.hoverEnd = _this.hoverEnd.bind(_assertThisInitialized(_this));
|
2217 | _this.handleTouchStart = _this.handleTouchStart.bind(_assertThisInitialized(_this));
|
2218 | _this.handleTouchEnd = _this.handleTouchEnd.bind(_assertThisInitialized(_this));
|
2219 | _this.touchStartX = 0;
|
2220 | _this.touchStartY = 0;
|
2221 | _this.state = {
|
2222 | activeIndex: _this.props.activeIndex,
|
2223 | direction: 'right',
|
2224 | indicatorClicked: false
|
2225 | };
|
2226 | return _this;
|
2227 | }
|
2228 |
|
2229 | var _proto = Carousel.prototype;
|
2230 |
|
2231 | _proto.getChildContext = function getChildContext() {
|
2232 | return {
|
2233 | direction: this.state.direction
|
2234 | };
|
2235 | };
|
2236 |
|
2237 | _proto.componentDidMount = function componentDidMount() {
|
2238 |
|
2239 | if (this.props.ride === 'carousel') {
|
2240 | this.setInterval();
|
2241 | }
|
2242 |
|
2243 |
|
2244 | document.addEventListener('keyup', this.handleKeyPress);
|
2245 | };
|
2246 |
|
2247 | Carousel.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
|
2248 | var newState = null;
|
2249 | var activeIndex = prevState.activeIndex,
|
2250 | direction = prevState.direction,
|
2251 | indicatorClicked = prevState.indicatorClicked;
|
2252 |
|
2253 | if (nextProps.activeIndex !== activeIndex) {
|
2254 |
|
2255 | if (nextProps.activeIndex === activeIndex + 1) {
|
2256 | direction = 'right';
|
2257 | } else if (nextProps.activeIndex === activeIndex - 1) {
|
2258 | direction = 'left';
|
2259 | } else if (nextProps.activeIndex < activeIndex) {
|
2260 | direction = indicatorClicked ? 'left' : 'right';
|
2261 | } else if (nextProps.activeIndex !== activeIndex) {
|
2262 | direction = indicatorClicked ? 'right' : 'left';
|
2263 | }
|
2264 |
|
2265 | newState = {
|
2266 | activeIndex: nextProps.activeIndex,
|
2267 | direction: direction,
|
2268 | indicatorClicked: false
|
2269 | };
|
2270 | }
|
2271 |
|
2272 | return newState;
|
2273 | };
|
2274 |
|
2275 | _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
2276 | if (prevState.activeIndex === this.state.activeIndex) return;
|
2277 | this.setInterval(this.props);
|
2278 | };
|
2279 |
|
2280 | _proto.componentWillUnmount = function componentWillUnmount() {
|
2281 | this.clearInterval();
|
2282 | document.removeEventListener('keyup', this.handleKeyPress);
|
2283 | };
|
2284 |
|
2285 | _proto.setInterval = function (_setInterval) {
|
2286 | function setInterval() {
|
2287 | return _setInterval.apply(this, arguments);
|
2288 | }
|
2289 |
|
2290 | setInterval.toString = function () {
|
2291 | return _setInterval.toString();
|
2292 | };
|
2293 |
|
2294 | return setInterval;
|
2295 | }(function (props) {
|
2296 | if (props === void 0) {
|
2297 | props = this.props;
|
2298 | }
|
2299 |
|
2300 |
|
2301 | this.clearInterval();
|
2302 |
|
2303 | if (props.interval) {
|
2304 | this.cycleInterval = setInterval(function () {
|
2305 | props.next();
|
2306 | }, parseInt(props.interval, 10));
|
2307 | }
|
2308 | });
|
2309 |
|
2310 | _proto.clearInterval = function (_clearInterval) {
|
2311 | function clearInterval() {
|
2312 | return _clearInterval.apply(this, arguments);
|
2313 | }
|
2314 |
|
2315 | clearInterval.toString = function () {
|
2316 | return _clearInterval.toString();
|
2317 | };
|
2318 |
|
2319 | return clearInterval;
|
2320 | }(function () {
|
2321 | clearInterval(this.cycleInterval);
|
2322 | });
|
2323 |
|
2324 | _proto.hoverStart = function hoverStart() {
|
2325 | if (this.props.pause === 'hover') {
|
2326 | this.clearInterval();
|
2327 | }
|
2328 |
|
2329 | if (this.props.mouseEnter) {
|
2330 | var _this$props;
|
2331 |
|
2332 | (_this$props = this.props).mouseEnter.apply(_this$props, arguments);
|
2333 | }
|
2334 | };
|
2335 |
|
2336 | _proto.hoverEnd = function hoverEnd() {
|
2337 | if (this.props.pause === 'hover') {
|
2338 | this.setInterval();
|
2339 | }
|
2340 |
|
2341 | if (this.props.mouseLeave) {
|
2342 | var _this$props2;
|
2343 |
|
2344 | (_this$props2 = this.props).mouseLeave.apply(_this$props2, arguments);
|
2345 | }
|
2346 | };
|
2347 |
|
2348 | _proto.handleKeyPress = function handleKeyPress(evt) {
|
2349 | if (this.props.keyboard) {
|
2350 | if (evt.keyCode === 37) {
|
2351 | this.props.previous();
|
2352 | } else if (evt.keyCode === 39) {
|
2353 | this.props.next();
|
2354 | }
|
2355 | }
|
2356 | };
|
2357 |
|
2358 | _proto.handleTouchStart = function handleTouchStart(e) {
|
2359 | if (!this.props.enableTouch) {
|
2360 | return;
|
2361 | }
|
2362 |
|
2363 | this.touchStartX = e.changedTouches[0].screenX;
|
2364 | this.touchStartY = e.changedTouches[0].screenY;
|
2365 | };
|
2366 |
|
2367 | _proto.handleTouchEnd = function handleTouchEnd(e) {
|
2368 | if (!this.props.enableTouch) {
|
2369 | return;
|
2370 | }
|
2371 |
|
2372 | var currentX = e.changedTouches[0].screenX;
|
2373 | var currentY = e.changedTouches[0].screenY;
|
2374 | var diffX = Math.abs(this.touchStartX - currentX);
|
2375 | var diffY = Math.abs(this.touchStartY - currentY);
|
2376 |
|
2377 | if (diffX < diffY) {
|
2378 | return;
|
2379 | }
|
2380 |
|
2381 | if (diffX < SWIPE_THRESHOLD) {
|
2382 | return;
|
2383 | }
|
2384 |
|
2385 | if (currentX < this.touchStartX) {
|
2386 | this.props.next();
|
2387 | } else {
|
2388 | this.props.previous();
|
2389 | }
|
2390 | };
|
2391 |
|
2392 | _proto.renderItems = function renderItems(carouselItems, className) {
|
2393 | var _this2 = this;
|
2394 |
|
2395 | var slide = this.props.slide;
|
2396 | return React.createElement("div", {
|
2397 | className: className
|
2398 | }, carouselItems.map(function (item, index) {
|
2399 | var isIn = index === _this2.state.activeIndex;
|
2400 | return React.cloneElement(item, {
|
2401 | in: isIn,
|
2402 | slide: slide
|
2403 | });
|
2404 | }));
|
2405 | };
|
2406 |
|
2407 | _proto.render = function render() {
|
2408 | var _this3 = this;
|
2409 |
|
2410 | var _this$props3 = this.props,
|
2411 | cssModule = _this$props3.cssModule,
|
2412 | slide = _this$props3.slide,
|
2413 | className = _this$props3.className;
|
2414 | var outerClasses = mapToCssModules(classNames(className, 'carousel', slide && 'slide'), cssModule);
|
2415 | var innerClasses = mapToCssModules(classNames('carousel-inner'), cssModule);
|
2416 |
|
2417 | var children = this.props.children.filter(function (child) {
|
2418 | return child !== null && child !== undefined && typeof child !== 'boolean';
|
2419 | });
|
2420 | var slidesOnly = children.every(function (child) {
|
2421 | return child.type === CarouselItem;
|
2422 | });
|
2423 |
|
2424 | if (slidesOnly) {
|
2425 | return React.createElement("div", {
|
2426 | className: outerClasses,
|
2427 | onMouseEnter: this.hoverStart,
|
2428 | onMouseLeave: this.hoverEnd
|
2429 | }, this.renderItems(children, innerClasses));
|
2430 | }
|
2431 |
|
2432 |
|
2433 | if (children[0] instanceof Array) {
|
2434 | var _carouselItems = children[0];
|
2435 | var _controlLeft = children[1];
|
2436 | var _controlRight = children[2];
|
2437 | return React.createElement("div", {
|
2438 | className: outerClasses,
|
2439 | onMouseEnter: this.hoverStart,
|
2440 | onMouseLeave: this.hoverEnd
|
2441 | }, this.renderItems(_carouselItems, innerClasses), _controlLeft, _controlRight);
|
2442 | }
|
2443 |
|
2444 |
|
2445 | var indicators = children[0];
|
2446 |
|
2447 | var wrappedOnClick = function wrappedOnClick(e) {
|
2448 | if (typeof indicators.props.onClickHandler === 'function') {
|
2449 | _this3.setState({
|
2450 | indicatorClicked: true
|
2451 | }, function () {
|
2452 | return indicators.props.onClickHandler(e);
|
2453 | });
|
2454 | }
|
2455 | };
|
2456 |
|
2457 | var wrappedIndicators = React.cloneElement(indicators, {
|
2458 | onClickHandler: wrappedOnClick
|
2459 | });
|
2460 | var carouselItems = children[1];
|
2461 | var controlLeft = children[2];
|
2462 | var controlRight = children[3];
|
2463 | return React.createElement("div", {
|
2464 | className: outerClasses,
|
2465 | onMouseEnter: this.hoverStart,
|
2466 | onMouseLeave: this.hoverEnd,
|
2467 | onTouchStart: this.handleTouchStart,
|
2468 | onTouchEnd: this.handleTouchEnd
|
2469 | }, wrappedIndicators, this.renderItems(carouselItems, innerClasses), controlLeft, controlRight);
|
2470 | };
|
2471 |
|
2472 | return Carousel;
|
2473 | }(React.Component);
|
2474 |
|
2475 | Carousel.propTypes = {
|
2476 |
|
2477 | activeIndex: PropTypes.number,
|
2478 |
|
2479 | next: PropTypes.func.isRequired,
|
2480 |
|
2481 | previous: PropTypes.func.isRequired,
|
2482 |
|
2483 | keyboard: PropTypes.bool,
|
2484 |
|
2485 | |
2486 |
|
2487 |
|
2488 | pause: PropTypes.oneOf(['hover', false]),
|
2489 |
|
2490 |
|
2491 | ride: PropTypes.oneOf(['carousel']),
|
2492 |
|
2493 |
|
2494 | interval: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.bool]),
|
2495 | children: PropTypes.array,
|
2496 |
|
2497 | mouseEnter: PropTypes.func,
|
2498 |
|
2499 | mouseLeave: PropTypes.func,
|
2500 |
|
2501 | slide: PropTypes.bool,
|
2502 | cssModule: PropTypes.object,
|
2503 | className: PropTypes.string,
|
2504 | enableTouch: PropTypes.bool
|
2505 | };
|
2506 | Carousel.defaultProps = {
|
2507 | interval: 5000,
|
2508 | pause: 'hover',
|
2509 | keyboard: true,
|
2510 | slide: true,
|
2511 | enableTouch: true
|
2512 | };
|
2513 | Carousel.childContextTypes = {
|
2514 | direction: PropTypes.string
|
2515 | };
|
2516 |
|
2517 | var CarouselControl = function CarouselControl(props) {
|
2518 | var direction = props.direction,
|
2519 | onClickHandler = props.onClickHandler,
|
2520 | cssModule = props.cssModule,
|
2521 | directionText = props.directionText,
|
2522 | className = props.className;
|
2523 | var anchorClasses = mapToCssModules(classNames(className, "carousel-control-" + direction), cssModule);
|
2524 | var iconClasses = mapToCssModules(classNames("carousel-control-" + direction + "-icon"), cssModule);
|
2525 | var screenReaderClasses = mapToCssModules(classNames('sr-only'), cssModule);
|
2526 | return React.createElement("a", {
|
2527 | className: anchorClasses,
|
2528 | style: {
|
2529 | cursor: "pointer"
|
2530 | },
|
2531 | role: "button",
|
2532 | tabIndex: "0",
|
2533 | onClick: function onClick(e) {
|
2534 | e.preventDefault();
|
2535 | onClickHandler();
|
2536 | }
|
2537 | }, React.createElement("span", {
|
2538 | className: iconClasses,
|
2539 | "aria-hidden": "true"
|
2540 | }), React.createElement("span", {
|
2541 | className: screenReaderClasses
|
2542 | }, directionText || direction));
|
2543 | };
|
2544 |
|
2545 | CarouselControl.propTypes = {
|
2546 | direction: PropTypes.oneOf(['prev', 'next']).isRequired,
|
2547 | onClickHandler: PropTypes.func.isRequired,
|
2548 | cssModule: PropTypes.object,
|
2549 | directionText: PropTypes.string,
|
2550 | className: PropTypes.string
|
2551 | };
|
2552 |
|
2553 | var CarouselIndicators = function CarouselIndicators(props) {
|
2554 | var items = props.items,
|
2555 | activeIndex = props.activeIndex,
|
2556 | cssModule = props.cssModule,
|
2557 | onClickHandler = props.onClickHandler,
|
2558 | className = props.className;
|
2559 | var listClasses = mapToCssModules(classNames(className, 'carousel-indicators'), cssModule);
|
2560 | var indicators = items.map(function (item, idx) {
|
2561 | var indicatorClasses = mapToCssModules(classNames({
|
2562 | active: activeIndex === idx
|
2563 | }), cssModule);
|
2564 | return React.createElement("li", {
|
2565 | key: "" + (item.key || Object.values(item).join('')),
|
2566 | onClick: function onClick(e) {
|
2567 | e.preventDefault();
|
2568 | onClickHandler(idx);
|
2569 | },
|
2570 | className: indicatorClasses
|
2571 | });
|
2572 | });
|
2573 | return React.createElement("ol", {
|
2574 | className: listClasses
|
2575 | }, indicators);
|
2576 | };
|
2577 |
|
2578 | CarouselIndicators.propTypes = {
|
2579 | items: PropTypes.array.isRequired,
|
2580 | activeIndex: PropTypes.number.isRequired,
|
2581 | cssModule: PropTypes.object,
|
2582 | onClickHandler: PropTypes.func.isRequired,
|
2583 | className: PropTypes.string
|
2584 | };
|
2585 |
|
2586 | var CarouselCaption = function CarouselCaption(props) {
|
2587 | var captionHeader = props.captionHeader,
|
2588 | captionText = props.captionText,
|
2589 | cssModule = props.cssModule,
|
2590 | className = props.className;
|
2591 | var classes = mapToCssModules(classNames(className, 'carousel-caption', 'd-none', 'd-md-block'), cssModule);
|
2592 | return React.createElement("div", {
|
2593 | className: classes
|
2594 | }, React.createElement("h3", null, captionHeader), React.createElement("p", null, captionText));
|
2595 | };
|
2596 |
|
2597 | CarouselCaption.propTypes = {
|
2598 | captionHeader: PropTypes.node,
|
2599 | captionText: PropTypes.node.isRequired,
|
2600 | cssModule: PropTypes.object,
|
2601 | className: PropTypes.string
|
2602 | };
|
2603 |
|
2604 | var propTypes$x = {
|
2605 | items: PropTypes.array.isRequired,
|
2606 | indicators: PropTypes.bool,
|
2607 | controls: PropTypes.bool,
|
2608 | autoPlay: PropTypes.bool,
|
2609 | defaultActiveIndex: PropTypes.number,
|
2610 | activeIndex: PropTypes.number,
|
2611 | next: PropTypes.func,
|
2612 | previous: PropTypes.func,
|
2613 | goToIndex: PropTypes.func
|
2614 | };
|
2615 |
|
2616 | var UncontrolledCarousel =
|
2617 |
|
2618 | function (_Component) {
|
2619 | _inheritsLoose(UncontrolledCarousel, _Component);
|
2620 |
|
2621 | function UncontrolledCarousel(props) {
|
2622 | var _this;
|
2623 |
|
2624 | _this = _Component.call(this, props) || this;
|
2625 | _this.animating = false;
|
2626 | _this.state = {
|
2627 | activeIndex: props.defaultActiveIndex || 0
|
2628 | };
|
2629 | _this.next = _this.next.bind(_assertThisInitialized(_this));
|
2630 | _this.previous = _this.previous.bind(_assertThisInitialized(_this));
|
2631 | _this.goToIndex = _this.goToIndex.bind(_assertThisInitialized(_this));
|
2632 | _this.onExiting = _this.onExiting.bind(_assertThisInitialized(_this));
|
2633 | _this.onExited = _this.onExited.bind(_assertThisInitialized(_this));
|
2634 | return _this;
|
2635 | }
|
2636 |
|
2637 | var _proto = UncontrolledCarousel.prototype;
|
2638 |
|
2639 | _proto.onExiting = function onExiting() {
|
2640 | this.animating = true;
|
2641 | };
|
2642 |
|
2643 | _proto.onExited = function onExited() {
|
2644 | this.animating = false;
|
2645 | };
|
2646 |
|
2647 | _proto.next = function next() {
|
2648 | if (this.animating) return;
|
2649 | var nextIndex = this.state.activeIndex === this.props.items.length - 1 ? 0 : this.state.activeIndex + 1;
|
2650 | this.setState({
|
2651 | activeIndex: nextIndex
|
2652 | });
|
2653 | };
|
2654 |
|
2655 | _proto.previous = function previous() {
|
2656 | if (this.animating) return;
|
2657 | var nextIndex = this.state.activeIndex === 0 ? this.props.items.length - 1 : this.state.activeIndex - 1;
|
2658 | this.setState({
|
2659 | activeIndex: nextIndex
|
2660 | });
|
2661 | };
|
2662 |
|
2663 | _proto.goToIndex = function goToIndex(newIndex) {
|
2664 | if (this.animating) return;
|
2665 | this.setState({
|
2666 | activeIndex: newIndex
|
2667 | });
|
2668 | };
|
2669 |
|
2670 | _proto.render = function render() {
|
2671 | var _this2 = this;
|
2672 |
|
2673 | var _this$props = this.props,
|
2674 | defaultActiveIndex = _this$props.defaultActiveIndex,
|
2675 | autoPlay = _this$props.autoPlay,
|
2676 | indicators = _this$props.indicators,
|
2677 | controls = _this$props.controls,
|
2678 | items = _this$props.items,
|
2679 | goToIndex = _this$props.goToIndex,
|
2680 | props = _objectWithoutPropertiesLoose(_this$props, ["defaultActiveIndex", "autoPlay", "indicators", "controls", "items", "goToIndex"]);
|
2681 |
|
2682 | var activeIndex = this.state.activeIndex;
|
2683 | var slides = items.map(function (item) {
|
2684 | var key = item.key || item.src;
|
2685 | return React.createElement(CarouselItem, {
|
2686 | onExiting: _this2.onExiting,
|
2687 | onExited: _this2.onExited,
|
2688 | key: key
|
2689 | }, React.createElement("img", {
|
2690 | className: "d-block w-100",
|
2691 | src: item.src,
|
2692 | alt: item.altText
|
2693 | }), React.createElement(CarouselCaption, {
|
2694 | captionText: item.caption,
|
2695 | captionHeader: item.header || item.caption
|
2696 | }));
|
2697 | });
|
2698 | return React.createElement(Carousel, _extends({
|
2699 | activeIndex: activeIndex,
|
2700 | next: this.next,
|
2701 | previous: this.previous,
|
2702 | ride: autoPlay ? 'carousel' : undefined
|
2703 | }, props), indicators && React.createElement(CarouselIndicators, {
|
2704 | items: items,
|
2705 | activeIndex: props.activeIndex || activeIndex,
|
2706 | onClickHandler: goToIndex || this.goToIndex
|
2707 | }), slides, controls && React.createElement(CarouselControl, {
|
2708 | direction: "prev",
|
2709 | directionText: "Previous",
|
2710 | onClickHandler: props.previous || this.previous
|
2711 | }), controls && React.createElement(CarouselControl, {
|
2712 | direction: "next",
|
2713 | directionText: "Next",
|
2714 | onClickHandler: props.next || this.next
|
2715 | }));
|
2716 | };
|
2717 |
|
2718 | return UncontrolledCarousel;
|
2719 | }(Component);
|
2720 |
|
2721 | UncontrolledCarousel.propTypes = propTypes$x;
|
2722 | UncontrolledCarousel.defaultProps = {
|
2723 | controls: true,
|
2724 | indicators: true,
|
2725 | autoPlay: true
|
2726 | };
|
2727 |
|
2728 | var propTypes$y = {
|
2729 | tag: tagPropType,
|
2730 | className: PropTypes.string,
|
2731 | cssModule: PropTypes.object
|
2732 | };
|
2733 | var defaultProps$w = {
|
2734 | tag: 'div'
|
2735 | };
|
2736 |
|
2737 | var CardSubtitle = function CardSubtitle(props) {
|
2738 | var className = props.className,
|
2739 | cssModule = props.cssModule,
|
2740 | Tag = props.tag,
|
2741 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
2742 |
|
2743 | var classes = mapToCssModules(classNames(className, 'card-subtitle'), cssModule);
|
2744 | return React.createElement(Tag, _extends({}, attributes, {
|
2745 | className: classes
|
2746 | }));
|
2747 | };
|
2748 |
|
2749 | CardSubtitle.propTypes = propTypes$y;
|
2750 | CardSubtitle.defaultProps = defaultProps$w;
|
2751 |
|
2752 | var propTypes$z = {
|
2753 | tag: tagPropType,
|
2754 | className: PropTypes.string,
|
2755 | cssModule: PropTypes.object
|
2756 | };
|
2757 | var defaultProps$x = {
|
2758 | tag: 'p'
|
2759 | };
|
2760 |
|
2761 | var CardText = function CardText(props) {
|
2762 | var className = props.className,
|
2763 | cssModule = props.cssModule,
|
2764 | Tag = props.tag,
|
2765 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
2766 |
|
2767 | var classes = mapToCssModules(classNames(className, 'card-text'), cssModule);
|
2768 | return React.createElement(Tag, _extends({}, attributes, {
|
2769 | className: classes
|
2770 | }));
|
2771 | };
|
2772 |
|
2773 | CardText.propTypes = propTypes$z;
|
2774 | CardText.defaultProps = defaultProps$x;
|
2775 |
|
2776 | var propTypes$A = {
|
2777 | tag: tagPropType,
|
2778 | className: PropTypes.string,
|
2779 | cssModule: PropTypes.object
|
2780 | };
|
2781 | var defaultProps$y = {
|
2782 | tag: 'div'
|
2783 | };
|
2784 |
|
2785 | var CardTitle = function CardTitle(props) {
|
2786 | var className = props.className,
|
2787 | cssModule = props.cssModule,
|
2788 | Tag = props.tag,
|
2789 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
2790 |
|
2791 | var classes = mapToCssModules(classNames(className, 'card-title'), cssModule);
|
2792 | return React.createElement(Tag, _extends({}, attributes, {
|
2793 | className: classes
|
2794 | }));
|
2795 | };
|
2796 |
|
2797 | CardTitle.propTypes = propTypes$A;
|
2798 | CardTitle.defaultProps = defaultProps$y;
|
2799 |
|
2800 | var propTypes$B = {
|
2801 | className: PropTypes.string,
|
2802 | id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
2803 | label: PropTypes.node,
|
2804 | valid: PropTypes.bool,
|
2805 | invalid: PropTypes.bool,
|
2806 | bsSize: PropTypes.string,
|
2807 | htmlFor: PropTypes.string,
|
2808 | cssModule: PropTypes.object,
|
2809 | onChange: PropTypes.func,
|
2810 | children: PropTypes.oneOfType([PropTypes.node, PropTypes.array, PropTypes.func]),
|
2811 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
|
2812 | };
|
2813 |
|
2814 | var CustomFileInput =
|
2815 |
|
2816 | function (_React$Component) {
|
2817 | _inheritsLoose(CustomFileInput, _React$Component);
|
2818 |
|
2819 | function CustomFileInput(props) {
|
2820 | var _this;
|
2821 |
|
2822 | _this = _React$Component.call(this, props) || this;
|
2823 | _this.state = {
|
2824 | files: null
|
2825 | };
|
2826 | _this.onChange = _this.onChange.bind(_assertThisInitialized(_this));
|
2827 | return _this;
|
2828 | }
|
2829 |
|
2830 | var _proto = CustomFileInput.prototype;
|
2831 |
|
2832 | _proto.onChange = function onChange(e) {
|
2833 | var input = e.target;
|
2834 | var onChange = this.props.onChange;
|
2835 | var files = this.getSelectedFiles(input);
|
2836 |
|
2837 | if (typeof onChange === 'function') {
|
2838 | onChange.apply(void 0, arguments);
|
2839 | }
|
2840 |
|
2841 | this.setState({
|
2842 | files: files
|
2843 | });
|
2844 | };
|
2845 |
|
2846 | _proto.getSelectedFiles = function getSelectedFiles(input) {
|
2847 | var multiple = this.props.multiple;
|
2848 |
|
2849 | if (multiple && input.files) {
|
2850 | var files = [].slice.call(input.files);
|
2851 | return files.map(function (file) {
|
2852 | return file.name;
|
2853 | }).join(', ');
|
2854 | }
|
2855 |
|
2856 | if (input.value.indexOf('fakepath') !== -1) {
|
2857 | var parts = input.value.split('\\');
|
2858 | return parts[parts.length - 1];
|
2859 | }
|
2860 |
|
2861 | return input.value;
|
2862 | };
|
2863 |
|
2864 | _proto.render = function render() {
|
2865 | var _this$props = this.props,
|
2866 | className = _this$props.className,
|
2867 | label = _this$props.label,
|
2868 | valid = _this$props.valid,
|
2869 | invalid = _this$props.invalid,
|
2870 | cssModule = _this$props.cssModule,
|
2871 | children = _this$props.children,
|
2872 | bsSize = _this$props.bsSize,
|
2873 | innerRef = _this$props.innerRef,
|
2874 | htmlFor = _this$props.htmlFor,
|
2875 | type = _this$props.type,
|
2876 | onChange = _this$props.onChange,
|
2877 | dataBrowse = _this$props.dataBrowse,
|
2878 | attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "label", "valid", "invalid", "cssModule", "children", "bsSize", "innerRef", "htmlFor", "type", "onChange", "dataBrowse"]);
|
2879 |
|
2880 | var customClass = mapToCssModules(classNames(className, "custom-file"), cssModule);
|
2881 | var validationClassNames = mapToCssModules(classNames(invalid && 'is-invalid', valid && 'is-valid'), cssModule);
|
2882 | var labelHtmlFor = htmlFor || attributes.id;
|
2883 | var files = this.state.files;
|
2884 | return React.createElement("div", {
|
2885 | className: customClass
|
2886 | }, React.createElement("input", _extends({
|
2887 | type: "file"
|
2888 | }, attributes, {
|
2889 | ref: innerRef,
|
2890 | className: classNames(validationClassNames, mapToCssModules('custom-file-input', cssModule)),
|
2891 | onChange: this.onChange
|
2892 | })), React.createElement("label", {
|
2893 | className: mapToCssModules('custom-file-label', cssModule),
|
2894 | htmlFor: labelHtmlFor,
|
2895 | "data-browse": dataBrowse
|
2896 | }, files || label || 'Choose file'), children);
|
2897 | };
|
2898 |
|
2899 | return CustomFileInput;
|
2900 | }(React.Component);
|
2901 |
|
2902 | CustomFileInput.propTypes = propTypes$B;
|
2903 |
|
2904 | var propTypes$C = {
|
2905 | className: PropTypes.string,
|
2906 | id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
2907 | type: PropTypes.string.isRequired,
|
2908 | label: PropTypes.node,
|
2909 | inline: PropTypes.bool,
|
2910 | valid: PropTypes.bool,
|
2911 | invalid: PropTypes.bool,
|
2912 | bsSize: PropTypes.string,
|
2913 | htmlFor: PropTypes.string,
|
2914 | cssModule: PropTypes.object,
|
2915 | children: PropTypes.oneOfType([PropTypes.node, PropTypes.array, PropTypes.func]),
|
2916 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
|
2917 | };
|
2918 |
|
2919 | function CustomInput(props) {
|
2920 | var className = props.className,
|
2921 | label = props.label,
|
2922 | inline = props.inline,
|
2923 | valid = props.valid,
|
2924 | invalid = props.invalid,
|
2925 | cssModule = props.cssModule,
|
2926 | children = props.children,
|
2927 | bsSize = props.bsSize,
|
2928 | innerRef = props.innerRef,
|
2929 | htmlFor = props.htmlFor,
|
2930 | attributes = _objectWithoutPropertiesLoose(props, ["className", "label", "inline", "valid", "invalid", "cssModule", "children", "bsSize", "innerRef", "htmlFor"]);
|
2931 |
|
2932 | var type = attributes.type;
|
2933 | var customClass = mapToCssModules(classNames(className, "custom-" + type, bsSize ? "custom-" + type + "-" + bsSize : false), cssModule);
|
2934 | var validationClassNames = mapToCssModules(classNames(invalid && 'is-invalid', valid && 'is-valid'), cssModule);
|
2935 | var labelHtmlFor = htmlFor || attributes.id;
|
2936 |
|
2937 | if (type === 'select') {
|
2938 | var _type = attributes.type,
|
2939 | rest = _objectWithoutPropertiesLoose(attributes, ["type"]);
|
2940 |
|
2941 | return React.createElement("select", _extends({}, rest, {
|
2942 | ref: innerRef,
|
2943 | className: classNames(validationClassNames, customClass)
|
2944 | }), children);
|
2945 | }
|
2946 |
|
2947 | if (type === 'file') {
|
2948 | return React.createElement(CustomFileInput, props);
|
2949 | }
|
2950 |
|
2951 | if (type !== 'checkbox' && type !== 'radio' && type !== 'switch') {
|
2952 | return React.createElement("input", _extends({}, attributes, {
|
2953 | ref: innerRef,
|
2954 | className: classNames(validationClassNames, customClass)
|
2955 | }));
|
2956 | }
|
2957 |
|
2958 | var wrapperClasses = classNames(customClass, mapToCssModules(classNames('custom-control', {
|
2959 | 'custom-control-inline': inline
|
2960 | }), cssModule));
|
2961 | return React.createElement("div", {
|
2962 | className: wrapperClasses
|
2963 | }, React.createElement("input", _extends({}, attributes, {
|
2964 | type: type === 'switch' ? 'checkbox' : type,
|
2965 | ref: innerRef,
|
2966 | className: classNames(validationClassNames, mapToCssModules('custom-control-input', cssModule))
|
2967 | })), React.createElement("label", {
|
2968 | className: mapToCssModules('custom-control-label', cssModule),
|
2969 | htmlFor: labelHtmlFor
|
2970 | }, label), children);
|
2971 | }
|
2972 |
|
2973 | CustomInput.propTypes = propTypes$C;
|
2974 |
|
2975 | function noop() {}
|
2976 |
|
2977 | var propTypes$D = {
|
2978 | children: PropTypes.node.isRequired,
|
2979 | popperClassName: PropTypes.string,
|
2980 | placement: PropTypes.string,
|
2981 | placementPrefix: PropTypes.string,
|
2982 | arrowClassName: PropTypes.string,
|
2983 | hideArrow: PropTypes.bool,
|
2984 | tag: tagPropType,
|
2985 | isOpen: PropTypes.bool.isRequired,
|
2986 | cssModule: PropTypes.object,
|
2987 | offset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
2988 | fallbackPlacement: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
2989 | flip: PropTypes.bool,
|
2990 | container: targetPropType,
|
2991 | target: targetPropType.isRequired,
|
2992 | modifiers: PropTypes.object,
|
2993 | boundariesElement: PropTypes.oneOfType([PropTypes.string, DOMElement]),
|
2994 | onClosed: PropTypes.func,
|
2995 | fade: PropTypes.bool,
|
2996 | transition: PropTypes.shape(Fade.propTypes)
|
2997 | };
|
2998 | var defaultProps$z = {
|
2999 | boundariesElement: 'scrollParent',
|
3000 | placement: 'auto',
|
3001 | hideArrow: false,
|
3002 | isOpen: false,
|
3003 | offset: 0,
|
3004 | fallbackPlacement: 'flip',
|
3005 | flip: true,
|
3006 | container: 'body',
|
3007 | modifiers: {},
|
3008 | onClosed: noop,
|
3009 | fade: true,
|
3010 | transition: _extends({}, Fade.defaultProps)
|
3011 | };
|
3012 |
|
3013 | var PopperContent =
|
3014 |
|
3015 | function (_React$Component) {
|
3016 | _inheritsLoose(PopperContent, _React$Component);
|
3017 |
|
3018 | function PopperContent(props) {
|
3019 | var _this;
|
3020 |
|
3021 | _this = _React$Component.call(this, props) || this;
|
3022 | _this.setTargetNode = _this.setTargetNode.bind(_assertThisInitialized(_this));
|
3023 | _this.getTargetNode = _this.getTargetNode.bind(_assertThisInitialized(_this));
|
3024 | _this.getRef = _this.getRef.bind(_assertThisInitialized(_this));
|
3025 | _this.onClosed = _this.onClosed.bind(_assertThisInitialized(_this));
|
3026 | _this.state = {
|
3027 | isOpen: props.isOpen
|
3028 | };
|
3029 | return _this;
|
3030 | }
|
3031 |
|
3032 | PopperContent.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
|
3033 | if (props.isOpen && !state.isOpen) {
|
3034 | return {
|
3035 | isOpen: props.isOpen
|
3036 | };
|
3037 | } else return null;
|
3038 | };
|
3039 |
|
3040 | var _proto = PopperContent.prototype;
|
3041 |
|
3042 | _proto.componentDidUpdate = function componentDidUpdate() {
|
3043 | if (this._element && this._element.childNodes && this._element.childNodes[0] && this._element.childNodes[0].focus) {
|
3044 | this._element.childNodes[0].focus();
|
3045 | }
|
3046 | };
|
3047 |
|
3048 | _proto.setTargetNode = function setTargetNode(node) {
|
3049 | this.targetNode = typeof node === 'string' ? getTarget(node) : node;
|
3050 | };
|
3051 |
|
3052 | _proto.getTargetNode = function getTargetNode() {
|
3053 | return this.targetNode;
|
3054 | };
|
3055 |
|
3056 | _proto.getContainerNode = function getContainerNode() {
|
3057 | return getTarget(this.props.container);
|
3058 | };
|
3059 |
|
3060 | _proto.getRef = function getRef(ref) {
|
3061 | this._element = ref;
|
3062 | };
|
3063 |
|
3064 | _proto.onClosed = function onClosed() {
|
3065 | this.props.onClosed();
|
3066 | this.setState({
|
3067 | isOpen: false
|
3068 | });
|
3069 | };
|
3070 |
|
3071 | _proto.renderChildren = function renderChildren() {
|
3072 | var _this$props = this.props,
|
3073 | cssModule = _this$props.cssModule,
|
3074 | children = _this$props.children,
|
3075 | isOpen = _this$props.isOpen,
|
3076 | flip = _this$props.flip,
|
3077 | target = _this$props.target,
|
3078 | offset = _this$props.offset,
|
3079 | fallbackPlacement = _this$props.fallbackPlacement,
|
3080 | placementPrefix = _this$props.placementPrefix,
|
3081 | _arrowClassName = _this$props.arrowClassName,
|
3082 | hideArrow = _this$props.hideArrow,
|
3083 | _popperClassName = _this$props.popperClassName,
|
3084 | tag = _this$props.tag,
|
3085 | container = _this$props.container,
|
3086 | modifiers = _this$props.modifiers,
|
3087 | boundariesElement = _this$props.boundariesElement,
|
3088 | onClosed = _this$props.onClosed,
|
3089 | fade = _this$props.fade,
|
3090 | transition = _this$props.transition,
|
3091 | placement = _this$props.placement,
|
3092 | attrs = _objectWithoutPropertiesLoose(_this$props, ["cssModule", "children", "isOpen", "flip", "target", "offset", "fallbackPlacement", "placementPrefix", "arrowClassName", "hideArrow", "popperClassName", "tag", "container", "modifiers", "boundariesElement", "onClosed", "fade", "transition", "placement"]);
|
3093 |
|
3094 | var arrowClassName = mapToCssModules(classNames('arrow', _arrowClassName), cssModule);
|
3095 | var popperClassName = mapToCssModules(classNames(_popperClassName, placementPrefix ? placementPrefix + "-auto" : ''), this.props.cssModule);
|
3096 |
|
3097 | var extendedModifiers = _extends({
|
3098 | offset: {
|
3099 | offset: offset
|
3100 | },
|
3101 | flip: {
|
3102 | enabled: flip,
|
3103 | behavior: fallbackPlacement
|
3104 | },
|
3105 | preventOverflow: {
|
3106 | boundariesElement: boundariesElement
|
3107 | }
|
3108 | }, modifiers);
|
3109 |
|
3110 | var popperTransition = _extends({}, Fade.defaultProps, {}, transition, {
|
3111 | baseClass: fade ? transition.baseClass : '',
|
3112 | timeout: fade ? transition.timeout : 0
|
3113 | });
|
3114 |
|
3115 | return React.createElement(Fade, _extends({}, popperTransition, attrs, {
|
3116 | in: isOpen,
|
3117 | onExited: this.onClosed,
|
3118 | tag: tag
|
3119 | }), React.createElement(Popper, {
|
3120 | referenceElement: this.targetNode,
|
3121 | modifiers: extendedModifiers,
|
3122 | placement: placement
|
3123 | }, function (_ref) {
|
3124 | var ref = _ref.ref,
|
3125 | style = _ref.style,
|
3126 | placement = _ref.placement,
|
3127 | arrowProps = _ref.arrowProps;
|
3128 | return React.createElement("div", {
|
3129 | ref: ref,
|
3130 | style: style,
|
3131 | className: popperClassName,
|
3132 | "x-placement": placement
|
3133 | }, children, !hideArrow && React.createElement("span", {
|
3134 | ref: arrowProps.ref,
|
3135 | className: arrowClassName,
|
3136 | style: arrowProps.style
|
3137 | }));
|
3138 | }));
|
3139 | };
|
3140 |
|
3141 | _proto.render = function render() {
|
3142 | this.setTargetNode(this.props.target);
|
3143 |
|
3144 | if (this.state.isOpen) {
|
3145 | return this.props.container === 'inline' ? this.renderChildren() : ReactDOM.createPortal(React.createElement("div", {
|
3146 | ref: this.getRef
|
3147 | }, this.renderChildren()), this.getContainerNode());
|
3148 | }
|
3149 |
|
3150 | return null;
|
3151 | };
|
3152 |
|
3153 | return PopperContent;
|
3154 | }(React.Component);
|
3155 |
|
3156 | PopperContent.propTypes = propTypes$D;
|
3157 | PopperContent.defaultProps = defaultProps$z;
|
3158 |
|
3159 | var PopperTargetHelper = function PopperTargetHelper(props, context) {
|
3160 | context.popperManager.setTargetNode(getTarget(props.target));
|
3161 | return null;
|
3162 | };
|
3163 |
|
3164 | PopperTargetHelper.contextTypes = {
|
3165 | popperManager: PropTypes.object.isRequired
|
3166 | };
|
3167 | PopperTargetHelper.propTypes = {
|
3168 | target: targetPropType.isRequired
|
3169 | };
|
3170 |
|
3171 | var propTypes$E = {
|
3172 | placement: PropTypes.oneOf(PopperPlacements),
|
3173 | target: targetPropType.isRequired,
|
3174 | container: targetPropType,
|
3175 | isOpen: PropTypes.bool,
|
3176 | disabled: PropTypes.bool,
|
3177 | hideArrow: PropTypes.bool,
|
3178 | boundariesElement: PropTypes.oneOfType([PropTypes.string, DOMElement]),
|
3179 | className: PropTypes.string,
|
3180 | innerClassName: PropTypes.string,
|
3181 | arrowClassName: PropTypes.string,
|
3182 | popperClassName: PropTypes.string,
|
3183 | cssModule: PropTypes.object,
|
3184 | toggle: PropTypes.func,
|
3185 | autohide: PropTypes.bool,
|
3186 | placementPrefix: PropTypes.string,
|
3187 | delay: PropTypes.oneOfType([PropTypes.shape({
|
3188 | show: PropTypes.number,
|
3189 | hide: PropTypes.number
|
3190 | }), PropTypes.number]),
|
3191 | modifiers: PropTypes.object,
|
3192 | offset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
3193 | innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.object]),
|
3194 | trigger: PropTypes.string,
|
3195 | fade: PropTypes.bool,
|
3196 | flip: PropTypes.bool
|
3197 | };
|
3198 | var DEFAULT_DELAYS = {
|
3199 | show: 0,
|
3200 | hide: 50
|
3201 | };
|
3202 | var defaultProps$A = {
|
3203 | isOpen: false,
|
3204 | hideArrow: false,
|
3205 | autohide: false,
|
3206 | delay: DEFAULT_DELAYS,
|
3207 | toggle: function toggle() {},
|
3208 | trigger: 'click',
|
3209 | fade: true
|
3210 | };
|
3211 |
|
3212 | function isInDOMSubtree(element, subtreeRoot) {
|
3213 | return subtreeRoot && (element === subtreeRoot || subtreeRoot.contains(element));
|
3214 | }
|
3215 |
|
3216 | function isInDOMSubtrees(element, subtreeRoots) {
|
3217 | if (subtreeRoots === void 0) {
|
3218 | subtreeRoots = [];
|
3219 | }
|
3220 |
|
3221 | return subtreeRoots && subtreeRoots.length && subtreeRoots.find(function (subTreeRoot) {
|
3222 | return isInDOMSubtree(element, subTreeRoot);
|
3223 | });
|
3224 | }
|
3225 |
|
3226 | var TooltipPopoverWrapper =
|
3227 |
|
3228 | function (_React$Component) {
|
3229 | _inheritsLoose(TooltipPopoverWrapper, _React$Component);
|
3230 |
|
3231 | function TooltipPopoverWrapper(props) {
|
3232 | var _this;
|
3233 |
|
3234 | _this = _React$Component.call(this, props) || this;
|
3235 | _this._targets = [];
|
3236 | _this.currentTargetElement = null;
|
3237 | _this.addTargetEvents = _this.addTargetEvents.bind(_assertThisInitialized(_this));
|
3238 | _this.handleDocumentClick = _this.handleDocumentClick.bind(_assertThisInitialized(_this));
|
3239 | _this.removeTargetEvents = _this.removeTargetEvents.bind(_assertThisInitialized(_this));
|
3240 | _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
|
3241 | _this.showWithDelay = _this.showWithDelay.bind(_assertThisInitialized(_this));
|
3242 | _this.hideWithDelay = _this.hideWithDelay.bind(_assertThisInitialized(_this));
|
3243 | _this.onMouseOverTooltipContent = _this.onMouseOverTooltipContent.bind(_assertThisInitialized(_this));
|
3244 | _this.onMouseLeaveTooltipContent = _this.onMouseLeaveTooltipContent.bind(_assertThisInitialized(_this));
|
3245 | _this.show = _this.show.bind(_assertThisInitialized(_this));
|
3246 | _this.hide = _this.hide.bind(_assertThisInitialized(_this));
|
3247 | _this.onEscKeyDown = _this.onEscKeyDown.bind(_assertThisInitialized(_this));
|
3248 | _this.getRef = _this.getRef.bind(_assertThisInitialized(_this));
|
3249 | _this.state = {
|
3250 | isOpen: props.isOpen
|
3251 | };
|
3252 | _this._isMounted = false;
|
3253 | return _this;
|
3254 | }
|
3255 |
|
3256 | var _proto = TooltipPopoverWrapper.prototype;
|
3257 |
|
3258 | _proto.componentDidMount = function componentDidMount() {
|
3259 | this._isMounted = true;
|
3260 | this.updateTarget();
|
3261 | };
|
3262 |
|
3263 | _proto.componentWillUnmount = function componentWillUnmount() {
|
3264 | this._isMounted = false;
|
3265 | this.removeTargetEvents();
|
3266 | this._targets = null;
|
3267 | this.clearShowTimeout();
|
3268 | this.clearHideTimeout();
|
3269 | };
|
3270 |
|
3271 | TooltipPopoverWrapper.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
|
3272 | if (props.isOpen && !state.isOpen) {
|
3273 | return {
|
3274 | isOpen: props.isOpen
|
3275 | };
|
3276 | } else return null;
|
3277 | };
|
3278 |
|
3279 | _proto.onMouseOverTooltipContent = function onMouseOverTooltipContent() {
|
3280 | if (this.props.trigger.indexOf('hover') > -1 && !this.props.autohide) {
|
3281 | if (this._hideTimeout) {
|
3282 | this.clearHideTimeout();
|
3283 | }
|
3284 |
|
3285 | if (this.state.isOpen && !this.props.isOpen) {
|
3286 | this.toggle();
|
3287 | }
|
3288 | }
|
3289 | };
|
3290 |
|
3291 | _proto.onMouseLeaveTooltipContent = function onMouseLeaveTooltipContent(e) {
|
3292 | if (this.props.trigger.indexOf('hover') > -1 && !this.props.autohide) {
|
3293 | if (this._showTimeout) {
|
3294 | this.clearShowTimeout();
|
3295 | }
|
3296 |
|
3297 | e.persist();
|
3298 | this._hideTimeout = setTimeout(this.hide.bind(this, e), this.getDelay('hide'));
|
3299 | }
|
3300 | };
|
3301 |
|
3302 | _proto.onEscKeyDown = function onEscKeyDown(e) {
|
3303 | if (e.key === 'Escape') {
|
3304 | this.hide(e);
|
3305 | }
|
3306 | };
|
3307 |
|
3308 | _proto.getRef = function getRef(ref) {
|
3309 | var innerRef = this.props.innerRef;
|
3310 |
|
3311 | if (innerRef) {
|
3312 | if (typeof innerRef === 'function') {
|
3313 | innerRef(ref);
|
3314 | } else if (typeof innerRef === 'object') {
|
3315 | innerRef.current = ref;
|
3316 | }
|
3317 | }
|
3318 |
|
3319 | this._popover = ref;
|
3320 | };
|
3321 |
|
3322 | _proto.getDelay = function getDelay(key) {
|
3323 | var delay = this.props.delay;
|
3324 |
|
3325 | if (typeof delay === 'object') {
|
3326 | return isNaN(delay[key]) ? DEFAULT_DELAYS[key] : delay[key];
|
3327 | }
|
3328 |
|
3329 | return delay;
|
3330 | };
|
3331 |
|
3332 | _proto.show = function show(e) {
|
3333 | if (!this.props.isOpen) {
|
3334 | this.clearShowTimeout();
|
3335 | this.currentTargetElement = e ? e.currentTarget || e.target : null;
|
3336 |
|
3337 | if (e && e.composedPath && typeof e.composedPath === 'function') {
|
3338 | var path = e.composedPath();
|
3339 | this.currentTargetElement = path && path[0] || this.currentTargetElement;
|
3340 | }
|
3341 |
|
3342 | this.toggle(e);
|
3343 | }
|
3344 | };
|
3345 |
|
3346 | _proto.showWithDelay = function showWithDelay(e) {
|
3347 | if (this._hideTimeout) {
|
3348 | this.clearHideTimeout();
|
3349 | }
|
3350 |
|
3351 | this._showTimeout = setTimeout(this.show.bind(this, e), this.getDelay('show'));
|
3352 | };
|
3353 |
|
3354 | _proto.hide = function hide(e) {
|
3355 | if (this.props.isOpen) {
|
3356 | this.clearHideTimeout();
|
3357 | this.currentTargetElement = null;
|
3358 | this.toggle(e);
|
3359 | }
|
3360 | };
|
3361 |
|
3362 | _proto.hideWithDelay = function hideWithDelay(e) {
|
3363 | if (this._showTimeout) {
|
3364 | this.clearShowTimeout();
|
3365 | }
|
3366 |
|
3367 | this._hideTimeout = setTimeout(this.hide.bind(this, e), this.getDelay('hide'));
|
3368 | };
|
3369 |
|
3370 | _proto.clearShowTimeout = function clearShowTimeout() {
|
3371 | clearTimeout(this._showTimeout);
|
3372 | this._showTimeout = undefined;
|
3373 | };
|
3374 |
|
3375 | _proto.clearHideTimeout = function clearHideTimeout() {
|
3376 | clearTimeout(this._hideTimeout);
|
3377 | this._hideTimeout = undefined;
|
3378 | };
|
3379 |
|
3380 | _proto.handleDocumentClick = function handleDocumentClick(e) {
|
3381 | var triggers = this.props.trigger.split(' ');
|
3382 |
|
3383 | if (triggers.indexOf('legacy') > -1 && (this.props.isOpen || isInDOMSubtrees(e.target, this._targets))) {
|
3384 | if (this._hideTimeout) {
|
3385 | this.clearHideTimeout();
|
3386 | }
|
3387 |
|
3388 | if (this.props.isOpen && !isInDOMSubtree(e.target, this._popover)) {
|
3389 | this.hideWithDelay(e);
|
3390 | } else if (!this.props.isOpen) {
|
3391 | this.showWithDelay(e);
|
3392 | }
|
3393 | } else if (triggers.indexOf('click') > -1 && isInDOMSubtrees(e.target, this._targets)) {
|
3394 | if (this._hideTimeout) {
|
3395 | this.clearHideTimeout();
|
3396 | }
|
3397 |
|
3398 | if (!this.props.isOpen) {
|
3399 | this.showWithDelay(e);
|
3400 | } else {
|
3401 | this.hideWithDelay(e);
|
3402 | }
|
3403 | }
|
3404 | };
|
3405 |
|
3406 | _proto.addEventOnTargets = function addEventOnTargets(type, handler, isBubble) {
|
3407 | this._targets.forEach(function (target) {
|
3408 | target.addEventListener(type, handler, isBubble);
|
3409 | });
|
3410 | };
|
3411 |
|
3412 | _proto.removeEventOnTargets = function removeEventOnTargets(type, handler, isBubble) {
|
3413 | this._targets.forEach(function (target) {
|
3414 | target.removeEventListener(type, handler, isBubble);
|
3415 | });
|
3416 | };
|
3417 |
|
3418 | _proto.addTargetEvents = function addTargetEvents() {
|
3419 | if (this.props.trigger) {
|
3420 | var triggers = this.props.trigger.split(' ');
|
3421 |
|
3422 | if (triggers.indexOf('manual') === -1) {
|
3423 | if (triggers.indexOf('click') > -1 || triggers.indexOf('legacy') > -1) {
|
3424 | document.addEventListener('click', this.handleDocumentClick, true);
|
3425 | }
|
3426 |
|
3427 | if (this._targets && this._targets.length) {
|
3428 | if (triggers.indexOf('hover') > -1) {
|
3429 | this.addEventOnTargets('mouseover', this.showWithDelay, true);
|
3430 | this.addEventOnTargets('mouseout', this.hideWithDelay, true);
|
3431 | }
|
3432 |
|
3433 | if (triggers.indexOf('focus') > -1) {
|
3434 | this.addEventOnTargets('focusin', this.show, true);
|
3435 | this.addEventOnTargets('focusout', this.hide, true);
|
3436 | }
|
3437 |
|
3438 | this.addEventOnTargets('keydown', this.onEscKeyDown, true);
|
3439 | }
|
3440 | }
|
3441 | }
|
3442 | };
|
3443 |
|
3444 | _proto.removeTargetEvents = function removeTargetEvents() {
|
3445 | if (this._targets) {
|
3446 | this.removeEventOnTargets('mouseover', this.showWithDelay, true);
|
3447 | this.removeEventOnTargets('mouseout', this.hideWithDelay, true);
|
3448 | this.removeEventOnTargets('keydown', this.onEscKeyDown, true);
|
3449 | this.removeEventOnTargets('focusin', this.show, true);
|
3450 | this.removeEventOnTargets('focusout', this.hide, true);
|
3451 | }
|
3452 |
|
3453 | document.removeEventListener('click', this.handleDocumentClick, true);
|
3454 | };
|
3455 |
|
3456 | _proto.updateTarget = function updateTarget() {
|
3457 | var newTarget = getTarget(this.props.target, true);
|
3458 |
|
3459 | if (newTarget !== this._targets) {
|
3460 | this.removeTargetEvents();
|
3461 | this._targets = newTarget ? Array.from(newTarget) : [];
|
3462 | this.currentTargetElement = this.currentTargetElement || this._targets[0];
|
3463 | this.addTargetEvents();
|
3464 | }
|
3465 | };
|
3466 |
|
3467 | _proto.toggle = function toggle(e) {
|
3468 | if (this.props.disabled || !this._isMounted) {
|
3469 | return e && e.preventDefault();
|
3470 | }
|
3471 |
|
3472 | return this.props.toggle(e);
|
3473 | };
|
3474 |
|
3475 | _proto.render = function render() {
|
3476 | if (!this.props.isOpen) {
|
3477 | return null;
|
3478 | }
|
3479 |
|
3480 | this.updateTarget();
|
3481 | var _this$props = this.props,
|
3482 | className = _this$props.className,
|
3483 | cssModule = _this$props.cssModule,
|
3484 | innerClassName = _this$props.innerClassName,
|
3485 | isOpen = _this$props.isOpen,
|
3486 | hideArrow = _this$props.hideArrow,
|
3487 | boundariesElement = _this$props.boundariesElement,
|
3488 | placement = _this$props.placement,
|
3489 | placementPrefix = _this$props.placementPrefix,
|
3490 | arrowClassName = _this$props.arrowClassName,
|
3491 | popperClassName = _this$props.popperClassName,
|
3492 | container = _this$props.container,
|
3493 | modifiers = _this$props.modifiers,
|
3494 | offset = _this$props.offset,
|
3495 | fade = _this$props.fade,
|
3496 | flip = _this$props.flip;
|
3497 | var attributes = omit(this.props, Object.keys(propTypes$E));
|
3498 | var popperClasses = mapToCssModules(popperClassName, cssModule);
|
3499 | var classes = mapToCssModules(innerClassName, cssModule);
|
3500 | return React.createElement(PopperContent, {
|
3501 | className: className,
|
3502 | target: this.currentTargetElement || this._targets[0],
|
3503 | isOpen: isOpen,
|
3504 | hideArrow: hideArrow,
|
3505 | boundariesElement: boundariesElement,
|
3506 | placement: placement,
|
3507 | placementPrefix: placementPrefix,
|
3508 | arrowClassName: arrowClassName,
|
3509 | popperClassName: popperClasses,
|
3510 | container: container,
|
3511 | modifiers: modifiers,
|
3512 | offset: offset,
|
3513 | cssModule: cssModule,
|
3514 | fade: fade,
|
3515 | flip: flip
|
3516 | }, React.createElement("div", _extends({}, attributes, {
|
3517 | ref: this.getRef,
|
3518 | className: classes,
|
3519 | role: "tooltip",
|
3520 | onMouseOver: this.onMouseOverTooltipContent,
|
3521 | onMouseLeave: this.onMouseLeaveTooltipContent,
|
3522 | onKeyDown: this.onEscKeyDown
|
3523 | })));
|
3524 | };
|
3525 |
|
3526 | return TooltipPopoverWrapper;
|
3527 | }(React.Component);
|
3528 |
|
3529 | TooltipPopoverWrapper.propTypes = propTypes$E;
|
3530 | TooltipPopoverWrapper.defaultProps = defaultProps$A;
|
3531 |
|
3532 | var defaultProps$B = {
|
3533 | placement: 'right',
|
3534 | placementPrefix: 'bs-popover',
|
3535 | trigger: 'click'
|
3536 | };
|
3537 |
|
3538 | var Popover = function Popover(props) {
|
3539 | var popperClasses = classNames('popover', 'show', props.popperClassName);
|
3540 | var classes = classNames('popover-inner', props.innerClassName);
|
3541 | return React.createElement(TooltipPopoverWrapper, _extends({}, props, {
|
3542 | popperClassName: popperClasses,
|
3543 | innerClassName: classes
|
3544 | }));
|
3545 | };
|
3546 |
|
3547 | Popover.propTypes = propTypes$E;
|
3548 | Popover.defaultProps = defaultProps$B;
|
3549 |
|
3550 | var omitKeys = ['defaultOpen'];
|
3551 |
|
3552 | var UncontrolledPopover =
|
3553 |
|
3554 | function (_Component) {
|
3555 | _inheritsLoose(UncontrolledPopover, _Component);
|
3556 |
|
3557 | function UncontrolledPopover(props) {
|
3558 | var _this;
|
3559 |
|
3560 | _this = _Component.call(this, props) || this;
|
3561 | _this.state = {
|
3562 | isOpen: props.defaultOpen || false
|
3563 | };
|
3564 | _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
|
3565 | return _this;
|
3566 | }
|
3567 |
|
3568 | var _proto = UncontrolledPopover.prototype;
|
3569 |
|
3570 | _proto.toggle = function toggle() {
|
3571 | this.setState({
|
3572 | isOpen: !this.state.isOpen
|
3573 | });
|
3574 | };
|
3575 |
|
3576 | _proto.render = function render() {
|
3577 | return React.createElement(Popover, _extends({
|
3578 | isOpen: this.state.isOpen,
|
3579 | toggle: this.toggle
|
3580 | }, omit(this.props, omitKeys)));
|
3581 | };
|
3582 |
|
3583 | return UncontrolledPopover;
|
3584 | }(Component);
|
3585 | UncontrolledPopover.propTypes = _extends({
|
3586 | defaultOpen: PropTypes.bool
|
3587 | }, Popover.propTypes);
|
3588 |
|
3589 | var propTypes$F = {
|
3590 | tag: tagPropType,
|
3591 | className: PropTypes.string,
|
3592 | cssModule: PropTypes.object
|
3593 | };
|
3594 | var defaultProps$C = {
|
3595 | tag: 'h3'
|
3596 | };
|
3597 |
|
3598 | var PopoverHeader = function PopoverHeader(props) {
|
3599 | var className = props.className,
|
3600 | cssModule = props.cssModule,
|
3601 | Tag = props.tag,
|
3602 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
3603 |
|
3604 | var classes = mapToCssModules(classNames(className, 'popover-header'), cssModule);
|
3605 | return React.createElement(Tag, _extends({}, attributes, {
|
3606 | className: classes
|
3607 | }));
|
3608 | };
|
3609 |
|
3610 | PopoverHeader.propTypes = propTypes$F;
|
3611 | PopoverHeader.defaultProps = defaultProps$C;
|
3612 |
|
3613 | var propTypes$G = {
|
3614 | tag: tagPropType,
|
3615 | className: PropTypes.string,
|
3616 | cssModule: PropTypes.object
|
3617 | };
|
3618 | var defaultProps$D = {
|
3619 | tag: 'div'
|
3620 | };
|
3621 |
|
3622 | var PopoverBody = function PopoverBody(props) {
|
3623 | var className = props.className,
|
3624 | cssModule = props.cssModule,
|
3625 | Tag = props.tag,
|
3626 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
3627 |
|
3628 | var classes = mapToCssModules(classNames(className, 'popover-body'), cssModule);
|
3629 | return React.createElement(Tag, _extends({}, attributes, {
|
3630 | className: classes
|
3631 | }));
|
3632 | };
|
3633 |
|
3634 | PopoverBody.propTypes = propTypes$G;
|
3635 | PopoverBody.defaultProps = defaultProps$D;
|
3636 |
|
3637 | var propTypes$H = {
|
3638 | children: PropTypes.node,
|
3639 | bar: PropTypes.bool,
|
3640 | multi: PropTypes.bool,
|
3641 | tag: tagPropType,
|
3642 | value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
3643 | max: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
3644 | animated: PropTypes.bool,
|
3645 | striped: PropTypes.bool,
|
3646 | color: PropTypes.string,
|
3647 | className: PropTypes.string,
|
3648 | barClassName: PropTypes.string,
|
3649 | cssModule: PropTypes.object
|
3650 | };
|
3651 | var defaultProps$E = {
|
3652 | tag: 'div',
|
3653 | value: 0,
|
3654 | max: 100
|
3655 | };
|
3656 |
|
3657 | var Progress = function Progress(props) {
|
3658 | var children = props.children,
|
3659 | className = props.className,
|
3660 | barClassName = props.barClassName,
|
3661 | cssModule = props.cssModule,
|
3662 | value = props.value,
|
3663 | max = props.max,
|
3664 | animated = props.animated,
|
3665 | striped = props.striped,
|
3666 | color = props.color,
|
3667 | bar = props.bar,
|
3668 | multi = props.multi,
|
3669 | Tag = props.tag,
|
3670 | attributes = _objectWithoutPropertiesLoose(props, ["children", "className", "barClassName", "cssModule", "value", "max", "animated", "striped", "color", "bar", "multi", "tag"]);
|
3671 |
|
3672 | var percent = toNumber(value) / toNumber(max) * 100;
|
3673 | var progressClasses = mapToCssModules(classNames(className, 'progress'), cssModule);
|
3674 | 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);
|
3675 | var ProgressBar = multi ? children : React.createElement("div", {
|
3676 | className: progressBarClasses,
|
3677 | style: {
|
3678 | width: percent + "%"
|
3679 | },
|
3680 | role: "progressbar",
|
3681 | "aria-valuenow": value,
|
3682 | "aria-valuemin": "0",
|
3683 | "aria-valuemax": max,
|
3684 | children: children
|
3685 | });
|
3686 |
|
3687 | if (bar) {
|
3688 | return ProgressBar;
|
3689 | }
|
3690 |
|
3691 | return React.createElement(Tag, _extends({}, attributes, {
|
3692 | className: progressClasses,
|
3693 | children: ProgressBar
|
3694 | }));
|
3695 | };
|
3696 |
|
3697 | Progress.propTypes = propTypes$H;
|
3698 | Progress.defaultProps = defaultProps$E;
|
3699 |
|
3700 | var propTypes$I = {
|
3701 | children: PropTypes.node.isRequired,
|
3702 | node: PropTypes.any
|
3703 | };
|
3704 |
|
3705 | var Portal =
|
3706 |
|
3707 | function (_React$Component) {
|
3708 | _inheritsLoose(Portal, _React$Component);
|
3709 |
|
3710 | function Portal() {
|
3711 | return _React$Component.apply(this, arguments) || this;
|
3712 | }
|
3713 |
|
3714 | var _proto = Portal.prototype;
|
3715 |
|
3716 | _proto.componentWillUnmount = function componentWillUnmount() {
|
3717 | if (this.defaultNode) {
|
3718 | document.body.removeChild(this.defaultNode);
|
3719 | }
|
3720 |
|
3721 | this.defaultNode = null;
|
3722 | };
|
3723 |
|
3724 | _proto.render = function render() {
|
3725 | if (!canUseDOM) {
|
3726 | return null;
|
3727 | }
|
3728 |
|
3729 | if (!this.props.node && !this.defaultNode) {
|
3730 | this.defaultNode = document.createElement('div');
|
3731 | document.body.appendChild(this.defaultNode);
|
3732 | }
|
3733 |
|
3734 | return ReactDOM.createPortal(this.props.children, this.props.node || this.defaultNode);
|
3735 | };
|
3736 |
|
3737 | return Portal;
|
3738 | }(React.Component);
|
3739 |
|
3740 | Portal.propTypes = propTypes$I;
|
3741 |
|
3742 | function noop$1() {}
|
3743 |
|
3744 | var FadePropTypes = PropTypes.shape(Fade.propTypes);
|
3745 | var propTypes$J = {
|
3746 | isOpen: PropTypes.bool,
|
3747 | autoFocus: PropTypes.bool,
|
3748 | centered: PropTypes.bool,
|
3749 | scrollable: PropTypes.bool,
|
3750 | size: PropTypes.string,
|
3751 | toggle: PropTypes.func,
|
3752 | keyboard: PropTypes.bool,
|
3753 | role: PropTypes.string,
|
3754 | labelledBy: PropTypes.string,
|
3755 | backdrop: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['static'])]),
|
3756 | onEnter: PropTypes.func,
|
3757 | onExit: PropTypes.func,
|
3758 | onOpened: PropTypes.func,
|
3759 | onClosed: PropTypes.func,
|
3760 | children: PropTypes.node,
|
3761 | className: PropTypes.string,
|
3762 | wrapClassName: PropTypes.string,
|
3763 | modalClassName: PropTypes.string,
|
3764 | backdropClassName: PropTypes.string,
|
3765 | contentClassName: PropTypes.string,
|
3766 | external: PropTypes.node,
|
3767 | fade: PropTypes.bool,
|
3768 | cssModule: PropTypes.object,
|
3769 | zIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
3770 | backdropTransition: FadePropTypes,
|
3771 | modalTransition: FadePropTypes,
|
3772 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func]),
|
3773 | unmountOnClose: PropTypes.bool,
|
3774 | returnFocusAfterClose: PropTypes.bool
|
3775 | };
|
3776 | var propsToOmit = Object.keys(propTypes$J);
|
3777 | var defaultProps$F = {
|
3778 | isOpen: false,
|
3779 | autoFocus: true,
|
3780 | centered: false,
|
3781 | scrollable: false,
|
3782 | role: 'dialog',
|
3783 | backdrop: true,
|
3784 | keyboard: true,
|
3785 | zIndex: 1050,
|
3786 | fade: true,
|
3787 | onOpened: noop$1,
|
3788 | onClosed: noop$1,
|
3789 | modalTransition: {
|
3790 | timeout: TransitionTimeouts.Modal
|
3791 | },
|
3792 | backdropTransition: {
|
3793 | mountOnEnter: true,
|
3794 | timeout: TransitionTimeouts.Fade
|
3795 |
|
3796 | },
|
3797 | unmountOnClose: true,
|
3798 | returnFocusAfterClose: true
|
3799 | };
|
3800 |
|
3801 | var Modal =
|
3802 |
|
3803 | function (_React$Component) {
|
3804 | _inheritsLoose(Modal, _React$Component);
|
3805 |
|
3806 | function Modal(props) {
|
3807 | var _this;
|
3808 |
|
3809 | _this = _React$Component.call(this, props) || this;
|
3810 | _this._element = null;
|
3811 | _this._originalBodyPadding = null;
|
3812 | _this.getFocusableChildren = _this.getFocusableChildren.bind(_assertThisInitialized(_this));
|
3813 | _this.handleBackdropClick = _this.handleBackdropClick.bind(_assertThisInitialized(_this));
|
3814 | _this.handleBackdropMouseDown = _this.handleBackdropMouseDown.bind(_assertThisInitialized(_this));
|
3815 | _this.handleEscape = _this.handleEscape.bind(_assertThisInitialized(_this));
|
3816 | _this.handleStaticBackdropAnimation = _this.handleStaticBackdropAnimation.bind(_assertThisInitialized(_this));
|
3817 | _this.handleTab = _this.handleTab.bind(_assertThisInitialized(_this));
|
3818 | _this.onOpened = _this.onOpened.bind(_assertThisInitialized(_this));
|
3819 | _this.onClosed = _this.onClosed.bind(_assertThisInitialized(_this));
|
3820 | _this.manageFocusAfterClose = _this.manageFocusAfterClose.bind(_assertThisInitialized(_this));
|
3821 | _this.clearBackdropAnimationTimeout = _this.clearBackdropAnimationTimeout.bind(_assertThisInitialized(_this));
|
3822 | _this.state = {
|
3823 | isOpen: false,
|
3824 | showStaticBackdropAnimation: false
|
3825 | };
|
3826 | return _this;
|
3827 | }
|
3828 |
|
3829 | var _proto = Modal.prototype;
|
3830 |
|
3831 | _proto.componentDidMount = function componentDidMount() {
|
3832 | var _this$props = this.props,
|
3833 | isOpen = _this$props.isOpen,
|
3834 | autoFocus = _this$props.autoFocus,
|
3835 | onEnter = _this$props.onEnter;
|
3836 |
|
3837 | if (isOpen) {
|
3838 | this.init();
|
3839 | this.setState({
|
3840 | isOpen: true
|
3841 | });
|
3842 |
|
3843 | if (autoFocus) {
|
3844 | this.setFocus();
|
3845 | }
|
3846 | }
|
3847 |
|
3848 | if (onEnter) {
|
3849 | onEnter();
|
3850 | }
|
3851 |
|
3852 | this._isMounted = true;
|
3853 | };
|
3854 |
|
3855 | _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
3856 | if (this.props.isOpen && !prevProps.isOpen) {
|
3857 | this.init();
|
3858 | this.setState({
|
3859 | isOpen: true
|
3860 | });
|
3861 |
|
3862 | return;
|
3863 | }
|
3864 |
|
3865 |
|
3866 | if (this.props.autoFocus && this.state.isOpen && !prevState.isOpen) {
|
3867 | this.setFocus();
|
3868 | }
|
3869 |
|
3870 | if (this._element && prevProps.zIndex !== this.props.zIndex) {
|
3871 | this._element.style.zIndex = this.props.zIndex;
|
3872 | }
|
3873 | };
|
3874 |
|
3875 | _proto.componentWillUnmount = function componentWillUnmount() {
|
3876 | this.clearBackdropAnimationTimeout();
|
3877 |
|
3878 | if (this.props.onExit) {
|
3879 | this.props.onExit();
|
3880 | }
|
3881 |
|
3882 | if (this._element) {
|
3883 | this.destroy();
|
3884 |
|
3885 | if (this.props.isOpen) {
|
3886 | this.close();
|
3887 | }
|
3888 | }
|
3889 |
|
3890 | this._isMounted = false;
|
3891 | };
|
3892 |
|
3893 | _proto.onOpened = function onOpened(node, isAppearing) {
|
3894 | this.props.onOpened();
|
3895 | (this.props.modalTransition.onEntered || noop$1)(node, isAppearing);
|
3896 | };
|
3897 |
|
3898 | _proto.onClosed = function onClosed(node) {
|
3899 | var unmountOnClose = this.props.unmountOnClose;
|
3900 |
|
3901 | this.props.onClosed();
|
3902 | (this.props.modalTransition.onExited || noop$1)(node);
|
3903 |
|
3904 | if (unmountOnClose) {
|
3905 | this.destroy();
|
3906 | }
|
3907 |
|
3908 | this.close();
|
3909 |
|
3910 | if (this._isMounted) {
|
3911 | this.setState({
|
3912 | isOpen: false
|
3913 | });
|
3914 | }
|
3915 | };
|
3916 |
|
3917 | _proto.setFocus = function setFocus() {
|
3918 | if (this._dialog && this._dialog.parentNode && typeof this._dialog.parentNode.focus === 'function') {
|
3919 | this._dialog.parentNode.focus();
|
3920 | }
|
3921 | };
|
3922 |
|
3923 | _proto.getFocusableChildren = function getFocusableChildren() {
|
3924 | return this._element.querySelectorAll(focusableElements.join(', '));
|
3925 | };
|
3926 |
|
3927 | _proto.getFocusedChild = function getFocusedChild() {
|
3928 | var currentFocus;
|
3929 | var focusableChildren = this.getFocusableChildren();
|
3930 |
|
3931 | try {
|
3932 | currentFocus = document.activeElement;
|
3933 | } catch (err) {
|
3934 | currentFocus = focusableChildren[0];
|
3935 | }
|
3936 |
|
3937 | return currentFocus;
|
3938 | }
|
3939 | ;
|
3940 |
|
3941 | _proto.handleBackdropClick = function handleBackdropClick(e) {
|
3942 | if (e.target === this._mouseDownElement) {
|
3943 | e.stopPropagation();
|
3944 | var backdrop = this._dialog ? this._dialog.parentNode : null;
|
3945 |
|
3946 | if (backdrop && e.target === backdrop && this.props.backdrop === 'static') {
|
3947 | this.handleStaticBackdropAnimation();
|
3948 | }
|
3949 |
|
3950 | if (!this.props.isOpen || this.props.backdrop !== true) return;
|
3951 |
|
3952 | if (backdrop && e.target === backdrop && this.props.toggle) {
|
3953 | this.props.toggle(e);
|
3954 | }
|
3955 | }
|
3956 | };
|
3957 |
|
3958 | _proto.handleTab = function handleTab(e) {
|
3959 | if (e.which !== 9) return;
|
3960 | var focusableChildren = this.getFocusableChildren();
|
3961 | var totalFocusable = focusableChildren.length;
|
3962 | if (totalFocusable === 0) return;
|
3963 | var currentFocus = this.getFocusedChild();
|
3964 | var focusedIndex = 0;
|
3965 |
|
3966 | for (var i = 0; i < totalFocusable; i += 1) {
|
3967 | if (focusableChildren[i] === currentFocus) {
|
3968 | focusedIndex = i;
|
3969 | break;
|
3970 | }
|
3971 | }
|
3972 |
|
3973 | if (e.shiftKey && focusedIndex === 0) {
|
3974 | e.preventDefault();
|
3975 | focusableChildren[totalFocusable - 1].focus();
|
3976 | } else if (!e.shiftKey && focusedIndex === totalFocusable - 1) {
|
3977 | e.preventDefault();
|
3978 | focusableChildren[0].focus();
|
3979 | }
|
3980 | };
|
3981 |
|
3982 | _proto.handleBackdropMouseDown = function handleBackdropMouseDown(e) {
|
3983 | this._mouseDownElement = e.target;
|
3984 | };
|
3985 |
|
3986 | _proto.handleEscape = function handleEscape(e) {
|
3987 | if (this.props.isOpen && e.keyCode === keyCodes.esc && this.props.toggle) {
|
3988 | if (this.props.keyboard) {
|
3989 | e.preventDefault();
|
3990 | e.stopPropagation();
|
3991 | this.props.toggle(e);
|
3992 | } else if (this.props.backdrop === 'static') {
|
3993 | e.preventDefault();
|
3994 | e.stopPropagation();
|
3995 | this.handleStaticBackdropAnimation();
|
3996 | }
|
3997 | }
|
3998 | };
|
3999 |
|
4000 | _proto.handleStaticBackdropAnimation = function handleStaticBackdropAnimation() {
|
4001 | var _this2 = this;
|
4002 |
|
4003 | this.clearBackdropAnimationTimeout();
|
4004 | this.setState({
|
4005 | showStaticBackdropAnimation: true
|
4006 | });
|
4007 | this._backdropAnimationTimeout = setTimeout(function () {
|
4008 | _this2.setState({
|
4009 | showStaticBackdropAnimation: false
|
4010 | });
|
4011 | }, 100);
|
4012 | };
|
4013 |
|
4014 | _proto.init = function init() {
|
4015 | try {
|
4016 | this._triggeringElement = document.activeElement;
|
4017 | } catch (err) {
|
4018 | this._triggeringElement = null;
|
4019 | }
|
4020 |
|
4021 | if (!this._element) {
|
4022 | this._element = document.createElement('div');
|
4023 |
|
4024 | this._element.setAttribute('tabindex', '-1');
|
4025 |
|
4026 | this._element.style.position = 'relative';
|
4027 | this._element.style.zIndex = this.props.zIndex;
|
4028 | document.body.appendChild(this._element);
|
4029 | }
|
4030 |
|
4031 | this._originalBodyPadding = getOriginalBodyPadding();
|
4032 | conditionallyUpdateScrollbar();
|
4033 |
|
4034 | if (Modal.openCount === 0) {
|
4035 | document.body.className = classNames(document.body.className, mapToCssModules('modal-open', this.props.cssModule));
|
4036 | }
|
4037 |
|
4038 | Modal.openCount += 1;
|
4039 | };
|
4040 |
|
4041 | _proto.destroy = function destroy() {
|
4042 | if (this._element) {
|
4043 | document.body.removeChild(this._element);
|
4044 | this._element = null;
|
4045 | }
|
4046 |
|
4047 | this.manageFocusAfterClose();
|
4048 | };
|
4049 |
|
4050 | _proto.manageFocusAfterClose = function manageFocusAfterClose() {
|
4051 | if (this._triggeringElement) {
|
4052 | var returnFocusAfterClose = this.props.returnFocusAfterClose;
|
4053 | if (this._triggeringElement.focus && returnFocusAfterClose) this._triggeringElement.focus();
|
4054 | this._triggeringElement = null;
|
4055 | }
|
4056 | };
|
4057 |
|
4058 | _proto.close = function close() {
|
4059 | if (Modal.openCount <= 1) {
|
4060 | var modalOpenClassName = mapToCssModules('modal-open', this.props.cssModule);
|
4061 |
|
4062 | var modalOpenClassNameRegex = new RegExp("(^| )" + modalOpenClassName + "( |$)");
|
4063 | document.body.className = document.body.className.replace(modalOpenClassNameRegex, ' ').trim();
|
4064 | }
|
4065 |
|
4066 | this.manageFocusAfterClose();
|
4067 | Modal.openCount = Math.max(0, Modal.openCount - 1);
|
4068 | setScrollbarWidth(this._originalBodyPadding);
|
4069 | };
|
4070 |
|
4071 | _proto.renderModalDialog = function renderModalDialog() {
|
4072 | var _classNames,
|
4073 | _this3 = this;
|
4074 |
|
4075 | var attributes = omit(this.props, propsToOmit);
|
4076 | var dialogBaseClass = 'modal-dialog';
|
4077 | return React.createElement("div", _extends({}, attributes, {
|
4078 | className: mapToCssModules(classNames(dialogBaseClass, this.props.className, (_classNames = {}, _classNames["modal-" + this.props.size] = this.props.size, _classNames[dialogBaseClass + "-centered"] = this.props.centered, _classNames[dialogBaseClass + "-scrollable"] = this.props.scrollable, _classNames)), this.props.cssModule),
|
4079 | role: "document",
|
4080 | ref: function ref(c) {
|
4081 | _this3._dialog = c;
|
4082 | }
|
4083 | }), React.createElement("div", {
|
4084 | className: mapToCssModules(classNames('modal-content', this.props.contentClassName), this.props.cssModule)
|
4085 | }, this.props.children));
|
4086 | };
|
4087 |
|
4088 | _proto.render = function render() {
|
4089 | var unmountOnClose = this.props.unmountOnClose;
|
4090 |
|
4091 | if (!!this._element && (this.state.isOpen || !unmountOnClose)) {
|
4092 | var isModalHidden = !!this._element && !this.state.isOpen && !unmountOnClose;
|
4093 | this._element.style.display = isModalHidden ? 'none' : 'block';
|
4094 | var _this$props2 = this.props,
|
4095 | wrapClassName = _this$props2.wrapClassName,
|
4096 | modalClassName = _this$props2.modalClassName,
|
4097 | backdropClassName = _this$props2.backdropClassName,
|
4098 | cssModule = _this$props2.cssModule,
|
4099 | isOpen = _this$props2.isOpen,
|
4100 | backdrop = _this$props2.backdrop,
|
4101 | role = _this$props2.role,
|
4102 | labelledBy = _this$props2.labelledBy,
|
4103 | external = _this$props2.external,
|
4104 | innerRef = _this$props2.innerRef;
|
4105 | var modalAttributes = {
|
4106 | onClick: this.handleBackdropClick,
|
4107 | onMouseDown: this.handleBackdropMouseDown,
|
4108 | onKeyUp: this.handleEscape,
|
4109 | onKeyDown: this.handleTab,
|
4110 | style: {
|
4111 | display: 'block'
|
4112 | },
|
4113 | 'aria-labelledby': labelledBy,
|
4114 | role: role,
|
4115 | tabIndex: '-1'
|
4116 | };
|
4117 | var hasTransition = this.props.fade;
|
4118 |
|
4119 | var modalTransition = _extends({}, Fade.defaultProps, {}, this.props.modalTransition, {
|
4120 | baseClass: hasTransition ? this.props.modalTransition.baseClass : '',
|
4121 | timeout: hasTransition ? this.props.modalTransition.timeout : 0
|
4122 | });
|
4123 |
|
4124 | var backdropTransition = _extends({}, Fade.defaultProps, {}, this.props.backdropTransition, {
|
4125 | baseClass: hasTransition ? this.props.backdropTransition.baseClass : '',
|
4126 | timeout: hasTransition ? this.props.backdropTransition.timeout : 0
|
4127 | });
|
4128 |
|
4129 | var Backdrop = backdrop && (hasTransition ? React.createElement(Fade, _extends({}, backdropTransition, {
|
4130 | in: isOpen && !!backdrop,
|
4131 | cssModule: cssModule,
|
4132 | className: mapToCssModules(classNames('modal-backdrop', backdropClassName), cssModule)
|
4133 | })) : React.createElement("div", {
|
4134 | className: mapToCssModules(classNames('modal-backdrop', 'show', backdropClassName), cssModule)
|
4135 | }));
|
4136 | return React.createElement(Portal, {
|
4137 | node: this._element
|
4138 | }, React.createElement("div", {
|
4139 | className: mapToCssModules(wrapClassName)
|
4140 | }, React.createElement(Fade, _extends({}, modalAttributes, modalTransition, {
|
4141 | in: isOpen,
|
4142 | onEntered: this.onOpened,
|
4143 | onExited: this.onClosed,
|
4144 | cssModule: cssModule,
|
4145 | className: mapToCssModules(classNames('modal', modalClassName, this.state.showStaticBackdropAnimation && 'modal-static'), cssModule),
|
4146 | innerRef: innerRef
|
4147 | }), external, this.renderModalDialog()), Backdrop));
|
4148 | }
|
4149 |
|
4150 | return null;
|
4151 | };
|
4152 |
|
4153 | _proto.clearBackdropAnimationTimeout = function clearBackdropAnimationTimeout() {
|
4154 | if (this._backdropAnimationTimeout) {
|
4155 | clearTimeout(this._backdropAnimationTimeout);
|
4156 | this._backdropAnimationTimeout = undefined;
|
4157 | }
|
4158 | };
|
4159 |
|
4160 | return Modal;
|
4161 | }(React.Component);
|
4162 |
|
4163 | Modal.propTypes = propTypes$J;
|
4164 | Modal.defaultProps = defaultProps$F;
|
4165 | Modal.openCount = 0;
|
4166 |
|
4167 | var propTypes$K = {
|
4168 | tag: tagPropType,
|
4169 | wrapTag: tagPropType,
|
4170 | toggle: PropTypes.func,
|
4171 | className: PropTypes.string,
|
4172 | cssModule: PropTypes.object,
|
4173 | children: PropTypes.node,
|
4174 | closeAriaLabel: PropTypes.string,
|
4175 | charCode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
4176 | close: PropTypes.object
|
4177 | };
|
4178 | var defaultProps$G = {
|
4179 | tag: 'h5',
|
4180 | wrapTag: 'div',
|
4181 | closeAriaLabel: 'Close',
|
4182 | charCode: 215
|
4183 | };
|
4184 |
|
4185 | var ModalHeader = function ModalHeader(props) {
|
4186 | var closeButton;
|
4187 |
|
4188 | var className = props.className,
|
4189 | cssModule = props.cssModule,
|
4190 | children = props.children,
|
4191 | toggle = props.toggle,
|
4192 | Tag = props.tag,
|
4193 | WrapTag = props.wrapTag,
|
4194 | closeAriaLabel = props.closeAriaLabel,
|
4195 | charCode = props.charCode,
|
4196 | close = props.close,
|
4197 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "children", "toggle", "tag", "wrapTag", "closeAriaLabel", "charCode", "close"]);
|
4198 |
|
4199 | var classes = mapToCssModules(classNames(className, 'modal-header'), cssModule);
|
4200 |
|
4201 | if (!close && toggle) {
|
4202 | var closeIcon = typeof charCode === 'number' ? String.fromCharCode(charCode) : charCode;
|
4203 | closeButton = React.createElement("button", {
|
4204 | type: "button",
|
4205 | onClick: toggle,
|
4206 | className: mapToCssModules('close', cssModule),
|
4207 | "aria-label": closeAriaLabel
|
4208 | }, React.createElement("span", {
|
4209 | "aria-hidden": "true"
|
4210 | }, closeIcon));
|
4211 | }
|
4212 |
|
4213 | return React.createElement(WrapTag, _extends({}, attributes, {
|
4214 | className: classes
|
4215 | }), React.createElement(Tag, {
|
4216 | className: mapToCssModules('modal-title', cssModule)
|
4217 | }, children), close || closeButton);
|
4218 | };
|
4219 |
|
4220 | ModalHeader.propTypes = propTypes$K;
|
4221 | ModalHeader.defaultProps = defaultProps$G;
|
4222 |
|
4223 | var propTypes$L = {
|
4224 | tag: tagPropType,
|
4225 | className: PropTypes.string,
|
4226 | cssModule: PropTypes.object
|
4227 | };
|
4228 | var defaultProps$H = {
|
4229 | tag: 'div'
|
4230 | };
|
4231 |
|
4232 | var ModalBody = function ModalBody(props) {
|
4233 | var className = props.className,
|
4234 | cssModule = props.cssModule,
|
4235 | Tag = props.tag,
|
4236 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
4237 |
|
4238 | var classes = mapToCssModules(classNames(className, 'modal-body'), cssModule);
|
4239 | return React.createElement(Tag, _extends({}, attributes, {
|
4240 | className: classes
|
4241 | }));
|
4242 | };
|
4243 |
|
4244 | ModalBody.propTypes = propTypes$L;
|
4245 | ModalBody.defaultProps = defaultProps$H;
|
4246 |
|
4247 | var propTypes$M = {
|
4248 | tag: tagPropType,
|
4249 | className: PropTypes.string,
|
4250 | cssModule: PropTypes.object
|
4251 | };
|
4252 | var defaultProps$I = {
|
4253 | tag: 'div'
|
4254 | };
|
4255 |
|
4256 | var ModalFooter = function ModalFooter(props) {
|
4257 | var className = props.className,
|
4258 | cssModule = props.cssModule,
|
4259 | Tag = props.tag,
|
4260 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
4261 |
|
4262 | var classes = mapToCssModules(classNames(className, 'modal-footer'), cssModule);
|
4263 | return React.createElement(Tag, _extends({}, attributes, {
|
4264 | className: classes
|
4265 | }));
|
4266 | };
|
4267 |
|
4268 | ModalFooter.propTypes = propTypes$M;
|
4269 | ModalFooter.defaultProps = defaultProps$I;
|
4270 |
|
4271 | var defaultProps$J = {
|
4272 | placement: 'top',
|
4273 | autohide: true,
|
4274 | placementPrefix: 'bs-tooltip',
|
4275 | trigger: 'hover focus'
|
4276 | };
|
4277 |
|
4278 | var Tooltip = function Tooltip(props) {
|
4279 | var popperClasses = classNames('tooltip', 'show', props.popperClassName);
|
4280 | var classes = classNames('tooltip-inner', props.innerClassName);
|
4281 | return React.createElement(TooltipPopoverWrapper, _extends({}, props, {
|
4282 | popperClassName: popperClasses,
|
4283 | innerClassName: classes
|
4284 | }));
|
4285 | };
|
4286 |
|
4287 | Tooltip.propTypes = propTypes$E;
|
4288 | Tooltip.defaultProps = defaultProps$J;
|
4289 |
|
4290 | var propTypes$N = {
|
4291 | className: PropTypes.string,
|
4292 | cssModule: PropTypes.object,
|
4293 | size: PropTypes.string,
|
4294 | bordered: PropTypes.bool,
|
4295 | borderless: PropTypes.bool,
|
4296 | striped: PropTypes.bool,
|
4297 | dark: PropTypes.bool,
|
4298 | hover: PropTypes.bool,
|
4299 | responsive: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
4300 | tag: tagPropType,
|
4301 | responsiveTag: tagPropType,
|
4302 | innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.object])
|
4303 | };
|
4304 | var defaultProps$K = {
|
4305 | tag: 'table',
|
4306 | responsiveTag: 'div'
|
4307 | };
|
4308 |
|
4309 | var Table = function Table(props) {
|
4310 | var className = props.className,
|
4311 | cssModule = props.cssModule,
|
4312 | size = props.size,
|
4313 | bordered = props.bordered,
|
4314 | borderless = props.borderless,
|
4315 | striped = props.striped,
|
4316 | dark = props.dark,
|
4317 | hover = props.hover,
|
4318 | responsive = props.responsive,
|
4319 | Tag = props.tag,
|
4320 | ResponsiveTag = props.responsiveTag,
|
4321 | innerRef = props.innerRef,
|
4322 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "size", "bordered", "borderless", "striped", "dark", "hover", "responsive", "tag", "responsiveTag", "innerRef"]);
|
4323 |
|
4324 | var classes = mapToCssModules(classNames(className, 'table', size ? 'table-' + size : false, bordered ? 'table-bordered' : false, borderless ? 'table-borderless' : false, striped ? 'table-striped' : false, dark ? 'table-dark' : false, hover ? 'table-hover' : false), cssModule);
|
4325 | var table = React.createElement(Tag, _extends({}, attributes, {
|
4326 | ref: innerRef,
|
4327 | className: classes
|
4328 | }));
|
4329 |
|
4330 | if (responsive) {
|
4331 | var responsiveClassName = mapToCssModules(responsive === true ? 'table-responsive' : "table-responsive-" + responsive, cssModule);
|
4332 | return React.createElement(ResponsiveTag, {
|
4333 | className: responsiveClassName
|
4334 | }, table);
|
4335 | }
|
4336 |
|
4337 | return table;
|
4338 | };
|
4339 |
|
4340 | Table.propTypes = propTypes$N;
|
4341 | Table.defaultProps = defaultProps$K;
|
4342 |
|
4343 | var propTypes$O = {
|
4344 | tag: tagPropType,
|
4345 | flush: PropTypes.bool,
|
4346 | className: PropTypes.string,
|
4347 | cssModule: PropTypes.object,
|
4348 | horizontal: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
|
4349 | };
|
4350 | var defaultProps$L = {
|
4351 | tag: 'ul',
|
4352 | horizontal: false
|
4353 | };
|
4354 |
|
4355 | var getHorizontalClass = function getHorizontalClass(horizontal) {
|
4356 | if (horizontal === false) {
|
4357 | return false;
|
4358 | } else if (horizontal === true || horizontal === "xs") {
|
4359 | return "list-group-horizontal";
|
4360 | }
|
4361 |
|
4362 | return "list-group-horizontal-" + horizontal;
|
4363 | };
|
4364 |
|
4365 | var ListGroup = function ListGroup(props) {
|
4366 | var className = props.className,
|
4367 | cssModule = props.cssModule,
|
4368 | Tag = props.tag,
|
4369 | flush = props.flush,
|
4370 | horizontal = props.horizontal,
|
4371 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "flush", "horizontal"]);
|
4372 |
|
4373 | var classes = mapToCssModules(classNames(className, 'list-group',
|
4374 |
|
4375 | flush ? 'list-group-flush' : getHorizontalClass(horizontal)), cssModule);
|
4376 | return React.createElement(Tag, _extends({}, attributes, {
|
4377 | className: classes
|
4378 | }));
|
4379 | };
|
4380 |
|
4381 | ListGroup.propTypes = propTypes$O;
|
4382 | ListGroup.defaultProps = defaultProps$L;
|
4383 |
|
4384 | var propTypes$P = {
|
4385 | children: PropTypes.node,
|
4386 | inline: PropTypes.bool,
|
4387 | tag: tagPropType,
|
4388 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
|
4389 | className: PropTypes.string,
|
4390 | cssModule: PropTypes.object
|
4391 | };
|
4392 | var defaultProps$M = {
|
4393 | tag: 'form'
|
4394 | };
|
4395 |
|
4396 | var Form =
|
4397 |
|
4398 | function (_Component) {
|
4399 | _inheritsLoose(Form, _Component);
|
4400 |
|
4401 | function Form(props) {
|
4402 | var _this;
|
4403 |
|
4404 | _this = _Component.call(this, props) || this;
|
4405 | _this.getRef = _this.getRef.bind(_assertThisInitialized(_this));
|
4406 | _this.submit = _this.submit.bind(_assertThisInitialized(_this));
|
4407 | return _this;
|
4408 | }
|
4409 |
|
4410 | var _proto = Form.prototype;
|
4411 |
|
4412 | _proto.getRef = function getRef(ref) {
|
4413 | if (this.props.innerRef) {
|
4414 | this.props.innerRef(ref);
|
4415 | }
|
4416 |
|
4417 | this.ref = ref;
|
4418 | };
|
4419 |
|
4420 | _proto.submit = function submit() {
|
4421 | if (this.ref) {
|
4422 | this.ref.submit();
|
4423 | }
|
4424 | };
|
4425 |
|
4426 | _proto.render = function render() {
|
4427 | var _this$props = this.props,
|
4428 | className = _this$props.className,
|
4429 | cssModule = _this$props.cssModule,
|
4430 | inline = _this$props.inline,
|
4431 | Tag = _this$props.tag,
|
4432 | innerRef = _this$props.innerRef,
|
4433 | attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "cssModule", "inline", "tag", "innerRef"]);
|
4434 |
|
4435 | var classes = mapToCssModules(classNames(className, inline ? 'form-inline' : false), cssModule);
|
4436 | return React.createElement(Tag, _extends({}, attributes, {
|
4437 | ref: innerRef,
|
4438 | className: classes
|
4439 | }));
|
4440 | };
|
4441 |
|
4442 | return Form;
|
4443 | }(Component);
|
4444 |
|
4445 | Form.propTypes = propTypes$P;
|
4446 | Form.defaultProps = defaultProps$M;
|
4447 |
|
4448 | var propTypes$Q = {
|
4449 | children: PropTypes.node,
|
4450 | tag: tagPropType,
|
4451 | className: PropTypes.string,
|
4452 | cssModule: PropTypes.object,
|
4453 | valid: PropTypes.bool,
|
4454 | tooltip: PropTypes.bool
|
4455 | };
|
4456 | var defaultProps$N = {
|
4457 | tag: 'div',
|
4458 | valid: undefined
|
4459 | };
|
4460 |
|
4461 | var FormFeedback = function FormFeedback(props) {
|
4462 | var className = props.className,
|
4463 | cssModule = props.cssModule,
|
4464 | valid = props.valid,
|
4465 | tooltip = props.tooltip,
|
4466 | Tag = props.tag,
|
4467 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "valid", "tooltip", "tag"]);
|
4468 |
|
4469 | var validMode = tooltip ? 'tooltip' : 'feedback';
|
4470 | var classes = mapToCssModules(classNames(className, valid ? "valid-" + validMode : "invalid-" + validMode), cssModule);
|
4471 | return React.createElement(Tag, _extends({}, attributes, {
|
4472 | className: classes
|
4473 | }));
|
4474 | };
|
4475 |
|
4476 | FormFeedback.propTypes = propTypes$Q;
|
4477 | FormFeedback.defaultProps = defaultProps$N;
|
4478 |
|
4479 | var propTypes$R = {
|
4480 | children: PropTypes.node,
|
4481 | row: PropTypes.bool,
|
4482 | check: PropTypes.bool,
|
4483 | inline: PropTypes.bool,
|
4484 | disabled: PropTypes.bool,
|
4485 | tag: tagPropType,
|
4486 | className: PropTypes.string,
|
4487 | cssModule: PropTypes.object
|
4488 | };
|
4489 | var defaultProps$O = {
|
4490 | tag: 'div'
|
4491 | };
|
4492 |
|
4493 | var FormGroup = function FormGroup(props) {
|
4494 | var className = props.className,
|
4495 | cssModule = props.cssModule,
|
4496 | row = props.row,
|
4497 | disabled = props.disabled,
|
4498 | check = props.check,
|
4499 | inline = props.inline,
|
4500 | Tag = props.tag,
|
4501 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "row", "disabled", "check", "inline", "tag"]);
|
4502 |
|
4503 | var classes = mapToCssModules(classNames(className, row ? 'row' : false, check ? 'form-check' : 'form-group', check && inline ? 'form-check-inline' : false, check && disabled ? 'disabled' : false), cssModule);
|
4504 |
|
4505 | if (Tag === 'fieldset') {
|
4506 | attributes.disabled = disabled;
|
4507 | }
|
4508 |
|
4509 | return React.createElement(Tag, _extends({}, attributes, {
|
4510 | className: classes
|
4511 | }));
|
4512 | };
|
4513 |
|
4514 | FormGroup.propTypes = propTypes$R;
|
4515 | FormGroup.defaultProps = defaultProps$O;
|
4516 |
|
4517 | var propTypes$S = {
|
4518 | children: PropTypes.node,
|
4519 | inline: PropTypes.bool,
|
4520 | tag: tagPropType,
|
4521 | color: PropTypes.string,
|
4522 | className: PropTypes.string,
|
4523 | cssModule: PropTypes.object
|
4524 | };
|
4525 | var defaultProps$P = {
|
4526 | tag: 'small',
|
4527 | color: 'muted'
|
4528 | };
|
4529 |
|
4530 | var FormText = function FormText(props) {
|
4531 | var className = props.className,
|
4532 | cssModule = props.cssModule,
|
4533 | inline = props.inline,
|
4534 | color = props.color,
|
4535 | Tag = props.tag,
|
4536 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "inline", "color", "tag"]);
|
4537 |
|
4538 | var classes = mapToCssModules(classNames(className, !inline ? 'form-text' : false, color ? "text-" + color : false), cssModule);
|
4539 | return React.createElement(Tag, _extends({}, attributes, {
|
4540 | className: classes
|
4541 | }));
|
4542 | };
|
4543 |
|
4544 | FormText.propTypes = propTypes$S;
|
4545 | FormText.defaultProps = defaultProps$P;
|
4546 |
|
4547 | var propTypes$T = {
|
4548 | children: PropTypes.node,
|
4549 | type: PropTypes.string,
|
4550 | size: PropTypes.string,
|
4551 | bsSize: PropTypes.string,
|
4552 | valid: PropTypes.bool,
|
4553 | invalid: PropTypes.bool,
|
4554 | tag: tagPropType,
|
4555 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
|
4556 | plaintext: PropTypes.bool,
|
4557 | addon: PropTypes.bool,
|
4558 | className: PropTypes.string,
|
4559 | cssModule: PropTypes.object
|
4560 | };
|
4561 | var defaultProps$Q = {
|
4562 | type: 'text'
|
4563 | };
|
4564 |
|
4565 | var Input =
|
4566 |
|
4567 | function (_React$Component) {
|
4568 | _inheritsLoose(Input, _React$Component);
|
4569 |
|
4570 | function Input(props) {
|
4571 | var _this;
|
4572 |
|
4573 | _this = _React$Component.call(this, props) || this;
|
4574 | _this.getRef = _this.getRef.bind(_assertThisInitialized(_this));
|
4575 | _this.focus = _this.focus.bind(_assertThisInitialized(_this));
|
4576 | return _this;
|
4577 | }
|
4578 |
|
4579 | var _proto = Input.prototype;
|
4580 |
|
4581 | _proto.getRef = function getRef(ref) {
|
4582 | if (this.props.innerRef) {
|
4583 | this.props.innerRef(ref);
|
4584 | }
|
4585 |
|
4586 | this.ref = ref;
|
4587 | };
|
4588 |
|
4589 | _proto.focus = function focus() {
|
4590 | if (this.ref) {
|
4591 | this.ref.focus();
|
4592 | }
|
4593 | };
|
4594 |
|
4595 | _proto.render = function render() {
|
4596 | var _this$props = this.props,
|
4597 | className = _this$props.className,
|
4598 | cssModule = _this$props.cssModule,
|
4599 | type = _this$props.type,
|
4600 | bsSize = _this$props.bsSize,
|
4601 | valid = _this$props.valid,
|
4602 | invalid = _this$props.invalid,
|
4603 | tag = _this$props.tag,
|
4604 | addon = _this$props.addon,
|
4605 | plaintext = _this$props.plaintext,
|
4606 | innerRef = _this$props.innerRef,
|
4607 | attributes = _objectWithoutPropertiesLoose(_this$props, ["className", "cssModule", "type", "bsSize", "valid", "invalid", "tag", "addon", "plaintext", "innerRef"]);
|
4608 |
|
4609 | var checkInput = ['radio', 'checkbox'].indexOf(type) > -1;
|
4610 | var isNotaNumber = new RegExp('\\D', 'g');
|
4611 | var fileInput = type === 'file';
|
4612 | var textareaInput = type === 'textarea';
|
4613 | var selectInput = type === 'select';
|
4614 | var Tag = tag || (selectInput || textareaInput ? type : 'input');
|
4615 | var formControlClass = 'form-control';
|
4616 |
|
4617 | if (plaintext) {
|
4618 | formControlClass = formControlClass + "-plaintext";
|
4619 | Tag = tag || 'input';
|
4620 | } else if (fileInput) {
|
4621 | formControlClass = formControlClass + "-file";
|
4622 | } else if (checkInput) {
|
4623 | if (addon) {
|
4624 | formControlClass = null;
|
4625 | } else {
|
4626 | formControlClass = 'form-check-input';
|
4627 | }
|
4628 | }
|
4629 |
|
4630 | if (attributes.size && isNotaNumber.test(attributes.size)) {
|
4631 | warnOnce('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.');
|
4632 | bsSize = attributes.size;
|
4633 | delete attributes.size;
|
4634 | }
|
4635 |
|
4636 | var classes = mapToCssModules(classNames(className, invalid && 'is-invalid', valid && 'is-valid', bsSize ? "form-control-" + bsSize : false, formControlClass), cssModule);
|
4637 |
|
4638 | if (Tag === 'input' || tag && typeof tag === 'function') {
|
4639 | attributes.type = type;
|
4640 | }
|
4641 |
|
4642 | if (attributes.children && !(plaintext || type === 'select' || typeof Tag !== 'string' || Tag === 'select')) {
|
4643 | warnOnce("Input with a type of \"" + type + "\" cannot have children. Please use \"value\"/\"defaultValue\" instead.");
|
4644 | delete attributes.children;
|
4645 | }
|
4646 |
|
4647 | return React.createElement(Tag, _extends({}, attributes, {
|
4648 | ref: innerRef,
|
4649 | className: classes
|
4650 | }));
|
4651 | };
|
4652 |
|
4653 | return Input;
|
4654 | }(React.Component);
|
4655 |
|
4656 | Input.propTypes = propTypes$T;
|
4657 | Input.defaultProps = defaultProps$Q;
|
4658 |
|
4659 | var propTypes$U = {
|
4660 | tag: tagPropType,
|
4661 | size: PropTypes.string,
|
4662 | className: PropTypes.string,
|
4663 | cssModule: PropTypes.object
|
4664 | };
|
4665 | var defaultProps$R = {
|
4666 | tag: 'div'
|
4667 | };
|
4668 |
|
4669 | var InputGroup = function InputGroup(props) {
|
4670 | var className = props.className,
|
4671 | cssModule = props.cssModule,
|
4672 | Tag = props.tag,
|
4673 | size = props.size,
|
4674 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "size"]);
|
4675 |
|
4676 | var classes = mapToCssModules(classNames(className, 'input-group', size ? "input-group-" + size : null), cssModule);
|
4677 | return React.createElement(Tag, _extends({}, attributes, {
|
4678 | className: classes
|
4679 | }));
|
4680 | };
|
4681 |
|
4682 | InputGroup.propTypes = propTypes$U;
|
4683 | InputGroup.defaultProps = defaultProps$R;
|
4684 |
|
4685 | var propTypes$V = {
|
4686 | tag: tagPropType,
|
4687 | className: PropTypes.string,
|
4688 | cssModule: PropTypes.object
|
4689 | };
|
4690 | var defaultProps$S = {
|
4691 | tag: 'span'
|
4692 | };
|
4693 |
|
4694 | var InputGroupText = function InputGroupText(props) {
|
4695 | var className = props.className,
|
4696 | cssModule = props.cssModule,
|
4697 | Tag = props.tag,
|
4698 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
4699 |
|
4700 | var classes = mapToCssModules(classNames(className, 'input-group-text'), cssModule);
|
4701 | return React.createElement(Tag, _extends({}, attributes, {
|
4702 | className: classes
|
4703 | }));
|
4704 | };
|
4705 |
|
4706 | InputGroupText.propTypes = propTypes$V;
|
4707 | InputGroupText.defaultProps = defaultProps$S;
|
4708 |
|
4709 | var propTypes$W = {
|
4710 | tag: tagPropType,
|
4711 | addonType: PropTypes.oneOf(['prepend', 'append']).isRequired,
|
4712 | children: PropTypes.node,
|
4713 | className: PropTypes.string,
|
4714 | cssModule: PropTypes.object
|
4715 | };
|
4716 | var defaultProps$T = {
|
4717 | tag: 'div'
|
4718 | };
|
4719 |
|
4720 | var InputGroupAddon = function InputGroupAddon(props) {
|
4721 | var className = props.className,
|
4722 | cssModule = props.cssModule,
|
4723 | Tag = props.tag,
|
4724 | addonType = props.addonType,
|
4725 | children = props.children,
|
4726 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "addonType", "children"]);
|
4727 |
|
4728 | var classes = mapToCssModules(classNames(className, 'input-group-' + addonType), cssModule);
|
4729 |
|
4730 | if (typeof children === 'string') {
|
4731 | return React.createElement(Tag, _extends({}, attributes, {
|
4732 | className: classes
|
4733 | }), React.createElement(InputGroupText, {
|
4734 | children: children
|
4735 | }));
|
4736 | }
|
4737 |
|
4738 | return React.createElement(Tag, _extends({}, attributes, {
|
4739 | className: classes,
|
4740 | children: children
|
4741 | }));
|
4742 | };
|
4743 |
|
4744 | InputGroupAddon.propTypes = propTypes$W;
|
4745 | InputGroupAddon.defaultProps = defaultProps$T;
|
4746 |
|
4747 | var propTypes$X = {
|
4748 | addonType: PropTypes.oneOf(['prepend', 'append']).isRequired,
|
4749 | children: PropTypes.node
|
4750 | };
|
4751 |
|
4752 | var InputGroupButtonDropdown = function InputGroupButtonDropdown(props) {
|
4753 | return React.createElement(Dropdown, props);
|
4754 | };
|
4755 |
|
4756 | InputGroupButtonDropdown.propTypes = propTypes$X;
|
4757 |
|
4758 | var colWidths$1 = ['xs', 'sm', 'md', 'lg', 'xl'];
|
4759 | var stringOrNumberProp$1 = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
|
4760 | var columnProps$1 = PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.shape({
|
4761 | size: stringOrNumberProp$1,
|
4762 | order: stringOrNumberProp$1,
|
4763 | offset: stringOrNumberProp$1
|
4764 | })]);
|
4765 | var propTypes$Y = {
|
4766 | children: PropTypes.node,
|
4767 | hidden: PropTypes.bool,
|
4768 | check: PropTypes.bool,
|
4769 | size: PropTypes.string,
|
4770 | for: PropTypes.string,
|
4771 | tag: tagPropType,
|
4772 | className: PropTypes.string,
|
4773 | cssModule: PropTypes.object,
|
4774 | xs: columnProps$1,
|
4775 | sm: columnProps$1,
|
4776 | md: columnProps$1,
|
4777 | lg: columnProps$1,
|
4778 | xl: columnProps$1,
|
4779 | widths: PropTypes.array
|
4780 | };
|
4781 | var defaultProps$U = {
|
4782 | tag: 'label',
|
4783 | widths: colWidths$1
|
4784 | };
|
4785 |
|
4786 | var getColumnSizeClass$1 = function getColumnSizeClass(isXs, colWidth, colSize) {
|
4787 | if (colSize === true || colSize === '') {
|
4788 | return isXs ? 'col' : "col-" + colWidth;
|
4789 | } else if (colSize === 'auto') {
|
4790 | return isXs ? 'col-auto' : "col-" + colWidth + "-auto";
|
4791 | }
|
4792 |
|
4793 | return isXs ? "col-" + colSize : "col-" + colWidth + "-" + colSize;
|
4794 | };
|
4795 |
|
4796 | var Label = function Label(props) {
|
4797 | var className = props.className,
|
4798 | cssModule = props.cssModule,
|
4799 | hidden = props.hidden,
|
4800 | widths = props.widths,
|
4801 | Tag = props.tag,
|
4802 | check = props.check,
|
4803 | size = props.size,
|
4804 | htmlFor = props.for,
|
4805 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "hidden", "widths", "tag", "check", "size", "for"]);
|
4806 |
|
4807 | var colClasses = [];
|
4808 | widths.forEach(function (colWidth, i) {
|
4809 | var columnProp = props[colWidth];
|
4810 | delete attributes[colWidth];
|
4811 |
|
4812 | if (!columnProp && columnProp !== '') {
|
4813 | return;
|
4814 | }
|
4815 |
|
4816 | var isXs = !i;
|
4817 | var colClass;
|
4818 |
|
4819 | if (isObject(columnProp)) {
|
4820 | var _classNames;
|
4821 |
|
4822 | var colSizeInterfix = isXs ? '-' : "-" + colWidth + "-";
|
4823 | colClass = getColumnSizeClass$1(isXs, colWidth, columnProp.size);
|
4824 | 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);
|
4825 | } else {
|
4826 | colClass = getColumnSizeClass$1(isXs, colWidth, columnProp);
|
4827 | colClasses.push(colClass);
|
4828 | }
|
4829 | });
|
4830 | 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);
|
4831 | return React.createElement(Tag, _extends({
|
4832 | htmlFor: htmlFor
|
4833 | }, attributes, {
|
4834 | className: classes
|
4835 | }));
|
4836 | };
|
4837 |
|
4838 | Label.propTypes = propTypes$Y;
|
4839 | Label.defaultProps = defaultProps$U;
|
4840 |
|
4841 | var propTypes$Z = {
|
4842 | body: PropTypes.bool,
|
4843 | bottom: PropTypes.bool,
|
4844 | children: PropTypes.node,
|
4845 | className: PropTypes.string,
|
4846 | cssModule: PropTypes.object,
|
4847 | heading: PropTypes.bool,
|
4848 | left: PropTypes.bool,
|
4849 | list: PropTypes.bool,
|
4850 | middle: PropTypes.bool,
|
4851 | object: PropTypes.bool,
|
4852 | right: PropTypes.bool,
|
4853 | tag: tagPropType,
|
4854 | top: PropTypes.bool
|
4855 | };
|
4856 |
|
4857 | var Media = function Media(props) {
|
4858 | var body = props.body,
|
4859 | bottom = props.bottom,
|
4860 | className = props.className,
|
4861 | cssModule = props.cssModule,
|
4862 | heading = props.heading,
|
4863 | left = props.left,
|
4864 | list = props.list,
|
4865 | middle = props.middle,
|
4866 | object = props.object,
|
4867 | right = props.right,
|
4868 | tag = props.tag,
|
4869 | top = props.top,
|
4870 | attributes = _objectWithoutPropertiesLoose(props, ["body", "bottom", "className", "cssModule", "heading", "left", "list", "middle", "object", "right", "tag", "top"]);
|
4871 |
|
4872 | var defaultTag;
|
4873 |
|
4874 | if (heading) {
|
4875 | defaultTag = 'h4';
|
4876 | } else if (attributes.href) {
|
4877 | defaultTag = 'a';
|
4878 | } else if (attributes.src || object) {
|
4879 | defaultTag = 'img';
|
4880 | } else if (list) {
|
4881 | defaultTag = 'ul';
|
4882 | } else {
|
4883 | defaultTag = 'div';
|
4884 | }
|
4885 |
|
4886 | var Tag = tag || defaultTag;
|
4887 | var classes = mapToCssModules(classNames(className, {
|
4888 | 'media-body': body,
|
4889 | 'media-heading': heading,
|
4890 | 'media-left': left,
|
4891 | 'media-right': right,
|
4892 | 'media-top': top,
|
4893 | 'media-bottom': bottom,
|
4894 | 'media-middle': middle,
|
4895 | 'media-object': object,
|
4896 | 'media-list': list,
|
4897 | media: !body && !heading && !left && !right && !top && !bottom && !middle && !object && !list
|
4898 | }), cssModule);
|
4899 | return React.createElement(Tag, _extends({}, attributes, {
|
4900 | className: classes
|
4901 | }));
|
4902 | };
|
4903 |
|
4904 | Media.propTypes = propTypes$Z;
|
4905 |
|
4906 | var propTypes$_ = {
|
4907 | children: PropTypes.node,
|
4908 | className: PropTypes.string,
|
4909 | listClassName: PropTypes.string,
|
4910 | cssModule: PropTypes.object,
|
4911 | size: PropTypes.string,
|
4912 | tag: tagPropType,
|
4913 | listTag: tagPropType,
|
4914 | 'aria-label': PropTypes.string
|
4915 | };
|
4916 | var defaultProps$V = {
|
4917 | tag: 'nav',
|
4918 | listTag: 'ul',
|
4919 | 'aria-label': 'pagination'
|
4920 | };
|
4921 |
|
4922 | var Pagination = function Pagination(props) {
|
4923 | var _classNames;
|
4924 |
|
4925 | var className = props.className,
|
4926 | listClassName = props.listClassName,
|
4927 | cssModule = props.cssModule,
|
4928 | size = props.size,
|
4929 | Tag = props.tag,
|
4930 | ListTag = props.listTag,
|
4931 | label = props['aria-label'],
|
4932 | attributes = _objectWithoutPropertiesLoose(props, ["className", "listClassName", "cssModule", "size", "tag", "listTag", "aria-label"]);
|
4933 |
|
4934 | var classes = mapToCssModules(classNames(className), cssModule);
|
4935 | var listClasses = mapToCssModules(classNames(listClassName, 'pagination', (_classNames = {}, _classNames["pagination-" + size] = !!size, _classNames)), cssModule);
|
4936 | return React.createElement(Tag, {
|
4937 | className: classes,
|
4938 | "aria-label": label
|
4939 | }, React.createElement(ListTag, _extends({}, attributes, {
|
4940 | className: listClasses
|
4941 | })));
|
4942 | };
|
4943 |
|
4944 | Pagination.propTypes = propTypes$_;
|
4945 | Pagination.defaultProps = defaultProps$V;
|
4946 |
|
4947 | var propTypes$$ = {
|
4948 | active: PropTypes.bool,
|
4949 | children: PropTypes.node,
|
4950 | className: PropTypes.string,
|
4951 | cssModule: PropTypes.object,
|
4952 | disabled: PropTypes.bool,
|
4953 | tag: tagPropType
|
4954 | };
|
4955 | var defaultProps$W = {
|
4956 | tag: 'li'
|
4957 | };
|
4958 |
|
4959 | var PaginationItem = function PaginationItem(props) {
|
4960 | var active = props.active,
|
4961 | className = props.className,
|
4962 | cssModule = props.cssModule,
|
4963 | disabled = props.disabled,
|
4964 | Tag = props.tag,
|
4965 | attributes = _objectWithoutPropertiesLoose(props, ["active", "className", "cssModule", "disabled", "tag"]);
|
4966 |
|
4967 | var classes = mapToCssModules(classNames(className, 'page-item', {
|
4968 | active: active,
|
4969 | disabled: disabled
|
4970 | }), cssModule);
|
4971 | return React.createElement(Tag, _extends({}, attributes, {
|
4972 | className: classes
|
4973 | }));
|
4974 | };
|
4975 |
|
4976 | PaginationItem.propTypes = propTypes$$;
|
4977 | PaginationItem.defaultProps = defaultProps$W;
|
4978 |
|
4979 | var propTypes$10 = {
|
4980 | 'aria-label': PropTypes.string,
|
4981 | children: PropTypes.node,
|
4982 | className: PropTypes.string,
|
4983 | cssModule: PropTypes.object,
|
4984 | next: PropTypes.bool,
|
4985 | previous: PropTypes.bool,
|
4986 | first: PropTypes.bool,
|
4987 | last: PropTypes.bool,
|
4988 | tag: tagPropType
|
4989 | };
|
4990 | var defaultProps$X = {
|
4991 | tag: 'a'
|
4992 | };
|
4993 |
|
4994 | var PaginationLink = function PaginationLink(props) {
|
4995 | var className = props.className,
|
4996 | cssModule = props.cssModule,
|
4997 | next = props.next,
|
4998 | previous = props.previous,
|
4999 | first = props.first,
|
5000 | last = props.last,
|
5001 | Tag = props.tag,
|
5002 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "next", "previous", "first", "last", "tag"]);
|
5003 |
|
5004 | var classes = mapToCssModules(classNames(className, 'page-link'), cssModule);
|
5005 | var defaultAriaLabel;
|
5006 |
|
5007 | if (previous) {
|
5008 | defaultAriaLabel = 'Previous';
|
5009 | } else if (next) {
|
5010 | defaultAriaLabel = 'Next';
|
5011 | } else if (first) {
|
5012 | defaultAriaLabel = 'First';
|
5013 | } else if (last) {
|
5014 | defaultAriaLabel = 'Last';
|
5015 | }
|
5016 |
|
5017 | var ariaLabel = props['aria-label'] || defaultAriaLabel;
|
5018 | var defaultCaret;
|
5019 |
|
5020 | if (previous) {
|
5021 | defaultCaret = "\u2039";
|
5022 | } else if (next) {
|
5023 | defaultCaret = "\u203A";
|
5024 | } else if (first) {
|
5025 | defaultCaret = "\xAB";
|
5026 | } else if (last) {
|
5027 | defaultCaret = "\xBB";
|
5028 | }
|
5029 |
|
5030 | var children = props.children;
|
5031 |
|
5032 | if (children && Array.isArray(children) && children.length === 0) {
|
5033 | children = null;
|
5034 | }
|
5035 |
|
5036 | if (!attributes.href && Tag === 'a') {
|
5037 | Tag = 'button';
|
5038 | }
|
5039 |
|
5040 | if (previous || next || first || last) {
|
5041 | children = [React.createElement("span", {
|
5042 | "aria-hidden": "true",
|
5043 | key: "caret"
|
5044 | }, children || defaultCaret), React.createElement("span", {
|
5045 | className: "sr-only",
|
5046 | key: "sr"
|
5047 | }, ariaLabel)];
|
5048 | }
|
5049 |
|
5050 | return React.createElement(Tag, _extends({}, attributes, {
|
5051 | className: classes,
|
5052 | "aria-label": ariaLabel
|
5053 | }), children);
|
5054 | };
|
5055 |
|
5056 | PaginationLink.propTypes = propTypes$10;
|
5057 | PaginationLink.defaultProps = defaultProps$X;
|
5058 |
|
5059 |
|
5060 |
|
5061 |
|
5062 |
|
5063 |
|
5064 |
|
5065 |
|
5066 | var TabContext = React.createContext({});
|
5067 |
|
5068 | var propTypes$11 = {
|
5069 | tag: tagPropType,
|
5070 | activeTab: PropTypes.any,
|
5071 | className: PropTypes.string,
|
5072 | cssModule: PropTypes.object
|
5073 | };
|
5074 | var defaultProps$Y = {
|
5075 | tag: 'div'
|
5076 | };
|
5077 |
|
5078 | var TabContent =
|
5079 |
|
5080 | function (_Component) {
|
5081 | _inheritsLoose(TabContent, _Component);
|
5082 |
|
5083 | TabContent.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
|
5084 | if (prevState.activeTab !== nextProps.activeTab) {
|
5085 | return {
|
5086 | activeTab: nextProps.activeTab
|
5087 | };
|
5088 | }
|
5089 |
|
5090 | return null;
|
5091 | };
|
5092 |
|
5093 | function TabContent(props) {
|
5094 | var _this;
|
5095 |
|
5096 | _this = _Component.call(this, props) || this;
|
5097 | _this.state = {
|
5098 | activeTab: _this.props.activeTab
|
5099 | };
|
5100 | return _this;
|
5101 | }
|
5102 |
|
5103 | var _proto = TabContent.prototype;
|
5104 |
|
5105 | _proto.render = function render() {
|
5106 | var _this$props = this.props,
|
5107 | className = _this$props.className,
|
5108 | cssModule = _this$props.cssModule,
|
5109 | Tag = _this$props.tag;
|
5110 | var attributes = omit(this.props, Object.keys(propTypes$11));
|
5111 | var classes = mapToCssModules(classNames('tab-content', className), cssModule);
|
5112 | return React.createElement(TabContext.Provider, {
|
5113 | value: {
|
5114 | activeTabId: this.state.activeTab
|
5115 | }
|
5116 | }, React.createElement(Tag, _extends({}, attributes, {
|
5117 | className: classes
|
5118 | })));
|
5119 | };
|
5120 |
|
5121 | return TabContent;
|
5122 | }(Component);
|
5123 |
|
5124 | polyfill(TabContent);
|
5125 | TabContent.propTypes = propTypes$11;
|
5126 | TabContent.defaultProps = defaultProps$Y;
|
5127 |
|
5128 | var propTypes$12 = {
|
5129 | tag: tagPropType,
|
5130 | className: PropTypes.string,
|
5131 | cssModule: PropTypes.object,
|
5132 | tabId: PropTypes.any
|
5133 | };
|
5134 | var defaultProps$Z = {
|
5135 | tag: 'div'
|
5136 | };
|
5137 | function TabPane(props) {
|
5138 | var className = props.className,
|
5139 | cssModule = props.cssModule,
|
5140 | tabId = props.tabId,
|
5141 | Tag = props.tag,
|
5142 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tabId", "tag"]);
|
5143 |
|
5144 | var getClasses = function getClasses(activeTabId) {
|
5145 | return mapToCssModules(classNames('tab-pane', className, {
|
5146 | active: tabId === activeTabId
|
5147 | }), cssModule);
|
5148 | };
|
5149 |
|
5150 | return React.createElement(TabContext.Consumer, null, function (_ref) {
|
5151 | var activeTabId = _ref.activeTabId;
|
5152 | return React.createElement(Tag, _extends({}, attributes, {
|
5153 | className: getClasses(activeTabId)
|
5154 | }));
|
5155 | });
|
5156 | }
|
5157 | TabPane.propTypes = propTypes$12;
|
5158 | TabPane.defaultProps = defaultProps$Z;
|
5159 |
|
5160 | var propTypes$13 = {
|
5161 | tag: tagPropType,
|
5162 | fluid: PropTypes.bool,
|
5163 | className: PropTypes.string,
|
5164 | cssModule: PropTypes.object
|
5165 | };
|
5166 | var defaultProps$_ = {
|
5167 | tag: 'div'
|
5168 | };
|
5169 |
|
5170 | var Jumbotron = function Jumbotron(props) {
|
5171 | var className = props.className,
|
5172 | cssModule = props.cssModule,
|
5173 | Tag = props.tag,
|
5174 | fluid = props.fluid,
|
5175 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "fluid"]);
|
5176 |
|
5177 | var classes = mapToCssModules(classNames(className, 'jumbotron', fluid ? 'jumbotron-fluid' : false), cssModule);
|
5178 | return React.createElement(Tag, _extends({}, attributes, {
|
5179 | className: classes
|
5180 | }));
|
5181 | };
|
5182 |
|
5183 | Jumbotron.propTypes = propTypes$13;
|
5184 | Jumbotron.defaultProps = defaultProps$_;
|
5185 |
|
5186 | var propTypes$14 = {
|
5187 | children: PropTypes.node,
|
5188 | className: PropTypes.string,
|
5189 | closeClassName: PropTypes.string,
|
5190 | closeAriaLabel: PropTypes.string,
|
5191 | cssModule: PropTypes.object,
|
5192 | color: PropTypes.string,
|
5193 | fade: PropTypes.bool,
|
5194 | isOpen: PropTypes.bool,
|
5195 | toggle: PropTypes.func,
|
5196 | tag: tagPropType,
|
5197 | transition: PropTypes.shape(Fade.propTypes),
|
5198 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
|
5199 | };
|
5200 | var defaultProps$$ = {
|
5201 | color: 'success',
|
5202 | isOpen: true,
|
5203 | tag: 'div',
|
5204 | closeAriaLabel: 'Close',
|
5205 | fade: true,
|
5206 | transition: _extends({}, Fade.defaultProps, {
|
5207 | unmountOnExit: true
|
5208 | })
|
5209 | };
|
5210 |
|
5211 | function Alert(props) {
|
5212 | var className = props.className,
|
5213 | closeClassName = props.closeClassName,
|
5214 | closeAriaLabel = props.closeAriaLabel,
|
5215 | cssModule = props.cssModule,
|
5216 | Tag = props.tag,
|
5217 | color = props.color,
|
5218 | isOpen = props.isOpen,
|
5219 | toggle = props.toggle,
|
5220 | children = props.children,
|
5221 | transition = props.transition,
|
5222 | fade = props.fade,
|
5223 | innerRef = props.innerRef,
|
5224 | attributes = _objectWithoutPropertiesLoose(props, ["className", "closeClassName", "closeAriaLabel", "cssModule", "tag", "color", "isOpen", "toggle", "children", "transition", "fade", "innerRef"]);
|
5225 |
|
5226 | var classes = mapToCssModules(classNames(className, 'alert', "alert-" + color, {
|
5227 | 'alert-dismissible': toggle
|
5228 | }), cssModule);
|
5229 | var closeClasses = mapToCssModules(classNames('close', closeClassName), cssModule);
|
5230 |
|
5231 | var alertTransition = _extends({}, Fade.defaultProps, {}, transition, {
|
5232 | baseClass: fade ? transition.baseClass : '',
|
5233 | timeout: fade ? transition.timeout : 0
|
5234 | });
|
5235 |
|
5236 | return React.createElement(Fade, _extends({}, attributes, alertTransition, {
|
5237 | tag: Tag,
|
5238 | className: classes,
|
5239 | in: isOpen,
|
5240 | role: "alert",
|
5241 | innerRef: innerRef
|
5242 | }), toggle ? React.createElement("button", {
|
5243 | type: "button",
|
5244 | className: closeClasses,
|
5245 | "aria-label": closeAriaLabel,
|
5246 | onClick: toggle
|
5247 | }, React.createElement("span", {
|
5248 | "aria-hidden": "true"
|
5249 | }, "\xD7")) : null, children);
|
5250 | }
|
5251 |
|
5252 | Alert.propTypes = propTypes$14;
|
5253 | Alert.defaultProps = defaultProps$$;
|
5254 |
|
5255 | var propTypes$15 = {
|
5256 | children: PropTypes.node,
|
5257 | className: PropTypes.string,
|
5258 | cssModule: PropTypes.object,
|
5259 | fade: PropTypes.bool,
|
5260 | isOpen: PropTypes.bool,
|
5261 | tag: tagPropType,
|
5262 | transition: PropTypes.shape(Fade.propTypes),
|
5263 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
|
5264 | };
|
5265 | var defaultProps$10 = {
|
5266 | isOpen: true,
|
5267 | tag: 'div',
|
5268 | fade: true,
|
5269 | transition: _extends({}, Fade.defaultProps, {
|
5270 | unmountOnExit: true
|
5271 | })
|
5272 | };
|
5273 |
|
5274 | function Toast(props) {
|
5275 | var className = props.className,
|
5276 | cssModule = props.cssModule,
|
5277 | Tag = props.tag,
|
5278 | isOpen = props.isOpen,
|
5279 | children = props.children,
|
5280 | transition = props.transition,
|
5281 | fade = props.fade,
|
5282 | innerRef = props.innerRef,
|
5283 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "isOpen", "children", "transition", "fade", "innerRef"]);
|
5284 |
|
5285 | var classes = mapToCssModules(classNames(className, 'toast'), cssModule);
|
5286 |
|
5287 | var toastTransition = _extends({}, Fade.defaultProps, {}, transition, {
|
5288 | baseClass: fade ? transition.baseClass : '',
|
5289 | timeout: fade ? transition.timeout : 0
|
5290 | });
|
5291 |
|
5292 | return React.createElement(Fade, _extends({}, attributes, toastTransition, {
|
5293 | tag: Tag,
|
5294 | className: classes,
|
5295 | in: isOpen,
|
5296 | role: "alert",
|
5297 | innerRef: innerRef
|
5298 | }), children);
|
5299 | }
|
5300 |
|
5301 | Toast.propTypes = propTypes$15;
|
5302 | Toast.defaultProps = defaultProps$10;
|
5303 |
|
5304 | var propTypes$16 = {
|
5305 | tag: tagPropType,
|
5306 | className: PropTypes.string,
|
5307 | cssModule: PropTypes.object,
|
5308 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
|
5309 | };
|
5310 | var defaultProps$11 = {
|
5311 | tag: 'div'
|
5312 | };
|
5313 |
|
5314 | var ToastBody = function ToastBody(props) {
|
5315 | var className = props.className,
|
5316 | cssModule = props.cssModule,
|
5317 | innerRef = props.innerRef,
|
5318 | Tag = props.tag,
|
5319 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "innerRef", "tag"]);
|
5320 |
|
5321 | var classes = mapToCssModules(classNames(className, 'toast-body'), cssModule);
|
5322 | return React.createElement(Tag, _extends({}, attributes, {
|
5323 | className: classes,
|
5324 | ref: innerRef
|
5325 | }));
|
5326 | };
|
5327 |
|
5328 | ToastBody.propTypes = propTypes$16;
|
5329 | ToastBody.defaultProps = defaultProps$11;
|
5330 |
|
5331 | var propTypes$17 = {
|
5332 | tag: tagPropType,
|
5333 | icon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
5334 | wrapTag: tagPropType,
|
5335 | toggle: PropTypes.func,
|
5336 | className: PropTypes.string,
|
5337 | cssModule: PropTypes.object,
|
5338 | children: PropTypes.node,
|
5339 | closeAriaLabel: PropTypes.string,
|
5340 | charCode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
5341 | close: PropTypes.object
|
5342 | };
|
5343 | var defaultProps$12 = {
|
5344 | tag: 'strong',
|
5345 | wrapTag: 'div',
|
5346 | tagClassName: 'mr-auto',
|
5347 | closeAriaLabel: 'Close',
|
5348 | charCode: 215
|
5349 | };
|
5350 |
|
5351 | var ToastHeader = function ToastHeader(props) {
|
5352 | var closeButton;
|
5353 | var icon;
|
5354 |
|
5355 | var className = props.className,
|
5356 | cssModule = props.cssModule,
|
5357 | children = props.children,
|
5358 | toggle = props.toggle,
|
5359 | Tag = props.tag,
|
5360 | WrapTag = props.wrapTag,
|
5361 | closeAriaLabel = props.closeAriaLabel,
|
5362 | charCode = props.charCode,
|
5363 | close = props.close,
|
5364 | tagClassName = props.tagClassName,
|
5365 | iconProp = props.icon,
|
5366 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "children", "toggle", "tag", "wrapTag", "closeAriaLabel", "charCode", "close", "tagClassName", "icon"]);
|
5367 |
|
5368 | var classes = mapToCssModules(classNames(className, 'toast-header'), cssModule);
|
5369 |
|
5370 | if (!close && toggle) {
|
5371 | var closeIcon = typeof charCode === 'number' ? String.fromCharCode(charCode) : charCode;
|
5372 | closeButton = React.createElement("button", {
|
5373 | type: "button",
|
5374 | onClick: toggle,
|
5375 | className: mapToCssModules('close', cssModule),
|
5376 | "aria-label": closeAriaLabel
|
5377 | }, React.createElement("span", {
|
5378 | "aria-hidden": "true"
|
5379 | }, closeIcon));
|
5380 | }
|
5381 |
|
5382 | if (typeof iconProp === "string") {
|
5383 | icon = React.createElement("svg", {
|
5384 | className: mapToCssModules("rounded text-" + iconProp),
|
5385 | width: "20",
|
5386 | height: "20",
|
5387 | xmlns: "http://www.w3.org/2000/svg",
|
5388 | preserveAspectRatio: "xMidYMid slice",
|
5389 | focusable: "false",
|
5390 | role: "img"
|
5391 | }, React.createElement("rect", {
|
5392 | fill: "currentColor",
|
5393 | width: "100%",
|
5394 | height: "100%"
|
5395 | }));
|
5396 | } else if (iconProp) {
|
5397 | icon = iconProp;
|
5398 | }
|
5399 |
|
5400 | return React.createElement(WrapTag, _extends({}, attributes, {
|
5401 | className: classes
|
5402 | }), icon, React.createElement(Tag, {
|
5403 | className: mapToCssModules(classNames(tagClassName, {
|
5404 | "ml-2": icon != null
|
5405 | }), cssModule)
|
5406 | }, children), close || closeButton);
|
5407 | };
|
5408 |
|
5409 | ToastHeader.propTypes = propTypes$17;
|
5410 | ToastHeader.defaultProps = defaultProps$12;
|
5411 |
|
5412 | var _transitionStatusToCl;
|
5413 |
|
5414 | var propTypes$18 = _extends({}, Transition.propTypes, {
|
5415 | isOpen: PropTypes.bool,
|
5416 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
5417 | tag: tagPropType,
|
5418 | className: PropTypes.node,
|
5419 | navbar: PropTypes.bool,
|
5420 | cssModule: PropTypes.object,
|
5421 | innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.object])
|
5422 | });
|
5423 |
|
5424 | var defaultProps$13 = _extends({}, Transition.defaultProps, {
|
5425 | isOpen: false,
|
5426 | appear: false,
|
5427 | enter: true,
|
5428 | exit: true,
|
5429 | tag: 'div',
|
5430 | timeout: TransitionTimeouts.Collapse
|
5431 | });
|
5432 |
|
5433 | var transitionStatusToClassHash = (_transitionStatusToCl = {}, _transitionStatusToCl[TransitionStatuses.ENTERING] = 'collapsing', _transitionStatusToCl[TransitionStatuses.ENTERED] = 'collapse show', _transitionStatusToCl[TransitionStatuses.EXITING] = 'collapsing', _transitionStatusToCl[TransitionStatuses.EXITED] = 'collapse', _transitionStatusToCl);
|
5434 |
|
5435 | function getTransitionClass(status) {
|
5436 | return transitionStatusToClassHash[status] || 'collapse';
|
5437 | }
|
5438 |
|
5439 | function getHeight(node) {
|
5440 | return node.scrollHeight;
|
5441 | }
|
5442 |
|
5443 | var Collapse =
|
5444 |
|
5445 | function (_Component) {
|
5446 | _inheritsLoose(Collapse, _Component);
|
5447 |
|
5448 | function Collapse(props) {
|
5449 | var _this;
|
5450 |
|
5451 | _this = _Component.call(this, props) || this;
|
5452 | _this.state = {
|
5453 | height: null
|
5454 | };
|
5455 | ['onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'].forEach(function (name) {
|
5456 | _this[name] = _this[name].bind(_assertThisInitialized(_this));
|
5457 | });
|
5458 | return _this;
|
5459 | }
|
5460 |
|
5461 | var _proto = Collapse.prototype;
|
5462 |
|
5463 | _proto.onEntering = function onEntering(node, isAppearing) {
|
5464 | this.setState({
|
5465 | height: getHeight(node)
|
5466 | });
|
5467 | this.props.onEntering(node, isAppearing);
|
5468 | };
|
5469 |
|
5470 | _proto.onEntered = function onEntered(node, isAppearing) {
|
5471 | this.setState({
|
5472 | height: null
|
5473 | });
|
5474 | this.props.onEntered(node, isAppearing);
|
5475 | };
|
5476 |
|
5477 | _proto.onExit = function onExit(node) {
|
5478 | this.setState({
|
5479 | height: getHeight(node)
|
5480 | });
|
5481 | this.props.onExit(node);
|
5482 | };
|
5483 |
|
5484 | _proto.onExiting = function onExiting(node) {
|
5485 |
|
5486 | var _unused = node.offsetHeight;
|
5487 |
|
5488 | this.setState({
|
5489 | height: 0
|
5490 | });
|
5491 | this.props.onExiting(node);
|
5492 | };
|
5493 |
|
5494 | _proto.onExited = function onExited(node) {
|
5495 | this.setState({
|
5496 | height: null
|
5497 | });
|
5498 | this.props.onExited(node);
|
5499 | };
|
5500 |
|
5501 | _proto.render = function render() {
|
5502 | var _this2 = this;
|
5503 |
|
5504 | var _this$props = this.props,
|
5505 | Tag = _this$props.tag,
|
5506 | isOpen = _this$props.isOpen,
|
5507 | className = _this$props.className,
|
5508 | navbar = _this$props.navbar,
|
5509 | cssModule = _this$props.cssModule,
|
5510 | children = _this$props.children,
|
5511 | innerRef = _this$props.innerRef,
|
5512 | otherProps = _objectWithoutPropertiesLoose(_this$props, ["tag", "isOpen", "className", "navbar", "cssModule", "children", "innerRef"]);
|
5513 |
|
5514 | var height = this.state.height;
|
5515 | var transitionProps = pick(otherProps, TransitionPropTypeKeys);
|
5516 | var childProps = omit(otherProps, TransitionPropTypeKeys);
|
5517 | return React.createElement(Transition, _extends({}, transitionProps, {
|
5518 | in: isOpen,
|
5519 | onEntering: this.onEntering,
|
5520 | onEntered: this.onEntered,
|
5521 | onExit: this.onExit,
|
5522 | onExiting: this.onExiting,
|
5523 | onExited: this.onExited
|
5524 | }), function (status) {
|
5525 | var collapseClass = getTransitionClass(status);
|
5526 | var classes = mapToCssModules(classNames(className, collapseClass, navbar && 'navbar-collapse'), cssModule);
|
5527 | var style = height === null ? null : {
|
5528 | height: height
|
5529 | };
|
5530 | return React.createElement(Tag, _extends({}, childProps, {
|
5531 | style: _extends({}, childProps.style, {}, style),
|
5532 | className: classes,
|
5533 | ref: _this2.props.innerRef
|
5534 | }), children);
|
5535 | });
|
5536 | };
|
5537 |
|
5538 | return Collapse;
|
5539 | }(Component);
|
5540 |
|
5541 | Collapse.propTypes = propTypes$18;
|
5542 | Collapse.defaultProps = defaultProps$13;
|
5543 |
|
5544 | var propTypes$19 = {
|
5545 | tag: tagPropType,
|
5546 | active: PropTypes.bool,
|
5547 | disabled: PropTypes.bool,
|
5548 | color: PropTypes.string,
|
5549 | action: PropTypes.bool,
|
5550 | className: PropTypes.any,
|
5551 | cssModule: PropTypes.object
|
5552 | };
|
5553 | var defaultProps$14 = {
|
5554 | tag: 'li'
|
5555 | };
|
5556 |
|
5557 | var handleDisabledOnClick = function handleDisabledOnClick(e) {
|
5558 | e.preventDefault();
|
5559 | };
|
5560 |
|
5561 | var ListGroupItem = function ListGroupItem(props) {
|
5562 | var className = props.className,
|
5563 | cssModule = props.cssModule,
|
5564 | Tag = props.tag,
|
5565 | active = props.active,
|
5566 | disabled = props.disabled,
|
5567 | action = props.action,
|
5568 | color = props.color,
|
5569 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "active", "disabled", "action", "color"]);
|
5570 |
|
5571 | 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);
|
5572 |
|
5573 | if (disabled) {
|
5574 | attributes.onClick = handleDisabledOnClick;
|
5575 | }
|
5576 |
|
5577 | return React.createElement(Tag, _extends({}, attributes, {
|
5578 | className: classes
|
5579 | }));
|
5580 | };
|
5581 |
|
5582 | ListGroupItem.propTypes = propTypes$19;
|
5583 | ListGroupItem.defaultProps = defaultProps$14;
|
5584 |
|
5585 | var propTypes$1a = {
|
5586 | tag: tagPropType,
|
5587 | className: PropTypes.any,
|
5588 | cssModule: PropTypes.object
|
5589 | };
|
5590 | var defaultProps$15 = {
|
5591 | tag: 'h5'
|
5592 | };
|
5593 |
|
5594 | var ListGroupItemHeading = function ListGroupItemHeading(props) {
|
5595 | var className = props.className,
|
5596 | cssModule = props.cssModule,
|
5597 | Tag = props.tag,
|
5598 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
5599 |
|
5600 | var classes = mapToCssModules(classNames(className, 'list-group-item-heading'), cssModule);
|
5601 | return React.createElement(Tag, _extends({}, attributes, {
|
5602 | className: classes
|
5603 | }));
|
5604 | };
|
5605 |
|
5606 | ListGroupItemHeading.propTypes = propTypes$1a;
|
5607 | ListGroupItemHeading.defaultProps = defaultProps$15;
|
5608 |
|
5609 | var propTypes$1b = {
|
5610 | tag: tagPropType,
|
5611 | className: PropTypes.any,
|
5612 | cssModule: PropTypes.object
|
5613 | };
|
5614 | var defaultProps$16 = {
|
5615 | tag: 'p'
|
5616 | };
|
5617 |
|
5618 | var ListGroupItemText = function ListGroupItemText(props) {
|
5619 | var className = props.className,
|
5620 | cssModule = props.cssModule,
|
5621 | Tag = props.tag,
|
5622 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag"]);
|
5623 |
|
5624 | var classes = mapToCssModules(classNames(className, 'list-group-item-text'), cssModule);
|
5625 | return React.createElement(Tag, _extends({}, attributes, {
|
5626 | className: classes
|
5627 | }));
|
5628 | };
|
5629 |
|
5630 | ListGroupItemText.propTypes = propTypes$1b;
|
5631 | ListGroupItemText.defaultProps = defaultProps$16;
|
5632 |
|
5633 | var UncontrolledAlert =
|
5634 |
|
5635 | function (_Component) {
|
5636 | _inheritsLoose(UncontrolledAlert, _Component);
|
5637 |
|
5638 | function UncontrolledAlert(props) {
|
5639 | var _this;
|
5640 |
|
5641 | _this = _Component.call(this, props) || this;
|
5642 | _this.state = {
|
5643 | isOpen: true
|
5644 | };
|
5645 | _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
|
5646 | return _this;
|
5647 | }
|
5648 |
|
5649 | var _proto = UncontrolledAlert.prototype;
|
5650 |
|
5651 | _proto.toggle = function toggle() {
|
5652 | this.setState({
|
5653 | isOpen: !this.state.isOpen
|
5654 | });
|
5655 | };
|
5656 |
|
5657 | _proto.render = function render() {
|
5658 | return React.createElement(Alert, _extends({
|
5659 | isOpen: this.state.isOpen,
|
5660 | toggle: this.toggle
|
5661 | }, this.props));
|
5662 | };
|
5663 |
|
5664 | return UncontrolledAlert;
|
5665 | }(Component);
|
5666 |
|
5667 | var omitKeys$1 = ['defaultOpen'];
|
5668 |
|
5669 | var UncontrolledButtonDropdown =
|
5670 |
|
5671 | function (_Component) {
|
5672 | _inheritsLoose(UncontrolledButtonDropdown, _Component);
|
5673 |
|
5674 | function UncontrolledButtonDropdown(props) {
|
5675 | var _this;
|
5676 |
|
5677 | _this = _Component.call(this, props) || this;
|
5678 | _this.state = {
|
5679 | isOpen: props.defaultOpen || false
|
5680 | };
|
5681 | _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
|
5682 | return _this;
|
5683 | }
|
5684 |
|
5685 | var _proto = UncontrolledButtonDropdown.prototype;
|
5686 |
|
5687 | _proto.toggle = function toggle() {
|
5688 | this.setState({
|
5689 | isOpen: !this.state.isOpen
|
5690 | });
|
5691 | };
|
5692 |
|
5693 | _proto.render = function render() {
|
5694 | return React.createElement(ButtonDropdown, _extends({
|
5695 | isOpen: this.state.isOpen,
|
5696 | toggle: this.toggle
|
5697 | }, omit(this.props, omitKeys$1)));
|
5698 | };
|
5699 |
|
5700 | return UncontrolledButtonDropdown;
|
5701 | }(Component);
|
5702 | UncontrolledButtonDropdown.propTypes = _extends({
|
5703 | defaultOpen: PropTypes.bool
|
5704 | }, ButtonDropdown.propTypes);
|
5705 |
|
5706 | var omitKeys$2 = ['toggleEvents', 'defaultOpen'];
|
5707 | var propTypes$1c = {
|
5708 | defaultOpen: PropTypes.bool,
|
5709 | toggler: PropTypes.string.isRequired,
|
5710 | toggleEvents: PropTypes.arrayOf(PropTypes.string)
|
5711 | };
|
5712 | var defaultProps$17 = {
|
5713 | toggleEvents: defaultToggleEvents
|
5714 | };
|
5715 |
|
5716 | var UncontrolledCollapse =
|
5717 |
|
5718 | function (_Component) {
|
5719 | _inheritsLoose(UncontrolledCollapse, _Component);
|
5720 |
|
5721 | function UncontrolledCollapse(props) {
|
5722 | var _this;
|
5723 |
|
5724 | _this = _Component.call(this, props) || this;
|
5725 | _this.togglers = null;
|
5726 | _this.removeEventListeners = null;
|
5727 | _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
|
5728 | _this.state = {
|
5729 | isOpen: props.defaultOpen || false
|
5730 | };
|
5731 | return _this;
|
5732 | }
|
5733 |
|
5734 | var _proto = UncontrolledCollapse.prototype;
|
5735 |
|
5736 | _proto.componentDidMount = function componentDidMount() {
|
5737 | this.togglers = findDOMElements(this.props.toggler);
|
5738 |
|
5739 | if (this.togglers.length) {
|
5740 | this.removeEventListeners = addMultipleEventListeners(this.togglers, this.toggle, this.props.toggleEvents);
|
5741 | }
|
5742 | };
|
5743 |
|
5744 | _proto.componentWillUnmount = function componentWillUnmount() {
|
5745 | if (this.togglers.length && this.removeEventListeners) {
|
5746 | this.removeEventListeners();
|
5747 | }
|
5748 | };
|
5749 |
|
5750 | _proto.toggle = function toggle(e) {
|
5751 | this.setState(function (_ref) {
|
5752 | var isOpen = _ref.isOpen;
|
5753 | return {
|
5754 | isOpen: !isOpen
|
5755 | };
|
5756 | });
|
5757 | e.preventDefault();
|
5758 | };
|
5759 |
|
5760 | _proto.render = function render() {
|
5761 | return React.createElement(Collapse, _extends({
|
5762 | isOpen: this.state.isOpen
|
5763 | }, omit(this.props, omitKeys$2)));
|
5764 | };
|
5765 |
|
5766 | return UncontrolledCollapse;
|
5767 | }(Component);
|
5768 |
|
5769 | UncontrolledCollapse.propTypes = propTypes$1c;
|
5770 | UncontrolledCollapse.defaultProps = defaultProps$17;
|
5771 |
|
5772 | var omitKeys$3 = ['defaultOpen'];
|
5773 |
|
5774 | var UncontrolledDropdown =
|
5775 |
|
5776 | function (_Component) {
|
5777 | _inheritsLoose(UncontrolledDropdown, _Component);
|
5778 |
|
5779 | function UncontrolledDropdown(props) {
|
5780 | var _this;
|
5781 |
|
5782 | _this = _Component.call(this, props) || this;
|
5783 | _this.state = {
|
5784 | isOpen: props.defaultOpen || false
|
5785 | };
|
5786 | _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
|
5787 | return _this;
|
5788 | }
|
5789 |
|
5790 | var _proto = UncontrolledDropdown.prototype;
|
5791 |
|
5792 | _proto.toggle = function toggle(e) {
|
5793 | this.setState({
|
5794 | isOpen: !this.state.isOpen
|
5795 | });
|
5796 |
|
5797 | if (this.props.onToggle) {
|
5798 | this.props.onToggle(e, !this.state.isOpen);
|
5799 | }
|
5800 | };
|
5801 |
|
5802 | _proto.render = function render() {
|
5803 | return React.createElement(Dropdown, _extends({
|
5804 | isOpen: this.state.isOpen,
|
5805 | toggle: this.toggle
|
5806 | }, omit(this.props, omitKeys$3)));
|
5807 | };
|
5808 |
|
5809 | return UncontrolledDropdown;
|
5810 | }(Component);
|
5811 | UncontrolledDropdown.propTypes = _extends({
|
5812 | defaultOpen: PropTypes.bool,
|
5813 | onToggle: PropTypes.func
|
5814 | }, Dropdown.propTypes);
|
5815 |
|
5816 | var omitKeys$4 = ['defaultOpen'];
|
5817 |
|
5818 | var UncontrolledTooltip =
|
5819 |
|
5820 | function (_Component) {
|
5821 | _inheritsLoose(UncontrolledTooltip, _Component);
|
5822 |
|
5823 | function UncontrolledTooltip(props) {
|
5824 | var _this;
|
5825 |
|
5826 | _this = _Component.call(this, props) || this;
|
5827 | _this.state = {
|
5828 | isOpen: props.defaultOpen || false
|
5829 | };
|
5830 | _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
|
5831 | return _this;
|
5832 | }
|
5833 |
|
5834 | var _proto = UncontrolledTooltip.prototype;
|
5835 |
|
5836 | _proto.toggle = function toggle() {
|
5837 | this.setState({
|
5838 | isOpen: !this.state.isOpen
|
5839 | });
|
5840 | };
|
5841 |
|
5842 | _proto.render = function render() {
|
5843 | return React.createElement(Tooltip, _extends({
|
5844 | isOpen: this.state.isOpen,
|
5845 | toggle: this.toggle
|
5846 | }, omit(this.props, omitKeys$4)));
|
5847 | };
|
5848 |
|
5849 | return UncontrolledTooltip;
|
5850 | }(Component);
|
5851 | UncontrolledTooltip.propTypes = _extends({
|
5852 | defaultOpen: PropTypes.bool
|
5853 | }, Tooltip.propTypes);
|
5854 |
|
5855 | var propTypes$1d = {
|
5856 | tag: tagPropType,
|
5857 | type: PropTypes.string,
|
5858 | size: PropTypes.string,
|
5859 | color: PropTypes.string,
|
5860 | className: PropTypes.string,
|
5861 | cssModule: PropTypes.object,
|
5862 | children: PropTypes.string
|
5863 | };
|
5864 | var defaultProps$18 = {
|
5865 | tag: 'div',
|
5866 | type: 'border',
|
5867 | children: 'Loading...'
|
5868 | };
|
5869 |
|
5870 | var Spinner = function Spinner(props) {
|
5871 | var className = props.className,
|
5872 | cssModule = props.cssModule,
|
5873 | type = props.type,
|
5874 | size = props.size,
|
5875 | color = props.color,
|
5876 | children = props.children,
|
5877 | Tag = props.tag,
|
5878 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "type", "size", "color", "children", "tag"]);
|
5879 |
|
5880 | var classes = mapToCssModules(classNames(className, size ? "spinner-" + type + "-" + size : false, "spinner-" + type, color ? "text-" + color : false), cssModule);
|
5881 | return React.createElement(Tag, _extends({
|
5882 | role: "status"
|
5883 | }, attributes, {
|
5884 | className: classes
|
5885 | }), children && React.createElement("span", {
|
5886 | className: mapToCssModules('sr-only', cssModule)
|
5887 | }, children));
|
5888 | };
|
5889 |
|
5890 | Spinner.propTypes = propTypes$1d;
|
5891 | Spinner.defaultProps = defaultProps$18;
|
5892 |
|
5893 | export { Alert, Badge, Breadcrumb, BreadcrumbItem, Button, ButtonDropdown, ButtonGroup, ButtonToggle, ButtonToolbar, Card, CardBody, CardColumns, CardDeck, CardFooter, CardGroup, CardHeader, CardImg, CardImgOverlay, CardLink, CardSubtitle, CardText, CardTitle, Carousel, CarouselCaption, CarouselControl, CarouselIndicators, CarouselItem, Col, Collapse, Container, CustomFileInput, CustomInput, Dropdown, DropdownContext, DropdownItem, DropdownMenu, DropdownToggle, Fade, Form, FormFeedback, FormGroup, FormText, Input, InputGroup, InputGroupAddon, InputGroupButtonDropdown, InputGroupText, Jumbotron, Label, ListGroup, ListGroupItem, ListGroupItemHeading, ListGroupItemText, Media, Modal, ModalBody, ModalFooter, ModalHeader, Nav, NavItem, NavLink, Navbar, NavbarBrand, NavbarText, NavbarToggler, Pagination, PaginationItem, PaginationLink, Popover, PopoverBody, PopoverHeader, PopperContent, PopperTargetHelper, Progress, Row, Spinner, TabContent, TabPane, Table, Toast, ToastBody, ToastHeader, Tooltip, UncontrolledAlert, UncontrolledButtonDropdown, UncontrolledCarousel, UncontrolledCollapse, UncontrolledDropdown, UncontrolledPopover, UncontrolledTooltip, utils as Util };
|
5894 |
|