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