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