@gravity-ui/navigation 3.0.0-beta.2 → 3.0.0-beta.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 (125) hide show
  1. package/build/cjs/{index-B6c8DVdr.js → index-D5mnpi6c.js} +8 -8
  2. package/build/cjs/{index-B6c8DVdr.js.map → index-D5mnpi6c.js.map} +1 -1
  3. package/build/cjs/index-DOLqlMz4.js +5732 -0
  4. package/build/cjs/index-DOLqlMz4.js.map +1 -0
  5. package/build/cjs/index.js +28 -4
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/esm/{index-BLdwsphX.js → index-CO69JxhQ.js} +5 -5
  8. package/build/esm/{index-BLdwsphX.js.map → index-CO69JxhQ.js.map} +1 -1
  9. package/build/esm/index-Cj3tqMQo.js +5687 -0
  10. package/build/esm/index-Cj3tqMQo.js.map +1 -0
  11. package/build/esm/index.js +5 -3
  12. package/build/esm/index.js.map +1 -1
  13. package/package.json +1 -1
  14. package/build/cjs/ActionBar-_qjZ9IMA.js +0 -59
  15. package/build/cjs/ActionBar-_qjZ9IMA.js.map +0 -1
  16. package/build/cjs/AsideFallback.js +0 -25
  17. package/build/cjs/AsideFallback.js.map +0 -1
  18. package/build/cjs/AsideHeader.js +0 -33
  19. package/build/cjs/AsideHeader.js.map +0 -1
  20. package/build/cjs/AsideHeaderContext.js +0 -38
  21. package/build/cjs/AsideHeaderContext.js.map +0 -1
  22. package/build/cjs/Content-Dy2XkiRi.js +0 -16
  23. package/build/cjs/Content-Dy2XkiRi.js.map +0 -1
  24. package/build/cjs/Drawer.js +0 -2493
  25. package/build/cjs/Drawer.js.map +0 -1
  26. package/build/cjs/FooterItem-CLk0aHrc.js +0 -332
  27. package/build/cjs/FooterItem-CLk0aHrc.js.map +0 -1
  28. package/build/cjs/FooterItem.js +0 -26
  29. package/build/cjs/FooterItem.js.map +0 -1
  30. package/build/cjs/HotkeysPanel-C436myZY.js +0 -63
  31. package/build/cjs/HotkeysPanel-C436myZY.js.map +0 -1
  32. package/build/cjs/Item-CLHysLDd.js +0 -328
  33. package/build/cjs/Item-CLHysLDd.js.map +0 -1
  34. package/build/cjs/PageLayout.js +0 -34
  35. package/build/cjs/PageLayout.js.map +0 -1
  36. package/build/cjs/PageLayoutAside-SMHlPBAO.js +0 -979
  37. package/build/cjs/PageLayoutAside-SMHlPBAO.js.map +0 -1
  38. package/build/cjs/PageLayoutAside.js +0 -24
  39. package/build/cjs/PageLayoutAside.js.map +0 -1
  40. package/build/cjs/Settings-x0a3P0Vr.js +0 -586
  41. package/build/cjs/Settings-x0a3P0Vr.js.map +0 -1
  42. package/build/cjs/Title-CzxcSMoP.js +0 -36
  43. package/build/cjs/Title-CzxcSMoP.js.map +0 -1
  44. package/build/cjs/_commonjsHelpers-BJu3ubxk.js +0 -11
  45. package/build/cjs/_commonjsHelpers-BJu3ubxk.js.map +0 -1
  46. package/build/cjs/cn-DSlPZbcs.js +0 -11
  47. package/build/cjs/cn-DSlPZbcs.js.map +0 -1
  48. package/build/cjs/constants-B0DLAQY9.js +0 -14
  49. package/build/cjs/constants-B0DLAQY9.js.map +0 -1
  50. package/build/cjs/debounce-RFF04eVR.js +0 -660
  51. package/build/cjs/debounce-RFF04eVR.js.map +0 -1
  52. package/build/cjs/divider-collapsed-BLSp99lJ.js +0 -39
  53. package/build/cjs/divider-collapsed-BLSp99lJ.js.map +0 -1
  54. package/build/cjs/index2.js +0 -15
  55. package/build/cjs/index2.js.map +0 -1
  56. package/build/cjs/index3.js +0 -17
  57. package/build/cjs/index3.js.map +0 -1
  58. package/build/cjs/index4.js +0 -21
  59. package/build/cjs/index4.js.map +0 -1
  60. package/build/cjs/index5.js +0 -22
  61. package/build/cjs/index5.js.map +0 -1
  62. package/build/cjs/index6.js +0 -194
  63. package/build/cjs/index6.js.map +0 -1
  64. package/build/cjs/style-inject.es-CsU6UJbw.js +0 -31
  65. package/build/cjs/style-inject.es-CsU6UJbw.js.map +0 -1
  66. package/build/cjs/tslib.es6-D25eJ2i9.js +0 -38
  67. package/build/cjs/tslib.es6-D25eJ2i9.js.map +0 -1
  68. package/build/cjs/utils-BrRoop7o.js +0 -8
  69. package/build/cjs/utils-BrRoop7o.js.map +0 -1
  70. package/build/esm/ActionBar-BD_roj92.js +0 -57
  71. package/build/esm/ActionBar-BD_roj92.js.map +0 -1
  72. package/build/esm/AsideFallback.js +0 -23
  73. package/build/esm/AsideFallback.js.map +0 -1
  74. package/build/esm/AsideHeader.js +0 -31
  75. package/build/esm/AsideHeader.js.map +0 -1
  76. package/build/esm/AsideHeaderContext.js +0 -31
  77. package/build/esm/AsideHeaderContext.js.map +0 -1
  78. package/build/esm/Content-c3e3OunO.js +0 -14
  79. package/build/esm/Content-c3e3OunO.js.map +0 -1
  80. package/build/esm/Drawer.js +0 -2472
  81. package/build/esm/Drawer.js.map +0 -1
  82. package/build/esm/FooterItem-DuFjLZPI.js +0 -326
  83. package/build/esm/FooterItem-DuFjLZPI.js.map +0 -1
  84. package/build/esm/FooterItem.js +0 -24
  85. package/build/esm/FooterItem.js.map +0 -1
  86. package/build/esm/HotkeysPanel-BWL1Xkqi.js +0 -61
  87. package/build/esm/HotkeysPanel-BWL1Xkqi.js.map +0 -1
  88. package/build/esm/Item-BU0M-jfC.js +0 -318
  89. package/build/esm/Item-BU0M-jfC.js.map +0 -1
  90. package/build/esm/PageLayout.js +0 -32
  91. package/build/esm/PageLayout.js.map +0 -1
  92. package/build/esm/PageLayoutAside-Bd3aJNrH.js +0 -958
  93. package/build/esm/PageLayoutAside-Bd3aJNrH.js.map +0 -1
  94. package/build/esm/PageLayoutAside.js +0 -18
  95. package/build/esm/PageLayoutAside.js.map +0 -1
  96. package/build/esm/Settings-BC6Kmplf.js +0 -564
  97. package/build/esm/Settings-BC6Kmplf.js.map +0 -1
  98. package/build/esm/Title-CRlzgg4r.js +0 -34
  99. package/build/esm/Title-CRlzgg4r.js.map +0 -1
  100. package/build/esm/_commonjsHelpers-BFTU3MAI.js +0 -8
  101. package/build/esm/_commonjsHelpers-BFTU3MAI.js.map +0 -1
  102. package/build/esm/cn-CgiqTV3v.js +0 -8
  103. package/build/esm/cn-CgiqTV3v.js.map +0 -1
  104. package/build/esm/constants-ChYDZ5F2.js +0 -8
  105. package/build/esm/constants-ChYDZ5F2.js.map +0 -1
  106. package/build/esm/debounce-DW3XyyUs.js +0 -658
  107. package/build/esm/debounce-DW3XyyUs.js.map +0 -1
  108. package/build/esm/divider-collapsed-BgKmR8h9.js +0 -18
  109. package/build/esm/divider-collapsed-BgKmR8h9.js.map +0 -1
  110. package/build/esm/index2.js +0 -9
  111. package/build/esm/index2.js.map +0 -1
  112. package/build/esm/index3.js +0 -11
  113. package/build/esm/index3.js.map +0 -1
  114. package/build/esm/index4.js +0 -13
  115. package/build/esm/index4.js.map +0 -1
  116. package/build/esm/index5.js +0 -13
  117. package/build/esm/index5.js.map +0 -1
  118. package/build/esm/index6.js +0 -171
  119. package/build/esm/index6.js.map +0 -1
  120. package/build/esm/style-inject.es-Bff-fD1R.js +0 -29
  121. package/build/esm/style-inject.es-Bff-fD1R.js.map +0 -1
  122. package/build/esm/tslib.es6-BCqiemNI.js +0 -36
  123. package/build/esm/tslib.es6-BCqiemNI.js.map +0 -1
  124. package/build/esm/utils-D0s6YtvW.js +0 -6
  125. package/build/esm/utils-D0s6YtvW.js.map +0 -1
@@ -1,2472 +0,0 @@
1
- import * as React from 'react';
2
- import React__default from 'react';
3
- import { useForkRef, Portal } from '@gravity-ui/uikit';
4
- import { b as block } from './cn-CgiqTV3v.js';
5
- import { s as styleInject } from './style-inject.es-Bff-fD1R.js';
6
- import { g as getDefaultExportFromCjs } from './_commonjsHelpers-BFTU3MAI.js';
7
- import ReactDOM from 'react-dom';
8
- import '@bem-react/classname';
9
-
10
- function _extends() {
11
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
12
- for (var e = 1; e < arguments.length; e++) {
13
- var t = arguments[e];
14
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
15
- }
16
- return n;
17
- }, _extends.apply(null, arguments);
18
- }
19
-
20
- function _objectWithoutPropertiesLoose(r, e) {
21
- if (null == r) return {};
22
- var t = {};
23
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
24
- if (e.indexOf(n) >= 0) continue;
25
- t[n] = r[n];
26
- }
27
- return t;
28
- }
29
-
30
- function _setPrototypeOf(t, e) {
31
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
32
- return t.__proto__ = e, t;
33
- }, _setPrototypeOf(t, e);
34
- }
35
-
36
- function _inheritsLoose(t, o) {
37
- t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
38
- }
39
-
40
- var propTypes = {exports: {}};
41
-
42
- var reactIs = {exports: {}};
43
-
44
- var reactIs_production_min = {};
45
-
46
- /** @license React v16.13.1
47
- * react-is.production.min.js
48
- *
49
- * Copyright (c) Facebook, Inc. and its affiliates.
50
- *
51
- * This source code is licensed under the MIT license found in the
52
- * LICENSE file in the root directory of this source tree.
53
- */
54
-
55
- var hasRequiredReactIs_production_min;
56
-
57
- function requireReactIs_production_min () {
58
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
59
- hasRequiredReactIs_production_min = 1;
60
- 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?
61
- 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;
62
- 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}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
63
- reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
64
- reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
65
- reactIs_production_min.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)};reactIs_production_min.typeOf=z;
66
- return reactIs_production_min;
67
- }
68
-
69
- var reactIs_development = {};
70
-
71
- /** @license React v16.13.1
72
- * react-is.development.js
73
- *
74
- * Copyright (c) Facebook, Inc. and its affiliates.
75
- *
76
- * This source code is licensed under the MIT license found in the
77
- * LICENSE file in the root directory of this source tree.
78
- */
79
-
80
- var hasRequiredReactIs_development;
81
-
82
- function requireReactIs_development () {
83
- if (hasRequiredReactIs_development) return reactIs_development;
84
- hasRequiredReactIs_development = 1;
85
-
86
-
87
-
88
- if (process.env.NODE_ENV !== "production") {
89
- (function() {
90
-
91
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
92
- // nor polyfill, then a plain number is used for performance.
93
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
94
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
95
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
96
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
97
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
98
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
99
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
100
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
101
- // (unstable) APIs that have been removed. Can we remove the symbols?
102
-
103
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
104
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
105
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
106
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
107
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
108
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
109
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
110
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
111
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
112
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
113
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
114
-
115
- function isValidElementType(type) {
116
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
117
- 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);
118
- }
119
-
120
- function typeOf(object) {
121
- if (typeof object === 'object' && object !== null) {
122
- var $$typeof = object.$$typeof;
123
-
124
- switch ($$typeof) {
125
- case REACT_ELEMENT_TYPE:
126
- var type = object.type;
127
-
128
- switch (type) {
129
- case REACT_ASYNC_MODE_TYPE:
130
- case REACT_CONCURRENT_MODE_TYPE:
131
- case REACT_FRAGMENT_TYPE:
132
- case REACT_PROFILER_TYPE:
133
- case REACT_STRICT_MODE_TYPE:
134
- case REACT_SUSPENSE_TYPE:
135
- return type;
136
-
137
- default:
138
- var $$typeofType = type && type.$$typeof;
139
-
140
- switch ($$typeofType) {
141
- case REACT_CONTEXT_TYPE:
142
- case REACT_FORWARD_REF_TYPE:
143
- case REACT_LAZY_TYPE:
144
- case REACT_MEMO_TYPE:
145
- case REACT_PROVIDER_TYPE:
146
- return $$typeofType;
147
-
148
- default:
149
- return $$typeof;
150
- }
151
-
152
- }
153
-
154
- case REACT_PORTAL_TYPE:
155
- return $$typeof;
156
- }
157
- }
158
-
159
- return undefined;
160
- } // AsyncMode is deprecated along with isAsyncMode
161
-
162
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
163
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
164
- var ContextConsumer = REACT_CONTEXT_TYPE;
165
- var ContextProvider = REACT_PROVIDER_TYPE;
166
- var Element = REACT_ELEMENT_TYPE;
167
- var ForwardRef = REACT_FORWARD_REF_TYPE;
168
- var Fragment = REACT_FRAGMENT_TYPE;
169
- var Lazy = REACT_LAZY_TYPE;
170
- var Memo = REACT_MEMO_TYPE;
171
- var Portal = REACT_PORTAL_TYPE;
172
- var Profiler = REACT_PROFILER_TYPE;
173
- var StrictMode = REACT_STRICT_MODE_TYPE;
174
- var Suspense = REACT_SUSPENSE_TYPE;
175
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
176
-
177
- function isAsyncMode(object) {
178
- {
179
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
180
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
181
-
182
- 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.');
183
- }
184
- }
185
-
186
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
187
- }
188
- function isConcurrentMode(object) {
189
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
190
- }
191
- function isContextConsumer(object) {
192
- return typeOf(object) === REACT_CONTEXT_TYPE;
193
- }
194
- function isContextProvider(object) {
195
- return typeOf(object) === REACT_PROVIDER_TYPE;
196
- }
197
- function isElement(object) {
198
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
199
- }
200
- function isForwardRef(object) {
201
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
202
- }
203
- function isFragment(object) {
204
- return typeOf(object) === REACT_FRAGMENT_TYPE;
205
- }
206
- function isLazy(object) {
207
- return typeOf(object) === REACT_LAZY_TYPE;
208
- }
209
- function isMemo(object) {
210
- return typeOf(object) === REACT_MEMO_TYPE;
211
- }
212
- function isPortal(object) {
213
- return typeOf(object) === REACT_PORTAL_TYPE;
214
- }
215
- function isProfiler(object) {
216
- return typeOf(object) === REACT_PROFILER_TYPE;
217
- }
218
- function isStrictMode(object) {
219
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
220
- }
221
- function isSuspense(object) {
222
- return typeOf(object) === REACT_SUSPENSE_TYPE;
223
- }
224
-
225
- reactIs_development.AsyncMode = AsyncMode;
226
- reactIs_development.ConcurrentMode = ConcurrentMode;
227
- reactIs_development.ContextConsumer = ContextConsumer;
228
- reactIs_development.ContextProvider = ContextProvider;
229
- reactIs_development.Element = Element;
230
- reactIs_development.ForwardRef = ForwardRef;
231
- reactIs_development.Fragment = Fragment;
232
- reactIs_development.Lazy = Lazy;
233
- reactIs_development.Memo = Memo;
234
- reactIs_development.Portal = Portal;
235
- reactIs_development.Profiler = Profiler;
236
- reactIs_development.StrictMode = StrictMode;
237
- reactIs_development.Suspense = Suspense;
238
- reactIs_development.isAsyncMode = isAsyncMode;
239
- reactIs_development.isConcurrentMode = isConcurrentMode;
240
- reactIs_development.isContextConsumer = isContextConsumer;
241
- reactIs_development.isContextProvider = isContextProvider;
242
- reactIs_development.isElement = isElement;
243
- reactIs_development.isForwardRef = isForwardRef;
244
- reactIs_development.isFragment = isFragment;
245
- reactIs_development.isLazy = isLazy;
246
- reactIs_development.isMemo = isMemo;
247
- reactIs_development.isPortal = isPortal;
248
- reactIs_development.isProfiler = isProfiler;
249
- reactIs_development.isStrictMode = isStrictMode;
250
- reactIs_development.isSuspense = isSuspense;
251
- reactIs_development.isValidElementType = isValidElementType;
252
- reactIs_development.typeOf = typeOf;
253
- })();
254
- }
255
- return reactIs_development;
256
- }
257
-
258
- var hasRequiredReactIs;
259
-
260
- function requireReactIs () {
261
- if (hasRequiredReactIs) return reactIs.exports;
262
- hasRequiredReactIs = 1;
263
-
264
- if (process.env.NODE_ENV === 'production') {
265
- reactIs.exports = requireReactIs_production_min();
266
- } else {
267
- reactIs.exports = requireReactIs_development();
268
- }
269
- return reactIs.exports;
270
- }
271
-
272
- /*
273
- object-assign
274
- (c) Sindre Sorhus
275
- @license MIT
276
- */
277
-
278
- var objectAssign;
279
- var hasRequiredObjectAssign;
280
-
281
- function requireObjectAssign () {
282
- if (hasRequiredObjectAssign) return objectAssign;
283
- hasRequiredObjectAssign = 1;
284
- /* eslint-disable no-unused-vars */
285
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
286
- var hasOwnProperty = Object.prototype.hasOwnProperty;
287
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
288
-
289
- function toObject(val) {
290
- if (val === null || val === undefined) {
291
- throw new TypeError('Object.assign cannot be called with null or undefined');
292
- }
293
-
294
- return Object(val);
295
- }
296
-
297
- function shouldUseNative() {
298
- try {
299
- if (!Object.assign) {
300
- return false;
301
- }
302
-
303
- // Detect buggy property enumeration order in older V8 versions.
304
-
305
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
306
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
307
- test1[5] = 'de';
308
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
309
- return false;
310
- }
311
-
312
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
313
- var test2 = {};
314
- for (var i = 0; i < 10; i++) {
315
- test2['_' + String.fromCharCode(i)] = i;
316
- }
317
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
318
- return test2[n];
319
- });
320
- if (order2.join('') !== '0123456789') {
321
- return false;
322
- }
323
-
324
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
325
- var test3 = {};
326
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
327
- test3[letter] = letter;
328
- });
329
- if (Object.keys(Object.assign({}, test3)).join('') !==
330
- 'abcdefghijklmnopqrst') {
331
- return false;
332
- }
333
-
334
- return true;
335
- } catch (err) {
336
- // We don't expect any of the above to throw, but better to be safe.
337
- return false;
338
- }
339
- }
340
-
341
- objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
342
- var from;
343
- var to = toObject(target);
344
- var symbols;
345
-
346
- for (var s = 1; s < arguments.length; s++) {
347
- from = Object(arguments[s]);
348
-
349
- for (var key in from) {
350
- if (hasOwnProperty.call(from, key)) {
351
- to[key] = from[key];
352
- }
353
- }
354
-
355
- if (getOwnPropertySymbols) {
356
- symbols = getOwnPropertySymbols(from);
357
- for (var i = 0; i < symbols.length; i++) {
358
- if (propIsEnumerable.call(from, symbols[i])) {
359
- to[symbols[i]] = from[symbols[i]];
360
- }
361
- }
362
- }
363
- }
364
-
365
- return to;
366
- };
367
- return objectAssign;
368
- }
369
-
370
- /**
371
- * Copyright (c) 2013-present, Facebook, Inc.
372
- *
373
- * This source code is licensed under the MIT license found in the
374
- * LICENSE file in the root directory of this source tree.
375
- */
376
-
377
- var ReactPropTypesSecret_1;
378
- var hasRequiredReactPropTypesSecret;
379
-
380
- function requireReactPropTypesSecret () {
381
- if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
382
- hasRequiredReactPropTypesSecret = 1;
383
-
384
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
385
-
386
- ReactPropTypesSecret_1 = ReactPropTypesSecret;
387
- return ReactPropTypesSecret_1;
388
- }
389
-
390
- var has;
391
- var hasRequiredHas;
392
-
393
- function requireHas () {
394
- if (hasRequiredHas) return has;
395
- hasRequiredHas = 1;
396
- has = Function.call.bind(Object.prototype.hasOwnProperty);
397
- return has;
398
- }
399
-
400
- /**
401
- * Copyright (c) 2013-present, Facebook, Inc.
402
- *
403
- * This source code is licensed under the MIT license found in the
404
- * LICENSE file in the root directory of this source tree.
405
- */
406
-
407
- var checkPropTypes_1;
408
- var hasRequiredCheckPropTypes;
409
-
410
- function requireCheckPropTypes () {
411
- if (hasRequiredCheckPropTypes) return checkPropTypes_1;
412
- hasRequiredCheckPropTypes = 1;
413
-
414
- var printWarning = function() {};
415
-
416
- if (process.env.NODE_ENV !== 'production') {
417
- var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
418
- var loggedTypeFailures = {};
419
- var has = /*@__PURE__*/ requireHas();
420
-
421
- printWarning = function(text) {
422
- var message = 'Warning: ' + text;
423
- if (typeof console !== 'undefined') {
424
- console.error(message);
425
- }
426
- try {
427
- // --- Welcome to debugging React ---
428
- // This error was thrown as a convenience so that you can use this stack
429
- // to find the callsite that caused this warning to fire.
430
- throw new Error(message);
431
- } catch (x) { /**/ }
432
- };
433
- }
434
-
435
- /**
436
- * Assert that the values match with the type specs.
437
- * Error messages are memorized and will only be shown once.
438
- *
439
- * @param {object} typeSpecs Map of name to a ReactPropType
440
- * @param {object} values Runtime values that need to be type-checked
441
- * @param {string} location e.g. "prop", "context", "child context"
442
- * @param {string} componentName Name of the component for error messages.
443
- * @param {?Function} getStack Returns the component stack.
444
- * @private
445
- */
446
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
447
- if (process.env.NODE_ENV !== 'production') {
448
- for (var typeSpecName in typeSpecs) {
449
- if (has(typeSpecs, typeSpecName)) {
450
- var error;
451
- // Prop type validation may throw. In case they do, we don't want to
452
- // fail the render phase where it didn't fail before. So we log it.
453
- // After these have been cleaned up, we'll let them throw.
454
- try {
455
- // This is intentionally an invariant that gets caught. It's the same
456
- // behavior as without this statement except with a better message.
457
- if (typeof typeSpecs[typeSpecName] !== 'function') {
458
- var err = Error(
459
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
460
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
461
- 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
462
- );
463
- err.name = 'Invariant Violation';
464
- throw err;
465
- }
466
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
467
- } catch (ex) {
468
- error = ex;
469
- }
470
- if (error && !(error instanceof Error)) {
471
- printWarning(
472
- (componentName || 'React class') + ': type specification of ' +
473
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
474
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
475
- 'You may have forgotten to pass an argument to the type checker ' +
476
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
477
- 'shape all require an argument).'
478
- );
479
- }
480
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
481
- // Only monitor this failure once because there tends to be a lot of the
482
- // same error.
483
- loggedTypeFailures[error.message] = true;
484
-
485
- var stack = getStack ? getStack() : '';
486
-
487
- printWarning(
488
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
489
- );
490
- }
491
- }
492
- }
493
- }
494
- }
495
-
496
- /**
497
- * Resets warning cache when testing.
498
- *
499
- * @private
500
- */
501
- checkPropTypes.resetWarningCache = function() {
502
- if (process.env.NODE_ENV !== 'production') {
503
- loggedTypeFailures = {};
504
- }
505
- };
506
-
507
- checkPropTypes_1 = checkPropTypes;
508
- return checkPropTypes_1;
509
- }
510
-
511
- /**
512
- * Copyright (c) 2013-present, Facebook, Inc.
513
- *
514
- * This source code is licensed under the MIT license found in the
515
- * LICENSE file in the root directory of this source tree.
516
- */
517
-
518
- var factoryWithTypeCheckers;
519
- var hasRequiredFactoryWithTypeCheckers;
520
-
521
- function requireFactoryWithTypeCheckers () {
522
- if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
523
- hasRequiredFactoryWithTypeCheckers = 1;
524
-
525
- var ReactIs = requireReactIs();
526
- var assign = requireObjectAssign();
527
-
528
- var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
529
- var has = /*@__PURE__*/ requireHas();
530
- var checkPropTypes = /*@__PURE__*/ requireCheckPropTypes();
531
-
532
- var printWarning = function() {};
533
-
534
- if (process.env.NODE_ENV !== 'production') {
535
- printWarning = function(text) {
536
- var message = 'Warning: ' + text;
537
- if (typeof console !== 'undefined') {
538
- console.error(message);
539
- }
540
- try {
541
- // --- Welcome to debugging React ---
542
- // This error was thrown as a convenience so that you can use this stack
543
- // to find the callsite that caused this warning to fire.
544
- throw new Error(message);
545
- } catch (x) {}
546
- };
547
- }
548
-
549
- function emptyFunctionThatReturnsNull() {
550
- return null;
551
- }
552
-
553
- factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
554
- /* global Symbol */
555
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
556
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
557
-
558
- /**
559
- * Returns the iterator method function contained on the iterable object.
560
- *
561
- * Be sure to invoke the function with the iterable as context:
562
- *
563
- * var iteratorFn = getIteratorFn(myIterable);
564
- * if (iteratorFn) {
565
- * var iterator = iteratorFn.call(myIterable);
566
- * ...
567
- * }
568
- *
569
- * @param {?object} maybeIterable
570
- * @return {?function}
571
- */
572
- function getIteratorFn(maybeIterable) {
573
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
574
- if (typeof iteratorFn === 'function') {
575
- return iteratorFn;
576
- }
577
- }
578
-
579
- /**
580
- * Collection of methods that allow declaration and validation of props that are
581
- * supplied to React components. Example usage:
582
- *
583
- * var Props = require('ReactPropTypes');
584
- * var MyArticle = React.createClass({
585
- * propTypes: {
586
- * // An optional string prop named "description".
587
- * description: Props.string,
588
- *
589
- * // A required enum prop named "category".
590
- * category: Props.oneOf(['News','Photos']).isRequired,
591
- *
592
- * // A prop named "dialog" that requires an instance of Dialog.
593
- * dialog: Props.instanceOf(Dialog).isRequired
594
- * },
595
- * render: function() { ... }
596
- * });
597
- *
598
- * A more formal specification of how these methods are used:
599
- *
600
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
601
- * decl := ReactPropTypes.{type}(.isRequired)?
602
- *
603
- * Each and every declaration produces a function with the same signature. This
604
- * allows the creation of custom validation functions. For example:
605
- *
606
- * var MyLink = React.createClass({
607
- * propTypes: {
608
- * // An optional string or URI prop named "href".
609
- * href: function(props, propName, componentName) {
610
- * var propValue = props[propName];
611
- * if (propValue != null && typeof propValue !== 'string' &&
612
- * !(propValue instanceof URI)) {
613
- * return new Error(
614
- * 'Expected a string or an URI for ' + propName + ' in ' +
615
- * componentName
616
- * );
617
- * }
618
- * }
619
- * },
620
- * render: function() {...}
621
- * });
622
- *
623
- * @internal
624
- */
625
-
626
- var ANONYMOUS = '<<anonymous>>';
627
-
628
- // Important!
629
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
630
- var ReactPropTypes = {
631
- array: createPrimitiveTypeChecker('array'),
632
- bigint: createPrimitiveTypeChecker('bigint'),
633
- bool: createPrimitiveTypeChecker('boolean'),
634
- func: createPrimitiveTypeChecker('function'),
635
- number: createPrimitiveTypeChecker('number'),
636
- object: createPrimitiveTypeChecker('object'),
637
- string: createPrimitiveTypeChecker('string'),
638
- symbol: createPrimitiveTypeChecker('symbol'),
639
-
640
- any: createAnyTypeChecker(),
641
- arrayOf: createArrayOfTypeChecker,
642
- element: createElementTypeChecker(),
643
- elementType: createElementTypeTypeChecker(),
644
- instanceOf: createInstanceTypeChecker,
645
- node: createNodeChecker(),
646
- objectOf: createObjectOfTypeChecker,
647
- oneOf: createEnumTypeChecker,
648
- oneOfType: createUnionTypeChecker,
649
- shape: createShapeTypeChecker,
650
- exact: createStrictShapeTypeChecker,
651
- };
652
-
653
- /**
654
- * inlined Object.is polyfill to avoid requiring consumers ship their own
655
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
656
- */
657
- /*eslint-disable no-self-compare*/
658
- function is(x, y) {
659
- // SameValue algorithm
660
- if (x === y) {
661
- // Steps 1-5, 7-10
662
- // Steps 6.b-6.e: +0 != -0
663
- return x !== 0 || 1 / x === 1 / y;
664
- } else {
665
- // Step 6.a: NaN == NaN
666
- return x !== x && y !== y;
667
- }
668
- }
669
- /*eslint-enable no-self-compare*/
670
-
671
- /**
672
- * We use an Error-like object for backward compatibility as people may call
673
- * PropTypes directly and inspect their output. However, we don't use real
674
- * Errors anymore. We don't inspect their stack anyway, and creating them
675
- * is prohibitively expensive if they are created too often, such as what
676
- * happens in oneOfType() for any type before the one that matched.
677
- */
678
- function PropTypeError(message, data) {
679
- this.message = message;
680
- this.data = data && typeof data === 'object' ? data: {};
681
- this.stack = '';
682
- }
683
- // Make `instanceof Error` still work for returned errors.
684
- PropTypeError.prototype = Error.prototype;
685
-
686
- function createChainableTypeChecker(validate) {
687
- if (process.env.NODE_ENV !== 'production') {
688
- var manualPropTypeCallCache = {};
689
- var manualPropTypeWarningCount = 0;
690
- }
691
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
692
- componentName = componentName || ANONYMOUS;
693
- propFullName = propFullName || propName;
694
-
695
- if (secret !== ReactPropTypesSecret) {
696
- if (throwOnDirectAccess) {
697
- // New behavior only for users of `prop-types` package
698
- var err = new Error(
699
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
700
- 'Use `PropTypes.checkPropTypes()` to call them. ' +
701
- 'Read more at http://fb.me/use-check-prop-types'
702
- );
703
- err.name = 'Invariant Violation';
704
- throw err;
705
- } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
706
- // Old behavior for people using React.PropTypes
707
- var cacheKey = componentName + ':' + propName;
708
- if (
709
- !manualPropTypeCallCache[cacheKey] &&
710
- // Avoid spamming the console because they are often not actionable except for lib authors
711
- manualPropTypeWarningCount < 3
712
- ) {
713
- printWarning(
714
- 'You are manually calling a React.PropTypes validation ' +
715
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
716
- 'and will throw in the standalone `prop-types` package. ' +
717
- 'You may be seeing this warning due to a third-party PropTypes ' +
718
- 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
719
- );
720
- manualPropTypeCallCache[cacheKey] = true;
721
- manualPropTypeWarningCount++;
722
- }
723
- }
724
- }
725
- if (props[propName] == null) {
726
- if (isRequired) {
727
- if (props[propName] === null) {
728
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
729
- }
730
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
731
- }
732
- return null;
733
- } else {
734
- return validate(props, propName, componentName, location, propFullName);
735
- }
736
- }
737
-
738
- var chainedCheckType = checkType.bind(null, false);
739
- chainedCheckType.isRequired = checkType.bind(null, true);
740
-
741
- return chainedCheckType;
742
- }
743
-
744
- function createPrimitiveTypeChecker(expectedType) {
745
- function validate(props, propName, componentName, location, propFullName, secret) {
746
- var propValue = props[propName];
747
- var propType = getPropType(propValue);
748
- if (propType !== expectedType) {
749
- // `propValue` being instance of, say, date/regexp, pass the 'object'
750
- // check, but we can offer a more precise error message here rather than
751
- // 'of type `object`'.
752
- var preciseType = getPreciseType(propValue);
753
-
754
- return new PropTypeError(
755
- 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
756
- {expectedType: expectedType}
757
- );
758
- }
759
- return null;
760
- }
761
- return createChainableTypeChecker(validate);
762
- }
763
-
764
- function createAnyTypeChecker() {
765
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
766
- }
767
-
768
- function createArrayOfTypeChecker(typeChecker) {
769
- function validate(props, propName, componentName, location, propFullName) {
770
- if (typeof typeChecker !== 'function') {
771
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
772
- }
773
- var propValue = props[propName];
774
- if (!Array.isArray(propValue)) {
775
- var propType = getPropType(propValue);
776
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
777
- }
778
- for (var i = 0; i < propValue.length; i++) {
779
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
780
- if (error instanceof Error) {
781
- return error;
782
- }
783
- }
784
- return null;
785
- }
786
- return createChainableTypeChecker(validate);
787
- }
788
-
789
- function createElementTypeChecker() {
790
- function validate(props, propName, componentName, location, propFullName) {
791
- var propValue = props[propName];
792
- if (!isValidElement(propValue)) {
793
- var propType = getPropType(propValue);
794
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
795
- }
796
- return null;
797
- }
798
- return createChainableTypeChecker(validate);
799
- }
800
-
801
- function createElementTypeTypeChecker() {
802
- function validate(props, propName, componentName, location, propFullName) {
803
- var propValue = props[propName];
804
- if (!ReactIs.isValidElementType(propValue)) {
805
- var propType = getPropType(propValue);
806
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
807
- }
808
- return null;
809
- }
810
- return createChainableTypeChecker(validate);
811
- }
812
-
813
- function createInstanceTypeChecker(expectedClass) {
814
- function validate(props, propName, componentName, location, propFullName) {
815
- if (!(props[propName] instanceof expectedClass)) {
816
- var expectedClassName = expectedClass.name || ANONYMOUS;
817
- var actualClassName = getClassName(props[propName]);
818
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
819
- }
820
- return null;
821
- }
822
- return createChainableTypeChecker(validate);
823
- }
824
-
825
- function createEnumTypeChecker(expectedValues) {
826
- if (!Array.isArray(expectedValues)) {
827
- if (process.env.NODE_ENV !== 'production') {
828
- if (arguments.length > 1) {
829
- printWarning(
830
- 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
831
- 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
832
- );
833
- } else {
834
- printWarning('Invalid argument supplied to oneOf, expected an array.');
835
- }
836
- }
837
- return emptyFunctionThatReturnsNull;
838
- }
839
-
840
- function validate(props, propName, componentName, location, propFullName) {
841
- var propValue = props[propName];
842
- for (var i = 0; i < expectedValues.length; i++) {
843
- if (is(propValue, expectedValues[i])) {
844
- return null;
845
- }
846
- }
847
-
848
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
849
- var type = getPreciseType(value);
850
- if (type === 'symbol') {
851
- return String(value);
852
- }
853
- return value;
854
- });
855
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
856
- }
857
- return createChainableTypeChecker(validate);
858
- }
859
-
860
- function createObjectOfTypeChecker(typeChecker) {
861
- function validate(props, propName, componentName, location, propFullName) {
862
- if (typeof typeChecker !== 'function') {
863
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
864
- }
865
- var propValue = props[propName];
866
- var propType = getPropType(propValue);
867
- if (propType !== 'object') {
868
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
869
- }
870
- for (var key in propValue) {
871
- if (has(propValue, key)) {
872
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
873
- if (error instanceof Error) {
874
- return error;
875
- }
876
- }
877
- }
878
- return null;
879
- }
880
- return createChainableTypeChecker(validate);
881
- }
882
-
883
- function createUnionTypeChecker(arrayOfTypeCheckers) {
884
- if (!Array.isArray(arrayOfTypeCheckers)) {
885
- process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : undefined;
886
- return emptyFunctionThatReturnsNull;
887
- }
888
-
889
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
890
- var checker = arrayOfTypeCheckers[i];
891
- if (typeof checker !== 'function') {
892
- printWarning(
893
- 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
894
- 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
895
- );
896
- return emptyFunctionThatReturnsNull;
897
- }
898
- }
899
-
900
- function validate(props, propName, componentName, location, propFullName) {
901
- var expectedTypes = [];
902
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
903
- var checker = arrayOfTypeCheckers[i];
904
- var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
905
- if (checkerResult == null) {
906
- return null;
907
- }
908
- if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
909
- expectedTypes.push(checkerResult.data.expectedType);
910
- }
911
- }
912
- var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
913
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
914
- }
915
- return createChainableTypeChecker(validate);
916
- }
917
-
918
- function createNodeChecker() {
919
- function validate(props, propName, componentName, location, propFullName) {
920
- if (!isNode(props[propName])) {
921
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
922
- }
923
- return null;
924
- }
925
- return createChainableTypeChecker(validate);
926
- }
927
-
928
- function invalidValidatorError(componentName, location, propFullName, key, type) {
929
- return new PropTypeError(
930
- (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
931
- 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
932
- );
933
- }
934
-
935
- function createShapeTypeChecker(shapeTypes) {
936
- function validate(props, propName, componentName, location, propFullName) {
937
- var propValue = props[propName];
938
- var propType = getPropType(propValue);
939
- if (propType !== 'object') {
940
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
941
- }
942
- for (var key in shapeTypes) {
943
- var checker = shapeTypes[key];
944
- if (typeof checker !== 'function') {
945
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
946
- }
947
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
948
- if (error) {
949
- return error;
950
- }
951
- }
952
- return null;
953
- }
954
- return createChainableTypeChecker(validate);
955
- }
956
-
957
- function createStrictShapeTypeChecker(shapeTypes) {
958
- function validate(props, propName, componentName, location, propFullName) {
959
- var propValue = props[propName];
960
- var propType = getPropType(propValue);
961
- if (propType !== 'object') {
962
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
963
- }
964
- // We need to check all keys in case some are required but missing from props.
965
- var allKeys = assign({}, props[propName], shapeTypes);
966
- for (var key in allKeys) {
967
- var checker = shapeTypes[key];
968
- if (has(shapeTypes, key) && typeof checker !== 'function') {
969
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
970
- }
971
- if (!checker) {
972
- return new PropTypeError(
973
- 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
974
- '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
975
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
976
- );
977
- }
978
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
979
- if (error) {
980
- return error;
981
- }
982
- }
983
- return null;
984
- }
985
-
986
- return createChainableTypeChecker(validate);
987
- }
988
-
989
- function isNode(propValue) {
990
- switch (typeof propValue) {
991
- case 'number':
992
- case 'string':
993
- case 'undefined':
994
- return true;
995
- case 'boolean':
996
- return !propValue;
997
- case 'object':
998
- if (Array.isArray(propValue)) {
999
- return propValue.every(isNode);
1000
- }
1001
- if (propValue === null || isValidElement(propValue)) {
1002
- return true;
1003
- }
1004
-
1005
- var iteratorFn = getIteratorFn(propValue);
1006
- if (iteratorFn) {
1007
- var iterator = iteratorFn.call(propValue);
1008
- var step;
1009
- if (iteratorFn !== propValue.entries) {
1010
- while (!(step = iterator.next()).done) {
1011
- if (!isNode(step.value)) {
1012
- return false;
1013
- }
1014
- }
1015
- } else {
1016
- // Iterator will provide entry [k,v] tuples rather than values.
1017
- while (!(step = iterator.next()).done) {
1018
- var entry = step.value;
1019
- if (entry) {
1020
- if (!isNode(entry[1])) {
1021
- return false;
1022
- }
1023
- }
1024
- }
1025
- }
1026
- } else {
1027
- return false;
1028
- }
1029
-
1030
- return true;
1031
- default:
1032
- return false;
1033
- }
1034
- }
1035
-
1036
- function isSymbol(propType, propValue) {
1037
- // Native Symbol.
1038
- if (propType === 'symbol') {
1039
- return true;
1040
- }
1041
-
1042
- // falsy value can't be a Symbol
1043
- if (!propValue) {
1044
- return false;
1045
- }
1046
-
1047
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1048
- if (propValue['@@toStringTag'] === 'Symbol') {
1049
- return true;
1050
- }
1051
-
1052
- // Fallback for non-spec compliant Symbols which are polyfilled.
1053
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1054
- return true;
1055
- }
1056
-
1057
- return false;
1058
- }
1059
-
1060
- // Equivalent of `typeof` but with special handling for array and regexp.
1061
- function getPropType(propValue) {
1062
- var propType = typeof propValue;
1063
- if (Array.isArray(propValue)) {
1064
- return 'array';
1065
- }
1066
- if (propValue instanceof RegExp) {
1067
- // Old webkits (at least until Android 4.0) return 'function' rather than
1068
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1069
- // passes PropTypes.object.
1070
- return 'object';
1071
- }
1072
- if (isSymbol(propType, propValue)) {
1073
- return 'symbol';
1074
- }
1075
- return propType;
1076
- }
1077
-
1078
- // This handles more types than `getPropType`. Only used for error messages.
1079
- // See `createPrimitiveTypeChecker`.
1080
- function getPreciseType(propValue) {
1081
- if (typeof propValue === 'undefined' || propValue === null) {
1082
- return '' + propValue;
1083
- }
1084
- var propType = getPropType(propValue);
1085
- if (propType === 'object') {
1086
- if (propValue instanceof Date) {
1087
- return 'date';
1088
- } else if (propValue instanceof RegExp) {
1089
- return 'regexp';
1090
- }
1091
- }
1092
- return propType;
1093
- }
1094
-
1095
- // Returns a string that is postfixed to a warning about an invalid type.
1096
- // For example, "undefined" or "of type array"
1097
- function getPostfixForTypeWarning(value) {
1098
- var type = getPreciseType(value);
1099
- switch (type) {
1100
- case 'array':
1101
- case 'object':
1102
- return 'an ' + type;
1103
- case 'boolean':
1104
- case 'date':
1105
- case 'regexp':
1106
- return 'a ' + type;
1107
- default:
1108
- return type;
1109
- }
1110
- }
1111
-
1112
- // Returns class name of the object, if any.
1113
- function getClassName(propValue) {
1114
- if (!propValue.constructor || !propValue.constructor.name) {
1115
- return ANONYMOUS;
1116
- }
1117
- return propValue.constructor.name;
1118
- }
1119
-
1120
- ReactPropTypes.checkPropTypes = checkPropTypes;
1121
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1122
- ReactPropTypes.PropTypes = ReactPropTypes;
1123
-
1124
- return ReactPropTypes;
1125
- };
1126
- return factoryWithTypeCheckers;
1127
- }
1128
-
1129
- /**
1130
- * Copyright (c) 2013-present, Facebook, Inc.
1131
- *
1132
- * This source code is licensed under the MIT license found in the
1133
- * LICENSE file in the root directory of this source tree.
1134
- */
1135
-
1136
- var factoryWithThrowingShims;
1137
- var hasRequiredFactoryWithThrowingShims;
1138
-
1139
- function requireFactoryWithThrowingShims () {
1140
- if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
1141
- hasRequiredFactoryWithThrowingShims = 1;
1142
-
1143
- var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
1144
-
1145
- function emptyFunction() {}
1146
- function emptyFunctionWithReset() {}
1147
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
1148
-
1149
- factoryWithThrowingShims = function() {
1150
- function shim(props, propName, componentName, location, propFullName, secret) {
1151
- if (secret === ReactPropTypesSecret) {
1152
- // It is still safe when called from React.
1153
- return;
1154
- }
1155
- var err = new Error(
1156
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1157
- 'Use PropTypes.checkPropTypes() to call them. ' +
1158
- 'Read more at http://fb.me/use-check-prop-types'
1159
- );
1160
- err.name = 'Invariant Violation';
1161
- throw err;
1162
- } shim.isRequired = shim;
1163
- function getShim() {
1164
- return shim;
1165
- } // Important!
1166
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1167
- var ReactPropTypes = {
1168
- array: shim,
1169
- bigint: shim,
1170
- bool: shim,
1171
- func: shim,
1172
- number: shim,
1173
- object: shim,
1174
- string: shim,
1175
- symbol: shim,
1176
-
1177
- any: shim,
1178
- arrayOf: getShim,
1179
- element: shim,
1180
- elementType: shim,
1181
- instanceOf: getShim,
1182
- node: shim,
1183
- objectOf: getShim,
1184
- oneOf: getShim,
1185
- oneOfType: getShim,
1186
- shape: getShim,
1187
- exact: getShim,
1188
-
1189
- checkPropTypes: emptyFunctionWithReset,
1190
- resetWarningCache: emptyFunction
1191
- };
1192
-
1193
- ReactPropTypes.PropTypes = ReactPropTypes;
1194
-
1195
- return ReactPropTypes;
1196
- };
1197
- return factoryWithThrowingShims;
1198
- }
1199
-
1200
- /**
1201
- * Copyright (c) 2013-present, Facebook, Inc.
1202
- *
1203
- * This source code is licensed under the MIT license found in the
1204
- * LICENSE file in the root directory of this source tree.
1205
- */
1206
-
1207
- var hasRequiredPropTypes;
1208
-
1209
- function requirePropTypes () {
1210
- if (hasRequiredPropTypes) return propTypes.exports;
1211
- hasRequiredPropTypes = 1;
1212
- if (process.env.NODE_ENV !== 'production') {
1213
- var ReactIs = requireReactIs();
1214
-
1215
- // By explicitly using `prop-types` you are opting into new development behavior.
1216
- // http://fb.me/prop-types-in-prod
1217
- var throwOnDirectAccess = true;
1218
- propTypes.exports = /*@__PURE__*/ requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
1219
- } else {
1220
- // By explicitly using `prop-types` you are opting into new production behavior.
1221
- // http://fb.me/prop-types-in-prod
1222
- propTypes.exports = /*@__PURE__*/ requireFactoryWithThrowingShims()();
1223
- }
1224
- return propTypes.exports;
1225
- }
1226
-
1227
- var propTypesExports = /*@__PURE__*/ requirePropTypes();
1228
- var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
1229
-
1230
- /**
1231
- * Checks if a given element has a CSS class.
1232
- *
1233
- * @param element the element
1234
- * @param className the CSS class name
1235
- */
1236
- function hasClass(element, className) {
1237
- if (element.classList) return !!className && element.classList.contains(className);
1238
- return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
1239
- }
1240
-
1241
- /**
1242
- * Adds a CSS class to a given element.
1243
- *
1244
- * @param element the element
1245
- * @param className the CSS class name
1246
- */
1247
-
1248
- function addClass(element, className) {
1249
- 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);
1250
- }
1251
-
1252
- function replaceClassName(origClass, classToRemove) {
1253
- return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
1254
- }
1255
- /**
1256
- * Removes a CSS class from a given element.
1257
- *
1258
- * @param element the element
1259
- * @param className the CSS class name
1260
- */
1261
-
1262
-
1263
- function removeClass$1(element, className) {
1264
- if (element.classList) {
1265
- element.classList.remove(className);
1266
- } else if (typeof element.className === 'string') {
1267
- element.className = replaceClassName(element.className, className);
1268
- } else {
1269
- element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
1270
- }
1271
- }
1272
-
1273
- var config = {
1274
- disabled: false
1275
- };
1276
-
1277
- var timeoutsShape = process.env.NODE_ENV !== 'production' ? PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
1278
- enter: PropTypes.number,
1279
- exit: PropTypes.number,
1280
- appear: PropTypes.number
1281
- }).isRequired]) : null;
1282
- var classNamesShape = process.env.NODE_ENV !== 'production' ? PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
1283
- enter: PropTypes.string,
1284
- exit: PropTypes.string,
1285
- active: PropTypes.string
1286
- }), PropTypes.shape({
1287
- enter: PropTypes.string,
1288
- enterDone: PropTypes.string,
1289
- enterActive: PropTypes.string,
1290
- exit: PropTypes.string,
1291
- exitDone: PropTypes.string,
1292
- exitActive: PropTypes.string
1293
- })]) : null;
1294
-
1295
- var TransitionGroupContext = React__default.createContext(null);
1296
-
1297
- var forceReflow = function forceReflow(node) {
1298
- return node.scrollTop;
1299
- };
1300
-
1301
- var UNMOUNTED = 'unmounted';
1302
- var EXITED = 'exited';
1303
- var ENTERING = 'entering';
1304
- var ENTERED = 'entered';
1305
- var EXITING = 'exiting';
1306
- /**
1307
- * The Transition component lets you describe a transition from one component
1308
- * state to another _over time_ with a simple declarative API. Most commonly
1309
- * it's used to animate the mounting and unmounting of a component, but can also
1310
- * be used to describe in-place transition states as well.
1311
- *
1312
- * ---
1313
- *
1314
- * **Note**: `Transition` is a platform-agnostic base component. If you're using
1315
- * transitions in CSS, you'll probably want to use
1316
- * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
1317
- * instead. It inherits all the features of `Transition`, but contains
1318
- * additional features necessary to play nice with CSS transitions (hence the
1319
- * name of the component).
1320
- *
1321
- * ---
1322
- *
1323
- * By default the `Transition` component does not alter the behavior of the
1324
- * component it renders, it only tracks "enter" and "exit" states for the
1325
- * components. It's up to you to give meaning and effect to those states. For
1326
- * example we can add styles to a component when it enters or exits:
1327
- *
1328
- * ```jsx
1329
- * import { Transition } from 'react-transition-group';
1330
- *
1331
- * const duration = 300;
1332
- *
1333
- * const defaultStyle = {
1334
- * transition: `opacity ${duration}ms ease-in-out`,
1335
- * opacity: 0,
1336
- * }
1337
- *
1338
- * const transitionStyles = {
1339
- * entering: { opacity: 1 },
1340
- * entered: { opacity: 1 },
1341
- * exiting: { opacity: 0 },
1342
- * exited: { opacity: 0 },
1343
- * };
1344
- *
1345
- * const Fade = ({ in: inProp }) => (
1346
- * <Transition in={inProp} timeout={duration}>
1347
- * {state => (
1348
- * <div style={{
1349
- * ...defaultStyle,
1350
- * ...transitionStyles[state]
1351
- * }}>
1352
- * I'm a fade Transition!
1353
- * </div>
1354
- * )}
1355
- * </Transition>
1356
- * );
1357
- * ```
1358
- *
1359
- * There are 4 main states a Transition can be in:
1360
- * - `'entering'`
1361
- * - `'entered'`
1362
- * - `'exiting'`
1363
- * - `'exited'`
1364
- *
1365
- * Transition state is toggled via the `in` prop. When `true` the component
1366
- * begins the "Enter" stage. During this stage, the component will shift from
1367
- * its current transition state, to `'entering'` for the duration of the
1368
- * transition and then to the `'entered'` stage once it's complete. Let's take
1369
- * the following example (we'll use the
1370
- * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
1371
- *
1372
- * ```jsx
1373
- * function App() {
1374
- * const [inProp, setInProp] = useState(false);
1375
- * return (
1376
- * <div>
1377
- * <Transition in={inProp} timeout={500}>
1378
- * {state => (
1379
- * // ...
1380
- * )}
1381
- * </Transition>
1382
- * <button onClick={() => setInProp(true)}>
1383
- * Click to Enter
1384
- * </button>
1385
- * </div>
1386
- * );
1387
- * }
1388
- * ```
1389
- *
1390
- * When the button is clicked the component will shift to the `'entering'` state
1391
- * and stay there for 500ms (the value of `timeout`) before it finally switches
1392
- * to `'entered'`.
1393
- *
1394
- * When `in` is `false` the same thing happens except the state moves from
1395
- * `'exiting'` to `'exited'`.
1396
- */
1397
-
1398
- var Transition = /*#__PURE__*/function (_React$Component) {
1399
- _inheritsLoose(Transition, _React$Component);
1400
-
1401
- function Transition(props, context) {
1402
- var _this;
1403
-
1404
- _this = _React$Component.call(this, props, context) || this;
1405
- var parentGroup = context; // In the context of a TransitionGroup all enters are really appears
1406
-
1407
- var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
1408
- var initialStatus;
1409
- _this.appearStatus = null;
1410
-
1411
- if (props.in) {
1412
- if (appear) {
1413
- initialStatus = EXITED;
1414
- _this.appearStatus = ENTERING;
1415
- } else {
1416
- initialStatus = ENTERED;
1417
- }
1418
- } else {
1419
- if (props.unmountOnExit || props.mountOnEnter) {
1420
- initialStatus = UNMOUNTED;
1421
- } else {
1422
- initialStatus = EXITED;
1423
- }
1424
- }
1425
-
1426
- _this.state = {
1427
- status: initialStatus
1428
- };
1429
- _this.nextCallback = null;
1430
- return _this;
1431
- }
1432
-
1433
- Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
1434
- var nextIn = _ref.in;
1435
-
1436
- if (nextIn && prevState.status === UNMOUNTED) {
1437
- return {
1438
- status: EXITED
1439
- };
1440
- }
1441
-
1442
- return null;
1443
- } // getSnapshotBeforeUpdate(prevProps) {
1444
- // let nextStatus = null
1445
- // if (prevProps !== this.props) {
1446
- // const { status } = this.state
1447
- // if (this.props.in) {
1448
- // if (status !== ENTERING && status !== ENTERED) {
1449
- // nextStatus = ENTERING
1450
- // }
1451
- // } else {
1452
- // if (status === ENTERING || status === ENTERED) {
1453
- // nextStatus = EXITING
1454
- // }
1455
- // }
1456
- // }
1457
- // return { nextStatus }
1458
- // }
1459
- ;
1460
-
1461
- var _proto = Transition.prototype;
1462
-
1463
- _proto.componentDidMount = function componentDidMount() {
1464
- this.updateStatus(true, this.appearStatus);
1465
- };
1466
-
1467
- _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
1468
- var nextStatus = null;
1469
-
1470
- if (prevProps !== this.props) {
1471
- var status = this.state.status;
1472
-
1473
- if (this.props.in) {
1474
- if (status !== ENTERING && status !== ENTERED) {
1475
- nextStatus = ENTERING;
1476
- }
1477
- } else {
1478
- if (status === ENTERING || status === ENTERED) {
1479
- nextStatus = EXITING;
1480
- }
1481
- }
1482
- }
1483
-
1484
- this.updateStatus(false, nextStatus);
1485
- };
1486
-
1487
- _proto.componentWillUnmount = function componentWillUnmount() {
1488
- this.cancelNextCallback();
1489
- };
1490
-
1491
- _proto.getTimeouts = function getTimeouts() {
1492
- var timeout = this.props.timeout;
1493
- var exit, enter, appear;
1494
- exit = enter = appear = timeout;
1495
-
1496
- if (timeout != null && typeof timeout !== 'number') {
1497
- exit = timeout.exit;
1498
- enter = timeout.enter; // TODO: remove fallback for next major
1499
-
1500
- appear = timeout.appear !== undefined ? timeout.appear : enter;
1501
- }
1502
-
1503
- return {
1504
- exit: exit,
1505
- enter: enter,
1506
- appear: appear
1507
- };
1508
- };
1509
-
1510
- _proto.updateStatus = function updateStatus(mounting, nextStatus) {
1511
- if (mounting === undefined) {
1512
- mounting = false;
1513
- }
1514
-
1515
- if (nextStatus !== null) {
1516
- // nextStatus will always be ENTERING or EXITING.
1517
- this.cancelNextCallback();
1518
-
1519
- if (nextStatus === ENTERING) {
1520
- if (this.props.unmountOnExit || this.props.mountOnEnter) {
1521
- var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749
1522
- // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
1523
- // To make the animation happen, we have to separate each rendering and avoid being processed as batched.
1524
-
1525
- if (node) forceReflow(node);
1526
- }
1527
-
1528
- this.performEnter(mounting);
1529
- } else {
1530
- this.performExit();
1531
- }
1532
- } else if (this.props.unmountOnExit && this.state.status === EXITED) {
1533
- this.setState({
1534
- status: UNMOUNTED
1535
- });
1536
- }
1537
- };
1538
-
1539
- _proto.performEnter = function performEnter(mounting) {
1540
- var _this2 = this;
1541
-
1542
- var enter = this.props.enter;
1543
- var appearing = this.context ? this.context.isMounting : mounting;
1544
-
1545
- var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing],
1546
- maybeNode = _ref2[0],
1547
- maybeAppearing = _ref2[1];
1548
-
1549
- var timeouts = this.getTimeouts();
1550
- var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
1551
- // if we are mounting and running this it means appear _must_ be set
1552
-
1553
- if (!mounting && !enter || config.disabled) {
1554
- this.safeSetState({
1555
- status: ENTERED
1556
- }, function () {
1557
- _this2.props.onEntered(maybeNode);
1558
- });
1559
- return;
1560
- }
1561
-
1562
- this.props.onEnter(maybeNode, maybeAppearing);
1563
- this.safeSetState({
1564
- status: ENTERING
1565
- }, function () {
1566
- _this2.props.onEntering(maybeNode, maybeAppearing);
1567
-
1568
- _this2.onTransitionEnd(enterTimeout, function () {
1569
- _this2.safeSetState({
1570
- status: ENTERED
1571
- }, function () {
1572
- _this2.props.onEntered(maybeNode, maybeAppearing);
1573
- });
1574
- });
1575
- });
1576
- };
1577
-
1578
- _proto.performExit = function performExit() {
1579
- var _this3 = this;
1580
-
1581
- var exit = this.props.exit;
1582
- var timeouts = this.getTimeouts();
1583
- var maybeNode = this.props.nodeRef ? undefined : ReactDOM.findDOMNode(this); // no exit animation skip right to EXITED
1584
-
1585
- if (!exit || config.disabled) {
1586
- this.safeSetState({
1587
- status: EXITED
1588
- }, function () {
1589
- _this3.props.onExited(maybeNode);
1590
- });
1591
- return;
1592
- }
1593
-
1594
- this.props.onExit(maybeNode);
1595
- this.safeSetState({
1596
- status: EXITING
1597
- }, function () {
1598
- _this3.props.onExiting(maybeNode);
1599
-
1600
- _this3.onTransitionEnd(timeouts.exit, function () {
1601
- _this3.safeSetState({
1602
- status: EXITED
1603
- }, function () {
1604
- _this3.props.onExited(maybeNode);
1605
- });
1606
- });
1607
- });
1608
- };
1609
-
1610
- _proto.cancelNextCallback = function cancelNextCallback() {
1611
- if (this.nextCallback !== null) {
1612
- this.nextCallback.cancel();
1613
- this.nextCallback = null;
1614
- }
1615
- };
1616
-
1617
- _proto.safeSetState = function safeSetState(nextState, callback) {
1618
- // This shouldn't be necessary, but there are weird race conditions with
1619
- // setState callbacks and unmounting in testing, so always make sure that
1620
- // we can cancel any pending setState callbacks after we unmount.
1621
- callback = this.setNextCallback(callback);
1622
- this.setState(nextState, callback);
1623
- };
1624
-
1625
- _proto.setNextCallback = function setNextCallback(callback) {
1626
- var _this4 = this;
1627
-
1628
- var active = true;
1629
-
1630
- this.nextCallback = function (event) {
1631
- if (active) {
1632
- active = false;
1633
- _this4.nextCallback = null;
1634
- callback(event);
1635
- }
1636
- };
1637
-
1638
- this.nextCallback.cancel = function () {
1639
- active = false;
1640
- };
1641
-
1642
- return this.nextCallback;
1643
- };
1644
-
1645
- _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {
1646
- this.setNextCallback(handler);
1647
- var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);
1648
- var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
1649
-
1650
- if (!node || doesNotHaveTimeoutOrListener) {
1651
- setTimeout(this.nextCallback, 0);
1652
- return;
1653
- }
1654
-
1655
- if (this.props.addEndListener) {
1656
- var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],
1657
- maybeNode = _ref3[0],
1658
- maybeNextCallback = _ref3[1];
1659
-
1660
- this.props.addEndListener(maybeNode, maybeNextCallback);
1661
- }
1662
-
1663
- if (timeout != null) {
1664
- setTimeout(this.nextCallback, timeout);
1665
- }
1666
- };
1667
-
1668
- _proto.render = function render() {
1669
- var status = this.state.status;
1670
-
1671
- if (status === UNMOUNTED) {
1672
- return null;
1673
- }
1674
-
1675
- var _this$props = this.props,
1676
- children = _this$props.children;
1677
- _this$props.in;
1678
- _this$props.mountOnEnter;
1679
- _this$props.unmountOnExit;
1680
- _this$props.appear;
1681
- _this$props.enter;
1682
- _this$props.exit;
1683
- _this$props.timeout;
1684
- _this$props.addEndListener;
1685
- _this$props.onEnter;
1686
- _this$props.onEntering;
1687
- _this$props.onEntered;
1688
- _this$props.onExit;
1689
- _this$props.onExiting;
1690
- _this$props.onExited;
1691
- _this$props.nodeRef;
1692
- var childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
1693
-
1694
- return (
1695
- /*#__PURE__*/
1696
- // allows for nested Transitions
1697
- React__default.createElement(TransitionGroupContext.Provider, {
1698
- value: null
1699
- }, typeof children === 'function' ? children(status, childProps) : React__default.cloneElement(React__default.Children.only(children), childProps))
1700
- );
1701
- };
1702
-
1703
- return Transition;
1704
- }(React__default.Component);
1705
-
1706
- Transition.contextType = TransitionGroupContext;
1707
- Transition.propTypes = process.env.NODE_ENV !== "production" ? {
1708
- /**
1709
- * A React reference to DOM element that need to transition:
1710
- * https://stackoverflow.com/a/51127130/4671932
1711
- *
1712
- * - When `nodeRef` prop is used, `node` is not passed to callback functions
1713
- * (e.g. `onEnter`) because user already has direct access to the node.
1714
- * - When changing `key` prop of `Transition` in a `TransitionGroup` a new
1715
- * `nodeRef` need to be provided to `Transition` with changed `key` prop
1716
- * (see
1717
- * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
1718
- */
1719
- nodeRef: PropTypes.shape({
1720
- current: typeof Element === 'undefined' ? PropTypes.any : function (propValue, key, componentName, location, propFullName, secret) {
1721
- var value = propValue[key];
1722
- return PropTypes.instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
1723
- }
1724
- }),
1725
-
1726
- /**
1727
- * A `function` child can be used instead of a React element. This function is
1728
- * called with the current transition status (`'entering'`, `'entered'`,
1729
- * `'exiting'`, `'exited'`), which can be used to apply context
1730
- * specific props to a component.
1731
- *
1732
- * ```jsx
1733
- * <Transition in={this.state.in} timeout={150}>
1734
- * {state => (
1735
- * <MyComponent className={`fade fade-${state}`} />
1736
- * )}
1737
- * </Transition>
1738
- * ```
1739
- */
1740
- children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,
1741
-
1742
- /**
1743
- * Show the component; triggers the enter or exit states
1744
- */
1745
- in: PropTypes.bool,
1746
-
1747
- /**
1748
- * By default the child component is mounted immediately along with
1749
- * the parent `Transition` component. If you want to "lazy mount" the component on the
1750
- * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
1751
- * mounted, even on "exited", unless you also specify `unmountOnExit`.
1752
- */
1753
- mountOnEnter: PropTypes.bool,
1754
-
1755
- /**
1756
- * By default the child component stays mounted after it reaches the `'exited'` state.
1757
- * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
1758
- */
1759
- unmountOnExit: PropTypes.bool,
1760
-
1761
- /**
1762
- * By default the child component does not perform the enter transition when
1763
- * it first mounts, regardless of the value of `in`. If you want this
1764
- * behavior, set both `appear` and `in` to `true`.
1765
- *
1766
- * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
1767
- * > only adds an additional enter transition. However, in the
1768
- * > `<CSSTransition>` component that first enter transition does result in
1769
- * > additional `.appear-*` classes, that way you can choose to style it
1770
- * > differently.
1771
- */
1772
- appear: PropTypes.bool,
1773
-
1774
- /**
1775
- * Enable or disable enter transitions.
1776
- */
1777
- enter: PropTypes.bool,
1778
-
1779
- /**
1780
- * Enable or disable exit transitions.
1781
- */
1782
- exit: PropTypes.bool,
1783
-
1784
- /**
1785
- * The duration of the transition, in milliseconds.
1786
- * Required unless `addEndListener` is provided.
1787
- *
1788
- * You may specify a single timeout for all transitions:
1789
- *
1790
- * ```jsx
1791
- * timeout={500}
1792
- * ```
1793
- *
1794
- * or individually:
1795
- *
1796
- * ```jsx
1797
- * timeout={{
1798
- * appear: 500,
1799
- * enter: 300,
1800
- * exit: 500,
1801
- * }}
1802
- * ```
1803
- *
1804
- * - `appear` defaults to the value of `enter`
1805
- * - `enter` defaults to `0`
1806
- * - `exit` defaults to `0`
1807
- *
1808
- * @type {number | { enter?: number, exit?: number, appear?: number }}
1809
- */
1810
- timeout: function timeout(props) {
1811
- var pt = timeoutsShape;
1812
- if (!props.addEndListener) pt = pt.isRequired;
1813
-
1814
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1815
- args[_key - 1] = arguments[_key];
1816
- }
1817
-
1818
- return pt.apply(undefined, [props].concat(args));
1819
- },
1820
-
1821
- /**
1822
- * Add a custom transition end trigger. Called with the transitioning
1823
- * DOM node and a `done` callback. Allows for more fine grained transition end
1824
- * logic. Timeouts are still used as a fallback if provided.
1825
- *
1826
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1827
- *
1828
- * ```jsx
1829
- * addEndListener={(node, done) => {
1830
- * // use the css transitionend event to mark the finish of a transition
1831
- * node.addEventListener('transitionend', done, false);
1832
- * }}
1833
- * ```
1834
- */
1835
- addEndListener: PropTypes.func,
1836
-
1837
- /**
1838
- * Callback fired before the "entering" status is applied. An extra parameter
1839
- * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
1840
- *
1841
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1842
- *
1843
- * @type Function(node: HtmlElement, isAppearing: bool) -> void
1844
- */
1845
- onEnter: PropTypes.func,
1846
-
1847
- /**
1848
- * Callback fired after the "entering" status is applied. An extra parameter
1849
- * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
1850
- *
1851
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1852
- *
1853
- * @type Function(node: HtmlElement, isAppearing: bool)
1854
- */
1855
- onEntering: PropTypes.func,
1856
-
1857
- /**
1858
- * Callback fired after the "entered" status is applied. An extra parameter
1859
- * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
1860
- *
1861
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1862
- *
1863
- * @type Function(node: HtmlElement, isAppearing: bool) -> void
1864
- */
1865
- onEntered: PropTypes.func,
1866
-
1867
- /**
1868
- * Callback fired before the "exiting" status is applied.
1869
- *
1870
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1871
- *
1872
- * @type Function(node: HtmlElement) -> void
1873
- */
1874
- onExit: PropTypes.func,
1875
-
1876
- /**
1877
- * Callback fired after the "exiting" status is applied.
1878
- *
1879
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1880
- *
1881
- * @type Function(node: HtmlElement) -> void
1882
- */
1883
- onExiting: PropTypes.func,
1884
-
1885
- /**
1886
- * Callback fired after the "exited" status is applied.
1887
- *
1888
- * **Note**: when `nodeRef` prop is passed, `node` is not passed
1889
- *
1890
- * @type Function(node: HtmlElement) -> void
1891
- */
1892
- onExited: PropTypes.func
1893
- } : {}; // Name the function so it is clearer in the documentation
1894
-
1895
- function noop() {}
1896
-
1897
- Transition.defaultProps = {
1898
- in: false,
1899
- mountOnEnter: false,
1900
- unmountOnExit: false,
1901
- appear: false,
1902
- enter: true,
1903
- exit: true,
1904
- onEnter: noop,
1905
- onEntering: noop,
1906
- onEntered: noop,
1907
- onExit: noop,
1908
- onExiting: noop,
1909
- onExited: noop
1910
- };
1911
- Transition.UNMOUNTED = UNMOUNTED;
1912
- Transition.EXITED = EXITED;
1913
- Transition.ENTERING = ENTERING;
1914
- Transition.ENTERED = ENTERED;
1915
- Transition.EXITING = EXITING;
1916
-
1917
- var _addClass = function addClass$1(node, classes) {
1918
- return node && classes && classes.split(' ').forEach(function (c) {
1919
- return addClass(node, c);
1920
- });
1921
- };
1922
-
1923
- var removeClass = function removeClass(node, classes) {
1924
- return node && classes && classes.split(' ').forEach(function (c) {
1925
- return removeClass$1(node, c);
1926
- });
1927
- };
1928
- /**
1929
- * A transition component inspired by the excellent
1930
- * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
1931
- * use it if you're using CSS transitions or animations. It's built upon the
1932
- * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
1933
- * component, so it inherits all of its props.
1934
- *
1935
- * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
1936
- * and `exit` states of the transition. The first class is applied and then a
1937
- * second `*-active` class in order to activate the CSS transition. After the
1938
- * transition, matching `*-done` class names are applied to persist the
1939
- * transition state.
1940
- *
1941
- * ```jsx
1942
- * function App() {
1943
- * const [inProp, setInProp] = useState(false);
1944
- * return (
1945
- * <div>
1946
- * <CSSTransition in={inProp} timeout={200} classNames="my-node">
1947
- * <div>
1948
- * {"I'll receive my-node-* classes"}
1949
- * </div>
1950
- * </CSSTransition>
1951
- * <button type="button" onClick={() => setInProp(true)}>
1952
- * Click to Enter
1953
- * </button>
1954
- * </div>
1955
- * );
1956
- * }
1957
- * ```
1958
- *
1959
- * When the `in` prop is set to `true`, the child component will first receive
1960
- * the class `example-enter`, then the `example-enter-active` will be added in
1961
- * the next tick. `CSSTransition` [forces a
1962
- * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
1963
- * between before adding the `example-enter-active`. This is an important trick
1964
- * because it allows us to transition between `example-enter` and
1965
- * `example-enter-active` even though they were added immediately one after
1966
- * another. Most notably, this is what makes it possible for us to animate
1967
- * _appearance_.
1968
- *
1969
- * ```css
1970
- * .my-node-enter {
1971
- * opacity: 0;
1972
- * }
1973
- * .my-node-enter-active {
1974
- * opacity: 1;
1975
- * transition: opacity 200ms;
1976
- * }
1977
- * .my-node-exit {
1978
- * opacity: 1;
1979
- * }
1980
- * .my-node-exit-active {
1981
- * opacity: 0;
1982
- * transition: opacity 200ms;
1983
- * }
1984
- * ```
1985
- *
1986
- * `*-active` classes represent which styles you want to animate **to**, so it's
1987
- * important to add `transition` declaration only to them, otherwise transitions
1988
- * might not behave as intended! This might not be obvious when the transitions
1989
- * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
1990
- * the example above (minus `transition`), but it becomes apparent in more
1991
- * complex transitions.
1992
- *
1993
- * **Note**: If you're using the
1994
- * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
1995
- * prop, make sure to define styles for `.appear-*` classes as well.
1996
- */
1997
-
1998
-
1999
- var CSSTransition = /*#__PURE__*/function (_React$Component) {
2000
- _inheritsLoose(CSSTransition, _React$Component);
2001
-
2002
- function CSSTransition() {
2003
- var _this;
2004
-
2005
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2006
- args[_key] = arguments[_key];
2007
- }
2008
-
2009
- _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
2010
- _this.appliedClasses = {
2011
- appear: {},
2012
- enter: {},
2013
- exit: {}
2014
- };
2015
-
2016
- _this.onEnter = function (maybeNode, maybeAppearing) {
2017
- var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),
2018
- node = _this$resolveArgument[0],
2019
- appearing = _this$resolveArgument[1];
2020
-
2021
- _this.removeClasses(node, 'exit');
2022
-
2023
- _this.addClass(node, appearing ? 'appear' : 'enter', 'base');
2024
-
2025
- if (_this.props.onEnter) {
2026
- _this.props.onEnter(maybeNode, maybeAppearing);
2027
- }
2028
- };
2029
-
2030
- _this.onEntering = function (maybeNode, maybeAppearing) {
2031
- var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),
2032
- node = _this$resolveArgument2[0],
2033
- appearing = _this$resolveArgument2[1];
2034
-
2035
- var type = appearing ? 'appear' : 'enter';
2036
-
2037
- _this.addClass(node, type, 'active');
2038
-
2039
- if (_this.props.onEntering) {
2040
- _this.props.onEntering(maybeNode, maybeAppearing);
2041
- }
2042
- };
2043
-
2044
- _this.onEntered = function (maybeNode, maybeAppearing) {
2045
- var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),
2046
- node = _this$resolveArgument3[0],
2047
- appearing = _this$resolveArgument3[1];
2048
-
2049
- var type = appearing ? 'appear' : 'enter';
2050
-
2051
- _this.removeClasses(node, type);
2052
-
2053
- _this.addClass(node, type, 'done');
2054
-
2055
- if (_this.props.onEntered) {
2056
- _this.props.onEntered(maybeNode, maybeAppearing);
2057
- }
2058
- };
2059
-
2060
- _this.onExit = function (maybeNode) {
2061
- var _this$resolveArgument4 = _this.resolveArguments(maybeNode),
2062
- node = _this$resolveArgument4[0];
2063
-
2064
- _this.removeClasses(node, 'appear');
2065
-
2066
- _this.removeClasses(node, 'enter');
2067
-
2068
- _this.addClass(node, 'exit', 'base');
2069
-
2070
- if (_this.props.onExit) {
2071
- _this.props.onExit(maybeNode);
2072
- }
2073
- };
2074
-
2075
- _this.onExiting = function (maybeNode) {
2076
- var _this$resolveArgument5 = _this.resolveArguments(maybeNode),
2077
- node = _this$resolveArgument5[0];
2078
-
2079
- _this.addClass(node, 'exit', 'active');
2080
-
2081
- if (_this.props.onExiting) {
2082
- _this.props.onExiting(maybeNode);
2083
- }
2084
- };
2085
-
2086
- _this.onExited = function (maybeNode) {
2087
- var _this$resolveArgument6 = _this.resolveArguments(maybeNode),
2088
- node = _this$resolveArgument6[0];
2089
-
2090
- _this.removeClasses(node, 'exit');
2091
-
2092
- _this.addClass(node, 'exit', 'done');
2093
-
2094
- if (_this.props.onExited) {
2095
- _this.props.onExited(maybeNode);
2096
- }
2097
- };
2098
-
2099
- _this.resolveArguments = function (maybeNode, maybeAppearing) {
2100
- return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`
2101
- : [maybeNode, maybeAppearing];
2102
- };
2103
-
2104
- _this.getClassNames = function (type) {
2105
- var classNames = _this.props.classNames;
2106
- var isStringClassNames = typeof classNames === 'string';
2107
- var prefix = isStringClassNames && classNames ? classNames + "-" : '';
2108
- var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
2109
- var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
2110
- var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
2111
- return {
2112
- baseClassName: baseClassName,
2113
- activeClassName: activeClassName,
2114
- doneClassName: doneClassName
2115
- };
2116
- };
2117
-
2118
- return _this;
2119
- }
2120
-
2121
- var _proto = CSSTransition.prototype;
2122
-
2123
- _proto.addClass = function addClass(node, type, phase) {
2124
- var className = this.getClassNames(type)[phase + "ClassName"];
2125
-
2126
- var _this$getClassNames = this.getClassNames('enter'),
2127
- doneClassName = _this$getClassNames.doneClassName;
2128
-
2129
- if (type === 'appear' && phase === 'done' && doneClassName) {
2130
- className += " " + doneClassName;
2131
- } // This is to force a repaint,
2132
- // which is necessary in order to transition styles when adding a class name.
2133
-
2134
-
2135
- if (phase === 'active') {
2136
- if (node) forceReflow(node);
2137
- }
2138
-
2139
- if (className) {
2140
- this.appliedClasses[type][phase] = className;
2141
-
2142
- _addClass(node, className);
2143
- }
2144
- };
2145
-
2146
- _proto.removeClasses = function removeClasses(node, type) {
2147
- var _this$appliedClasses$ = this.appliedClasses[type],
2148
- baseClassName = _this$appliedClasses$.base,
2149
- activeClassName = _this$appliedClasses$.active,
2150
- doneClassName = _this$appliedClasses$.done;
2151
- this.appliedClasses[type] = {};
2152
-
2153
- if (baseClassName) {
2154
- removeClass(node, baseClassName);
2155
- }
2156
-
2157
- if (activeClassName) {
2158
- removeClass(node, activeClassName);
2159
- }
2160
-
2161
- if (doneClassName) {
2162
- removeClass(node, doneClassName);
2163
- }
2164
- };
2165
-
2166
- _proto.render = function render() {
2167
- var _this$props = this.props;
2168
- _this$props.classNames;
2169
- var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
2170
-
2171
- return /*#__PURE__*/React__default.createElement(Transition, _extends({}, props, {
2172
- onEnter: this.onEnter,
2173
- onEntered: this.onEntered,
2174
- onEntering: this.onEntering,
2175
- onExit: this.onExit,
2176
- onExiting: this.onExiting,
2177
- onExited: this.onExited
2178
- }));
2179
- };
2180
-
2181
- return CSSTransition;
2182
- }(React__default.Component);
2183
-
2184
- CSSTransition.defaultProps = {
2185
- classNames: ''
2186
- };
2187
- CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, Transition.propTypes, {
2188
- /**
2189
- * The animation classNames applied to the component as it appears, enters,
2190
- * exits or has finished the transition. A single name can be provided, which
2191
- * will be suffixed for each stage, e.g. `classNames="fade"` applies:
2192
- *
2193
- * - `fade-appear`, `fade-appear-active`, `fade-appear-done`
2194
- * - `fade-enter`, `fade-enter-active`, `fade-enter-done`
2195
- * - `fade-exit`, `fade-exit-active`, `fade-exit-done`
2196
- *
2197
- * A few details to note about how these classes are applied:
2198
- *
2199
- * 1. They are _joined_ with the ones that are already defined on the child
2200
- * component, so if you want to add some base styles, you can use
2201
- * `className` without worrying that it will be overridden.
2202
- *
2203
- * 2. If the transition component mounts with `in={false}`, no classes are
2204
- * applied yet. You might be expecting `*-exit-done`, but if you think
2205
- * about it, a component cannot finish exiting if it hasn't entered yet.
2206
- *
2207
- * 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This
2208
- * allows you to define different behavior for when appearing is done and
2209
- * when regular entering is done, using selectors like
2210
- * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply
2211
- * an epic entrance animation when element first appears in the DOM using
2212
- * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
2213
- * simply use `fade-enter-done` for defining both cases.
2214
- *
2215
- * Each individual classNames can also be specified independently like:
2216
- *
2217
- * ```js
2218
- * classNames={{
2219
- * appear: 'my-appear',
2220
- * appearActive: 'my-active-appear',
2221
- * appearDone: 'my-done-appear',
2222
- * enter: 'my-enter',
2223
- * enterActive: 'my-active-enter',
2224
- * enterDone: 'my-done-enter',
2225
- * exit: 'my-exit',
2226
- * exitActive: 'my-active-exit',
2227
- * exitDone: 'my-done-exit',
2228
- * }}
2229
- * ```
2230
- *
2231
- * If you want to set these classes using CSS Modules:
2232
- *
2233
- * ```js
2234
- * import styles from './styles.css';
2235
- * ```
2236
- *
2237
- * you might want to use camelCase in your CSS file, that way could simply
2238
- * spread them instead of listing them one by one:
2239
- *
2240
- * ```js
2241
- * classNames={{ ...styles }}
2242
- * ```
2243
- *
2244
- * @type {string | {
2245
- * appear?: string,
2246
- * appearActive?: string,
2247
- * appearDone?: string,
2248
- * enter?: string,
2249
- * enterActive?: string,
2250
- * enterDone?: string,
2251
- * exit?: string,
2252
- * exitActive?: string,
2253
- * exitDone?: string,
2254
- * }}
2255
- */
2256
- classNames: classNamesShape,
2257
-
2258
- /**
2259
- * A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
2260
- * applied.
2261
- *
2262
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2263
- *
2264
- * @type Function(node: HtmlElement, isAppearing: bool)
2265
- */
2266
- onEnter: PropTypes.func,
2267
-
2268
- /**
2269
- * A `<Transition>` callback fired immediately after the 'enter-active' or
2270
- * 'appear-active' class is applied.
2271
- *
2272
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2273
- *
2274
- * @type Function(node: HtmlElement, isAppearing: bool)
2275
- */
2276
- onEntering: PropTypes.func,
2277
-
2278
- /**
2279
- * A `<Transition>` callback fired immediately after the 'enter' or
2280
- * 'appear' classes are **removed** and the `done` class is added to the DOM node.
2281
- *
2282
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
2283
- *
2284
- * @type Function(node: HtmlElement, isAppearing: bool)
2285
- */
2286
- onEntered: PropTypes.func,
2287
-
2288
- /**
2289
- * A `<Transition>` callback fired immediately after the 'exit' class is
2290
- * applied.
2291
- *
2292
- * **Note**: when `nodeRef` prop is passed, `node` is not passed
2293
- *
2294
- * @type Function(node: HtmlElement)
2295
- */
2296
- onExit: PropTypes.func,
2297
-
2298
- /**
2299
- * A `<Transition>` callback fired immediately after the 'exit-active' is applied.
2300
- *
2301
- * **Note**: when `nodeRef` prop is passed, `node` is not passed
2302
- *
2303
- * @type Function(node: HtmlElement)
2304
- */
2305
- onExiting: PropTypes.func,
2306
-
2307
- /**
2308
- * A `<Transition>` callback fired immediately after the 'exit' classes
2309
- * are **removed** and the `exit-done` class is added to the DOM node.
2310
- *
2311
- * **Note**: when `nodeRef` prop is passed, `node` is not passed
2312
- *
2313
- * @type Function(node: HtmlElement)
2314
- */
2315
- onExited: PropTypes.func
2316
- }) : {};
2317
-
2318
- const DRAWER_ITEM_MIN_RESIZE_WIDTH = 200;
2319
- const DRAWER_ITEM_MAX_RESIZE_WIDTH = 800;
2320
- const DRAWER_ITEM_INITIAL_RESIZE_WIDTH = 400;
2321
- function getEventClientX(e) {
2322
- var _a, _b;
2323
- return 'touches' in e ? ((_b = (_a = e.touches[0]) === null || _a === undefined ? undefined : _a.clientX) !== null && _b !== undefined ? _b : 0) : e.clientX;
2324
- }
2325
- function useResizeHandlers({ onStart, onMove, onEnd }) {
2326
- const initialXPosition = React.useRef(0);
2327
- const currentXPosition = React.useRef(0);
2328
- const handleMove = React.useCallback((e) => {
2329
- const currentX = getEventClientX(e);
2330
- if (currentXPosition.current === currentX) {
2331
- return;
2332
- }
2333
- currentXPosition.current = currentX;
2334
- const delta = initialXPosition.current - currentX;
2335
- onMove(delta);
2336
- }, [onMove]);
2337
- const handleEnd = React.useCallback((e) => {
2338
- window.removeEventListener('mousemove', handleMove);
2339
- window.removeEventListener('touchmove', handleMove);
2340
- document.body.style.removeProperty('user-select');
2341
- document.body.style.removeProperty('-webkit-user-select');
2342
- document.body.style.removeProperty('cursor');
2343
- const currentX = getEventClientX(e);
2344
- const delta = initialXPosition.current - currentX;
2345
- onEnd(delta);
2346
- }, [handleMove, onEnd]);
2347
- const handleStart = React.useCallback((e) => {
2348
- const currentX = getEventClientX(e);
2349
- initialXPosition.current = currentX;
2350
- currentXPosition.current = currentX;
2351
- window.addEventListener('mouseup', handleEnd, { once: true });
2352
- window.addEventListener('touchend', handleEnd, { once: true });
2353
- window.addEventListener('touchcancel', handleEnd, { once: true });
2354
- window.addEventListener('mousemove', handleMove);
2355
- window.addEventListener('touchmove', handleMove);
2356
- document.body.style.setProperty('user-select', 'none');
2357
- document.body.style.setProperty('-webkit-user-select', 'none');
2358
- document.body.style.setProperty('cursor', 'col-resize');
2359
- onStart();
2360
- }, [handleEnd, handleMove, onStart]);
2361
- return {
2362
- onMouseDown: handleStart,
2363
- onTouchStart: handleStart,
2364
- };
2365
- }
2366
- function useResizableDrawerItem(params) {
2367
- const { direction, width, minResizeWidth = DRAWER_ITEM_MIN_RESIZE_WIDTH, maxResizeWidth = DRAWER_ITEM_MAX_RESIZE_WIDTH, onResizeStart, onResize, } = params;
2368
- const [isResizing, setIsResizing] = React.useState(false);
2369
- const [resizeDelta, setResizeDelta] = React.useState(0);
2370
- const [internalWidth, setInternalWidth] = React.useState(width !== null && width !== undefined ? width : DRAWER_ITEM_INITIAL_RESIZE_WIDTH);
2371
- const getClampedWidth = React.useCallback((width) => Math.min(Math.max(width, minResizeWidth), maxResizeWidth), [minResizeWidth, maxResizeWidth]);
2372
- const getResizedWidth = React.useCallback((delta) => {
2373
- const signedDelta = direction === 'right' ? delta : -delta;
2374
- const newWidth = (width !== null && width !== undefined ? width : internalWidth) + signedDelta;
2375
- return getClampedWidth(newWidth);
2376
- }, [width, internalWidth, direction, getClampedWidth]);
2377
- const onStart = React.useCallback(() => {
2378
- setIsResizing(true);
2379
- setResizeDelta(0);
2380
- onResizeStart === null || onResizeStart === undefined ? undefined : onResizeStart();
2381
- }, [onResizeStart]);
2382
- const onMove = React.useCallback((delta) => {
2383
- setResizeDelta(delta);
2384
- }, []);
2385
- const onEnd = React.useCallback((delta) => {
2386
- const newWidth = getResizedWidth(delta);
2387
- setIsResizing(false);
2388
- setInternalWidth(newWidth);
2389
- onResize === null || onResize === undefined ? undefined : onResize(newWidth);
2390
- }, [getResizedWidth, onResize]);
2391
- const displayWidth = isResizing
2392
- ? getResizedWidth(resizeDelta)
2393
- : getClampedWidth(width !== null && width !== undefined ? width : internalWidth);
2394
- const handlers = useResizeHandlers({ onStart, onMove, onEnd });
2395
- return { resizedWidth: displayWidth, resizerHandlers: handlers };
2396
- }
2397
-
2398
- var css_248z = ".gn-drawer{--_--item-shadow-default:0 1px 5px 0 var(--g-color-sfx-shadow);--_--item-position:fixed;--_--resizer-width:8px;--_--resizer-color:var(--g-color-base-generic);--_--resizer-handle-color:var(--g-color-line-generic);--_--resizer-handle-color-hover:var(--g-color-line-generic-hover);--_--resizer-z-index:100;--_--veil-background-color:var(--g-color-sfx-veil);pointer-events:none}.gn-drawer_hideVeil{--_--item-shadow:var(--gn-drawer-item-shadow,var(--_--item-shadow-default))}.gn-drawer__item{background-color:var(--g-color-base-background);bottom:0;box-shadow:var(--_--item-shadow,none);height:100%;left:var(--gn-aside-header-size);pointer-events:auto;position:var(--gn-drawer-item-position,var(--_--item-position));top:0;will-change:transform;z-index:var(--gn-drawer-item-z-index)}.gn-drawer__item_direction_right{left:auto;right:0}.gn-drawer__item-transition-enter{transform:translate(-100%)}.gn-drawer__item-transition_direction_right-enter{transform:translate(100%)}.gn-drawer__item-transition-enter-active,.gn-drawer__item-transition_direction_right-enter-active{transform:translate(0);transition:transform .3s}.gn-drawer__item-transition-enter-done,.gn-drawer__item-transition_direction_right-enter-done{filter:blur(0);transform:translateZ(0)}.gn-drawer__item-transition-exit,.gn-drawer__item-transition_direction_right-exit{transform:translate(0)}.gn-drawer__item-transition-exit-active,.gn-drawer__item-transition_direction_right-exit-active{transition:transform .3s}.gn-drawer__item-transition-exit-active{transform:translate(-100%)}.gn-drawer__item-transition_direction_right-exit-active{transform:translate(100%)}.gn-drawer__item-transition-exit-done,.gn-drawer__item-transition_direction_right-exit-done,.gn-drawer__item_hidden{visibility:hidden}.gn-drawer__veil{background-color:var(--gn-drawer-veil-background-color,var(--_--veil-background-color));inset:0;pointer-events:auto;position:absolute;z-index:var(--gn-drawer-veil-z-index)}.gn-drawer__veil_hidden{display:none}.gn-drawer__veil-transition-enter{opacity:0}.gn-drawer__veil-transition-enter-active{opacity:1;transition:opacity .3s}.gn-drawer__veil-transition-exit{opacity:1}.gn-drawer__veil-transition-exit-active{opacity:0;transition:opacity .3s}.gn-drawer__veil-transition-exit-done{visibility:hidden}.gn-drawer__resizer-handle{background:var(--gn-drawer-item-resizer-handle-color,var(--_--resizer-handle-color));border-radius:2px;height:28px;width:2px}.gn-drawer__resizer{align-items:center;background:var(--gn-drawer-item-resizer-color,var(--_--resizer-color));cursor:col-resize;display:flex;flex-direction:column;height:100%;justify-content:center;position:absolute;top:0;width:var(--gn-drawer-item-resizer-width,var(--_--resizer-width));z-index:var(--gn-drawer-item-resizer-z-index,var(--_--resizer-z-index))}.gn-drawer__resizer_direction_right{left:0}.gn-drawer__resizer_direction_left{right:0}.gn-drawer__resizer:hover .gn-drawer__resizer-handle{background:var(--gn-drawer-item-resizer-handle-color-hover,var(--_--resizer-handle-color-hover))}";
2399
- styleInject(css_248z);
2400
-
2401
- const b = block('drawer');
2402
- const TIMEOUT = 300;
2403
- const DrawerItem = React__default.forwardRef(function DrawerItem(props, ref) {
2404
- const { visible, content, children, direction = 'left', className, resizable, width, minResizeWidth, maxResizeWidth, onResizeStart, onResize, keepMounted = false, } = props;
2405
- const [isInitialRender, setInitialRender] = React__default.useState(true);
2406
- const itemRef = React__default.useRef(null);
2407
- const handleRef = useForkRef(ref, itemRef);
2408
- const cssDirection = direction === 'left' ? undefined : direction;
2409
- const { resizedWidth, resizerHandlers } = useResizableDrawerItem({
2410
- direction,
2411
- width,
2412
- minResizeWidth,
2413
- maxResizeWidth,
2414
- onResizeStart,
2415
- onResize,
2416
- });
2417
- React__default.useEffect(() => {
2418
- setInitialRender(true);
2419
- }, [direction]);
2420
- const resizerElement = resizable ? (React__default.createElement("div", Object.assign({ className: b('resizer', { direction }) }, resizerHandlers),
2421
- React__default.createElement("div", { className: b('resizer-handle') }))) : null;
2422
- return (React__default.createElement(CSSTransition, { in: visible, timeout: TIMEOUT, mountOnEnter: !keepMounted, unmountOnExit: !keepMounted, classNames: b('item-transition', { direction: cssDirection }), nodeRef: itemRef, onEnter: () => setInitialRender(false), onExit: () => setInitialRender(false) },
2423
- React__default.createElement("div", { ref: handleRef, className: b('item', { direction: cssDirection, hidden: isInitialRender && !visible }, [className]), style: { width: resizable ? `${resizedWidth}px` : undefined } },
2424
- resizerElement, children !== null && children !== undefined ? children : content)));
2425
- });
2426
- const Drawer = ({ className, veilClassName, children, style, onVeilClick, onEscape, hideVeil, disablePortal = true, keepMounted = false, }) => {
2427
- let someItemVisible = false;
2428
- React__default.Children.forEach(children, (child) => {
2429
- if (React__default.isValidElement(child) && child.type === DrawerItem) {
2430
- const childVisible = Boolean(child.props.visible);
2431
- if (childVisible) {
2432
- someItemVisible = true;
2433
- }
2434
- }
2435
- });
2436
- React__default.useEffect(() => {
2437
- function onKeyDown(event) {
2438
- if (event.key === 'Escape') {
2439
- onEscape === null || onEscape === undefined ? undefined : onEscape();
2440
- }
2441
- }
2442
- if (someItemVisible) {
2443
- window.addEventListener('keydown', onKeyDown);
2444
- }
2445
- return () => {
2446
- window.removeEventListener('keydown', onKeyDown);
2447
- };
2448
- }, [onEscape, someItemVisible]);
2449
- const containerRef = React__default.useRef(null);
2450
- const veilRef = React__default.useRef(null);
2451
- const drawer = (React__default.createElement(Transition, { in: someItemVisible, timeout: { enter: 0, exit: TIMEOUT }, mountOnEnter: !keepMounted, unmountOnExit: !keepMounted, nodeRef: containerRef }, (state) => {
2452
- const childrenVisible = someItemVisible && state === 'entered';
2453
- return (React__default.createElement("div", { ref: containerRef, className: b({ hideVeil }, className), style: style },
2454
- React__default.createElement(CSSTransition, { in: childrenVisible, timeout: TIMEOUT, unmountOnExit: true, classNames: b('veil-transition'), nodeRef: veilRef },
2455
- React__default.createElement("div", { ref: veilRef, className: b('veil', { hidden: hideVeil }, veilClassName), onClick: onVeilClick })),
2456
- React__default.Children.map(children, (child) => {
2457
- if (React__default.isValidElement(child) &&
2458
- child.type === DrawerItem) {
2459
- const childVisible = Boolean(child.props.visible);
2460
- return React__default.cloneElement(child, Object.assign(Object.assign({ keepMounted }, child.props), { visible: childVisible && childrenVisible }));
2461
- }
2462
- return child;
2463
- })));
2464
- }));
2465
- if (disablePortal) {
2466
- return drawer;
2467
- }
2468
- return React__default.createElement(Portal, null, drawer);
2469
- };
2470
-
2471
- export { Drawer, DrawerItem };
2472
- //# sourceMappingURL=Drawer.js.map