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