taro-react-uilib 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/index.esm.js +2599 -41
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.js +2604 -39
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.js +2606 -42
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/styles/components/alert.scss +4 -0
  8. package/dist/styles/components/bankicon.scss +4 -0
  9. package/dist/styles/components/button.scss +4 -6
  10. package/dist/styles/components/captcha.scss +2 -3
  11. package/dist/styles/components/confirm.scss +11 -0
  12. package/dist/styles/components/dialogcomponent.scss +191 -0
  13. package/dist/styles/components/dialogref.scss +214 -0
  14. package/dist/styles/components/{formInput.scss → forminput.scss} +8 -8
  15. package/dist/styles/components/index.scss +13 -4
  16. package/dist/styles/components/key.scss +27 -0
  17. package/dist/styles/components/loading.scss +1 -4
  18. package/dist/styles/components/mask.scss +2 -2
  19. package/dist/styles/components/numberkeyboard.scss +72 -0
  20. package/dist/styles/components/page.scss +17 -1
  21. package/dist/styles/components/passwordinput.scss +42 -0
  22. package/dist/styles/components/progress.scss +30 -0
  23. package/dist/styles/components/toast.scss +83 -0
  24. package/dist/styles/themes/base.scss +1 -1
  25. package/dist/styles/themes/default.scss +6 -0
  26. package/dist/styles/themes/variable.scss +25 -0
  27. package/lib/components/BankIcon/index.js +7 -7
  28. package/lib/components/BankIcon/index.js.map +1 -1
  29. package/lib/components/Button/index.js +22 -22
  30. package/lib/components/Button/index.js.map +1 -1
  31. package/lib/components/Dialog/Alert/index.js +16 -15
  32. package/lib/components/Dialog/Alert/index.js.map +1 -1
  33. package/lib/components/Dialog/Confirm/index.js +43 -0
  34. package/lib/components/Dialog/Confirm/index.js.map +1 -0
  35. package/lib/components/Dialog/{Dialog → DialogComponent}/index.js +10 -10
  36. package/lib/components/Dialog/DialogComponent/index.js.map +1 -0
  37. package/lib/components/Dialog/index.js +3 -1
  38. package/lib/components/Dialog/index.js.map +1 -1
  39. package/lib/components/DialogRef/index.js +55 -0
  40. package/lib/components/DialogRef/index.js.map +1 -0
  41. package/lib/components/FormInput/index.js +16 -16
  42. package/lib/components/FormInput/index.js.map +1 -1
  43. package/lib/components/Image/index.js +12 -6
  44. package/lib/components/Image/index.js.map +1 -1
  45. package/lib/components/NumberKeyboard/Key/index.js +9 -0
  46. package/lib/components/NumberKeyboard/Key/index.js.map +1 -0
  47. package/lib/components/NumberKeyboard/index.js +56 -0
  48. package/lib/components/NumberKeyboard/index.js.map +1 -0
  49. package/lib/components/PasswordInput/index.js +24 -0
  50. package/lib/components/PasswordInput/index.js.map +1 -0
  51. package/lib/components/Progress/index.js +20 -0
  52. package/lib/components/Progress/index.js.map +1 -0
  53. package/lib/components/Toast/Toast.js +37 -0
  54. package/lib/components/Toast/Toast.js.map +1 -0
  55. package/lib/components/Toast/index.js +48 -0
  56. package/lib/components/Toast/index.js.map +1 -0
  57. package/lib/index.js +15 -9
  58. package/lib/index.js.map +1 -1
  59. package/package.json +3 -2
  60. package/types/components/BankIcon/index.d.ts +5 -5
  61. package/types/components/Button/index.d.ts +17 -17
  62. package/types/components/Dialog/Alert/index.d.ts +18 -2
  63. package/types/components/Dialog/Confirm/index.d.ts +37 -0
  64. package/types/components/Dialog/DialogComponent/index.d.ts +19 -0
  65. package/types/components/Dialog/index.d.ts +3 -1
  66. package/types/components/DialogRef/index.d.ts +30 -0
  67. package/types/components/NumberKeyboard/Key/index.d.ts +8 -0
  68. package/types/components/NumberKeyboard/index.d.ts +23 -0
  69. package/types/components/PasswordInput/index.d.ts +11 -0
  70. package/types/components/Progress/index.d.ts +12 -0
  71. package/types/components/Toast/Toast.d.ts +20 -0
  72. package/types/components/Toast/index.d.ts +5 -0
  73. package/types/index.d.ts +15 -9
  74. package/dist/styles/components/backIcon.scss +0 -10
  75. package/dist/styles/components/images/loading.png +0 -0
  76. package/lib/components/Dialog/Dialog/index.js.map +0 -1
package/dist/index.esm.js CHANGED
@@ -1,6 +1,7 @@
1
- import React, { useState, useEffect, useMemo, forwardRef, useRef, useImperativeHandle } from 'react';
2
- import { getEnv, getImageInfo } from '@tarojs/taro';
1
+ import React, { useState, useEffect, useMemo, forwardRef, useRef, useImperativeHandle, createRef } from 'react';
3
2
  import { Button, View, Image, Text, Input } from '@tarojs/components';
3
+ import { getEnv, getImageInfo, pxTransform, showModal, showToast } from '@tarojs/taro';
4
+ import ReactDOM from 'react-dom';
4
5
 
5
6
  function createCommonjsModule(fn, basedir, module) {
6
7
  return module = {
@@ -97,6 +98,56 @@ var __assign = function() {
97
98
  return __assign.apply(this, arguments);
98
99
  };
99
100
 
101
+ function __rest(s, e) {
102
+ var t = {};
103
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
104
+ t[p] = s[p];
105
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
106
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
107
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
108
+ t[p[i]] = s[p[i]];
109
+ }
110
+ return t;
111
+ }
112
+
113
+ function __awaiter(thisArg, _arguments, P, generator) {
114
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
115
+ return new (P || (P = Promise))(function (resolve, reject) {
116
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
117
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
118
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
119
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
120
+ });
121
+ }
122
+
123
+ function __generator(thisArg, body) {
124
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
125
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
126
+ function verb(n) { return function (v) { return step([n, v]); }; }
127
+ function step(op) {
128
+ if (f) throw new TypeError("Generator is already executing.");
129
+ while (_) try {
130
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
131
+ if (y = 0, t) op = [op[0] & 2, t.value];
132
+ switch (op[0]) {
133
+ case 0: case 1: t = op; break;
134
+ case 4: _.label++; return { value: op[1], done: false };
135
+ case 5: _.label++; y = op[1]; op = [0]; continue;
136
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
137
+ default:
138
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
139
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
140
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
141
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
142
+ if (t[2]) _.ops.pop();
143
+ _.trys.pop(); continue;
144
+ }
145
+ op = body.call(thisArg, _);
146
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
147
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
148
+ }
149
+ }
150
+
100
151
  function __read(o, n) {
101
152
  var m = typeof Symbol === "function" && o[Symbol.iterator];
102
153
  if (!m) return o;
@@ -123,28 +174,28 @@ var useTaroEnv = function () {
123
174
  };
124
175
 
125
176
  var XhButton = function (props) {
126
- var _a = props.disabled, disabled = _a === void 0 ? false : _a, _b = props.type, type = _b === void 0 ? 'default' : _b, _c = props.size, size = _c === void 0 ? 'normal' : _c, _d = props.shape, shape = _d === void 0 ? 'round' : _d, children = props.children, className = props.className, htmlType = props.htmlType, formType = props.formType, text = props.text, openType = props.openType, lang = props.lang, sessionFrom = props.sessionFrom, sendMessageTitle = props.sendMessageTitle, sendMessagePath = props.sendMessagePath, sendMessageImg = props.sendMessageImg, showMessageCard = props.showMessageCard, appParameter = props.appParameter, onGetUserInfo = props.onGetUserInfo, onGetPhoneNumber = props.onGetPhoneNumber, onOpenSetting = props.onOpenSetting, onError = props.onError, onContact = props.onContact, onClick = props.onClick;
177
+ var _a = props.disabled, disabled = _a === void 0 ? false : _a, _b = props.type, type = _b === void 0 ? "default" : _b, _c = props.size, size = _c === void 0 ? "normal" : _c, _d = props.shape, shape = _d === void 0 ? "round" : _d, children = props.children, className = props.className, htmlType = props.htmlType, formType = props.formType, text = props.text, openType = props.openType, lang = props.lang, sessionFrom = props.sessionFrom, sendMessageTitle = props.sendMessageTitle, sendMessagePath = props.sendMessagePath, sendMessageImg = props.sendMessageImg, showMessageCard = props.showMessageCard, appParameter = props.appParameter, onGetUserInfo = props.onGetUserInfo, onGetPhoneNumber = props.onGetPhoneNumber, onOpenSetting = props.onOpenSetting, onError = props.onError, onContact = props.onContact, onClick = props.onClick;
127
178
  var state = useTaroEnv();
128
- var classObj = classnames('xh-button', {
129
- 'xh-button-default': type === 'default',
130
- 'xh-button-primary': type === 'primary',
131
- 'xh-button-secondary': type === 'secondary',
132
- 'xh-button-warn': type === 'warn',
133
- 'xh-button-square': shape === 'square',
134
- 'xh-button-round': shape === 'round',
135
- 'xh-button-normal': size === 'normal',
136
- 'xh-button-small': size === 'mini',
137
- 'xh-button-full': size === 'full',
138
- 'xh-button-disabled': disabled,
139
- 'xh-button-webutton': state === 'WEAPP'
179
+ var classObj = classnames("xh-button", {
180
+ "xh-button-default": type === "default",
181
+ "xh-button-primary": type === "primary",
182
+ "xh-button-secondary": type === "secondary",
183
+ "xh-button-warn": type === "warn",
184
+ "xh-button-square": shape === "square",
185
+ "xh-button-round": shape === "round",
186
+ "xh-button-normal": size === "normal",
187
+ "xh-button-small": size === "mini",
188
+ "xh-button-full": size === "full",
189
+ "xh-button-disabled": disabled,
190
+ "xh-button-webutton": state === "WEAPP",
140
191
  }, className);
141
192
  var handleClick = function (e) {
142
- state === 'WEB' && e.nativeEvent.stopImmediatePropagation();
193
+ state === "WEB" && e.nativeEvent.stopImmediatePropagation();
143
194
  e.preventDefault();
144
195
  onClick && onClick(e);
145
196
  };
146
197
  var weButton = (React.createElement(Button, { className: classObj, formType: formType, openType: openType, lang: lang, type: type, sessionFrom: sessionFrom, sendMessageTitle: sendMessageTitle, sendMessagePath: sendMessagePath, sendMessageImg: sendMessageImg, showMessageCard: showMessageCard, appParameter: appParameter, onGetUserInfo: onGetUserInfo, onGetPhoneNumber: onGetPhoneNumber, onOpenSetting: onOpenSetting, onError: onError, onContact: onContact, onClick: onClick, disabled: disabled }, children));
147
- if (state === 'WEAPP') {
198
+ if (state === "WEAPP") {
148
199
  return weButton;
149
200
  }
150
201
  return (
@@ -185,10 +236,9 @@ var Page = function (props) {
185
236
  var XHImage = function (props) {
186
237
  var _a = props.width, width = _a === void 0 ? "" : _a, _b = props.height, height = _b === void 0 ? "" : _b, src = props.src, className = props.className;
187
238
  var _c = __read(useState({}), 2), defaultSize = _c[0], setDefaultSize = _c[1];
188
- // const style = { width: `${width}px`, height: `${height}px` }
189
239
  var state = useTaroEnv();
190
240
  useEffect(function () {
191
- if (state !== "WEB" && !className) {
241
+ if (process.env.TARO_ENV !== "h5" && !className) {
192
242
  getImageInfo({
193
243
  src: src,
194
244
  success: function (res) {
@@ -201,10 +251,15 @@ var XHImage = function (props) {
201
251
  }
202
252
  }, [state]);
203
253
  var size = useMemo(function () {
204
- if (width || height) {
205
- return { width: width, height: height };
254
+ var computedSize = defaultSize || {};
255
+ if (width) {
256
+ computedSize.width = "".concat(pxTransform(width));
257
+ }
258
+ if (height) {
259
+ computedSize.height = "".concat(pxTransform(height));
206
260
  }
207
- return defaultSize;
261
+ console.log("size");
262
+ return computedSize;
208
263
  }, [width, height, defaultSize]);
209
264
  return state !== "WEB" ? (React.createElement(Image, { src: src, style: size, className: className })) : (React.createElement("img", { src: src, alt: "", style: size, className: className }));
210
265
  };
@@ -259,8 +314,8 @@ var bankImage = {
259
314
 
260
315
  var XHBankIcon = function (props) {
261
316
  var code = props.code, className = props.className, size = props.size;
262
- var cls = classnames('xh-bank-icon', "item-".concat(size), className);
263
- return (React.createElement(XHImage, { src: bankImage[code], className: cls }));
317
+ var cls = classnames("xh-bank-icon", className);
318
+ return (React.createElement(XHImage, { src: bankImage[code], width: size, height: size, className: cls }));
264
319
  };
265
320
 
266
321
  var CountdownButton = forwardRef(function (props, fromRef) {
@@ -388,31 +443,31 @@ var FormInput = React.forwardRef(function (props, formRef) {
388
443
  },
389
444
  }); });
390
445
  if (taroEnv !== "WEB") {
391
- return (React.createElement(View, { className: "form-input" },
392
- React.createElement(View, { className: "form-input-left" },
393
- label && (React.createElement(View, { className: "form-input-left-label" },
446
+ return (React.createElement(View, { className: "xh-form-input" },
447
+ React.createElement(View, { className: "xh-form-input-left" },
448
+ label && (React.createElement(View, { className: "xh-form-input-left-label" },
394
449
  label,
395
- React.createElement(View, { className: "form-input-left-label-icon" }, LeftIcon))),
450
+ React.createElement(View, { className: "xh-form-input-left-label-icon" }, LeftIcon))),
396
451
  labelHtml && (React.createElement("label", { dangerouslySetInnerHTML: { __html: labelHtml }, className: "label" })),
397
452
  React.createElement(View, null, LeftComponent)),
398
- React.createElement(View, { className: "form-input-center" }, readonly ? (React.createElement(Text, { className: classnames("form-input-readonly", {
399
- "form-input-placeholder": !value,
400
- }) }, value || placeholder)) : (React.createElement(Input, { ref: inputRef, className: "form-input-center-native", maxlength: maxlength, name: name, placeholder: placeholder, type: type, value: value, onBlur: handleBlur, onInput: handleChange, password: password }))),
401
- React.createElement(View, { className: "form-input-right" },
453
+ React.createElement(View, { className: "xh-form-input-center" }, readonly ? (React.createElement(Text, { className: classnames("xh-form-input-readonly", {
454
+ "xh-form-input-placeholder": !value,
455
+ }) }, value || placeholder)) : (React.createElement(Input, { ref: inputRef, className: "xh-form-input-center-native", maxlength: maxlength, name: name, placeholder: placeholder, type: type, value: value, onBlur: handleBlur, onInput: handleChange, password: password }))),
456
+ React.createElement(View, { className: "xh-form-input-right" },
402
457
  RightComponent,
403
458
  withArrow && React.createElement(View, { className: "arrow" }))));
404
459
  }
405
- return (React.createElement("div", { className: "form-input" },
406
- React.createElement("div", { className: "form-input-left" },
407
- label && (React.createElement("label", { className: "form-input-left-label" },
460
+ return (React.createElement("div", { className: "xh-form-input" },
461
+ React.createElement("div", { className: "xh-form-input-left" },
462
+ label && (React.createElement("label", { className: "xh-form-input-left-label" },
408
463
  label,
409
- React.createElement(View, { className: "form-input-left-label-icon" }, LeftIcon))),
464
+ React.createElement(View, { className: "xh-form-input-left-label-icon" }, LeftIcon))),
410
465
  labelHtml && (React.createElement("label", { dangerouslySetInnerHTML: { __html: labelHtml }, className: "label" })),
411
466
  React.createElement("div", null, LeftComponent)),
412
- React.createElement("div", { className: "form-input-center" }, readonly ? (React.createElement("p", { className: classnames("form-input-readonly", {
413
- "form-input-placeholder": !value,
414
- }) }, value || placeholder)) : (React.createElement("input", { ref: inputRef, className: "form-input-center-native", maxLength: maxlength, name: name, pattern: pattern, placeholder: placeholder, type: type, value: value, onBlur: handleBlur, onInput: handleChange }))),
415
- React.createElement("div", { className: "form-input-right" },
467
+ React.createElement("div", { className: "xh-form-input-center" }, readonly ? (React.createElement("p", { className: classnames("xh-form-input-readonly", {
468
+ "xh-form-input-placeholder": !value,
469
+ }) }, value || placeholder)) : (React.createElement("input", { ref: inputRef, className: "xh-form-input-center-native", maxLength: maxlength, name: name, pattern: pattern, placeholder: placeholder, type: type, value: value, onBlur: handleBlur, onInput: handleChange }))),
470
+ React.createElement("div", { className: "xh-form-input-right" },
416
471
  RightComponent,
417
472
  withArrow && React.createElement("i", { className: "arrow" }))));
418
473
  });
@@ -433,5 +488,2508 @@ var XHList = function (props) {
433
488
  React.createElement(View, { className: "xh-list-extra-icon" }, extraIcon ? extraIcon : (arrow && React.createElement(View, { className: "arrow" }))))));
434
489
  };
435
490
 
436
- export { XHBankIcon, XhButton as XHButton, CountdownButton as XHCaptcha, FormInput as XHFormInput, XHImage, XHList, Loading as XHLoading, Mask as XHMask, Page as XHPage };
491
+ function _extends() {
492
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
493
+ for (var i = 1; i < arguments.length; i++) {
494
+ var source = arguments[i];
495
+
496
+ for (var key in source) {
497
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
498
+ target[key] = source[key];
499
+ }
500
+ }
501
+ }
502
+
503
+ return target;
504
+ };
505
+ return _extends.apply(this, arguments);
506
+ }
507
+
508
+ function _objectWithoutPropertiesLoose(source, excluded) {
509
+ if (source == null) return {};
510
+ var target = {};
511
+ var sourceKeys = Object.keys(source);
512
+ var key, i;
513
+
514
+ for (i = 0; i < sourceKeys.length; i++) {
515
+ key = sourceKeys[i];
516
+ if (excluded.indexOf(key) >= 0) continue;
517
+ target[key] = source[key];
518
+ }
519
+
520
+ return target;
521
+ }
522
+
523
+ function _setPrototypeOf(o, p) {
524
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
525
+ o.__proto__ = p;
526
+ return o;
527
+ };
528
+ return _setPrototypeOf(o, p);
529
+ }
530
+
531
+ function _inheritsLoose(subClass, superClass) {
532
+ subClass.prototype = Object.create(superClass.prototype);
533
+ subClass.prototype.constructor = subClass;
534
+ _setPrototypeOf(subClass, superClass);
535
+ }
536
+
537
+ /** @license React v16.13.1
538
+ * react-is.production.min.js
539
+ *
540
+ * Copyright (c) Facebook, Inc. and its affiliates.
541
+ *
542
+ * This source code is licensed under the MIT license found in the
543
+ * LICENSE file in the root directory of this source tree.
544
+ */
545
+ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
546
+ Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
547
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element$1=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
548
+ var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
549
+ var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
550
+ var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
551
+
552
+ var reactIs_production_min = {
553
+ AsyncMode: AsyncMode,
554
+ ConcurrentMode: ConcurrentMode,
555
+ ContextConsumer: ContextConsumer,
556
+ ContextProvider: ContextProvider,
557
+ Element: Element$1,
558
+ ForwardRef: ForwardRef,
559
+ Fragment: Fragment,
560
+ Lazy: Lazy,
561
+ Memo: Memo,
562
+ Portal: Portal,
563
+ Profiler: Profiler,
564
+ StrictMode: StrictMode,
565
+ Suspense: Suspense,
566
+ isAsyncMode: isAsyncMode,
567
+ isConcurrentMode: isConcurrentMode,
568
+ isContextConsumer: isContextConsumer,
569
+ isContextProvider: isContextProvider,
570
+ isElement: isElement,
571
+ isForwardRef: isForwardRef,
572
+ isFragment: isFragment,
573
+ isLazy: isLazy,
574
+ isMemo: isMemo,
575
+ isPortal: isPortal,
576
+ isProfiler: isProfiler,
577
+ isStrictMode: isStrictMode,
578
+ isSuspense: isSuspense,
579
+ isValidElementType: isValidElementType,
580
+ typeOf: typeOf
581
+ };
582
+
583
+ var reactIs_development = createCommonjsModule(function (module, exports) {
584
+
585
+
586
+
587
+ if (process.env.NODE_ENV !== "production") {
588
+ (function() {
589
+
590
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
591
+ // nor polyfill, then a plain number is used for performance.
592
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
593
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
594
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
595
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
596
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
597
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
598
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
599
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
600
+ // (unstable) APIs that have been removed. Can we remove the symbols?
601
+
602
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
603
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
604
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
605
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
606
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
607
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
608
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
609
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
610
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
611
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
612
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
613
+
614
+ function isValidElementType(type) {
615
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
616
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
617
+ }
618
+
619
+ function typeOf(object) {
620
+ if (typeof object === 'object' && object !== null) {
621
+ var $$typeof = object.$$typeof;
622
+
623
+ switch ($$typeof) {
624
+ case REACT_ELEMENT_TYPE:
625
+ var type = object.type;
626
+
627
+ switch (type) {
628
+ case REACT_ASYNC_MODE_TYPE:
629
+ case REACT_CONCURRENT_MODE_TYPE:
630
+ case REACT_FRAGMENT_TYPE:
631
+ case REACT_PROFILER_TYPE:
632
+ case REACT_STRICT_MODE_TYPE:
633
+ case REACT_SUSPENSE_TYPE:
634
+ return type;
635
+
636
+ default:
637
+ var $$typeofType = type && type.$$typeof;
638
+
639
+ switch ($$typeofType) {
640
+ case REACT_CONTEXT_TYPE:
641
+ case REACT_FORWARD_REF_TYPE:
642
+ case REACT_LAZY_TYPE:
643
+ case REACT_MEMO_TYPE:
644
+ case REACT_PROVIDER_TYPE:
645
+ return $$typeofType;
646
+
647
+ default:
648
+ return $$typeof;
649
+ }
650
+
651
+ }
652
+
653
+ case REACT_PORTAL_TYPE:
654
+ return $$typeof;
655
+ }
656
+ }
657
+
658
+ return undefined;
659
+ } // AsyncMode is deprecated along with isAsyncMode
660
+
661
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
662
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
663
+ var ContextConsumer = REACT_CONTEXT_TYPE;
664
+ var ContextProvider = REACT_PROVIDER_TYPE;
665
+ var Element = REACT_ELEMENT_TYPE;
666
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
667
+ var Fragment = REACT_FRAGMENT_TYPE;
668
+ var Lazy = REACT_LAZY_TYPE;
669
+ var Memo = REACT_MEMO_TYPE;
670
+ var Portal = REACT_PORTAL_TYPE;
671
+ var Profiler = REACT_PROFILER_TYPE;
672
+ var StrictMode = REACT_STRICT_MODE_TYPE;
673
+ var Suspense = REACT_SUSPENSE_TYPE;
674
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
675
+
676
+ function isAsyncMode(object) {
677
+ {
678
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
679
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
680
+
681
+ console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
682
+ }
683
+ }
684
+
685
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
686
+ }
687
+ function isConcurrentMode(object) {
688
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
689
+ }
690
+ function isContextConsumer(object) {
691
+ return typeOf(object) === REACT_CONTEXT_TYPE;
692
+ }
693
+ function isContextProvider(object) {
694
+ return typeOf(object) === REACT_PROVIDER_TYPE;
695
+ }
696
+ function isElement(object) {
697
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
698
+ }
699
+ function isForwardRef(object) {
700
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
701
+ }
702
+ function isFragment(object) {
703
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
704
+ }
705
+ function isLazy(object) {
706
+ return typeOf(object) === REACT_LAZY_TYPE;
707
+ }
708
+ function isMemo(object) {
709
+ return typeOf(object) === REACT_MEMO_TYPE;
710
+ }
711
+ function isPortal(object) {
712
+ return typeOf(object) === REACT_PORTAL_TYPE;
713
+ }
714
+ function isProfiler(object) {
715
+ return typeOf(object) === REACT_PROFILER_TYPE;
716
+ }
717
+ function isStrictMode(object) {
718
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
719
+ }
720
+ function isSuspense(object) {
721
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
722
+ }
723
+
724
+ exports.AsyncMode = AsyncMode;
725
+ exports.ConcurrentMode = ConcurrentMode;
726
+ exports.ContextConsumer = ContextConsumer;
727
+ exports.ContextProvider = ContextProvider;
728
+ exports.Element = Element;
729
+ exports.ForwardRef = ForwardRef;
730
+ exports.Fragment = Fragment;
731
+ exports.Lazy = Lazy;
732
+ exports.Memo = Memo;
733
+ exports.Portal = Portal;
734
+ exports.Profiler = Profiler;
735
+ exports.StrictMode = StrictMode;
736
+ exports.Suspense = Suspense;
737
+ exports.isAsyncMode = isAsyncMode;
738
+ exports.isConcurrentMode = isConcurrentMode;
739
+ exports.isContextConsumer = isContextConsumer;
740
+ exports.isContextProvider = isContextProvider;
741
+ exports.isElement = isElement;
742
+ exports.isForwardRef = isForwardRef;
743
+ exports.isFragment = isFragment;
744
+ exports.isLazy = isLazy;
745
+ exports.isMemo = isMemo;
746
+ exports.isPortal = isPortal;
747
+ exports.isProfiler = isProfiler;
748
+ exports.isStrictMode = isStrictMode;
749
+ exports.isSuspense = isSuspense;
750
+ exports.isValidElementType = isValidElementType;
751
+ exports.typeOf = typeOf;
752
+ })();
753
+ }
754
+ });
755
+
756
+ var reactIs = createCommonjsModule(function (module) {
757
+
758
+ if (process.env.NODE_ENV === 'production') {
759
+ module.exports = reactIs_production_min;
760
+ } else {
761
+ module.exports = reactIs_development;
762
+ }
763
+ });
764
+
765
+ /*
766
+ object-assign
767
+ (c) Sindre Sorhus
768
+ @license MIT
769
+ */
770
+ /* eslint-disable no-unused-vars */
771
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
772
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
773
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
774
+
775
+ function toObject(val) {
776
+ if (val === null || val === undefined) {
777
+ throw new TypeError('Object.assign cannot be called with null or undefined');
778
+ }
779
+
780
+ return Object(val);
781
+ }
782
+
783
+ function shouldUseNative() {
784
+ try {
785
+ if (!Object.assign) {
786
+ return false;
787
+ }
788
+
789
+ // Detect buggy property enumeration order in older V8 versions.
790
+
791
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
792
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
793
+ test1[5] = 'de';
794
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
795
+ return false;
796
+ }
797
+
798
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
799
+ var test2 = {};
800
+ for (var i = 0; i < 10; i++) {
801
+ test2['_' + String.fromCharCode(i)] = i;
802
+ }
803
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
804
+ return test2[n];
805
+ });
806
+ if (order2.join('') !== '0123456789') {
807
+ return false;
808
+ }
809
+
810
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
811
+ var test3 = {};
812
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
813
+ test3[letter] = letter;
814
+ });
815
+ if (Object.keys(Object.assign({}, test3)).join('') !==
816
+ 'abcdefghijklmnopqrst') {
817
+ return false;
818
+ }
819
+
820
+ return true;
821
+ } catch (err) {
822
+ // We don't expect any of the above to throw, but better to be safe.
823
+ return false;
824
+ }
825
+ }
826
+
827
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
828
+ var from;
829
+ var to = toObject(target);
830
+ var symbols;
831
+
832
+ for (var s = 1; s < arguments.length; s++) {
833
+ from = Object(arguments[s]);
834
+
835
+ for (var key in from) {
836
+ if (hasOwnProperty.call(from, key)) {
837
+ to[key] = from[key];
838
+ }
839
+ }
840
+
841
+ if (getOwnPropertySymbols) {
842
+ symbols = getOwnPropertySymbols(from);
843
+ for (var i = 0; i < symbols.length; i++) {
844
+ if (propIsEnumerable.call(from, symbols[i])) {
845
+ to[symbols[i]] = from[symbols[i]];
846
+ }
847
+ }
848
+ }
849
+ }
850
+
851
+ return to;
852
+ };
853
+
854
+ /**
855
+ * Copyright (c) 2013-present, Facebook, Inc.
856
+ *
857
+ * This source code is licensed under the MIT license found in the
858
+ * LICENSE file in the root directory of this source tree.
859
+ */
860
+
861
+ var ReactPropTypesSecret$2 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
862
+
863
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret$2;
864
+
865
+ var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
866
+
867
+ var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
868
+
869
+ var has$1 = has$2;
870
+
871
+ var printWarning$1 = function() {};
872
+
873
+ if (process.env.NODE_ENV !== 'production') {
874
+ var ReactPropTypesSecret = ReactPropTypesSecret$1;
875
+ var loggedTypeFailures = {};
876
+ var has = has$1;
877
+
878
+ printWarning$1 = function(text) {
879
+ var message = 'Warning: ' + text;
880
+ if (typeof console !== 'undefined') {
881
+ console.error(message);
882
+ }
883
+ try {
884
+ // --- Welcome to debugging React ---
885
+ // This error was thrown as a convenience so that you can use this stack
886
+ // to find the callsite that caused this warning to fire.
887
+ throw new Error(message);
888
+ } catch (x) { /**/ }
889
+ };
890
+ }
891
+
892
+ /**
893
+ * Assert that the values match with the type specs.
894
+ * Error messages are memorized and will only be shown once.
895
+ *
896
+ * @param {object} typeSpecs Map of name to a ReactPropType
897
+ * @param {object} values Runtime values that need to be type-checked
898
+ * @param {string} location e.g. "prop", "context", "child context"
899
+ * @param {string} componentName Name of the component for error messages.
900
+ * @param {?Function} getStack Returns the component stack.
901
+ * @private
902
+ */
903
+ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
904
+ if (process.env.NODE_ENV !== 'production') {
905
+ for (var typeSpecName in typeSpecs) {
906
+ if (has(typeSpecs, typeSpecName)) {
907
+ var error;
908
+ // Prop type validation may throw. In case they do, we don't want to
909
+ // fail the render phase where it didn't fail before. So we log it.
910
+ // After these have been cleaned up, we'll let them throw.
911
+ try {
912
+ // This is intentionally an invariant that gets caught. It's the same
913
+ // behavior as without this statement except with a better message.
914
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
915
+ var err = Error(
916
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
917
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
918
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
919
+ );
920
+ err.name = 'Invariant Violation';
921
+ throw err;
922
+ }
923
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
924
+ } catch (ex) {
925
+ error = ex;
926
+ }
927
+ if (error && !(error instanceof Error)) {
928
+ printWarning$1(
929
+ (componentName || 'React class') + ': type specification of ' +
930
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
931
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
932
+ 'You may have forgotten to pass an argument to the type checker ' +
933
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
934
+ 'shape all require an argument).'
935
+ );
936
+ }
937
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
938
+ // Only monitor this failure once because there tends to be a lot of the
939
+ // same error.
940
+ loggedTypeFailures[error.message] = true;
941
+
942
+ var stack = getStack ? getStack() : '';
943
+
944
+ printWarning$1(
945
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
946
+ );
947
+ }
948
+ }
949
+ }
950
+ }
951
+ }
952
+
953
+ /**
954
+ * Resets warning cache when testing.
955
+ *
956
+ * @private
957
+ */
958
+ checkPropTypes$1.resetWarningCache = function() {
959
+ if (process.env.NODE_ENV !== 'production') {
960
+ loggedTypeFailures = {};
961
+ }
962
+ };
963
+
964
+ var checkPropTypes_1 = checkPropTypes$1;
965
+
966
+ var checkPropTypes = checkPropTypes_1;
967
+
968
+ var printWarning = function() {};
969
+
970
+ if (process.env.NODE_ENV !== 'production') {
971
+ printWarning = function(text) {
972
+ var message = 'Warning: ' + text;
973
+ if (typeof console !== 'undefined') {
974
+ console.error(message);
975
+ }
976
+ try {
977
+ // --- Welcome to debugging React ---
978
+ // This error was thrown as a convenience so that you can use this stack
979
+ // to find the callsite that caused this warning to fire.
980
+ throw new Error(message);
981
+ } catch (x) {}
982
+ };
983
+ }
984
+
985
+ function emptyFunctionThatReturnsNull() {
986
+ return null;
987
+ }
988
+
989
+ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
990
+ /* global Symbol */
991
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
992
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
993
+
994
+ /**
995
+ * Returns the iterator method function contained on the iterable object.
996
+ *
997
+ * Be sure to invoke the function with the iterable as context:
998
+ *
999
+ * var iteratorFn = getIteratorFn(myIterable);
1000
+ * if (iteratorFn) {
1001
+ * var iterator = iteratorFn.call(myIterable);
1002
+ * ...
1003
+ * }
1004
+ *
1005
+ * @param {?object} maybeIterable
1006
+ * @return {?function}
1007
+ */
1008
+ function getIteratorFn(maybeIterable) {
1009
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
1010
+ if (typeof iteratorFn === 'function') {
1011
+ return iteratorFn;
1012
+ }
1013
+ }
1014
+
1015
+ /**
1016
+ * Collection of methods that allow declaration and validation of props that are
1017
+ * supplied to React components. Example usage:
1018
+ *
1019
+ * var Props = require('ReactPropTypes');
1020
+ * var MyArticle = React.createClass({
1021
+ * propTypes: {
1022
+ * // An optional string prop named "description".
1023
+ * description: Props.string,
1024
+ *
1025
+ * // A required enum prop named "category".
1026
+ * category: Props.oneOf(['News','Photos']).isRequired,
1027
+ *
1028
+ * // A prop named "dialog" that requires an instance of Dialog.
1029
+ * dialog: Props.instanceOf(Dialog).isRequired
1030
+ * },
1031
+ * render: function() { ... }
1032
+ * });
1033
+ *
1034
+ * A more formal specification of how these methods are used:
1035
+ *
1036
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
1037
+ * decl := ReactPropTypes.{type}(.isRequired)?
1038
+ *
1039
+ * Each and every declaration produces a function with the same signature. This
1040
+ * allows the creation of custom validation functions. For example:
1041
+ *
1042
+ * var MyLink = React.createClass({
1043
+ * propTypes: {
1044
+ * // An optional string or URI prop named "href".
1045
+ * href: function(props, propName, componentName) {
1046
+ * var propValue = props[propName];
1047
+ * if (propValue != null && typeof propValue !== 'string' &&
1048
+ * !(propValue instanceof URI)) {
1049
+ * return new Error(
1050
+ * 'Expected a string or an URI for ' + propName + ' in ' +
1051
+ * componentName
1052
+ * );
1053
+ * }
1054
+ * }
1055
+ * },
1056
+ * render: function() {...}
1057
+ * });
1058
+ *
1059
+ * @internal
1060
+ */
1061
+
1062
+ var ANONYMOUS = '<<anonymous>>';
1063
+
1064
+ // Important!
1065
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
1066
+ var ReactPropTypes = {
1067
+ array: createPrimitiveTypeChecker('array'),
1068
+ bigint: createPrimitiveTypeChecker('bigint'),
1069
+ bool: createPrimitiveTypeChecker('boolean'),
1070
+ func: createPrimitiveTypeChecker('function'),
1071
+ number: createPrimitiveTypeChecker('number'),
1072
+ object: createPrimitiveTypeChecker('object'),
1073
+ string: createPrimitiveTypeChecker('string'),
1074
+ symbol: createPrimitiveTypeChecker('symbol'),
1075
+
1076
+ any: createAnyTypeChecker(),
1077
+ arrayOf: createArrayOfTypeChecker,
1078
+ element: createElementTypeChecker(),
1079
+ elementType: createElementTypeTypeChecker(),
1080
+ instanceOf: createInstanceTypeChecker,
1081
+ node: createNodeChecker(),
1082
+ objectOf: createObjectOfTypeChecker,
1083
+ oneOf: createEnumTypeChecker,
1084
+ oneOfType: createUnionTypeChecker,
1085
+ shape: createShapeTypeChecker,
1086
+ exact: createStrictShapeTypeChecker,
1087
+ };
1088
+
1089
+ /**
1090
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
1091
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
1092
+ */
1093
+ /*eslint-disable no-self-compare*/
1094
+ function is(x, y) {
1095
+ // SameValue algorithm
1096
+ if (x === y) {
1097
+ // Steps 1-5, 7-10
1098
+ // Steps 6.b-6.e: +0 != -0
1099
+ return x !== 0 || 1 / x === 1 / y;
1100
+ } else {
1101
+ // Step 6.a: NaN == NaN
1102
+ return x !== x && y !== y;
1103
+ }
1104
+ }
1105
+ /*eslint-enable no-self-compare*/
1106
+
1107
+ /**
1108
+ * We use an Error-like object for backward compatibility as people may call
1109
+ * PropTypes directly and inspect their output. However, we don't use real
1110
+ * Errors anymore. We don't inspect their stack anyway, and creating them
1111
+ * is prohibitively expensive if they are created too often, such as what
1112
+ * happens in oneOfType() for any type before the one that matched.
1113
+ */
1114
+ function PropTypeError(message, data) {
1115
+ this.message = message;
1116
+ this.data = data && typeof data === 'object' ? data: {};
1117
+ this.stack = '';
1118
+ }
1119
+ // Make `instanceof Error` still work for returned errors.
1120
+ PropTypeError.prototype = Error.prototype;
1121
+
1122
+ function createChainableTypeChecker(validate) {
1123
+ if (process.env.NODE_ENV !== 'production') {
1124
+ var manualPropTypeCallCache = {};
1125
+ var manualPropTypeWarningCount = 0;
1126
+ }
1127
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
1128
+ componentName = componentName || ANONYMOUS;
1129
+ propFullName = propFullName || propName;
1130
+
1131
+ if (secret !== ReactPropTypesSecret$1) {
1132
+ if (throwOnDirectAccess) {
1133
+ // New behavior only for users of `prop-types` package
1134
+ var err = new Error(
1135
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1136
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
1137
+ 'Read more at http://fb.me/use-check-prop-types'
1138
+ );
1139
+ err.name = 'Invariant Violation';
1140
+ throw err;
1141
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
1142
+ // Old behavior for people using React.PropTypes
1143
+ var cacheKey = componentName + ':' + propName;
1144
+ if (
1145
+ !manualPropTypeCallCache[cacheKey] &&
1146
+ // Avoid spamming the console because they are often not actionable except for lib authors
1147
+ manualPropTypeWarningCount < 3
1148
+ ) {
1149
+ printWarning(
1150
+ 'You are manually calling a React.PropTypes validation ' +
1151
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
1152
+ 'and will throw in the standalone `prop-types` package. ' +
1153
+ 'You may be seeing this warning due to a third-party PropTypes ' +
1154
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
1155
+ );
1156
+ manualPropTypeCallCache[cacheKey] = true;
1157
+ manualPropTypeWarningCount++;
1158
+ }
1159
+ }
1160
+ }
1161
+ if (props[propName] == null) {
1162
+ if (isRequired) {
1163
+ if (props[propName] === null) {
1164
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
1165
+ }
1166
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
1167
+ }
1168
+ return null;
1169
+ } else {
1170
+ return validate(props, propName, componentName, location, propFullName);
1171
+ }
1172
+ }
1173
+
1174
+ var chainedCheckType = checkType.bind(null, false);
1175
+ chainedCheckType.isRequired = checkType.bind(null, true);
1176
+
1177
+ return chainedCheckType;
1178
+ }
1179
+
1180
+ function createPrimitiveTypeChecker(expectedType) {
1181
+ function validate(props, propName, componentName, location, propFullName, secret) {
1182
+ var propValue = props[propName];
1183
+ var propType = getPropType(propValue);
1184
+ if (propType !== expectedType) {
1185
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
1186
+ // check, but we can offer a more precise error message here rather than
1187
+ // 'of type `object`'.
1188
+ var preciseType = getPreciseType(propValue);
1189
+
1190
+ return new PropTypeError(
1191
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
1192
+ {expectedType: expectedType}
1193
+ );
1194
+ }
1195
+ return null;
1196
+ }
1197
+ return createChainableTypeChecker(validate);
1198
+ }
1199
+
1200
+ function createAnyTypeChecker() {
1201
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
1202
+ }
1203
+
1204
+ function createArrayOfTypeChecker(typeChecker) {
1205
+ function validate(props, propName, componentName, location, propFullName) {
1206
+ if (typeof typeChecker !== 'function') {
1207
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
1208
+ }
1209
+ var propValue = props[propName];
1210
+ if (!Array.isArray(propValue)) {
1211
+ var propType = getPropType(propValue);
1212
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
1213
+ }
1214
+ for (var i = 0; i < propValue.length; i++) {
1215
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret$1);
1216
+ if (error instanceof Error) {
1217
+ return error;
1218
+ }
1219
+ }
1220
+ return null;
1221
+ }
1222
+ return createChainableTypeChecker(validate);
1223
+ }
1224
+
1225
+ function createElementTypeChecker() {
1226
+ function validate(props, propName, componentName, location, propFullName) {
1227
+ var propValue = props[propName];
1228
+ if (!isValidElement(propValue)) {
1229
+ var propType = getPropType(propValue);
1230
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
1231
+ }
1232
+ return null;
1233
+ }
1234
+ return createChainableTypeChecker(validate);
1235
+ }
1236
+
1237
+ function createElementTypeTypeChecker() {
1238
+ function validate(props, propName, componentName, location, propFullName) {
1239
+ var propValue = props[propName];
1240
+ if (!reactIs.isValidElementType(propValue)) {
1241
+ var propType = getPropType(propValue);
1242
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
1243
+ }
1244
+ return null;
1245
+ }
1246
+ return createChainableTypeChecker(validate);
1247
+ }
1248
+
1249
+ function createInstanceTypeChecker(expectedClass) {
1250
+ function validate(props, propName, componentName, location, propFullName) {
1251
+ if (!(props[propName] instanceof expectedClass)) {
1252
+ var expectedClassName = expectedClass.name || ANONYMOUS;
1253
+ var actualClassName = getClassName(props[propName]);
1254
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
1255
+ }
1256
+ return null;
1257
+ }
1258
+ return createChainableTypeChecker(validate);
1259
+ }
1260
+
1261
+ function createEnumTypeChecker(expectedValues) {
1262
+ if (!Array.isArray(expectedValues)) {
1263
+ if (process.env.NODE_ENV !== 'production') {
1264
+ if (arguments.length > 1) {
1265
+ printWarning(
1266
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
1267
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
1268
+ );
1269
+ } else {
1270
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
1271
+ }
1272
+ }
1273
+ return emptyFunctionThatReturnsNull;
1274
+ }
1275
+
1276
+ function validate(props, propName, componentName, location, propFullName) {
1277
+ var propValue = props[propName];
1278
+ for (var i = 0; i < expectedValues.length; i++) {
1279
+ if (is(propValue, expectedValues[i])) {
1280
+ return null;
1281
+ }
1282
+ }
1283
+
1284
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
1285
+ var type = getPreciseType(value);
1286
+ if (type === 'symbol') {
1287
+ return String(value);
1288
+ }
1289
+ return value;
1290
+ });
1291
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
1292
+ }
1293
+ return createChainableTypeChecker(validate);
1294
+ }
1295
+
1296
+ function createObjectOfTypeChecker(typeChecker) {
1297
+ function validate(props, propName, componentName, location, propFullName) {
1298
+ if (typeof typeChecker !== 'function') {
1299
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
1300
+ }
1301
+ var propValue = props[propName];
1302
+ var propType = getPropType(propValue);
1303
+ if (propType !== 'object') {
1304
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
1305
+ }
1306
+ for (var key in propValue) {
1307
+ if (has$1(propValue, key)) {
1308
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
1309
+ if (error instanceof Error) {
1310
+ return error;
1311
+ }
1312
+ }
1313
+ }
1314
+ return null;
1315
+ }
1316
+ return createChainableTypeChecker(validate);
1317
+ }
1318
+
1319
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
1320
+ if (!Array.isArray(arrayOfTypeCheckers)) {
1321
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
1322
+ return emptyFunctionThatReturnsNull;
1323
+ }
1324
+
1325
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1326
+ var checker = arrayOfTypeCheckers[i];
1327
+ if (typeof checker !== 'function') {
1328
+ printWarning(
1329
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
1330
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
1331
+ );
1332
+ return emptyFunctionThatReturnsNull;
1333
+ }
1334
+ }
1335
+
1336
+ function validate(props, propName, componentName, location, propFullName) {
1337
+ var expectedTypes = [];
1338
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1339
+ var checker = arrayOfTypeCheckers[i];
1340
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1);
1341
+ if (checkerResult == null) {
1342
+ return null;
1343
+ }
1344
+ if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
1345
+ expectedTypes.push(checkerResult.data.expectedType);
1346
+ }
1347
+ }
1348
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
1349
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
1350
+ }
1351
+ return createChainableTypeChecker(validate);
1352
+ }
1353
+
1354
+ function createNodeChecker() {
1355
+ function validate(props, propName, componentName, location, propFullName) {
1356
+ if (!isNode(props[propName])) {
1357
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
1358
+ }
1359
+ return null;
1360
+ }
1361
+ return createChainableTypeChecker(validate);
1362
+ }
1363
+
1364
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
1365
+ return new PropTypeError(
1366
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
1367
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
1368
+ );
1369
+ }
1370
+
1371
+ function createShapeTypeChecker(shapeTypes) {
1372
+ function validate(props, propName, componentName, location, propFullName) {
1373
+ var propValue = props[propName];
1374
+ var propType = getPropType(propValue);
1375
+ if (propType !== 'object') {
1376
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1377
+ }
1378
+ for (var key in shapeTypes) {
1379
+ var checker = shapeTypes[key];
1380
+ if (typeof checker !== 'function') {
1381
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1382
+ }
1383
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
1384
+ if (error) {
1385
+ return error;
1386
+ }
1387
+ }
1388
+ return null;
1389
+ }
1390
+ return createChainableTypeChecker(validate);
1391
+ }
1392
+
1393
+ function createStrictShapeTypeChecker(shapeTypes) {
1394
+ function validate(props, propName, componentName, location, propFullName) {
1395
+ var propValue = props[propName];
1396
+ var propType = getPropType(propValue);
1397
+ if (propType !== 'object') {
1398
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1399
+ }
1400
+ // We need to check all keys in case some are required but missing from props.
1401
+ var allKeys = objectAssign({}, props[propName], shapeTypes);
1402
+ for (var key in allKeys) {
1403
+ var checker = shapeTypes[key];
1404
+ if (has$1(shapeTypes, key) && typeof checker !== 'function') {
1405
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1406
+ }
1407
+ if (!checker) {
1408
+ return new PropTypeError(
1409
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
1410
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
1411
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
1412
+ );
1413
+ }
1414
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
1415
+ if (error) {
1416
+ return error;
1417
+ }
1418
+ }
1419
+ return null;
1420
+ }
1421
+
1422
+ return createChainableTypeChecker(validate);
1423
+ }
1424
+
1425
+ function isNode(propValue) {
1426
+ switch (typeof propValue) {
1427
+ case 'number':
1428
+ case 'string':
1429
+ case 'undefined':
1430
+ return true;
1431
+ case 'boolean':
1432
+ return !propValue;
1433
+ case 'object':
1434
+ if (Array.isArray(propValue)) {
1435
+ return propValue.every(isNode);
1436
+ }
1437
+ if (propValue === null || isValidElement(propValue)) {
1438
+ return true;
1439
+ }
1440
+
1441
+ var iteratorFn = getIteratorFn(propValue);
1442
+ if (iteratorFn) {
1443
+ var iterator = iteratorFn.call(propValue);
1444
+ var step;
1445
+ if (iteratorFn !== propValue.entries) {
1446
+ while (!(step = iterator.next()).done) {
1447
+ if (!isNode(step.value)) {
1448
+ return false;
1449
+ }
1450
+ }
1451
+ } else {
1452
+ // Iterator will provide entry [k,v] tuples rather than values.
1453
+ while (!(step = iterator.next()).done) {
1454
+ var entry = step.value;
1455
+ if (entry) {
1456
+ if (!isNode(entry[1])) {
1457
+ return false;
1458
+ }
1459
+ }
1460
+ }
1461
+ }
1462
+ } else {
1463
+ return false;
1464
+ }
1465
+
1466
+ return true;
1467
+ default:
1468
+ return false;
1469
+ }
1470
+ }
1471
+
1472
+ function isSymbol(propType, propValue) {
1473
+ // Native Symbol.
1474
+ if (propType === 'symbol') {
1475
+ return true;
1476
+ }
1477
+
1478
+ // falsy value can't be a Symbol
1479
+ if (!propValue) {
1480
+ return false;
1481
+ }
1482
+
1483
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1484
+ if (propValue['@@toStringTag'] === 'Symbol') {
1485
+ return true;
1486
+ }
1487
+
1488
+ // Fallback for non-spec compliant Symbols which are polyfilled.
1489
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1490
+ return true;
1491
+ }
1492
+
1493
+ return false;
1494
+ }
1495
+
1496
+ // Equivalent of `typeof` but with special handling for array and regexp.
1497
+ function getPropType(propValue) {
1498
+ var propType = typeof propValue;
1499
+ if (Array.isArray(propValue)) {
1500
+ return 'array';
1501
+ }
1502
+ if (propValue instanceof RegExp) {
1503
+ // Old webkits (at least until Android 4.0) return 'function' rather than
1504
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1505
+ // passes PropTypes.object.
1506
+ return 'object';
1507
+ }
1508
+ if (isSymbol(propType, propValue)) {
1509
+ return 'symbol';
1510
+ }
1511
+ return propType;
1512
+ }
1513
+
1514
+ // This handles more types than `getPropType`. Only used for error messages.
1515
+ // See `createPrimitiveTypeChecker`.
1516
+ function getPreciseType(propValue) {
1517
+ if (typeof propValue === 'undefined' || propValue === null) {
1518
+ return '' + propValue;
1519
+ }
1520
+ var propType = getPropType(propValue);
1521
+ if (propType === 'object') {
1522
+ if (propValue instanceof Date) {
1523
+ return 'date';
1524
+ } else if (propValue instanceof RegExp) {
1525
+ return 'regexp';
1526
+ }
1527
+ }
1528
+ return propType;
1529
+ }
1530
+
1531
+ // Returns a string that is postfixed to a warning about an invalid type.
1532
+ // For example, "undefined" or "of type array"
1533
+ function getPostfixForTypeWarning(value) {
1534
+ var type = getPreciseType(value);
1535
+ switch (type) {
1536
+ case 'array':
1537
+ case 'object':
1538
+ return 'an ' + type;
1539
+ case 'boolean':
1540
+ case 'date':
1541
+ case 'regexp':
1542
+ return 'a ' + type;
1543
+ default:
1544
+ return type;
1545
+ }
1546
+ }
1547
+
1548
+ // Returns class name of the object, if any.
1549
+ function getClassName(propValue) {
1550
+ if (!propValue.constructor || !propValue.constructor.name) {
1551
+ return ANONYMOUS;
1552
+ }
1553
+ return propValue.constructor.name;
1554
+ }
1555
+
1556
+ ReactPropTypes.checkPropTypes = checkPropTypes;
1557
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1558
+ ReactPropTypes.PropTypes = ReactPropTypes;
1559
+
1560
+ return ReactPropTypes;
1561
+ };
1562
+
1563
+ function emptyFunction() {}
1564
+ function emptyFunctionWithReset() {}
1565
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
1566
+
1567
+ var factoryWithThrowingShims = function() {
1568
+ function shim(props, propName, componentName, location, propFullName, secret) {
1569
+ if (secret === ReactPropTypesSecret$1) {
1570
+ // It is still safe when called from React.
1571
+ return;
1572
+ }
1573
+ var err = new Error(
1574
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1575
+ 'Use PropTypes.checkPropTypes() to call them. ' +
1576
+ 'Read more at http://fb.me/use-check-prop-types'
1577
+ );
1578
+ err.name = 'Invariant Violation';
1579
+ throw err;
1580
+ } shim.isRequired = shim;
1581
+ function getShim() {
1582
+ return shim;
1583
+ } // Important!
1584
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1585
+ var ReactPropTypes = {
1586
+ array: shim,
1587
+ bigint: shim,
1588
+ bool: shim,
1589
+ func: shim,
1590
+ number: shim,
1591
+ object: shim,
1592
+ string: shim,
1593
+ symbol: shim,
1594
+
1595
+ any: shim,
1596
+ arrayOf: getShim,
1597
+ element: shim,
1598
+ elementType: shim,
1599
+ instanceOf: getShim,
1600
+ node: shim,
1601
+ objectOf: getShim,
1602
+ oneOf: getShim,
1603
+ oneOfType: getShim,
1604
+ shape: getShim,
1605
+ exact: getShim,
1606
+
1607
+ checkPropTypes: emptyFunctionWithReset,
1608
+ resetWarningCache: emptyFunction
1609
+ };
1610
+
1611
+ ReactPropTypes.PropTypes = ReactPropTypes;
1612
+
1613
+ return ReactPropTypes;
1614
+ };
1615
+
1616
+ var require$$1 = factoryWithTypeCheckers;
1617
+
1618
+ var require$$2 = factoryWithThrowingShims;
1619
+
1620
+ var propTypes = createCommonjsModule(function (module) {
1621
+ /**
1622
+ * Copyright (c) 2013-present, Facebook, Inc.
1623
+ *
1624
+ * This source code is licensed under the MIT license found in the
1625
+ * LICENSE file in the root directory of this source tree.
1626
+ */
1627
+
1628
+ if (process.env.NODE_ENV !== 'production') {
1629
+ var ReactIs = reactIs;
1630
+
1631
+ // By explicitly using `prop-types` you are opting into new development behavior.
1632
+ // http://fb.me/prop-types-in-prod
1633
+ var throwOnDirectAccess = true;
1634
+ module.exports = require$$1(ReactIs.isElement, throwOnDirectAccess);
1635
+ } else {
1636
+ // By explicitly using `prop-types` you are opting into new production behavior.
1637
+ // http://fb.me/prop-types-in-prod
1638
+ module.exports = require$$2();
1639
+ }
1640
+ });
1641
+
1642
+ var PropTypes = propTypes;
1643
+
1644
+ /**
1645
+ * Checks if a given element has a CSS class.
1646
+ *
1647
+ * @param element the element
1648
+ * @param className the CSS class name
1649
+ */
1650
+ function hasClass(element, className) {
1651
+ if (element.classList) return !!className && element.classList.contains(className);
1652
+ return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
1653
+ }
1654
+
1655
+ /**
1656
+ * Adds a CSS class to a given element.
1657
+ *
1658
+ * @param element the element
1659
+ * @param className the CSS class name
1660
+ */
1661
+
1662
+ function addClass(element, className) {
1663
+ if (element.classList) element.classList.add(className);else if (!hasClass(element, className)) if (typeof element.className === 'string') element.className = element.className + " " + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + " " + className);
1664
+ }
1665
+
1666
+ function replaceClassName(origClass, classToRemove) {
1667
+ return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
1668
+ }
1669
+ /**
1670
+ * Removes a CSS class from a given element.
1671
+ *
1672
+ * @param element the element
1673
+ * @param className the CSS class name
1674
+ */
1675
+
1676
+
1677
+ function removeClass$1(element, className) {
1678
+ if (element.classList) {
1679
+ element.classList.remove(className);
1680
+ } else if (typeof element.className === 'string') {
1681
+ element.className = replaceClassName(element.className, className);
1682
+ } else {
1683
+ element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
1684
+ }
1685
+ }
1686
+
1687
+ var config = {
1688
+ disabled: false
1689
+ };
1690
+
1691
+ var timeoutsShape = process.env.NODE_ENV !== 'production' ? PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
1692
+ enter: PropTypes.number,
1693
+ exit: PropTypes.number,
1694
+ appear: PropTypes.number
1695
+ }).isRequired]) : null;
1696
+ var classNamesShape = process.env.NODE_ENV !== 'production' ? PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
1697
+ enter: PropTypes.string,
1698
+ exit: PropTypes.string,
1699
+ active: PropTypes.string
1700
+ }), PropTypes.shape({
1701
+ enter: PropTypes.string,
1702
+ enterDone: PropTypes.string,
1703
+ enterActive: PropTypes.string,
1704
+ exit: PropTypes.string,
1705
+ exitDone: PropTypes.string,
1706
+ exitActive: PropTypes.string
1707
+ })]) : null;
1708
+
1709
+ var TransitionGroupContext = React.createContext(null);
1710
+
1711
+ var UNMOUNTED = 'unmounted';
1712
+ var EXITED = 'exited';
1713
+ var ENTERING = 'entering';
1714
+ var ENTERED = 'entered';
1715
+ var EXITING = 'exiting';
1716
+ /**
1717
+ * The Transition component lets you describe a transition from one component
1718
+ * state to another _over time_ with a simple declarative API. Most commonly
1719
+ * it's used to animate the mounting and unmounting of a component, but can also
1720
+ * be used to describe in-place transition states as well.
1721
+ *
1722
+ * ---
1723
+ *
1724
+ * **Note**: `Transition` is a platform-agnostic base component. If you're using
1725
+ * transitions in CSS, you'll probably want to use
1726
+ * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
1727
+ * instead. It inherits all the features of `Transition`, but contains
1728
+ * additional features necessary to play nice with CSS transitions (hence the
1729
+ * name of the component).
1730
+ *
1731
+ * ---
1732
+ *
1733
+ * By default the `Transition` component does not alter the behavior of the
1734
+ * component it renders, it only tracks "enter" and "exit" states for the
1735
+ * components. It's up to you to give meaning and effect to those states. For
1736
+ * example we can add styles to a component when it enters or exits:
1737
+ *
1738
+ * ```jsx
1739
+ * import { Transition } from 'react-transition-group';
1740
+ *
1741
+ * const duration = 300;
1742
+ *
1743
+ * const defaultStyle = {
1744
+ * transition: `opacity ${duration}ms ease-in-out`,
1745
+ * opacity: 0,
1746
+ * }
1747
+ *
1748
+ * const transitionStyles = {
1749
+ * entering: { opacity: 1 },
1750
+ * entered: { opacity: 1 },
1751
+ * exiting: { opacity: 0 },
1752
+ * exited: { opacity: 0 },
1753
+ * };
1754
+ *
1755
+ * const Fade = ({ in: inProp }) => (
1756
+ * <Transition in={inProp} timeout={duration}>
1757
+ * {state => (
1758
+ * <div style={{
1759
+ * ...defaultStyle,
1760
+ * ...transitionStyles[state]
1761
+ * }}>
1762
+ * I'm a fade Transition!
1763
+ * </div>
1764
+ * )}
1765
+ * </Transition>
1766
+ * );
1767
+ * ```
1768
+ *
1769
+ * There are 4 main states a Transition can be in:
1770
+ * - `'entering'`
1771
+ * - `'entered'`
1772
+ * - `'exiting'`
1773
+ * - `'exited'`
1774
+ *
1775
+ * Transition state is toggled via the `in` prop. When `true` the component
1776
+ * begins the "Enter" stage. During this stage, the component will shift from
1777
+ * its current transition state, to `'entering'` for the duration of the
1778
+ * transition and then to the `'entered'` stage once it's complete. Let's take
1779
+ * the following example (we'll use the
1780
+ * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
1781
+ *
1782
+ * ```jsx
1783
+ * function App() {
1784
+ * const [inProp, setInProp] = useState(false);
1785
+ * return (
1786
+ * <div>
1787
+ * <Transition in={inProp} timeout={500}>
1788
+ * {state => (
1789
+ * // ...
1790
+ * )}
1791
+ * </Transition>
1792
+ * <button onClick={() => setInProp(true)}>
1793
+ * Click to Enter
1794
+ * </button>
1795
+ * </div>
1796
+ * );
1797
+ * }
1798
+ * ```
1799
+ *
1800
+ * When the button is clicked the component will shift to the `'entering'` state
1801
+ * and stay there for 500ms (the value of `timeout`) before it finally switches
1802
+ * to `'entered'`.
1803
+ *
1804
+ * When `in` is `false` the same thing happens except the state moves from
1805
+ * `'exiting'` to `'exited'`.
1806
+ */
1807
+
1808
+ var Transition = /*#__PURE__*/function (_React$Component) {
1809
+ _inheritsLoose(Transition, _React$Component);
1810
+
1811
+ function Transition(props, context) {
1812
+ var _this;
1813
+
1814
+ _this = _React$Component.call(this, props, context) || this;
1815
+ var parentGroup = context; // In the context of a TransitionGroup all enters are really appears
1816
+
1817
+ var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
1818
+ var initialStatus;
1819
+ _this.appearStatus = null;
1820
+
1821
+ if (props.in) {
1822
+ if (appear) {
1823
+ initialStatus = EXITED;
1824
+ _this.appearStatus = ENTERING;
1825
+ } else {
1826
+ initialStatus = ENTERED;
1827
+ }
1828
+ } else {
1829
+ if (props.unmountOnExit || props.mountOnEnter) {
1830
+ initialStatus = UNMOUNTED;
1831
+ } else {
1832
+ initialStatus = EXITED;
1833
+ }
1834
+ }
1835
+
1836
+ _this.state = {
1837
+ status: initialStatus
1838
+ };
1839
+ _this.nextCallback = null;
1840
+ return _this;
1841
+ }
1842
+
1843
+ Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
1844
+ var nextIn = _ref.in;
1845
+
1846
+ if (nextIn && prevState.status === UNMOUNTED) {
1847
+ return {
1848
+ status: EXITED
1849
+ };
1850
+ }
1851
+
1852
+ return null;
1853
+ } // getSnapshotBeforeUpdate(prevProps) {
1854
+ // let nextStatus = null
1855
+ // if (prevProps !== this.props) {
1856
+ // const { status } = this.state
1857
+ // if (this.props.in) {
1858
+ // if (status !== ENTERING && status !== ENTERED) {
1859
+ // nextStatus = ENTERING
1860
+ // }
1861
+ // } else {
1862
+ // if (status === ENTERING || status === ENTERED) {
1863
+ // nextStatus = EXITING
1864
+ // }
1865
+ // }
1866
+ // }
1867
+ // return { nextStatus }
1868
+ // }
1869
+ ;
1870
+
1871
+ var _proto = Transition.prototype;
1872
+
1873
+ _proto.componentDidMount = function componentDidMount() {
1874
+ this.updateStatus(true, this.appearStatus);
1875
+ };
1876
+
1877
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
1878
+ var nextStatus = null;
1879
+
1880
+ if (prevProps !== this.props) {
1881
+ var status = this.state.status;
1882
+
1883
+ if (this.props.in) {
1884
+ if (status !== ENTERING && status !== ENTERED) {
1885
+ nextStatus = ENTERING;
1886
+ }
1887
+ } else {
1888
+ if (status === ENTERING || status === ENTERED) {
1889
+ nextStatus = EXITING;
1890
+ }
1891
+ }
1892
+ }
1893
+
1894
+ this.updateStatus(false, nextStatus);
1895
+ };
1896
+
1897
+ _proto.componentWillUnmount = function componentWillUnmount() {
1898
+ this.cancelNextCallback();
1899
+ };
1900
+
1901
+ _proto.getTimeouts = function getTimeouts() {
1902
+ var timeout = this.props.timeout;
1903
+ var exit, enter, appear;
1904
+ exit = enter = appear = timeout;
1905
+
1906
+ if (timeout != null && typeof timeout !== 'number') {
1907
+ exit = timeout.exit;
1908
+ enter = timeout.enter; // TODO: remove fallback for next major
1909
+
1910
+ appear = timeout.appear !== undefined ? timeout.appear : enter;
1911
+ }
1912
+
1913
+ return {
1914
+ exit: exit,
1915
+ enter: enter,
1916
+ appear: appear
1917
+ };
1918
+ };
1919
+
1920
+ _proto.updateStatus = function updateStatus(mounting, nextStatus) {
1921
+ if (mounting === void 0) {
1922
+ mounting = false;
1923
+ }
1924
+
1925
+ if (nextStatus !== null) {
1926
+ // nextStatus will always be ENTERING or EXITING.
1927
+ this.cancelNextCallback();
1928
+
1929
+ if (nextStatus === ENTERING) {
1930
+ this.performEnter(mounting);
1931
+ } else {
1932
+ this.performExit();
1933
+ }
1934
+ } else if (this.props.unmountOnExit && this.state.status === EXITED) {
1935
+ this.setState({
1936
+ status: UNMOUNTED
1937
+ });
1938
+ }
1939
+ };
1940
+
1941
+ _proto.performEnter = function performEnter(mounting) {
1942
+ var _this2 = this;
1943
+
1944
+ var enter = this.props.enter;
1945
+ var appearing = this.context ? this.context.isMounting : mounting;
1946
+
1947
+ var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing],
1948
+ maybeNode = _ref2[0],
1949
+ maybeAppearing = _ref2[1];
1950
+
1951
+ var timeouts = this.getTimeouts();
1952
+ var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
1953
+ // if we are mounting and running this it means appear _must_ be set
1954
+
1955
+ if (!mounting && !enter || config.disabled) {
1956
+ this.safeSetState({
1957
+ status: ENTERED
1958
+ }, function () {
1959
+ _this2.props.onEntered(maybeNode);
1960
+ });
1961
+ return;
1962
+ }
1963
+
1964
+ this.props.onEnter(maybeNode, maybeAppearing);
1965
+ this.safeSetState({
1966
+ status: ENTERING
1967
+ }, function () {
1968
+ _this2.props.onEntering(maybeNode, maybeAppearing);
1969
+
1970
+ _this2.onTransitionEnd(enterTimeout, function () {
1971
+ _this2.safeSetState({
1972
+ status: ENTERED
1973
+ }, function () {
1974
+ _this2.props.onEntered(maybeNode, maybeAppearing);
1975
+ });
1976
+ });
1977
+ });
1978
+ };
1979
+
1980
+ _proto.performExit = function performExit() {
1981
+ var _this3 = this;
1982
+
1983
+ var exit = this.props.exit;
1984
+ var timeouts = this.getTimeouts();
1985
+ var maybeNode = this.props.nodeRef ? undefined : ReactDOM.findDOMNode(this); // no exit animation skip right to EXITED
1986
+
1987
+ if (!exit || config.disabled) {
1988
+ this.safeSetState({
1989
+ status: EXITED
1990
+ }, function () {
1991
+ _this3.props.onExited(maybeNode);
1992
+ });
1993
+ return;
1994
+ }
1995
+
1996
+ this.props.onExit(maybeNode);
1997
+ this.safeSetState({
1998
+ status: EXITING
1999
+ }, function () {
2000
+ _this3.props.onExiting(maybeNode);
2001
+
2002
+ _this3.onTransitionEnd(timeouts.exit, function () {
2003
+ _this3.safeSetState({
2004
+ status: EXITED
2005
+ }, function () {
2006
+ _this3.props.onExited(maybeNode);
2007
+ });
2008
+ });
2009
+ });
2010
+ };
2011
+
2012
+ _proto.cancelNextCallback = function cancelNextCallback() {
2013
+ if (this.nextCallback !== null) {
2014
+ this.nextCallback.cancel();
2015
+ this.nextCallback = null;
2016
+ }
2017
+ };
2018
+
2019
+ _proto.safeSetState = function safeSetState(nextState, callback) {
2020
+ // This shouldn't be necessary, but there are weird race conditions with
2021
+ // setState callbacks and unmounting in testing, so always make sure that
2022
+ // we can cancel any pending setState callbacks after we unmount.
2023
+ callback = this.setNextCallback(callback);
2024
+ this.setState(nextState, callback);
2025
+ };
2026
+
2027
+ _proto.setNextCallback = function setNextCallback(callback) {
2028
+ var _this4 = this;
2029
+
2030
+ var active = true;
2031
+
2032
+ this.nextCallback = function (event) {
2033
+ if (active) {
2034
+ active = false;
2035
+ _this4.nextCallback = null;
2036
+ callback(event);
2037
+ }
2038
+ };
2039
+
2040
+ this.nextCallback.cancel = function () {
2041
+ active = false;
2042
+ };
2043
+
2044
+ return this.nextCallback;
2045
+ };
2046
+
2047
+ _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {
2048
+ this.setNextCallback(handler);
2049
+ var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);
2050
+ var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
2051
+
2052
+ if (!node || doesNotHaveTimeoutOrListener) {
2053
+ setTimeout(this.nextCallback, 0);
2054
+ return;
2055
+ }
2056
+
2057
+ if (this.props.addEndListener) {
2058
+ var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],
2059
+ maybeNode = _ref3[0],
2060
+ maybeNextCallback = _ref3[1];
2061
+
2062
+ this.props.addEndListener(maybeNode, maybeNextCallback);
2063
+ }
2064
+
2065
+ if (timeout != null) {
2066
+ setTimeout(this.nextCallback, timeout);
2067
+ }
2068
+ };
2069
+
2070
+ _proto.render = function render() {
2071
+ var status = this.state.status;
2072
+
2073
+ if (status === UNMOUNTED) {
2074
+ return null;
2075
+ }
2076
+
2077
+ var _this$props = this.props,
2078
+ children = _this$props.children;
2079
+ _this$props.in;
2080
+ _this$props.mountOnEnter;
2081
+ _this$props.unmountOnExit;
2082
+ _this$props.appear;
2083
+ _this$props.enter;
2084
+ _this$props.exit;
2085
+ _this$props.timeout;
2086
+ _this$props.addEndListener;
2087
+ _this$props.onEnter;
2088
+ _this$props.onEntering;
2089
+ _this$props.onEntered;
2090
+ _this$props.onExit;
2091
+ _this$props.onExiting;
2092
+ _this$props.onExited;
2093
+ _this$props.nodeRef;
2094
+ var childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
2095
+
2096
+ return (
2097
+ /*#__PURE__*/
2098
+ // allows for nested Transitions
2099
+ React.createElement(TransitionGroupContext.Provider, {
2100
+ value: null
2101
+ }, typeof children === 'function' ? children(status, childProps) : React.cloneElement(React.Children.only(children), childProps))
2102
+ );
2103
+ };
2104
+
2105
+ return Transition;
2106
+ }(React.Component);
2107
+
2108
+ Transition.contextType = TransitionGroupContext;
2109
+ Transition.propTypes = process.env.NODE_ENV !== "production" ? {
2110
+ /**
2111
+ * A React reference to DOM element that need to transition:
2112
+ * https://stackoverflow.com/a/51127130/4671932
2113
+ *
2114
+ * - When `nodeRef` prop is used, `node` is not passed to callback functions
2115
+ * (e.g. `onEnter`) because user already has direct access to the node.
2116
+ * - When changing `key` prop of `Transition` in a `TransitionGroup` a new
2117
+ * `nodeRef` need to be provided to `Transition` with changed `key` prop
2118
+ * (see
2119
+ * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
2120
+ */
2121
+ nodeRef: PropTypes.shape({
2122
+ current: typeof Element === 'undefined' ? PropTypes.any : function (propValue, key, componentName, location, propFullName, secret) {
2123
+ var value = propValue[key];
2124
+ return PropTypes.instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
2125
+ }
2126
+ }),
2127
+
2128
+ /**
2129
+ * A `function` child can be used instead of a React element. This function is
2130
+ * called with the current transition status (`'entering'`, `'entered'`,
2131
+ * `'exiting'`, `'exited'`), which can be used to apply context
2132
+ * specific props to a component.
2133
+ *
2134
+ * ```jsx
2135
+ * <Transition in={this.state.in} timeout={150}>
2136
+ * {state => (
2137
+ * <MyComponent className={`fade fade-${state}`} />
2138
+ * )}
2139
+ * </Transition>
2140
+ * ```
2141
+ */
2142
+ children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,
2143
+
2144
+ /**
2145
+ * Show the component; triggers the enter or exit states
2146
+ */
2147
+ in: PropTypes.bool,
2148
+
2149
+ /**
2150
+ * By default the child component is mounted immediately along with
2151
+ * the parent `Transition` component. If you want to "lazy mount" the component on the
2152
+ * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
2153
+ * mounted, even on "exited", unless you also specify `unmountOnExit`.
2154
+ */
2155
+ mountOnEnter: PropTypes.bool,
2156
+
2157
+ /**
2158
+ * By default the child component stays mounted after it reaches the `'exited'` state.
2159
+ * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
2160
+ */
2161
+ unmountOnExit: PropTypes.bool,
2162
+
2163
+ /**
2164
+ * By default the child component does not perform the enter transition when
2165
+ * it first mounts, regardless of the value of `in`. If you want this
2166
+ * behavior, set both `appear` and `in` to `true`.
2167
+ *
2168
+ * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
2169
+ * > only adds an additional enter transition. However, in the
2170
+ * > `<CSSTransition>` component that first enter transition does result in
2171
+ * > additional `.appear-*` classes, that way you can choose to style it
2172
+ * > differently.
2173
+ */
2174
+ appear: PropTypes.bool,
2175
+
2176
+ /**
2177
+ * Enable or disable enter transitions.
2178
+ */
2179
+ enter: PropTypes.bool,
2180
+
2181
+ /**
2182
+ * Enable or disable exit transitions.
2183
+ */
2184
+ exit: PropTypes.bool,
2185
+
2186
+ /**
2187
+ * The duration of the transition, in milliseconds.
2188
+ * Required unless `addEndListener` is provided.
2189
+ *
2190
+ * You may specify a single timeout for all transitions:
2191
+ *
2192
+ * ```jsx
2193
+ * timeout={500}
2194
+ * ```
2195
+ *
2196
+ * or individually:
2197
+ *
2198
+ * ```jsx
2199
+ * timeout={{
2200
+ * appear: 500,
2201
+ * enter: 300,
2202
+ * exit: 500,
2203
+ * }}
2204
+ * ```
2205
+ *
2206
+ * - `appear` defaults to the value of `enter`
2207
+ * - `enter` defaults to `0`
2208
+ * - `exit` defaults to `0`
2209
+ *
2210
+ * @type {number | { enter?: number, exit?: number, appear?: number }}
2211
+ */
2212
+ timeout: function timeout(props) {
2213
+ var pt = timeoutsShape;
2214
+ if (!props.addEndListener) pt = pt.isRequired;
2215
+
2216
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2217
+ args[_key - 1] = arguments[_key];
2218
+ }
2219
+
2220
+ return pt.apply(void 0, [props].concat(args));
2221
+ },
2222
+
2223
+ /**
2224
+ * Add a custom transition end trigger. Called with the transitioning
2225
+ * DOM node and a `done` callback. Allows for more fine grained transition end
2226
+ * logic. Timeouts are still used as a fallback if provided.
2227
+ *
2228
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2229
+ *
2230
+ * ```jsx
2231
+ * addEndListener={(node, done) => {
2232
+ * // use the css transitionend event to mark the finish of a transition
2233
+ * node.addEventListener('transitionend', done, false);
2234
+ * }}
2235
+ * ```
2236
+ */
2237
+ addEndListener: PropTypes.func,
2238
+
2239
+ /**
2240
+ * Callback fired before the "entering" status is applied. An extra parameter
2241
+ * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
2242
+ *
2243
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2244
+ *
2245
+ * @type Function(node: HtmlElement, isAppearing: bool) -> void
2246
+ */
2247
+ onEnter: PropTypes.func,
2248
+
2249
+ /**
2250
+ * Callback fired after the "entering" status is applied. An extra parameter
2251
+ * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
2252
+ *
2253
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2254
+ *
2255
+ * @type Function(node: HtmlElement, isAppearing: bool)
2256
+ */
2257
+ onEntering: PropTypes.func,
2258
+
2259
+ /**
2260
+ * Callback fired after the "entered" status is applied. An extra parameter
2261
+ * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
2262
+ *
2263
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2264
+ *
2265
+ * @type Function(node: HtmlElement, isAppearing: bool) -> void
2266
+ */
2267
+ onEntered: PropTypes.func,
2268
+
2269
+ /**
2270
+ * Callback fired before the "exiting" status is applied.
2271
+ *
2272
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2273
+ *
2274
+ * @type Function(node: HtmlElement) -> void
2275
+ */
2276
+ onExit: PropTypes.func,
2277
+
2278
+ /**
2279
+ * Callback fired after the "exiting" status is applied.
2280
+ *
2281
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2282
+ *
2283
+ * @type Function(node: HtmlElement) -> void
2284
+ */
2285
+ onExiting: PropTypes.func,
2286
+
2287
+ /**
2288
+ * Callback fired after the "exited" status is applied.
2289
+ *
2290
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed
2291
+ *
2292
+ * @type Function(node: HtmlElement) -> void
2293
+ */
2294
+ onExited: PropTypes.func
2295
+ } : {}; // Name the function so it is clearer in the documentation
2296
+
2297
+ function noop() {}
2298
+
2299
+ Transition.defaultProps = {
2300
+ in: false,
2301
+ mountOnEnter: false,
2302
+ unmountOnExit: false,
2303
+ appear: false,
2304
+ enter: true,
2305
+ exit: true,
2306
+ onEnter: noop,
2307
+ onEntering: noop,
2308
+ onEntered: noop,
2309
+ onExit: noop,
2310
+ onExiting: noop,
2311
+ onExited: noop
2312
+ };
2313
+ Transition.UNMOUNTED = UNMOUNTED;
2314
+ Transition.EXITED = EXITED;
2315
+ Transition.ENTERING = ENTERING;
2316
+ Transition.ENTERED = ENTERED;
2317
+ Transition.EXITING = EXITING;
2318
+ var Transition$1 = Transition;
2319
+
2320
+ var _addClass = function addClass$1(node, classes) {
2321
+ return node && classes && classes.split(' ').forEach(function (c) {
2322
+ return addClass(node, c);
2323
+ });
2324
+ };
2325
+
2326
+ var removeClass = function removeClass(node, classes) {
2327
+ return node && classes && classes.split(' ').forEach(function (c) {
2328
+ return removeClass$1(node, c);
2329
+ });
2330
+ };
2331
+ /**
2332
+ * A transition component inspired by the excellent
2333
+ * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
2334
+ * use it if you're using CSS transitions or animations. It's built upon the
2335
+ * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
2336
+ * component, so it inherits all of its props.
2337
+ *
2338
+ * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
2339
+ * and `exit` states of the transition. The first class is applied and then a
2340
+ * second `*-active` class in order to activate the CSS transition. After the
2341
+ * transition, matching `*-done` class names are applied to persist the
2342
+ * transition state.
2343
+ *
2344
+ * ```jsx
2345
+ * function App() {
2346
+ * const [inProp, setInProp] = useState(false);
2347
+ * return (
2348
+ * <div>
2349
+ * <CSSTransition in={inProp} timeout={200} classNames="my-node">
2350
+ * <div>
2351
+ * {"I'll receive my-node-* classes"}
2352
+ * </div>
2353
+ * </CSSTransition>
2354
+ * <button type="button" onClick={() => setInProp(true)}>
2355
+ * Click to Enter
2356
+ * </button>
2357
+ * </div>
2358
+ * );
2359
+ * }
2360
+ * ```
2361
+ *
2362
+ * When the `in` prop is set to `true`, the child component will first receive
2363
+ * the class `example-enter`, then the `example-enter-active` will be added in
2364
+ * the next tick. `CSSTransition` [forces a
2365
+ * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
2366
+ * between before adding the `example-enter-active`. This is an important trick
2367
+ * because it allows us to transition between `example-enter` and
2368
+ * `example-enter-active` even though they were added immediately one after
2369
+ * another. Most notably, this is what makes it possible for us to animate
2370
+ * _appearance_.
2371
+ *
2372
+ * ```css
2373
+ * .my-node-enter {
2374
+ * opacity: 0;
2375
+ * }
2376
+ * .my-node-enter-active {
2377
+ * opacity: 1;
2378
+ * transition: opacity 200ms;
2379
+ * }
2380
+ * .my-node-exit {
2381
+ * opacity: 1;
2382
+ * }
2383
+ * .my-node-exit-active {
2384
+ * opacity: 0;
2385
+ * transition: opacity 200ms;
2386
+ * }
2387
+ * ```
2388
+ *
2389
+ * `*-active` classes represent which styles you want to animate **to**, so it's
2390
+ * important to add `transition` declaration only to them, otherwise transitions
2391
+ * might not behave as intended! This might not be obvious when the transitions
2392
+ * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
2393
+ * the example above (minus `transition`), but it becomes apparent in more
2394
+ * complex transitions.
2395
+ *
2396
+ * **Note**: If you're using the
2397
+ * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
2398
+ * prop, make sure to define styles for `.appear-*` classes as well.
2399
+ */
2400
+
2401
+
2402
+ var CSSTransition = /*#__PURE__*/function (_React$Component) {
2403
+ _inheritsLoose(CSSTransition, _React$Component);
2404
+
2405
+ function CSSTransition() {
2406
+ var _this;
2407
+
2408
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2409
+ args[_key] = arguments[_key];
2410
+ }
2411
+
2412
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
2413
+ _this.appliedClasses = {
2414
+ appear: {},
2415
+ enter: {},
2416
+ exit: {}
2417
+ };
2418
+
2419
+ _this.onEnter = function (maybeNode, maybeAppearing) {
2420
+ var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),
2421
+ node = _this$resolveArgument[0],
2422
+ appearing = _this$resolveArgument[1];
2423
+
2424
+ _this.removeClasses(node, 'exit');
2425
+
2426
+ _this.addClass(node, appearing ? 'appear' : 'enter', 'base');
2427
+
2428
+ if (_this.props.onEnter) {
2429
+ _this.props.onEnter(maybeNode, maybeAppearing);
2430
+ }
2431
+ };
2432
+
2433
+ _this.onEntering = function (maybeNode, maybeAppearing) {
2434
+ var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),
2435
+ node = _this$resolveArgument2[0],
2436
+ appearing = _this$resolveArgument2[1];
2437
+
2438
+ var type = appearing ? 'appear' : 'enter';
2439
+
2440
+ _this.addClass(node, type, 'active');
2441
+
2442
+ if (_this.props.onEntering) {
2443
+ _this.props.onEntering(maybeNode, maybeAppearing);
2444
+ }
2445
+ };
2446
+
2447
+ _this.onEntered = function (maybeNode, maybeAppearing) {
2448
+ var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),
2449
+ node = _this$resolveArgument3[0],
2450
+ appearing = _this$resolveArgument3[1];
2451
+
2452
+ var type = appearing ? 'appear' : 'enter';
2453
+
2454
+ _this.removeClasses(node, type);
2455
+
2456
+ _this.addClass(node, type, 'done');
2457
+
2458
+ if (_this.props.onEntered) {
2459
+ _this.props.onEntered(maybeNode, maybeAppearing);
2460
+ }
2461
+ };
2462
+
2463
+ _this.onExit = function (maybeNode) {
2464
+ var _this$resolveArgument4 = _this.resolveArguments(maybeNode),
2465
+ node = _this$resolveArgument4[0];
2466
+
2467
+ _this.removeClasses(node, 'appear');
2468
+
2469
+ _this.removeClasses(node, 'enter');
2470
+
2471
+ _this.addClass(node, 'exit', 'base');
2472
+
2473
+ if (_this.props.onExit) {
2474
+ _this.props.onExit(maybeNode);
2475
+ }
2476
+ };
2477
+
2478
+ _this.onExiting = function (maybeNode) {
2479
+ var _this$resolveArgument5 = _this.resolveArguments(maybeNode),
2480
+ node = _this$resolveArgument5[0];
2481
+
2482
+ _this.addClass(node, 'exit', 'active');
2483
+
2484
+ if (_this.props.onExiting) {
2485
+ _this.props.onExiting(maybeNode);
2486
+ }
2487
+ };
2488
+
2489
+ _this.onExited = function (maybeNode) {
2490
+ var _this$resolveArgument6 = _this.resolveArguments(maybeNode),
2491
+ node = _this$resolveArgument6[0];
2492
+
2493
+ _this.removeClasses(node, 'exit');
2494
+
2495
+ _this.addClass(node, 'exit', 'done');
2496
+
2497
+ if (_this.props.onExited) {
2498
+ _this.props.onExited(maybeNode);
2499
+ }
2500
+ };
2501
+
2502
+ _this.resolveArguments = function (maybeNode, maybeAppearing) {
2503
+ return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`
2504
+ : [maybeNode, maybeAppearing];
2505
+ };
2506
+
2507
+ _this.getClassNames = function (type) {
2508
+ var classNames = _this.props.classNames;
2509
+ var isStringClassNames = typeof classNames === 'string';
2510
+ var prefix = isStringClassNames && classNames ? classNames + "-" : '';
2511
+ var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
2512
+ var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
2513
+ var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
2514
+ return {
2515
+ baseClassName: baseClassName,
2516
+ activeClassName: activeClassName,
2517
+ doneClassName: doneClassName
2518
+ };
2519
+ };
2520
+
2521
+ return _this;
2522
+ }
2523
+
2524
+ var _proto = CSSTransition.prototype;
2525
+
2526
+ _proto.addClass = function addClass(node, type, phase) {
2527
+ var className = this.getClassNames(type)[phase + "ClassName"];
2528
+
2529
+ var _this$getClassNames = this.getClassNames('enter'),
2530
+ doneClassName = _this$getClassNames.doneClassName;
2531
+
2532
+ if (type === 'appear' && phase === 'done' && doneClassName) {
2533
+ className += " " + doneClassName;
2534
+ } // This is to force a repaint,
2535
+ // which is necessary in order to transition styles when adding a class name.
2536
+
2537
+
2538
+ if (phase === 'active') {
2539
+ /* eslint-disable no-unused-expressions */
2540
+ node && node.scrollTop;
2541
+ }
2542
+
2543
+ if (className) {
2544
+ this.appliedClasses[type][phase] = className;
2545
+
2546
+ _addClass(node, className);
2547
+ }
2548
+ };
2549
+
2550
+ _proto.removeClasses = function removeClasses(node, type) {
2551
+ var _this$appliedClasses$ = this.appliedClasses[type],
2552
+ baseClassName = _this$appliedClasses$.base,
2553
+ activeClassName = _this$appliedClasses$.active,
2554
+ doneClassName = _this$appliedClasses$.done;
2555
+ this.appliedClasses[type] = {};
2556
+
2557
+ if (baseClassName) {
2558
+ removeClass(node, baseClassName);
2559
+ }
2560
+
2561
+ if (activeClassName) {
2562
+ removeClass(node, activeClassName);
2563
+ }
2564
+
2565
+ if (doneClassName) {
2566
+ removeClass(node, doneClassName);
2567
+ }
2568
+ };
2569
+
2570
+ _proto.render = function render() {
2571
+ var _this$props = this.props;
2572
+ _this$props.classNames;
2573
+ var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
2574
+
2575
+ return /*#__PURE__*/React.createElement(Transition$1, _extends({}, props, {
2576
+ onEnter: this.onEnter,
2577
+ onEntered: this.onEntered,
2578
+ onEntering: this.onEntering,
2579
+ onExit: this.onExit,
2580
+ onExiting: this.onExiting,
2581
+ onExited: this.onExited
2582
+ }));
2583
+ };
2584
+
2585
+ return CSSTransition;
2586
+ }(React.Component);
2587
+
2588
+ CSSTransition.defaultProps = {
2589
+ classNames: ''
2590
+ };
2591
+ CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, Transition$1.propTypes, {
2592
+ /**
2593
+ * The animation classNames applied to the component as it appears, enters,
2594
+ * exits or has finished the transition. A single name can be provided, which
2595
+ * will be suffixed for each stage, e.g. `classNames="fade"` applies:
2596
+ *
2597
+ * - `fade-appear`, `fade-appear-active`, `fade-appear-done`
2598
+ * - `fade-enter`, `fade-enter-active`, `fade-enter-done`
2599
+ * - `fade-exit`, `fade-exit-active`, `fade-exit-done`
2600
+ *
2601
+ * A few details to note about how these classes are applied:
2602
+ *
2603
+ * 1. They are _joined_ with the ones that are already defined on the child
2604
+ * component, so if you want to add some base styles, you can use
2605
+ * `className` without worrying that it will be overridden.
2606
+ *
2607
+ * 2. If the transition component mounts with `in={false}`, no classes are
2608
+ * applied yet. You might be expecting `*-exit-done`, but if you think
2609
+ * about it, a component cannot finish exiting if it hasn't entered yet.
2610
+ *
2611
+ * 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This
2612
+ * allows you to define different behavior for when appearing is done and
2613
+ * when regular entering is done, using selectors like
2614
+ * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply
2615
+ * an epic entrance animation when element first appears in the DOM using
2616
+ * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
2617
+ * simply use `fade-enter-done` for defining both cases.
2618
+ *
2619
+ * Each individual classNames can also be specified independently like:
2620
+ *
2621
+ * ```js
2622
+ * classNames={{
2623
+ * appear: 'my-appear',
2624
+ * appearActive: 'my-active-appear',
2625
+ * appearDone: 'my-done-appear',
2626
+ * enter: 'my-enter',
2627
+ * enterActive: 'my-active-enter',
2628
+ * enterDone: 'my-done-enter',
2629
+ * exit: 'my-exit',
2630
+ * exitActive: 'my-active-exit',
2631
+ * exitDone: 'my-done-exit',
2632
+ * }}
2633
+ * ```
2634
+ *
2635
+ * If you want to set these classes using CSS Modules:
2636
+ *
2637
+ * ```js
2638
+ * import styles from './styles.css';
2639
+ * ```
2640
+ *
2641
+ * you might want to use camelCase in your CSS file, that way could simply
2642
+ * spread them instead of listing them one by one:
2643
+ *
2644
+ * ```js
2645
+ * classNames={{ ...styles }}
2646
+ * ```
2647
+ *
2648
+ * @type {string | {
2649
+ * appear?: string,
2650
+ * appearActive?: string,
2651
+ * appearDone?: string,
2652
+ * enter?: string,
2653
+ * enterActive?: string,
2654
+ * enterDone?: string,
2655
+ * exit?: string,
2656
+ * exitActive?: string,
2657
+ * exitDone?: string,
2658
+ * }}
2659
+ */
2660
+ classNames: classNamesShape,
2661
+
2662
+ /**
2663
+ * A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
2664
+ * applied.
2665
+ *
2666
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2667
+ *
2668
+ * @type Function(node: HtmlElement, isAppearing: bool)
2669
+ */
2670
+ onEnter: PropTypes.func,
2671
+
2672
+ /**
2673
+ * A `<Transition>` callback fired immediately after the 'enter-active' or
2674
+ * 'appear-active' class is applied.
2675
+ *
2676
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2677
+ *
2678
+ * @type Function(node: HtmlElement, isAppearing: bool)
2679
+ */
2680
+ onEntering: PropTypes.func,
2681
+
2682
+ /**
2683
+ * A `<Transition>` callback fired immediately after the 'enter' or
2684
+ * 'appear' classes are **removed** and the `done` class is added to the DOM node.
2685
+ *
2686
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2687
+ *
2688
+ * @type Function(node: HtmlElement, isAppearing: bool)
2689
+ */
2690
+ onEntered: PropTypes.func,
2691
+
2692
+ /**
2693
+ * A `<Transition>` callback fired immediately after the 'exit' class is
2694
+ * applied.
2695
+ *
2696
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed
2697
+ *
2698
+ * @type Function(node: HtmlElement)
2699
+ */
2700
+ onExit: PropTypes.func,
2701
+
2702
+ /**
2703
+ * A `<Transition>` callback fired immediately after the 'exit-active' is applied.
2704
+ *
2705
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed
2706
+ *
2707
+ * @type Function(node: HtmlElement)
2708
+ */
2709
+ onExiting: PropTypes.func,
2710
+
2711
+ /**
2712
+ * A `<Transition>` callback fired immediately after the 'exit' classes
2713
+ * are **removed** and the `exit-done` class is added to the DOM node.
2714
+ *
2715
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed
2716
+ *
2717
+ * @type Function(node: HtmlElement)
2718
+ */
2719
+ onExited: PropTypes.func
2720
+ }) : {};
2721
+ var CSSTransition$1 = CSSTransition;
2722
+
2723
+ var DialogCom$1 = forwardRef(function (props, fromRef) {
2724
+ var header = props.header, content = props.content, footer = props.footer, _a = props.className, className = _a === void 0 ? "" : _a, visible = props.visible;
2725
+ var _b = __read(useState(false), 2), selfVisible = _b[0], setSelfVisible = _b[1];
2726
+ useImperativeHandle(fromRef, function () { return ({
2727
+ close: function () {
2728
+ console.log("closes");
2729
+ setSelfVisible(false);
2730
+ },
2731
+ }); });
2732
+ useEffect(function () {
2733
+ setSelfVisible(visible);
2734
+ }, [visible]);
2735
+ var dialogcls = classnames("xh-dialog", className);
2736
+ var DialogMain = (React.createElement(View, { className: dialogcls },
2737
+ React.createElement(Mask, null),
2738
+ React.createElement(CSSTransition$1, { in: selfVisible, timeout: 200, classNames: "scale", unmountOnExit: true },
2739
+ React.createElement(View, { className: "xh-dialog-content" },
2740
+ React.createElement(View, { className: "xh-dialog-content-header" }, header),
2741
+ React.createElement(View, { className: "xh-dialog-content-content" }, content),
2742
+ React.createElement(View, { className: "xh-dialog-content-footer" }, footer)))));
2743
+ return ReactDOM.createPortal(DialogMain, document.body);
2744
+ });
2745
+
2746
+ var Alert = function (props) {
2747
+ var _a = props.title, title = _a === void 0 ? "" : _a, content = props.content, _b = props.confirmText, confirmText = _b === void 0 ? "我知道了" : _b, rest = __rest(props, ["title", "content", "confirmText"]);
2748
+ return new Promise(function (resolve) {
2749
+ if (process.env.TARO_ENV === "h5") {
2750
+ var div_1 = document.createElement("div");
2751
+ var dialogRef = createRef();
2752
+ var alertFooter = (React.createElement(XhButton, { type: "primary", className: "xh-alert-button", onClick: function () {
2753
+ ReactDOM.unmountComponentAtNode(div_1);
2754
+ resolve();
2755
+ } }, confirmText));
2756
+ ReactDOM.render(React.createElement(DialogCom$1, { header: title, footer: alertFooter, content: content, visible: true, ref: dialogRef }), div_1);
2757
+ }
2758
+ else {
2759
+ showModal(__assign({ title: title, content: content, showCancel: false, confirmColor: "#f6ab00", confirmText: confirmText }, rest)).then(function () { return resolve(); });
2760
+ }
2761
+ });
2762
+ };
2763
+
2764
+ var Comfirm = function (props) {
2765
+ var _a = props.title, title = _a === void 0 ? "" : _a, content = props.content, _b = props.confirmText, confirmText = _b === void 0 ? "确定" : _b, _c = props.cancelText, cancelText = _c === void 0 ? "取消" : _c, rest = __rest(props, ["title", "content", "confirmText", "cancelText"]);
2766
+ return new Promise(function (resolve) {
2767
+ if (process.env.TARO_ENV === "h5") {
2768
+ var div_1 = document.createElement("div");
2769
+ var dialogRef = createRef();
2770
+ var alertFooter = (React.createElement("div", { className: "xh-confirm-footer" },
2771
+ React.createElement(XhButton, { className: "alert-button", onClick: function () {
2772
+ ReactDOM.unmountComponentAtNode(div_1);
2773
+ resolve({ errMsg: "ok", confirm: false, cancel: true });
2774
+ } }, cancelText),
2775
+ React.createElement(XhButton, { type: "primary", className: "alert-button", onClick: function () {
2776
+ ReactDOM.unmountComponentAtNode(div_1);
2777
+ resolve({ errMsg: "ok", confirm: true, cancel: false });
2778
+ } }, confirmText)));
2779
+ ReactDOM.render(React.createElement(DialogCom$1, { header: title, footer: alertFooter, content: content, visible: true, ref: dialogRef }), div_1);
2780
+ }
2781
+ else {
2782
+ showModal(__assign({ title: title, content: content, confirmColor: "#f6ab00", cancelText: cancelText, confirmText: confirmText }, rest)).then(resolve);
2783
+ }
2784
+ });
2785
+ };
2786
+
2787
+ var Dialog = DialogCom$1;
2788
+ Dialog.alert = Alert;
2789
+ Dialog.confirm = Comfirm;
2790
+
2791
+ var Key = function (props) {
2792
+ var children = props.children, onClick = props.onClick;
2793
+ return (React.createElement(XhButton, { shape: "square", className: "number-keyboard-key", type: "default", onClick: onClick }, children));
2794
+ };
2795
+
2796
+ var NumberKeyboard = function (props) {
2797
+ var onBlur = props.onBlur, show = props.show, _a = props.maxLength, maxLength = _a === void 0 ? Number.MAX_SAFE_INTEGER : _a, _b = props.showClose, showClose = _b === void 0 ? true : _b, _c = props.closeOnClickSpace, closeOnClickSpace = _c === void 0 ? true : _c, onClose = props.onClose, onChange = props.onChange, value = props.value, className = props.className;
2798
+ var _d = __read(useState(value), 2), input = _d[0], setInput = _d[1];
2799
+ var keys = getKeys();
2800
+ useEffect(function () {
2801
+ if (closeOnClickSpace) {
2802
+ document.addEventListener("click", handleClose);
2803
+ }
2804
+ return function () {
2805
+ document.removeEventListener("click", handleClose);
2806
+ };
2807
+ }, []);
2808
+ useEffect(function () {
2809
+ setInput(value);
2810
+ }, [value]);
2811
+ function handleClose(e) {
2812
+ onClose && onClose(e);
2813
+ onBlur && onBlur(e);
2814
+ }
2815
+ function handleKeyPress(_a) {
2816
+ var type = _a.type, value = _a.value;
2817
+ if (type === "none")
2818
+ return;
2819
+ var newInput = input;
2820
+ if (type === "delete") {
2821
+ newInput = input.slice(0, input.length - 1);
2822
+ }
2823
+ else if (newInput.length < maxLength) {
2824
+ newInput = input + value;
2825
+ }
2826
+ setInput(newInput);
2827
+ onChange && onChange(newInput);
2828
+ }
2829
+ function getKeys() {
2830
+ var keys = [];
2831
+ for (var i = 1; i <= 9; i++) {
2832
+ keys.push({ text: i, value: i, type: "number" });
2833
+ }
2834
+ keys.push({ text: "", value: "", type: "none" }, { text: 0, value: 0, type: "number" }, { text: "delete", value: "", type: "delete" });
2835
+ return keys;
2836
+ }
2837
+ var keyboardcls = classnames("xh-number-keyboard", className);
2838
+ return (React.createElement(CSSTransition$1, { classNames: "slide-up", in: show, unmountOnExit: true, timeout: 200 },
2839
+ React.createElement(View, { className: keyboardcls },
2840
+ React.createElement(View, { className: "xh-number-keyboard-header" }, showClose && (React.createElement(View, { className: "xh-number-keyboard-close", onClick: handleClose }, "\u5B8C\u6210"))),
2841
+ React.createElement(View, { className: "xh-number-keyboard-body" }, keys.map(function (key, index) { return (React.createElement(Key, { key: index, className: classnames({
2842
+ "xh-number-keyboard-key-gray": key.type !== "number",
2843
+ }), onClick: function () { return handleKeyPress(key); } }, key.type === "delete" ? (React.createElement(View, { className: "xh-number-keyboard-delete" })) : (React.createElement(View, null, key.text)))); })))));
2844
+ };
2845
+
2846
+ var PasswordInput = function (props) {
2847
+ var value = props.value, length = props.length, _a = props.mask, mask = _a === void 0 ? true : _a, onFocus = props.onFocus, className = props.className;
2848
+ function renderInputs() {
2849
+ var Inputs = [];
2850
+ for (var i = 0; i < length; i++) {
2851
+ var char = value[i];
2852
+ Inputs.push(React.createElement(View, { key: i, className: "xh-password-input-item" }, mask ? (React.createElement(View, { className: classnames({ "xh-password-input-mask": char }) })) : (char)));
2853
+ }
2854
+ return Inputs;
2855
+ }
2856
+ function handlerClick(e) {
2857
+ e.stopPropagation();
2858
+ onFocus && onFocus(e);
2859
+ }
2860
+ var xhpasswordcls = classnames("xh-password-input", className);
2861
+ return (React.createElement(View, { className: xhpasswordcls },
2862
+ React.createElement(View, { className: "xh-password-input-list", onClick: handlerClick }, renderInputs())));
2863
+ };
2864
+
2865
+ var Progress = function (props) {
2866
+ var _a = props.percent, percent = _a === void 0 ? 88 : _a, className = props.className, _b = props.showPercent, showPercent = _b === void 0 ? false : _b, _c = props.doneColor, doneColor = _c === void 0 ? "" : _c, _d = props.percentColor, percentColor = _d === void 0 ? "" : _d, height = props.height;
2867
+ var progresslcs = classnames("xh-progress", className);
2868
+ var showPercentcls = classnames("progress-bar");
2869
+ var showbarPercentcls = classnames("progress-bar-percent");
2870
+ return (React.createElement(View, { className: progresslcs },
2871
+ React.createElement(View, { className: "progress", style: { height: height && "".concat(pxTransform(height)) } },
2872
+ React.createElement(View, { style: {
2873
+ width: "".concat(percent, "%"),
2874
+ backgroundColor: doneColor,
2875
+ color: percentColor,
2876
+ }, className: showPercentcls }, showPercent && (React.createElement(View, { className: showbarPercentcls }, "".concat(percent, "%")))))));
2877
+ };
2878
+
2879
+ var ToastCom = function (props) {
2880
+ var title = props.title, _a = props.className, className = _a === void 0 ? "" : _a, _b = props.icon, icon = _b === void 0 ? "success" : _b, _c = props.image, image = _c === void 0 ? "" : _c;
2881
+ var toastcls = classnames("xh-toast", className);
2882
+ // icon-success_toast
2883
+ // icon-alert_toast
2884
+ // icon-failure_toast
2885
+ // icon-loading_toast
2886
+ var classConfig = {
2887
+ success: "icon-success_toast",
2888
+ error: "icon-failure_toast",
2889
+ loading: "icon-loading_toast",
2890
+ };
2891
+ var cls = classnames("iconfont", classConfig[icon]);
2892
+ var showIcon = useMemo(function () {
2893
+ if (image)
2894
+ return React.createElement(XHImage, { src: image, width: 24, height: 24 });
2895
+ if (icon)
2896
+ return React.createElement("span", { className: cls });
2897
+ }, [icon, image]);
2898
+ var DialogMain = (React.createElement(View, { className: toastcls },
2899
+ React.createElement(Mask, { mask: "transparent" }),
2900
+ React.createElement(CSSTransition$1, { in: true, timeout: 200, classNames: "face", unmountOnExit: true },
2901
+ React.createElement(View, { className: "xh-toast-content" },
2902
+ showIcon,
2903
+ React.createElement(View, null, title)))));
2904
+ return ReactDOM.createPortal(DialogMain, document.body);
2905
+ };
2906
+
2907
+ function Toast(arg) {
2908
+ var rest = [];
2909
+ for (var _i = 1; _i < arguments.length; _i++) {
2910
+ rest[_i - 1] = arguments[_i];
2911
+ }
2912
+ return __awaiter(this, void 0, void 0, function () {
2913
+ var defalutParam;
2914
+ return __generator(this, function (_a) {
2915
+ defalutParam = {
2916
+ title: "",
2917
+ duration: 3000,
2918
+ mask: true,
2919
+ };
2920
+ if (typeof arg === "string" || typeof arg === "number") {
2921
+ defalutParam.title = "".concat(arg);
2922
+ if (rest.length) {
2923
+ defalutParam.duration = rest[0];
2924
+ }
2925
+ }
2926
+ else {
2927
+ defalutParam = __assign(__assign({}, defalutParam), arg);
2928
+ }
2929
+ return [2 /*return*/, new Promise(function () {
2930
+ if (process.env.TARO_ENV === "h5") {
2931
+ var div = document.createElement("div");
2932
+ var timer_1 = setTimeout(function () {
2933
+ // ReactDOM.unmountComponentAtNode(div);
2934
+ clearTimeout(timer_1);
2935
+ }, defalutParam.duration);
2936
+ var title = defalutParam.title, other = __rest(defalutParam, ["title"]);
2937
+ ReactDOM.render(React.createElement(ToastCom, __assign({ title: title }, other)), div);
2938
+ }
2939
+ else {
2940
+ showToast(__assign({ icon: "none" }, defalutParam));
2941
+ }
2942
+ })];
2943
+ });
2944
+ });
2945
+ }
2946
+
2947
+ var DialogCom = forwardRef(function (props, fromRef) {
2948
+ var header = props.header, content = props.content, _a = props.className, className = _a === void 0 ? "" : _a, visible = props.visible, _b = props.showCancel, showCancel = _b === void 0 ? true : _b, onComfirm = props.onComfirm, onCancel = props.onCancel, onClose = props.onClose;
2949
+ var _c = __read(useState(false), 2), selfVisible = _c[0], setSelfVisible = _c[1];
2950
+ useImperativeHandle(fromRef, function () { return ({
2951
+ close: close,
2952
+ open: open,
2953
+ }); });
2954
+ var close = function () {
2955
+ setSelfVisible(false);
2956
+ };
2957
+ var open = function () {
2958
+ setSelfVisible(true);
2959
+ };
2960
+ var handleConfirm = function () {
2961
+ onComfirm && onComfirm();
2962
+ close();
2963
+ };
2964
+ var handleCancel = function () {
2965
+ onCancel && onCancel();
2966
+ close();
2967
+ };
2968
+ useEffect(function () {
2969
+ if (!visible) {
2970
+ onClose && onClose();
2971
+ }
2972
+ setSelfVisible(visible);
2973
+ }, [visible]);
2974
+ var dialogcls = classnames("xh-dialog-ref", className, {
2975
+ show: selfVisible,
2976
+ });
2977
+ var comfirmCls = classnames({ "one-button": !showCancel });
2978
+ var footercls = classnames("xh-dialog-ref-content-footer-button", {
2979
+ "xh-dialog-ref-content-footer-button-center": !showCancel,
2980
+ });
2981
+ var dialogFooter = (React.createElement(View, { className: footercls },
2982
+ showCancel && React.createElement(XhButton, { onClick: handleCancel }, "\u53D6\u6D88"),
2983
+ React.createElement(XhButton, { type: "primary", className: comfirmCls, onClick: handleConfirm }, "\u786E\u5B9A")));
2984
+ var DialogMain = (React.createElement(View, { className: dialogcls },
2985
+ React.createElement(Mask, null),
2986
+ React.createElement(CSSTransition$1, { in: selfVisible, timeout: 200, classNames: "scale" },
2987
+ React.createElement(View, { className: "xh-dialog-ref-content" },
2988
+ React.createElement(View, { className: "xh-dialog-ref-content-header" }, header),
2989
+ React.createElement(View, { className: "xh-dialog-ref-content-content" }, content),
2990
+ React.createElement(View, { className: "xh-dialog-ref-content-footer" }, dialogFooter)))));
2991
+ return DialogMain;
2992
+ });
2993
+
2994
+ export { XHBankIcon, XhButton as XHButton, CountdownButton as XHCaptcha, Dialog as XHDialog, DialogCom as XHDialogRef, FormInput as XHFormInput, XHImage, XHList, Loading as XHLoading, Mask as XHMask, NumberKeyboard as XHNumberKeyboard, Page as XHPage, PasswordInput as XHPasswordInput, Progress as XHProgress, Toast as XHToast };
437
2995
  //# sourceMappingURL=index.esm.js.map