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