react-day-picker 8.10.0 → 8.10.2
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.
- package/README.md +3 -9
- package/dist/index.d.ts +49 -46
- package/dist/index.esm.js +56 -1409
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +84 -1437
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -10
- package/dist/index.min.js.map +1 -1
- package/package.json +4 -4
- package/src/DayPicker.tsx +3 -1
- package/src/components/Button/Button.tsx +2 -1
- package/src/components/Caption/Caption.tsx +4 -2
- package/src/components/CaptionDropdowns/CaptionDropdowns.tsx +3 -1
- package/src/components/CaptionLabel/CaptionLabel.tsx +3 -1
- package/src/components/CaptionNavigation/CaptionNavigation.tsx +2 -2
- package/src/components/Day/Day.tsx +2 -1
- package/src/components/DayContent/DayContent.tsx +3 -1
- package/src/components/Dropdown/Dropdown.tsx +3 -2
- package/src/components/Footer/Footer.tsx +3 -1
- package/src/components/Head/Head.tsx +3 -1
- package/src/components/HeadRow/HeadRow.tsx +3 -1
- package/src/components/IconDropdown/IconDropdown.tsx +3 -1
- package/src/components/IconLeft/IconLeft.tsx +3 -1
- package/src/components/IconRight/IconRight.tsx +3 -1
- package/src/components/Months/Months.tsx +2 -2
- package/src/components/MonthsDropdown/MonthsDropdown.tsx +2 -2
- package/src/components/Navigation/Navigation.tsx +2 -2
- package/src/components/Root/Root.tsx +2 -1
- package/src/components/Row/Row.tsx +3 -1
- package/src/components/Table/Table.tsx +3 -1
- package/src/components/WeekNumber/WeekNumber.tsx +2 -2
- package/src/components/YearsDropdown/YearsDropdown.tsx +2 -2
- package/src/contexts/DayPicker/DayPickerContext.tsx +3 -2
- package/src/contexts/Focus/FocusContext.tsx +3 -2
- package/src/contexts/Modifiers/ModifiersContext.tsx +3 -2
- package/src/contexts/Navigation/NavigationContext.tsx +3 -2
- package/src/contexts/RootProvider.tsx +14 -4
- package/src/contexts/SelectMultiple/SelectMultipleContext.test.ts +1 -1
- package/src/contexts/SelectMultiple/SelectMultipleContext.tsx +4 -3
- package/src/contexts/SelectRange/SelectRangeContext.test.ts +1 -1
- package/src/contexts/SelectRange/SelectRangeContext.tsx +4 -3
- package/src/contexts/SelectSingle/SelectSingleContext.test.ts +1 -1
- package/src/contexts/SelectSingle/SelectSingleContext.tsx +4 -3
- package/src/hooks/useControlledValue/useControlledValue.test.ts +1 -1
- package/src/hooks/useDayEventHandlers/useDayEventHandlers.tsx +1 -1
- package/src/hooks/useDayRender/useDayRender.tsx +2 -1
- package/src/hooks/useDayRender/utils/getDayStyle.ts +1 -1
- package/src/hooks/useInput/useInput.ts +3 -3
- package/src/types/DayPickerBase.ts +15 -15
- package/src/types/EventHandlers.ts +1 -1
- package/src/types/Formatters.ts +1 -1
- package/src/types/Modifiers.ts +1 -1
- package/src/types/Styles.ts +1 -1
- package/src/hooks/useId/useIsomorphicLayoutEffect.ts +0 -31
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
4
5
|
var dateFns = require('date-fns');
|
|
5
6
|
var locale = require('date-fns/locale');
|
|
6
7
|
|
|
@@ -59,1360 +60,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
59
60
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
60
61
|
};
|
|
61
62
|
|
|
62
|
-
var jsxRuntime = {exports: {}};
|
|
63
|
-
|
|
64
|
-
var reactJsxRuntime_development = {};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @license React
|
|
68
|
-
* react-jsx-runtime.development.js
|
|
69
|
-
*
|
|
70
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
71
|
-
*
|
|
72
|
-
* This source code is licensed under the MIT license found in the
|
|
73
|
-
* LICENSE file in the root directory of this source tree.
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
var hasRequiredReactJsxRuntime_development;
|
|
77
|
-
|
|
78
|
-
function requireReactJsxRuntime_development () {
|
|
79
|
-
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
80
|
-
hasRequiredReactJsxRuntime_development = 1;
|
|
81
|
-
|
|
82
|
-
if (process.env.NODE_ENV !== "production") {
|
|
83
|
-
(function() {
|
|
84
|
-
|
|
85
|
-
var React = require$$0;
|
|
86
|
-
|
|
87
|
-
// ATTENTION
|
|
88
|
-
// When adding new symbols to this file,
|
|
89
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
90
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
91
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
92
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
93
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
94
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
95
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
96
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
97
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
98
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
99
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
100
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
101
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
102
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
103
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
104
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
105
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
106
|
-
function getIteratorFn(maybeIterable) {
|
|
107
|
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
112
|
-
|
|
113
|
-
if (typeof maybeIterator === 'function') {
|
|
114
|
-
return maybeIterator;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
121
|
-
|
|
122
|
-
function error(format) {
|
|
123
|
-
{
|
|
124
|
-
{
|
|
125
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
126
|
-
args[_key2 - 1] = arguments[_key2];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
printWarning('error', format, args);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function printWarning(level, format, args) {
|
|
135
|
-
// When changing this logic, you might want to also
|
|
136
|
-
// update consoleWithStackDev.www.js as well.
|
|
137
|
-
{
|
|
138
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
139
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
140
|
-
|
|
141
|
-
if (stack !== '') {
|
|
142
|
-
format += '%s';
|
|
143
|
-
args = args.concat([stack]);
|
|
144
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
var argsWithFormat = args.map(function (item) {
|
|
148
|
-
return String(item);
|
|
149
|
-
}); // Careful: RN currently depends on this prefix
|
|
150
|
-
|
|
151
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
152
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
153
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
154
|
-
|
|
155
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// -----------------------------------------------------------------------------
|
|
160
|
-
|
|
161
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
162
|
-
var enableCacheElement = false;
|
|
163
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
164
|
-
|
|
165
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
166
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
167
|
-
// issues in DEV builds.
|
|
168
|
-
|
|
169
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
170
|
-
|
|
171
|
-
var REACT_MODULE_REFERENCE;
|
|
172
|
-
|
|
173
|
-
{
|
|
174
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function isValidElementType(type) {
|
|
178
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
179
|
-
return true;
|
|
180
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (typeof type === 'object' && type !== null) {
|
|
188
|
-
if (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 || // This needs to include all possible module reference object
|
|
189
|
-
// types supported by any Flight configuration anywhere since
|
|
190
|
-
// we don't know which Flight build this will end up being used
|
|
191
|
-
// with.
|
|
192
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
193
|
-
return true;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
201
|
-
var displayName = outerType.displayName;
|
|
202
|
-
|
|
203
|
-
if (displayName) {
|
|
204
|
-
return displayName;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
208
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
209
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
function getContextName(type) {
|
|
213
|
-
return type.displayName || 'Context';
|
|
214
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
function getComponentNameFromType(type) {
|
|
218
|
-
if (type == null) {
|
|
219
|
-
// Host root, text node or just invalid type.
|
|
220
|
-
return null;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
{
|
|
224
|
-
if (typeof type.tag === 'number') {
|
|
225
|
-
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (typeof type === 'function') {
|
|
230
|
-
return type.displayName || type.name || null;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
if (typeof type === 'string') {
|
|
234
|
-
return type;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
switch (type) {
|
|
238
|
-
case REACT_FRAGMENT_TYPE:
|
|
239
|
-
return 'Fragment';
|
|
240
|
-
|
|
241
|
-
case REACT_PORTAL_TYPE:
|
|
242
|
-
return 'Portal';
|
|
243
|
-
|
|
244
|
-
case REACT_PROFILER_TYPE:
|
|
245
|
-
return 'Profiler';
|
|
246
|
-
|
|
247
|
-
case REACT_STRICT_MODE_TYPE:
|
|
248
|
-
return 'StrictMode';
|
|
249
|
-
|
|
250
|
-
case REACT_SUSPENSE_TYPE:
|
|
251
|
-
return 'Suspense';
|
|
252
|
-
|
|
253
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
254
|
-
return 'SuspenseList';
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (typeof type === 'object') {
|
|
259
|
-
switch (type.$$typeof) {
|
|
260
|
-
case REACT_CONTEXT_TYPE:
|
|
261
|
-
var context = type;
|
|
262
|
-
return getContextName(context) + '.Consumer';
|
|
263
|
-
|
|
264
|
-
case REACT_PROVIDER_TYPE:
|
|
265
|
-
var provider = type;
|
|
266
|
-
return getContextName(provider._context) + '.Provider';
|
|
267
|
-
|
|
268
|
-
case REACT_FORWARD_REF_TYPE:
|
|
269
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
270
|
-
|
|
271
|
-
case REACT_MEMO_TYPE:
|
|
272
|
-
var outerName = type.displayName || null;
|
|
273
|
-
|
|
274
|
-
if (outerName !== null) {
|
|
275
|
-
return outerName;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
279
|
-
|
|
280
|
-
case REACT_LAZY_TYPE:
|
|
281
|
-
{
|
|
282
|
-
var lazyComponent = type;
|
|
283
|
-
var payload = lazyComponent._payload;
|
|
284
|
-
var init = lazyComponent._init;
|
|
285
|
-
|
|
286
|
-
try {
|
|
287
|
-
return getComponentNameFromType(init(payload));
|
|
288
|
-
} catch (x) {
|
|
289
|
-
return null;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
// eslint-disable-next-line no-fallthrough
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return null;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
var assign = Object.assign;
|
|
301
|
-
|
|
302
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
303
|
-
// replaying on render function. This currently only patches the object
|
|
304
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
305
|
-
// We could also eagerly patch the method.
|
|
306
|
-
var disabledDepth = 0;
|
|
307
|
-
var prevLog;
|
|
308
|
-
var prevInfo;
|
|
309
|
-
var prevWarn;
|
|
310
|
-
var prevError;
|
|
311
|
-
var prevGroup;
|
|
312
|
-
var prevGroupCollapsed;
|
|
313
|
-
var prevGroupEnd;
|
|
314
|
-
|
|
315
|
-
function disabledLog() {}
|
|
316
|
-
|
|
317
|
-
disabledLog.__reactDisabledLog = true;
|
|
318
|
-
function disableLogs() {
|
|
319
|
-
{
|
|
320
|
-
if (disabledDepth === 0) {
|
|
321
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
322
|
-
prevLog = console.log;
|
|
323
|
-
prevInfo = console.info;
|
|
324
|
-
prevWarn = console.warn;
|
|
325
|
-
prevError = console.error;
|
|
326
|
-
prevGroup = console.group;
|
|
327
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
328
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
329
|
-
|
|
330
|
-
var props = {
|
|
331
|
-
configurable: true,
|
|
332
|
-
enumerable: true,
|
|
333
|
-
value: disabledLog,
|
|
334
|
-
writable: true
|
|
335
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
336
|
-
|
|
337
|
-
Object.defineProperties(console, {
|
|
338
|
-
info: props,
|
|
339
|
-
log: props,
|
|
340
|
-
warn: props,
|
|
341
|
-
error: props,
|
|
342
|
-
group: props,
|
|
343
|
-
groupCollapsed: props,
|
|
344
|
-
groupEnd: props
|
|
345
|
-
});
|
|
346
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
disabledDepth++;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
function reenableLogs() {
|
|
353
|
-
{
|
|
354
|
-
disabledDepth--;
|
|
355
|
-
|
|
356
|
-
if (disabledDepth === 0) {
|
|
357
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
358
|
-
var props = {
|
|
359
|
-
configurable: true,
|
|
360
|
-
enumerable: true,
|
|
361
|
-
writable: true
|
|
362
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
363
|
-
|
|
364
|
-
Object.defineProperties(console, {
|
|
365
|
-
log: assign({}, props, {
|
|
366
|
-
value: prevLog
|
|
367
|
-
}),
|
|
368
|
-
info: assign({}, props, {
|
|
369
|
-
value: prevInfo
|
|
370
|
-
}),
|
|
371
|
-
warn: assign({}, props, {
|
|
372
|
-
value: prevWarn
|
|
373
|
-
}),
|
|
374
|
-
error: assign({}, props, {
|
|
375
|
-
value: prevError
|
|
376
|
-
}),
|
|
377
|
-
group: assign({}, props, {
|
|
378
|
-
value: prevGroup
|
|
379
|
-
}),
|
|
380
|
-
groupCollapsed: assign({}, props, {
|
|
381
|
-
value: prevGroupCollapsed
|
|
382
|
-
}),
|
|
383
|
-
groupEnd: assign({}, props, {
|
|
384
|
-
value: prevGroupEnd
|
|
385
|
-
})
|
|
386
|
-
});
|
|
387
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
if (disabledDepth < 0) {
|
|
391
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
397
|
-
var prefix;
|
|
398
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
399
|
-
{
|
|
400
|
-
if (prefix === undefined) {
|
|
401
|
-
// Extract the VM specific prefix used by each line.
|
|
402
|
-
try {
|
|
403
|
-
throw Error();
|
|
404
|
-
} catch (x) {
|
|
405
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
406
|
-
prefix = match && match[1] || '';
|
|
407
|
-
}
|
|
408
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
return '\n' + prefix + name;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
var reentry = false;
|
|
415
|
-
var componentFrameCache;
|
|
416
|
-
|
|
417
|
-
{
|
|
418
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
419
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
423
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
424
|
-
if ( !fn || reentry) {
|
|
425
|
-
return '';
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
{
|
|
429
|
-
var frame = componentFrameCache.get(fn);
|
|
430
|
-
|
|
431
|
-
if (frame !== undefined) {
|
|
432
|
-
return frame;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
var control;
|
|
437
|
-
reentry = true;
|
|
438
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
439
|
-
|
|
440
|
-
Error.prepareStackTrace = undefined;
|
|
441
|
-
var previousDispatcher;
|
|
442
|
-
|
|
443
|
-
{
|
|
444
|
-
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
445
|
-
// for warnings.
|
|
446
|
-
|
|
447
|
-
ReactCurrentDispatcher.current = null;
|
|
448
|
-
disableLogs();
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
try {
|
|
452
|
-
// This should throw.
|
|
453
|
-
if (construct) {
|
|
454
|
-
// Something should be setting the props in the constructor.
|
|
455
|
-
var Fake = function () {
|
|
456
|
-
throw Error();
|
|
457
|
-
}; // $FlowFixMe
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
461
|
-
set: function () {
|
|
462
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
463
|
-
// because that won't throw in a non-strict mode function.
|
|
464
|
-
throw Error();
|
|
465
|
-
}
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
469
|
-
// We construct a different control for this case to include any extra
|
|
470
|
-
// frames added by the construct call.
|
|
471
|
-
try {
|
|
472
|
-
Reflect.construct(Fake, []);
|
|
473
|
-
} catch (x) {
|
|
474
|
-
control = x;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
Reflect.construct(fn, [], Fake);
|
|
478
|
-
} else {
|
|
479
|
-
try {
|
|
480
|
-
Fake.call();
|
|
481
|
-
} catch (x) {
|
|
482
|
-
control = x;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
fn.call(Fake.prototype);
|
|
486
|
-
}
|
|
487
|
-
} else {
|
|
488
|
-
try {
|
|
489
|
-
throw Error();
|
|
490
|
-
} catch (x) {
|
|
491
|
-
control = x;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
fn();
|
|
495
|
-
}
|
|
496
|
-
} catch (sample) {
|
|
497
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
498
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
499
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
500
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
501
|
-
var sampleLines = sample.stack.split('\n');
|
|
502
|
-
var controlLines = control.stack.split('\n');
|
|
503
|
-
var s = sampleLines.length - 1;
|
|
504
|
-
var c = controlLines.length - 1;
|
|
505
|
-
|
|
506
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
507
|
-
// We expect at least one stack frame to be shared.
|
|
508
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
509
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
510
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
511
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
512
|
-
// the sample somewhere in the control.
|
|
513
|
-
c--;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
517
|
-
// Next we find the first one that isn't the same which should be the
|
|
518
|
-
// frame that called our sample function and the control.
|
|
519
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
520
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
521
|
-
// If we're about to return the first line, and the control is also on the same
|
|
522
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
523
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
524
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
525
|
-
if (s !== 1 || c !== 1) {
|
|
526
|
-
do {
|
|
527
|
-
s--;
|
|
528
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
529
|
-
// The next one that isn't the same should be our match though.
|
|
530
|
-
|
|
531
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
532
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
533
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
534
|
-
// but we have a user-provided "displayName"
|
|
535
|
-
// splice it in to make the stack more readable.
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
539
|
-
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
{
|
|
543
|
-
if (typeof fn === 'function') {
|
|
544
|
-
componentFrameCache.set(fn, _frame);
|
|
545
|
-
}
|
|
546
|
-
} // Return the line we found.
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
return _frame;
|
|
550
|
-
}
|
|
551
|
-
} while (s >= 1 && c >= 0);
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
} finally {
|
|
559
|
-
reentry = false;
|
|
560
|
-
|
|
561
|
-
{
|
|
562
|
-
ReactCurrentDispatcher.current = previousDispatcher;
|
|
563
|
-
reenableLogs();
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
567
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
571
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
572
|
-
|
|
573
|
-
{
|
|
574
|
-
if (typeof fn === 'function') {
|
|
575
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
return syntheticFrame;
|
|
580
|
-
}
|
|
581
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
582
|
-
{
|
|
583
|
-
return describeNativeComponentFrame(fn, false);
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
function shouldConstruct(Component) {
|
|
588
|
-
var prototype = Component.prototype;
|
|
589
|
-
return !!(prototype && prototype.isReactComponent);
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
593
|
-
|
|
594
|
-
if (type == null) {
|
|
595
|
-
return '';
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
if (typeof type === 'function') {
|
|
599
|
-
{
|
|
600
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
if (typeof type === 'string') {
|
|
605
|
-
return describeBuiltInComponentFrame(type);
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
switch (type) {
|
|
609
|
-
case REACT_SUSPENSE_TYPE:
|
|
610
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
611
|
-
|
|
612
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
613
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
if (typeof type === 'object') {
|
|
617
|
-
switch (type.$$typeof) {
|
|
618
|
-
case REACT_FORWARD_REF_TYPE:
|
|
619
|
-
return describeFunctionComponentFrame(type.render);
|
|
620
|
-
|
|
621
|
-
case REACT_MEMO_TYPE:
|
|
622
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
623
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
624
|
-
|
|
625
|
-
case REACT_LAZY_TYPE:
|
|
626
|
-
{
|
|
627
|
-
var lazyComponent = type;
|
|
628
|
-
var payload = lazyComponent._payload;
|
|
629
|
-
var init = lazyComponent._init;
|
|
630
|
-
|
|
631
|
-
try {
|
|
632
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
633
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
634
|
-
} catch (x) {}
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
return '';
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
643
|
-
|
|
644
|
-
var loggedTypeFailures = {};
|
|
645
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
646
|
-
|
|
647
|
-
function setCurrentlyValidatingElement(element) {
|
|
648
|
-
{
|
|
649
|
-
if (element) {
|
|
650
|
-
var owner = element._owner;
|
|
651
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
652
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
653
|
-
} else {
|
|
654
|
-
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
660
|
-
{
|
|
661
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
662
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
663
|
-
|
|
664
|
-
for (var typeSpecName in typeSpecs) {
|
|
665
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
666
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
667
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
668
|
-
// After these have been cleaned up, we'll let them throw.
|
|
669
|
-
|
|
670
|
-
try {
|
|
671
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
672
|
-
// behavior as without this statement except with a better message.
|
|
673
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
674
|
-
// eslint-disable-next-line react-internal/prod-error-codes
|
|
675
|
-
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
|
676
|
-
err.name = 'Invariant Violation';
|
|
677
|
-
throw err;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
681
|
-
} catch (ex) {
|
|
682
|
-
error$1 = ex;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
686
|
-
setCurrentlyValidatingElement(element);
|
|
687
|
-
|
|
688
|
-
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
|
689
|
-
|
|
690
|
-
setCurrentlyValidatingElement(null);
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
694
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
695
|
-
// same error.
|
|
696
|
-
loggedTypeFailures[error$1.message] = true;
|
|
697
|
-
setCurrentlyValidatingElement(element);
|
|
698
|
-
|
|
699
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
700
|
-
|
|
701
|
-
setCurrentlyValidatingElement(null);
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
709
|
-
|
|
710
|
-
function isArray(a) {
|
|
711
|
-
return isArrayImpl(a);
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
/*
|
|
715
|
-
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
716
|
-
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
717
|
-
*
|
|
718
|
-
* The functions in this module will throw an easier-to-understand,
|
|
719
|
-
* easier-to-debug exception with a clear errors message message explaining the
|
|
720
|
-
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
721
|
-
* of the `value` object).
|
|
722
|
-
*/
|
|
723
|
-
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
724
|
-
function typeName(value) {
|
|
725
|
-
{
|
|
726
|
-
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
727
|
-
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
728
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
729
|
-
return type;
|
|
730
|
-
}
|
|
731
|
-
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
function willCoercionThrow(value) {
|
|
735
|
-
{
|
|
736
|
-
try {
|
|
737
|
-
testStringCoercion(value);
|
|
738
|
-
return false;
|
|
739
|
-
} catch (e) {
|
|
740
|
-
return true;
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
function testStringCoercion(value) {
|
|
746
|
-
// If you ended up here by following an exception call stack, here's what's
|
|
747
|
-
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
748
|
-
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
749
|
-
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
750
|
-
//
|
|
751
|
-
// The most common types that will cause this exception are `Symbol` instances
|
|
752
|
-
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
753
|
-
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
754
|
-
// exception. (Library authors do this to prevent users from using built-in
|
|
755
|
-
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
756
|
-
// methods are needed to perform accurate arithmetic or comparison.)
|
|
757
|
-
//
|
|
758
|
-
// To fix the problem, coerce this object or symbol value to a string before
|
|
759
|
-
// passing it to React. The most reliable way is usually `String(value)`.
|
|
760
|
-
//
|
|
761
|
-
// To find which value is throwing, check the browser or debugger console.
|
|
762
|
-
// Before this exception was thrown, there should be `console.error` output
|
|
763
|
-
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
764
|
-
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
765
|
-
// In most cases, this console output also shows the component and its
|
|
766
|
-
// ancestor components where the exception happened.
|
|
767
|
-
//
|
|
768
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
769
|
-
return '' + value;
|
|
770
|
-
}
|
|
771
|
-
function checkKeyStringCoercion(value) {
|
|
772
|
-
{
|
|
773
|
-
if (willCoercionThrow(value)) {
|
|
774
|
-
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
775
|
-
|
|
776
|
-
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
782
|
-
var RESERVED_PROPS = {
|
|
783
|
-
key: true,
|
|
784
|
-
ref: true,
|
|
785
|
-
__self: true,
|
|
786
|
-
__source: true
|
|
787
|
-
};
|
|
788
|
-
var specialPropKeyWarningShown;
|
|
789
|
-
var specialPropRefWarningShown;
|
|
790
|
-
var didWarnAboutStringRefs;
|
|
791
|
-
|
|
792
|
-
{
|
|
793
|
-
didWarnAboutStringRefs = {};
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
function hasValidRef(config) {
|
|
797
|
-
{
|
|
798
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
|
799
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
800
|
-
|
|
801
|
-
if (getter && getter.isReactWarning) {
|
|
802
|
-
return false;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
return config.ref !== undefined;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
function hasValidKey(config) {
|
|
811
|
-
{
|
|
812
|
-
if (hasOwnProperty.call(config, 'key')) {
|
|
813
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
814
|
-
|
|
815
|
-
if (getter && getter.isReactWarning) {
|
|
816
|
-
return false;
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
return config.key !== undefined;
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
825
|
-
{
|
|
826
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
827
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
828
|
-
|
|
829
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
830
|
-
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
|
831
|
-
|
|
832
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
839
|
-
{
|
|
840
|
-
var warnAboutAccessingKey = function () {
|
|
841
|
-
if (!specialPropKeyWarningShown) {
|
|
842
|
-
specialPropKeyWarningShown = true;
|
|
843
|
-
|
|
844
|
-
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
845
|
-
}
|
|
846
|
-
};
|
|
847
|
-
|
|
848
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
849
|
-
Object.defineProperty(props, 'key', {
|
|
850
|
-
get: warnAboutAccessingKey,
|
|
851
|
-
configurable: true
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
857
|
-
{
|
|
858
|
-
var warnAboutAccessingRef = function () {
|
|
859
|
-
if (!specialPropRefWarningShown) {
|
|
860
|
-
specialPropRefWarningShown = true;
|
|
861
|
-
|
|
862
|
-
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
863
|
-
}
|
|
864
|
-
};
|
|
865
|
-
|
|
866
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
867
|
-
Object.defineProperty(props, 'ref', {
|
|
868
|
-
get: warnAboutAccessingRef,
|
|
869
|
-
configurable: true
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
/**
|
|
874
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
875
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
876
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
877
|
-
* if something is a React Element.
|
|
878
|
-
*
|
|
879
|
-
* @param {*} type
|
|
880
|
-
* @param {*} props
|
|
881
|
-
* @param {*} key
|
|
882
|
-
* @param {string|object} ref
|
|
883
|
-
* @param {*} owner
|
|
884
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
885
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
886
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
887
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
888
|
-
* change in behavior.
|
|
889
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
890
|
-
* indicating filename, line number, and/or other information.
|
|
891
|
-
* @internal
|
|
892
|
-
*/
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
896
|
-
var element = {
|
|
897
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
898
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
899
|
-
// Built-in properties that belong on the element
|
|
900
|
-
type: type,
|
|
901
|
-
key: key,
|
|
902
|
-
ref: ref,
|
|
903
|
-
props: props,
|
|
904
|
-
// Record the component responsible for creating this element.
|
|
905
|
-
_owner: owner
|
|
906
|
-
};
|
|
907
|
-
|
|
908
|
-
{
|
|
909
|
-
// The validation flag is currently mutative. We put it on
|
|
910
|
-
// an external backing store so that we can freeze the whole object.
|
|
911
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
912
|
-
// commonly used development environments.
|
|
913
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
914
|
-
// the validation flag non-enumerable (where possible, which should
|
|
915
|
-
// include every environment we run tests in), so the test framework
|
|
916
|
-
// ignores it.
|
|
917
|
-
|
|
918
|
-
Object.defineProperty(element._store, 'validated', {
|
|
919
|
-
configurable: false,
|
|
920
|
-
enumerable: false,
|
|
921
|
-
writable: true,
|
|
922
|
-
value: false
|
|
923
|
-
}); // self and source are DEV only properties.
|
|
924
|
-
|
|
925
|
-
Object.defineProperty(element, '_self', {
|
|
926
|
-
configurable: false,
|
|
927
|
-
enumerable: false,
|
|
928
|
-
writable: false,
|
|
929
|
-
value: self
|
|
930
|
-
}); // Two elements created in two different places should be considered
|
|
931
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
932
|
-
|
|
933
|
-
Object.defineProperty(element, '_source', {
|
|
934
|
-
configurable: false,
|
|
935
|
-
enumerable: false,
|
|
936
|
-
writable: false,
|
|
937
|
-
value: source
|
|
938
|
-
});
|
|
939
|
-
|
|
940
|
-
if (Object.freeze) {
|
|
941
|
-
Object.freeze(element.props);
|
|
942
|
-
Object.freeze(element);
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
return element;
|
|
947
|
-
};
|
|
948
|
-
/**
|
|
949
|
-
* https://github.com/reactjs/rfcs/pull/107
|
|
950
|
-
* @param {*} type
|
|
951
|
-
* @param {object} props
|
|
952
|
-
* @param {string} key
|
|
953
|
-
*/
|
|
954
|
-
|
|
955
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
956
|
-
{
|
|
957
|
-
var propName; // Reserved names are extracted
|
|
958
|
-
|
|
959
|
-
var props = {};
|
|
960
|
-
var key = null;
|
|
961
|
-
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
962
|
-
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
963
|
-
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
964
|
-
// but as an intermediary step, we will use jsxDEV for everything except
|
|
965
|
-
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
966
|
-
// key is explicitly declared to be undefined or not.
|
|
967
|
-
|
|
968
|
-
if (maybeKey !== undefined) {
|
|
969
|
-
{
|
|
970
|
-
checkKeyStringCoercion(maybeKey);
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
key = '' + maybeKey;
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
if (hasValidKey(config)) {
|
|
977
|
-
{
|
|
978
|
-
checkKeyStringCoercion(config.key);
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
key = '' + config.key;
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
if (hasValidRef(config)) {
|
|
985
|
-
ref = config.ref;
|
|
986
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
987
|
-
} // Remaining properties are added to a new props object
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
for (propName in config) {
|
|
991
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
992
|
-
props[propName] = config[propName];
|
|
993
|
-
}
|
|
994
|
-
} // Resolve default props
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
if (type && type.defaultProps) {
|
|
998
|
-
var defaultProps = type.defaultProps;
|
|
999
|
-
|
|
1000
|
-
for (propName in defaultProps) {
|
|
1001
|
-
if (props[propName] === undefined) {
|
|
1002
|
-
props[propName] = defaultProps[propName];
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
if (key || ref) {
|
|
1008
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
1009
|
-
|
|
1010
|
-
if (key) {
|
|
1011
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
if (ref) {
|
|
1015
|
-
defineRefPropWarningGetter(props, displayName);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
1024
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1025
|
-
|
|
1026
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
1027
|
-
{
|
|
1028
|
-
if (element) {
|
|
1029
|
-
var owner = element._owner;
|
|
1030
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1031
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
1032
|
-
} else {
|
|
1033
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
var propTypesMisspellWarningShown;
|
|
1039
|
-
|
|
1040
|
-
{
|
|
1041
|
-
propTypesMisspellWarningShown = false;
|
|
1042
|
-
}
|
|
1043
|
-
/**
|
|
1044
|
-
* Verifies the object is a ReactElement.
|
|
1045
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1046
|
-
* @param {?object} object
|
|
1047
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
1048
|
-
* @final
|
|
1049
|
-
*/
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
function isValidElement(object) {
|
|
1053
|
-
{
|
|
1054
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
function getDeclarationErrorAddendum() {
|
|
1059
|
-
{
|
|
1060
|
-
if (ReactCurrentOwner$1.current) {
|
|
1061
|
-
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
1062
|
-
|
|
1063
|
-
if (name) {
|
|
1064
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
return '';
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
function getSourceInfoErrorAddendum(source) {
|
|
1073
|
-
{
|
|
1074
|
-
if (source !== undefined) {
|
|
1075
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
1076
|
-
var lineNumber = source.lineNumber;
|
|
1077
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
return '';
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
/**
|
|
1084
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1085
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
1086
|
-
* updates.
|
|
1087
|
-
*/
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
var ownerHasKeyUseWarning = {};
|
|
1091
|
-
|
|
1092
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
1093
|
-
{
|
|
1094
|
-
var info = getDeclarationErrorAddendum();
|
|
1095
|
-
|
|
1096
|
-
if (!info) {
|
|
1097
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1098
|
-
|
|
1099
|
-
if (parentName) {
|
|
1100
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
return info;
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
/**
|
|
1108
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1109
|
-
* This element is in an array. The array could grow and shrink or be
|
|
1110
|
-
* reordered. All children that haven't already been validated are required to
|
|
1111
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1112
|
-
* will only be shown once.
|
|
1113
|
-
*
|
|
1114
|
-
* @internal
|
|
1115
|
-
* @param {ReactElement} element Element that requires a key.
|
|
1116
|
-
* @param {*} parentType element's parent's type.
|
|
1117
|
-
*/
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
function validateExplicitKey(element, parentType) {
|
|
1121
|
-
{
|
|
1122
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
1123
|
-
return;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
element._store.validated = true;
|
|
1127
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1128
|
-
|
|
1129
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1130
|
-
return;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
1134
|
-
// property, it may be the creator of the child that's responsible for
|
|
1135
|
-
// assigning it a key.
|
|
1136
|
-
|
|
1137
|
-
var childOwner = '';
|
|
1138
|
-
|
|
1139
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
1140
|
-
// Give the component that originally created this child.
|
|
1141
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
setCurrentlyValidatingElement$1(element);
|
|
1145
|
-
|
|
1146
|
-
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1147
|
-
|
|
1148
|
-
setCurrentlyValidatingElement$1(null);
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
/**
|
|
1152
|
-
* Ensure that every element either is passed in a static location, in an
|
|
1153
|
-
* array with an explicit keys property defined, or in an object literal
|
|
1154
|
-
* with valid key property.
|
|
1155
|
-
*
|
|
1156
|
-
* @internal
|
|
1157
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
1158
|
-
* @param {*} parentType node's parent's type.
|
|
1159
|
-
*/
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
function validateChildKeys(node, parentType) {
|
|
1163
|
-
{
|
|
1164
|
-
if (typeof node !== 'object') {
|
|
1165
|
-
return;
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
if (isArray(node)) {
|
|
1169
|
-
for (var i = 0; i < node.length; i++) {
|
|
1170
|
-
var child = node[i];
|
|
1171
|
-
|
|
1172
|
-
if (isValidElement(child)) {
|
|
1173
|
-
validateExplicitKey(child, parentType);
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
} else if (isValidElement(node)) {
|
|
1177
|
-
// This element was passed in a valid location.
|
|
1178
|
-
if (node._store) {
|
|
1179
|
-
node._store.validated = true;
|
|
1180
|
-
}
|
|
1181
|
-
} else if (node) {
|
|
1182
|
-
var iteratorFn = getIteratorFn(node);
|
|
1183
|
-
|
|
1184
|
-
if (typeof iteratorFn === 'function') {
|
|
1185
|
-
// Entry iterators used to provide implicit keys,
|
|
1186
|
-
// but now we print a separate warning for them later.
|
|
1187
|
-
if (iteratorFn !== node.entries) {
|
|
1188
|
-
var iterator = iteratorFn.call(node);
|
|
1189
|
-
var step;
|
|
1190
|
-
|
|
1191
|
-
while (!(step = iterator.next()).done) {
|
|
1192
|
-
if (isValidElement(step.value)) {
|
|
1193
|
-
validateExplicitKey(step.value, parentType);
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
/**
|
|
1202
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
1203
|
-
* provided by the type.
|
|
1204
|
-
*
|
|
1205
|
-
* @param {ReactElement} element
|
|
1206
|
-
*/
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
function validatePropTypes(element) {
|
|
1210
|
-
{
|
|
1211
|
-
var type = element.type;
|
|
1212
|
-
|
|
1213
|
-
if (type === null || type === undefined || typeof type === 'string') {
|
|
1214
|
-
return;
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
var propTypes;
|
|
1218
|
-
|
|
1219
|
-
if (typeof type === 'function') {
|
|
1220
|
-
propTypes = type.propTypes;
|
|
1221
|
-
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1222
|
-
// Inner props are checked in the reconciler.
|
|
1223
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1224
|
-
propTypes = type.propTypes;
|
|
1225
|
-
} else {
|
|
1226
|
-
return;
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
if (propTypes) {
|
|
1230
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
1231
|
-
var name = getComponentNameFromType(type);
|
|
1232
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
1233
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1234
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1235
|
-
|
|
1236
|
-
var _name = getComponentNameFromType(type);
|
|
1237
|
-
|
|
1238
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
1242
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
/**
|
|
1247
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
1248
|
-
* @param {ReactElement} fragment
|
|
1249
|
-
*/
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
function validateFragmentProps(fragment) {
|
|
1253
|
-
{
|
|
1254
|
-
var keys = Object.keys(fragment.props);
|
|
1255
|
-
|
|
1256
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1257
|
-
var key = keys[i];
|
|
1258
|
-
|
|
1259
|
-
if (key !== 'children' && key !== 'key') {
|
|
1260
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1261
|
-
|
|
1262
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1263
|
-
|
|
1264
|
-
setCurrentlyValidatingElement$1(null);
|
|
1265
|
-
break;
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
if (fragment.ref !== null) {
|
|
1270
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1271
|
-
|
|
1272
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1273
|
-
|
|
1274
|
-
setCurrentlyValidatingElement$1(null);
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1280
|
-
{
|
|
1281
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1282
|
-
// succeed and there will likely be errors in render.
|
|
1283
|
-
|
|
1284
|
-
if (!validType) {
|
|
1285
|
-
var info = '';
|
|
1286
|
-
|
|
1287
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1288
|
-
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
1292
|
-
|
|
1293
|
-
if (sourceInfo) {
|
|
1294
|
-
info += sourceInfo;
|
|
1295
|
-
} else {
|
|
1296
|
-
info += getDeclarationErrorAddendum();
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
var typeString;
|
|
1300
|
-
|
|
1301
|
-
if (type === null) {
|
|
1302
|
-
typeString = 'null';
|
|
1303
|
-
} else if (isArray(type)) {
|
|
1304
|
-
typeString = 'array';
|
|
1305
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1306
|
-
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
1307
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1308
|
-
} else {
|
|
1309
|
-
typeString = typeof type;
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1316
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1317
|
-
|
|
1318
|
-
if (element == null) {
|
|
1319
|
-
return element;
|
|
1320
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1321
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1322
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
1323
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1324
|
-
// fixed, the key warnings will appear.)
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
if (validType) {
|
|
1328
|
-
var children = props.children;
|
|
1329
|
-
|
|
1330
|
-
if (children !== undefined) {
|
|
1331
|
-
if (isStaticChildren) {
|
|
1332
|
-
if (isArray(children)) {
|
|
1333
|
-
for (var i = 0; i < children.length; i++) {
|
|
1334
|
-
validateChildKeys(children[i], type);
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
if (Object.freeze) {
|
|
1338
|
-
Object.freeze(children);
|
|
1339
|
-
}
|
|
1340
|
-
} else {
|
|
1341
|
-
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
1342
|
-
}
|
|
1343
|
-
} else {
|
|
1344
|
-
validateChildKeys(children, type);
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
1350
|
-
validateFragmentProps(element);
|
|
1351
|
-
} else {
|
|
1352
|
-
validatePropTypes(element);
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
return element;
|
|
1356
|
-
}
|
|
1357
|
-
} // These two functions exist to still get child warnings in dev
|
|
1358
|
-
// even with the prod transform. This means that jsxDEV is purely
|
|
1359
|
-
// opt-in behavior for better messages but that we won't stop
|
|
1360
|
-
// giving you warnings if you use production apis.
|
|
1361
|
-
|
|
1362
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
1363
|
-
{
|
|
1364
|
-
return jsxWithValidation(type, props, key, true);
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
function jsxWithValidationDynamic(type, props, key) {
|
|
1368
|
-
{
|
|
1369
|
-
return jsxWithValidation(type, props, key, false);
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
1374
|
-
// for now we can ship identical prod functions
|
|
1375
|
-
|
|
1376
|
-
var jsxs = jsxWithValidationStatic ;
|
|
1377
|
-
|
|
1378
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
1379
|
-
reactJsxRuntime_development.jsx = jsx;
|
|
1380
|
-
reactJsxRuntime_development.jsxs = jsxs;
|
|
1381
|
-
})();
|
|
1382
|
-
}
|
|
1383
|
-
return reactJsxRuntime_development;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
var reactJsxRuntime_production_min = {};
|
|
1387
|
-
|
|
1388
|
-
/**
|
|
1389
|
-
* @license React
|
|
1390
|
-
* react-jsx-runtime.production.min.js
|
|
1391
|
-
*
|
|
1392
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1393
|
-
*
|
|
1394
|
-
* This source code is licensed under the MIT license found in the
|
|
1395
|
-
* LICENSE file in the root directory of this source tree.
|
|
1396
|
-
*/
|
|
1397
|
-
|
|
1398
|
-
var hasRequiredReactJsxRuntime_production_min;
|
|
1399
|
-
|
|
1400
|
-
function requireReactJsxRuntime_production_min () {
|
|
1401
|
-
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
1402
|
-
hasRequiredReactJsxRuntime_production_min = 1;
|
|
1403
|
-
var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
|
|
1404
|
-
function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
|
|
1405
|
-
return reactJsxRuntime_production_min;
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1409
|
-
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
1410
|
-
} else {
|
|
1411
|
-
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
var jsxRuntimeExports = jsxRuntime.exports;
|
|
1415
|
-
|
|
1416
63
|
/** Returns true when the props are of type {@link DayPickerMultipleProps}. */
|
|
1417
64
|
function isDayPickerMultiple(props) {
|
|
1418
65
|
return props.mode === 'multiple';
|
|
@@ -1644,7 +291,7 @@ function parseFromToProps(props) {
|
|
|
1644
291
|
*
|
|
1645
292
|
* Access to this context from the {@link useDayPicker} hook.
|
|
1646
293
|
*/
|
|
1647
|
-
var DayPickerContext =
|
|
294
|
+
var DayPickerContext = react.createContext(undefined);
|
|
1648
295
|
/**
|
|
1649
296
|
* The provider for the {@link DayPickerContext}, assigning the defaults from the
|
|
1650
297
|
* initial DayPicker props.
|
|
@@ -1666,7 +313,7 @@ function DayPickerProvider(props) {
|
|
|
1666
313
|
onSelect = initialProps.onSelect;
|
|
1667
314
|
}
|
|
1668
315
|
var value = __assign(__assign(__assign({}, defaultContextValues), initialProps), { captionLayout: captionLayout, classNames: __assign(__assign({}, defaultContextValues.classNames), initialProps.classNames), components: __assign({}, initialProps.components), formatters: __assign(__assign({}, defaultContextValues.formatters), initialProps.formatters), fromDate: fromDate, labels: __assign(__assign({}, defaultContextValues.labels), initialProps.labels), mode: initialProps.mode || defaultContextValues.mode, modifiers: __assign(__assign({}, defaultContextValues.modifiers), initialProps.modifiers), modifiersClassNames: __assign(__assign({}, defaultContextValues.modifiersClassNames), initialProps.modifiersClassNames), onSelect: onSelect, styles: __assign(__assign({}, defaultContextValues.styles), initialProps.styles), toDate: toDate });
|
|
1669
|
-
return (
|
|
316
|
+
return (jsxRuntime.jsx(DayPickerContext.Provider, { value: value, children: props.children }));
|
|
1670
317
|
}
|
|
1671
318
|
/**
|
|
1672
319
|
* Hook to access the {@link DayPickerContextValue}.
|
|
@@ -1675,7 +322,7 @@ function DayPickerProvider(props) {
|
|
|
1675
322
|
* internal or custom components.
|
|
1676
323
|
*/
|
|
1677
324
|
function useDayPicker() {
|
|
1678
|
-
var context =
|
|
325
|
+
var context = react.useContext(DayPickerContext);
|
|
1679
326
|
if (!context) {
|
|
1680
327
|
throw new Error("useDayPicker must be used within a DayPickerProvider.");
|
|
1681
328
|
}
|
|
@@ -1685,14 +332,14 @@ function useDayPicker() {
|
|
|
1685
332
|
/** Render the caption for the displayed month. This component is used when `captionLayout="buttons"`. */
|
|
1686
333
|
function CaptionLabel(props) {
|
|
1687
334
|
var _a = useDayPicker(), locale = _a.locale, classNames = _a.classNames, styles = _a.styles, formatCaption = _a.formatters.formatCaption;
|
|
1688
|
-
return (
|
|
335
|
+
return (jsxRuntime.jsx("div", { className: classNames.caption_label, style: styles.caption_label, "aria-live": "polite", role: "presentation", id: props.id, children: formatCaption(props.displayMonth, { locale: locale }) }));
|
|
1689
336
|
}
|
|
1690
337
|
|
|
1691
338
|
/**
|
|
1692
339
|
* Render the icon in the styled drop-down.
|
|
1693
340
|
*/
|
|
1694
341
|
function IconDropdown(props) {
|
|
1695
|
-
return (
|
|
342
|
+
return (jsxRuntime.jsx("svg", __assign({ width: "8px", height: "8px", viewBox: "0 0 120 120", "data-testid": "iconDropdown" }, props, { children: jsxRuntime.jsx("path", { d: "M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z", fill: "currentColor", fillRule: "nonzero" }) })));
|
|
1696
343
|
}
|
|
1697
344
|
|
|
1698
345
|
/**
|
|
@@ -1704,7 +351,7 @@ function Dropdown(props) {
|
|
|
1704
351
|
var onChange = props.onChange, value = props.value, children = props.children, caption = props.caption, className = props.className, style = props.style;
|
|
1705
352
|
var dayPicker = useDayPicker();
|
|
1706
353
|
var IconDropdownComponent = (_b = (_a = dayPicker.components) === null || _a === void 0 ? void 0 : _a.IconDropdown) !== null && _b !== void 0 ? _b : IconDropdown;
|
|
1707
|
-
return (
|
|
354
|
+
return (jsxRuntime.jsxs("div", { className: className, style: style, children: [jsxRuntime.jsx("span", { className: dayPicker.classNames.vhidden, children: props['aria-label'] }), jsxRuntime.jsx("select", { name: props.name, "aria-label": props['aria-label'], className: dayPicker.classNames.dropdown, style: dayPicker.styles.dropdown, value: value, onChange: onChange, children: children }), jsxRuntime.jsxs("div", { className: dayPicker.classNames.caption_label, style: dayPicker.styles.caption_label, "aria-hidden": "true", children: [caption, jsxRuntime.jsx(IconDropdownComponent, { className: dayPicker.classNames.dropdown_icon, style: dayPicker.styles.dropdown_icon })] })] }));
|
|
1708
355
|
}
|
|
1709
356
|
|
|
1710
357
|
/** Render the dropdown to navigate between months. */
|
|
@@ -1713,9 +360,9 @@ function MonthsDropdown(props) {
|
|
|
1713
360
|
var _b = useDayPicker(), fromDate = _b.fromDate, toDate = _b.toDate, styles = _b.styles, locale = _b.locale, formatMonthCaption = _b.formatters.formatMonthCaption, classNames = _b.classNames, components = _b.components, labelMonthDropdown = _b.labels.labelMonthDropdown;
|
|
1714
361
|
// Dropdown should appear only when both from/toDate is set
|
|
1715
362
|
if (!fromDate)
|
|
1716
|
-
return
|
|
363
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1717
364
|
if (!toDate)
|
|
1718
|
-
return
|
|
365
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1719
366
|
var dropdownMonths = [];
|
|
1720
367
|
if (dateFns.isSameYear(fromDate, toDate)) {
|
|
1721
368
|
// only display the months included in the range
|
|
@@ -1737,7 +384,7 @@ function MonthsDropdown(props) {
|
|
|
1737
384
|
props.onChange(newMonth);
|
|
1738
385
|
};
|
|
1739
386
|
var DropdownComponent = (_a = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a !== void 0 ? _a : Dropdown;
|
|
1740
|
-
return (
|
|
387
|
+
return (jsxRuntime.jsx(DropdownComponent, { name: "months", "aria-label": labelMonthDropdown(), className: classNames.dropdown_month, style: styles.dropdown_month, onChange: handleChange, value: props.displayMonth.getMonth(), caption: formatMonthCaption(props.displayMonth, { locale: locale }), children: dropdownMonths.map(function (m) { return (jsxRuntime.jsx("option", { value: m.getMonth(), children: formatMonthCaption(m, { locale: locale }) }, m.getMonth())); }) }));
|
|
1741
388
|
}
|
|
1742
389
|
|
|
1743
390
|
/**
|
|
@@ -1751,9 +398,9 @@ function YearsDropdown(props) {
|
|
|
1751
398
|
var years = [];
|
|
1752
399
|
// Dropdown should appear only when both from/toDate is set
|
|
1753
400
|
if (!fromDate)
|
|
1754
|
-
return
|
|
401
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1755
402
|
if (!toDate)
|
|
1756
|
-
return
|
|
403
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1757
404
|
var fromYear = fromDate.getFullYear();
|
|
1758
405
|
var toYear = toDate.getFullYear();
|
|
1759
406
|
for (var year = fromYear; year <= toYear; year++) {
|
|
@@ -1764,7 +411,7 @@ function YearsDropdown(props) {
|
|
|
1764
411
|
props.onChange(newMonth);
|
|
1765
412
|
};
|
|
1766
413
|
var DropdownComponent = (_a = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a !== void 0 ? _a : Dropdown;
|
|
1767
|
-
return (
|
|
414
|
+
return (jsxRuntime.jsx(DropdownComponent, { name: "years", "aria-label": labelYearDropdown(), className: classNames.dropdown_year, style: styles.dropdown_year, onChange: handleChange, value: displayMonth.getFullYear(), caption: formatYearCaption(displayMonth, { locale: locale }), children: years.map(function (year) { return (jsxRuntime.jsx("option", { value: year.getFullYear(), children: formatYearCaption(year, { locale: locale }) }, year.getFullYear())); }) }));
|
|
1768
415
|
}
|
|
1769
416
|
|
|
1770
417
|
/**
|
|
@@ -1777,7 +424,7 @@ function YearsDropdown(props) {
|
|
|
1777
424
|
* argument, which will be always returned as `value`.
|
|
1778
425
|
*/
|
|
1779
426
|
function useControlledValue(defaultValue, controlledValue) {
|
|
1780
|
-
var _a =
|
|
427
|
+
var _a = react.useState(defaultValue), uncontrolledValue = _a[0], setValue = _a[1];
|
|
1781
428
|
var value = controlledValue === undefined ? uncontrolledValue : controlledValue;
|
|
1782
429
|
return [value, setValue];
|
|
1783
430
|
}
|
|
@@ -1895,7 +542,7 @@ function getPreviousMonth(startingMonth, options) {
|
|
|
1895
542
|
* The Navigation context shares details and methods to navigate the months in DayPicker.
|
|
1896
543
|
* Access this context from the {@link useNavigation} hook.
|
|
1897
544
|
*/
|
|
1898
|
-
var NavigationContext =
|
|
545
|
+
var NavigationContext = react.createContext(undefined);
|
|
1899
546
|
/** Provides the values for the {@link NavigationContext}. */
|
|
1900
547
|
function NavigationProvider(props) {
|
|
1901
548
|
var dayPicker = useDayPicker();
|
|
@@ -1928,7 +575,7 @@ function NavigationProvider(props) {
|
|
|
1928
575
|
nextMonth: nextMonth,
|
|
1929
576
|
isDateDisplayed: isDateDisplayed
|
|
1930
577
|
};
|
|
1931
|
-
return (
|
|
578
|
+
return (jsxRuntime.jsx(NavigationContext.Provider, { value: value, children: props.children }));
|
|
1932
579
|
}
|
|
1933
580
|
/**
|
|
1934
581
|
* Hook to access the {@link NavigationContextValue}. Use this hook to navigate
|
|
@@ -1937,7 +584,7 @@ function NavigationProvider(props) {
|
|
|
1937
584
|
* This hook is meant to be used inside internal or custom components.
|
|
1938
585
|
*/
|
|
1939
586
|
function useNavigation() {
|
|
1940
|
-
var context =
|
|
587
|
+
var context = react.useContext(NavigationContext);
|
|
1941
588
|
if (!context) {
|
|
1942
589
|
throw new Error('useNavigation must be used within a NavigationProvider');
|
|
1943
590
|
}
|
|
@@ -1955,26 +602,26 @@ function CaptionDropdowns(props) {
|
|
|
1955
602
|
goToMonth(dateFns.addMonths(newMonth, props.displayIndex ? -props.displayIndex : 0));
|
|
1956
603
|
};
|
|
1957
604
|
var CaptionLabelComponent = (_a = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a !== void 0 ? _a : CaptionLabel;
|
|
1958
|
-
var captionLabel = (
|
|
1959
|
-
return (
|
|
605
|
+
var captionLabel = (jsxRuntime.jsx(CaptionLabelComponent, { id: props.id, displayMonth: props.displayMonth }));
|
|
606
|
+
return (jsxRuntime.jsxs("div", { className: classNames.caption_dropdowns, style: styles.caption_dropdowns, children: [jsxRuntime.jsx("div", { className: classNames.vhidden, children: captionLabel }), jsxRuntime.jsx(MonthsDropdown, { onChange: handleMonthChange, displayMonth: props.displayMonth }), jsxRuntime.jsx(YearsDropdown, { onChange: handleMonthChange, displayMonth: props.displayMonth })] }));
|
|
1960
607
|
}
|
|
1961
608
|
|
|
1962
609
|
/**
|
|
1963
610
|
* Render the "previous month" button in the navigation.
|
|
1964
611
|
*/
|
|
1965
612
|
function IconLeft(props) {
|
|
1966
|
-
return (
|
|
613
|
+
return (jsxRuntime.jsx("svg", __assign({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props, { children: jsxRuntime.jsx("path", { d: "M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z", fill: "currentColor", fillRule: "nonzero" }) })));
|
|
1967
614
|
}
|
|
1968
615
|
|
|
1969
616
|
/**
|
|
1970
617
|
* Render the "next month" button in the navigation.
|
|
1971
618
|
*/
|
|
1972
619
|
function IconRight(props) {
|
|
1973
|
-
return (
|
|
620
|
+
return (jsxRuntime.jsx("svg", __assign({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, props, { children: jsxRuntime.jsx("path", { d: "M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z", fill: "currentColor" }) })));
|
|
1974
621
|
}
|
|
1975
622
|
|
|
1976
623
|
/** Render a button HTML element applying the reset class name. */
|
|
1977
|
-
var Button =
|
|
624
|
+
var Button = react.forwardRef(function (props, ref) {
|
|
1978
625
|
var _a = useDayPicker(), classNames = _a.classNames, styles = _a.styles;
|
|
1979
626
|
var classNamesArr = [classNames.button_reset, classNames.button];
|
|
1980
627
|
if (props.className) {
|
|
@@ -1985,7 +632,7 @@ var Button = require$$0.forwardRef(function (props, ref) {
|
|
|
1985
632
|
if (props.style) {
|
|
1986
633
|
Object.assign(style, props.style);
|
|
1987
634
|
}
|
|
1988
|
-
return (
|
|
635
|
+
return (jsxRuntime.jsx("button", __assign({}, props, { ref: ref, type: "button", className: className, style: style })));
|
|
1989
636
|
});
|
|
1990
637
|
|
|
1991
638
|
/** A component rendering the navigation buttons or the drop-downs. */
|
|
@@ -1993,7 +640,7 @@ function Navigation(props) {
|
|
|
1993
640
|
var _a, _b;
|
|
1994
641
|
var _c = useDayPicker(), dir = _c.dir, locale = _c.locale, classNames = _c.classNames, styles = _c.styles, _d = _c.labels, labelPrevious = _d.labelPrevious, labelNext = _d.labelNext, components = _c.components;
|
|
1995
642
|
if (!props.nextMonth && !props.previousMonth) {
|
|
1996
|
-
return
|
|
643
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1997
644
|
}
|
|
1998
645
|
var previousLabel = labelPrevious(props.previousMonth, { locale: locale });
|
|
1999
646
|
var previousClassName = [
|
|
@@ -2007,7 +654,7 @@ function Navigation(props) {
|
|
|
2007
654
|
].join(' ');
|
|
2008
655
|
var IconRightComponent = (_a = components === null || components === void 0 ? void 0 : components.IconRight) !== null && _a !== void 0 ? _a : IconRight;
|
|
2009
656
|
var IconLeftComponent = (_b = components === null || components === void 0 ? void 0 : components.IconLeft) !== null && _b !== void 0 ? _b : IconLeft;
|
|
2010
|
-
return (
|
|
657
|
+
return (jsxRuntime.jsxs("div", { className: classNames.nav, style: styles.nav, children: [!props.hidePrevious && (jsxRuntime.jsx(Button, { name: "previous-month", "aria-label": previousLabel, className: previousClassName, style: styles.nav_button_previous, disabled: !props.previousMonth, onClick: props.onPreviousClick, children: dir === 'rtl' ? (jsxRuntime.jsx(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (jsxRuntime.jsx(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })) })), !props.hideNext && (jsxRuntime.jsx(Button, { name: "next-month", "aria-label": nextLabel, className: nextClassName, style: styles.nav_button_next, disabled: !props.nextMonth, onClick: props.onNextClick, children: dir === 'rtl' ? (jsxRuntime.jsx(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (jsxRuntime.jsx(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon })) }))] }));
|
|
2011
658
|
}
|
|
2012
659
|
|
|
2013
660
|
/**
|
|
@@ -2033,7 +680,7 @@ function CaptionNavigation(props) {
|
|
|
2033
680
|
return;
|
|
2034
681
|
goToMonth(nextMonth);
|
|
2035
682
|
};
|
|
2036
|
-
return (
|
|
683
|
+
return (jsxRuntime.jsx(Navigation, { displayMonth: props.displayMonth, hideNext: hideNext, hidePrevious: hidePrevious, nextMonth: nextMonth, previousMonth: previousMonth, onPreviousClick: handlePreviousClick, onNextClick: handleNextClick }));
|
|
2037
684
|
}
|
|
2038
685
|
|
|
2039
686
|
/**
|
|
@@ -2046,18 +693,18 @@ function Caption(props) {
|
|
|
2046
693
|
var CaptionLabelComponent = (_a = components === null || components === void 0 ? void 0 : components.CaptionLabel) !== null && _a !== void 0 ? _a : CaptionLabel;
|
|
2047
694
|
var caption;
|
|
2048
695
|
if (disableNavigation) {
|
|
2049
|
-
caption = (
|
|
696
|
+
caption = (jsxRuntime.jsx(CaptionLabelComponent, { id: props.id, displayMonth: props.displayMonth }));
|
|
2050
697
|
}
|
|
2051
698
|
else if (captionLayout === 'dropdown') {
|
|
2052
|
-
caption = (
|
|
699
|
+
caption = (jsxRuntime.jsx(CaptionDropdowns, { displayMonth: props.displayMonth, id: props.id }));
|
|
2053
700
|
}
|
|
2054
701
|
else if (captionLayout === 'dropdown-buttons') {
|
|
2055
|
-
caption = (
|
|
702
|
+
caption = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionDropdowns, { displayMonth: props.displayMonth, displayIndex: props.displayIndex, id: props.id }), jsxRuntime.jsx(CaptionNavigation, { displayMonth: props.displayMonth, displayIndex: props.displayIndex, id: props.id })] }));
|
|
2056
703
|
}
|
|
2057
704
|
else {
|
|
2058
|
-
caption = (
|
|
705
|
+
caption = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionLabelComponent, { id: props.id, displayMonth: props.displayMonth, displayIndex: props.displayIndex }), jsxRuntime.jsx(CaptionNavigation, { displayMonth: props.displayMonth, id: props.id })] }));
|
|
2059
706
|
}
|
|
2060
|
-
return (
|
|
707
|
+
return (jsxRuntime.jsx("div", { className: classNames.caption, style: styles.caption, children: caption }));
|
|
2061
708
|
}
|
|
2062
709
|
|
|
2063
710
|
/** Render the Footer component (empty as default).*/
|
|
@@ -2065,8 +712,8 @@ function Caption(props) {
|
|
|
2065
712
|
function Footer(props) {
|
|
2066
713
|
var _a = useDayPicker(), footer = _a.footer, styles = _a.styles, tfoot = _a.classNames.tfoot;
|
|
2067
714
|
if (!footer)
|
|
2068
|
-
return
|
|
2069
|
-
return (
|
|
715
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
716
|
+
return (jsxRuntime.jsx("tfoot", { className: tfoot, style: styles.tfoot, children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: 8, children: footer }) }) }));
|
|
2070
717
|
}
|
|
2071
718
|
|
|
2072
719
|
/**
|
|
@@ -2095,7 +742,7 @@ ISOWeek) {
|
|
|
2095
742
|
function HeadRow() {
|
|
2096
743
|
var _a = useDayPicker(), classNames = _a.classNames, styles = _a.styles, showWeekNumber = _a.showWeekNumber, locale = _a.locale, weekStartsOn = _a.weekStartsOn, ISOWeek = _a.ISOWeek, formatWeekdayName = _a.formatters.formatWeekdayName, labelWeekday = _a.labels.labelWeekday;
|
|
2097
744
|
var weekdays = getWeekdays(locale, weekStartsOn, ISOWeek);
|
|
2098
|
-
return (
|
|
745
|
+
return (jsxRuntime.jsxs("tr", { style: styles.head_row, className: classNames.head_row, children: [showWeekNumber && (jsxRuntime.jsx("td", { style: styles.head_cell, className: classNames.head_cell })), weekdays.map(function (weekday, i) { return (jsxRuntime.jsx("th", { scope: "col", className: classNames.head_cell, style: styles.head_cell, "aria-label": labelWeekday(weekday, { locale: locale }), children: formatWeekdayName(weekday, { locale: locale }) }, i)); })] }));
|
|
2099
746
|
}
|
|
2100
747
|
|
|
2101
748
|
/** Render the table head. */
|
|
@@ -2103,13 +750,13 @@ function Head() {
|
|
|
2103
750
|
var _a;
|
|
2104
751
|
var _b = useDayPicker(), classNames = _b.classNames, styles = _b.styles, components = _b.components;
|
|
2105
752
|
var HeadRowComponent = (_a = components === null || components === void 0 ? void 0 : components.HeadRow) !== null && _a !== void 0 ? _a : HeadRow;
|
|
2106
|
-
return (
|
|
753
|
+
return (jsxRuntime.jsx("thead", { style: styles.head, className: classNames.head, children: jsxRuntime.jsx(HeadRowComponent, {}) }));
|
|
2107
754
|
}
|
|
2108
755
|
|
|
2109
756
|
/** Render the content of the day cell. */
|
|
2110
757
|
function DayContent(props) {
|
|
2111
758
|
var _a = useDayPicker(), locale = _a.locale, formatDay = _a.formatters.formatDay;
|
|
2112
|
-
return
|
|
759
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: formatDay(props.date, { locale: locale }) });
|
|
2113
760
|
}
|
|
2114
761
|
|
|
2115
762
|
/**
|
|
@@ -2118,7 +765,7 @@ function DayContent(props) {
|
|
|
2118
765
|
*
|
|
2119
766
|
* Access this context from the {@link useSelectMultiple} hook.
|
|
2120
767
|
*/
|
|
2121
|
-
var SelectMultipleContext =
|
|
768
|
+
var SelectMultipleContext = react.createContext(undefined);
|
|
2122
769
|
/** Provides the values for the {@link SelectMultipleContext}. */
|
|
2123
770
|
function SelectMultipleProvider(props) {
|
|
2124
771
|
if (!isDayPickerMultiple(props.initialProps)) {
|
|
@@ -2128,9 +775,9 @@ function SelectMultipleProvider(props) {
|
|
|
2128
775
|
disabled: []
|
|
2129
776
|
}
|
|
2130
777
|
};
|
|
2131
|
-
return (
|
|
778
|
+
return (jsxRuntime.jsx(SelectMultipleContext.Provider, { value: emptyContextValue, children: props.children }));
|
|
2132
779
|
}
|
|
2133
|
-
return (
|
|
780
|
+
return (jsxRuntime.jsx(SelectMultipleProviderInternal, { initialProps: props.initialProps, children: props.children }));
|
|
2134
781
|
}
|
|
2135
782
|
function SelectMultipleProviderInternal(_a) {
|
|
2136
783
|
var initialProps = _a.initialProps, children = _a.children;
|
|
@@ -2175,7 +822,7 @@ function SelectMultipleProviderInternal(_a) {
|
|
|
2175
822
|
onDayClick: onDayClick,
|
|
2176
823
|
modifiers: modifiers
|
|
2177
824
|
};
|
|
2178
|
-
return (
|
|
825
|
+
return (jsxRuntime.jsx(SelectMultipleContext.Provider, { value: contextValue, children: children }));
|
|
2179
826
|
}
|
|
2180
827
|
/**
|
|
2181
828
|
* Hook to access the {@link SelectMultipleContextValue}.
|
|
@@ -2183,7 +830,7 @@ function SelectMultipleProviderInternal(_a) {
|
|
|
2183
830
|
* This hook is meant to be used inside internal or custom components.
|
|
2184
831
|
*/
|
|
2185
832
|
function useSelectMultiple() {
|
|
2186
|
-
var context =
|
|
833
|
+
var context = react.useContext(SelectMultipleContext);
|
|
2187
834
|
if (!context) {
|
|
2188
835
|
throw new Error('useSelectMultiple must be used within a SelectMultipleProvider');
|
|
2189
836
|
}
|
|
@@ -2234,7 +881,7 @@ function addToRange(day, range) {
|
|
|
2234
881
|
*
|
|
2235
882
|
* Access this context from the {@link useSelectRange} hook.
|
|
2236
883
|
*/
|
|
2237
|
-
var SelectRangeContext =
|
|
884
|
+
var SelectRangeContext = react.createContext(undefined);
|
|
2238
885
|
/** Provides the values for the {@link SelectRangeProvider}. */
|
|
2239
886
|
function SelectRangeProvider(props) {
|
|
2240
887
|
if (!isDayPickerRange(props.initialProps)) {
|
|
@@ -2247,9 +894,9 @@ function SelectRangeProvider(props) {
|
|
|
2247
894
|
disabled: []
|
|
2248
895
|
}
|
|
2249
896
|
};
|
|
2250
|
-
return (
|
|
897
|
+
return (jsxRuntime.jsx(SelectRangeContext.Provider, { value: emptyContextValue, children: props.children }));
|
|
2251
898
|
}
|
|
2252
|
-
return (
|
|
899
|
+
return (jsxRuntime.jsx(SelectRangeProviderInternal, { initialProps: props.initialProps, children: props.children }));
|
|
2253
900
|
}
|
|
2254
901
|
function SelectRangeProviderInternal(_a) {
|
|
2255
902
|
var initialProps = _a.initialProps, children = _a.children;
|
|
@@ -2338,7 +985,7 @@ function SelectRangeProviderInternal(_a) {
|
|
|
2338
985
|
});
|
|
2339
986
|
}
|
|
2340
987
|
}
|
|
2341
|
-
return (
|
|
988
|
+
return (jsxRuntime.jsx(SelectRangeContext.Provider, { value: { selected: selected, onDayClick: onDayClick, modifiers: modifiers }, children: children }));
|
|
2342
989
|
}
|
|
2343
990
|
/**
|
|
2344
991
|
* Hook to access the {@link SelectRangeContextValue}.
|
|
@@ -2346,7 +993,7 @@ function SelectRangeProviderInternal(_a) {
|
|
|
2346
993
|
* This hook is meant to be used inside internal or custom components.
|
|
2347
994
|
*/
|
|
2348
995
|
function useSelectRange() {
|
|
2349
|
-
var context =
|
|
996
|
+
var context = react.useContext(SelectRangeContext);
|
|
2350
997
|
if (!context) {
|
|
2351
998
|
throw new Error('useSelectRange must be used within a SelectRangeProvider');
|
|
2352
999
|
}
|
|
@@ -2429,7 +1076,7 @@ function getInternalModifiers(dayPicker, selectMultiple, selectRange) {
|
|
|
2429
1076
|
}
|
|
2430
1077
|
|
|
2431
1078
|
/** The Modifiers context store the modifiers used in DayPicker. To access the value of this context, use {@link useModifiers}. */
|
|
2432
|
-
var ModifiersContext =
|
|
1079
|
+
var ModifiersContext = react.createContext(undefined);
|
|
2433
1080
|
/** Provide the value for the {@link ModifiersContext}. */
|
|
2434
1081
|
function ModifiersProvider(props) {
|
|
2435
1082
|
var dayPicker = useDayPicker();
|
|
@@ -2438,7 +1085,7 @@ function ModifiersProvider(props) {
|
|
|
2438
1085
|
var internalModifiers = getInternalModifiers(dayPicker, selectMultiple, selectRange);
|
|
2439
1086
|
var customModifiers = getCustomModifiers(dayPicker.modifiers);
|
|
2440
1087
|
var modifiers = __assign(__assign({}, internalModifiers), customModifiers);
|
|
2441
|
-
return (
|
|
1088
|
+
return (jsxRuntime.jsx(ModifiersContext.Provider, { value: modifiers, children: props.children }));
|
|
2442
1089
|
}
|
|
2443
1090
|
/**
|
|
2444
1091
|
* Return the modifiers used by DayPicker.
|
|
@@ -2448,7 +1095,7 @@ function ModifiersProvider(props) {
|
|
|
2448
1095
|
*
|
|
2449
1096
|
*/
|
|
2450
1097
|
function useModifiers() {
|
|
2451
|
-
var context =
|
|
1098
|
+
var context = react.useContext(ModifiersContext);
|
|
2452
1099
|
if (!context) {
|
|
2453
1100
|
throw new Error('useModifiers must be used within a ModifiersProvider');
|
|
2454
1101
|
}
|
|
@@ -2686,13 +1333,13 @@ function getNextFocus(focusedDay, options) {
|
|
|
2686
1333
|
*
|
|
2687
1334
|
* Access this context from the {@link useFocusContext} hook.
|
|
2688
1335
|
*/
|
|
2689
|
-
var FocusContext =
|
|
1336
|
+
var FocusContext = react.createContext(undefined);
|
|
2690
1337
|
/** The provider for the {@link FocusContext}. */
|
|
2691
1338
|
function FocusProvider(props) {
|
|
2692
1339
|
var navigation = useNavigation();
|
|
2693
1340
|
var modifiers = useModifiers();
|
|
2694
|
-
var _a =
|
|
2695
|
-
var _b =
|
|
1341
|
+
var _a = react.useState(), focusedDay = _a[0], setFocusedDay = _a[1];
|
|
1342
|
+
var _b = react.useState(), lastFocused = _b[0], setLastFocused = _b[1];
|
|
2696
1343
|
var initialFocusTarget = getInitialFocusTarget(navigation.displayMonths, modifiers);
|
|
2697
1344
|
// TODO: cleanup and test obscure code below
|
|
2698
1345
|
var focusTarget = (focusedDay !== null && focusedDay !== void 0 ? focusedDay : (lastFocused && navigation.isDateDisplayed(lastFocused)))
|
|
@@ -2736,7 +1383,7 @@ function FocusProvider(props) {
|
|
|
2736
1383
|
focusStartOfWeek: function () { return moveFocus('startOfWeek', 'before'); },
|
|
2737
1384
|
focusEndOfWeek: function () { return moveFocus('endOfWeek', 'after'); }
|
|
2738
1385
|
};
|
|
2739
|
-
return (
|
|
1386
|
+
return (jsxRuntime.jsx(FocusContext.Provider, { value: value, children: props.children }));
|
|
2740
1387
|
}
|
|
2741
1388
|
/**
|
|
2742
1389
|
* Hook to access the {@link FocusContextValue}. Use this hook to handle the
|
|
@@ -2745,7 +1392,7 @@ function FocusProvider(props) {
|
|
|
2745
1392
|
* This hook is meant to be used inside internal or custom components.
|
|
2746
1393
|
*/
|
|
2747
1394
|
function useFocusContext() {
|
|
2748
|
-
var context =
|
|
1395
|
+
var context = react.useContext(FocusContext);
|
|
2749
1396
|
if (!context) {
|
|
2750
1397
|
throw new Error('useFocusContext must be used within a FocusProvider');
|
|
2751
1398
|
}
|
|
@@ -2777,16 +1424,16 @@ displayMonth) {
|
|
|
2777
1424
|
*
|
|
2778
1425
|
* Access this context from the {@link useSelectSingle} hook.
|
|
2779
1426
|
*/
|
|
2780
|
-
var SelectSingleContext =
|
|
1427
|
+
var SelectSingleContext = react.createContext(undefined);
|
|
2781
1428
|
/** Provides the values for the {@link SelectSingleProvider}. */
|
|
2782
1429
|
function SelectSingleProvider(props) {
|
|
2783
1430
|
if (!isDayPickerSingle(props.initialProps)) {
|
|
2784
1431
|
var emptyContextValue = {
|
|
2785
1432
|
selected: undefined
|
|
2786
1433
|
};
|
|
2787
|
-
return (
|
|
1434
|
+
return (jsxRuntime.jsx(SelectSingleContext.Provider, { value: emptyContextValue, children: props.children }));
|
|
2788
1435
|
}
|
|
2789
|
-
return (
|
|
1436
|
+
return (jsxRuntime.jsx(SelectSingleProviderInternal, { initialProps: props.initialProps, children: props.children }));
|
|
2790
1437
|
}
|
|
2791
1438
|
function SelectSingleProviderInternal(_a) {
|
|
2792
1439
|
var initialProps = _a.initialProps, children = _a.children;
|
|
@@ -2803,7 +1450,7 @@ function SelectSingleProviderInternal(_a) {
|
|
|
2803
1450
|
selected: initialProps.selected,
|
|
2804
1451
|
onDayClick: onDayClick
|
|
2805
1452
|
};
|
|
2806
|
-
return (
|
|
1453
|
+
return (jsxRuntime.jsx(SelectSingleContext.Provider, { value: contextValue, children: children }));
|
|
2807
1454
|
}
|
|
2808
1455
|
/**
|
|
2809
1456
|
* Hook to access the {@link SelectSingleContextValue}.
|
|
@@ -2811,7 +1458,7 @@ function SelectSingleProviderInternal(_a) {
|
|
|
2811
1458
|
* This hook is meant to be used inside internal or custom components.
|
|
2812
1459
|
*/
|
|
2813
1460
|
function useSelectSingle() {
|
|
2814
|
-
var context =
|
|
1461
|
+
var context = react.useContext(SelectSingleContext);
|
|
2815
1462
|
if (!context) {
|
|
2816
1463
|
throw new Error('useSelectSingle must be used within a SelectSingleProvider');
|
|
2817
1464
|
}
|
|
@@ -3050,7 +1697,7 @@ buttonRef) {
|
|
|
3050
1697
|
var selectedDays = useSelectedDays();
|
|
3051
1698
|
var isButton = Boolean(dayPicker.onDayClick || dayPicker.mode !== 'default');
|
|
3052
1699
|
// Focus the button if the day is focused according to the focus context
|
|
3053
|
-
|
|
1700
|
+
react.useEffect(function () {
|
|
3054
1701
|
var _a;
|
|
3055
1702
|
if (activeModifiers.outside)
|
|
3056
1703
|
return;
|
|
@@ -3073,7 +1720,7 @@ buttonRef) {
|
|
|
3073
1720
|
var isHidden = Boolean((activeModifiers.outside && !dayPicker.showOutsideDays) ||
|
|
3074
1721
|
activeModifiers.hidden);
|
|
3075
1722
|
var DayContentComponent = (_c = (_b = dayPicker.components) === null || _b === void 0 ? void 0 : _b.DayContent) !== null && _c !== void 0 ? _c : DayContent;
|
|
3076
|
-
var children = (
|
|
1723
|
+
var children = (jsxRuntime.jsx(DayContentComponent, { date: day, displayMonth: displayMonth, activeModifiers: activeModifiers }));
|
|
3077
1724
|
var divProps = {
|
|
3078
1725
|
style: style,
|
|
3079
1726
|
className: className,
|
|
@@ -3101,15 +1748,15 @@ buttonRef) {
|
|
|
3101
1748
|
* modifiers.
|
|
3102
1749
|
*/
|
|
3103
1750
|
function Day(props) {
|
|
3104
|
-
var buttonRef =
|
|
1751
|
+
var buttonRef = react.useRef(null);
|
|
3105
1752
|
var dayRender = useDayRender(props.date, props.displayMonth, buttonRef);
|
|
3106
1753
|
if (dayRender.isHidden) {
|
|
3107
|
-
return
|
|
1754
|
+
return jsxRuntime.jsx("div", { role: "gridcell" });
|
|
3108
1755
|
}
|
|
3109
1756
|
if (!dayRender.isButton) {
|
|
3110
|
-
return
|
|
1757
|
+
return jsxRuntime.jsx("div", __assign({}, dayRender.divProps));
|
|
3111
1758
|
}
|
|
3112
|
-
return
|
|
1759
|
+
return jsxRuntime.jsx(Button, __assign({ name: "day", ref: buttonRef }, dayRender.buttonProps));
|
|
3113
1760
|
}
|
|
3114
1761
|
|
|
3115
1762
|
/**
|
|
@@ -3121,13 +1768,13 @@ function WeekNumber(props) {
|
|
|
3121
1768
|
var _a = useDayPicker(), onWeekNumberClick = _a.onWeekNumberClick, styles = _a.styles, classNames = _a.classNames, locale = _a.locale, labelWeekNumber = _a.labels.labelWeekNumber, formatWeekNumber = _a.formatters.formatWeekNumber;
|
|
3122
1769
|
var content = formatWeekNumber(Number(weekNumber), { locale: locale });
|
|
3123
1770
|
if (!onWeekNumberClick) {
|
|
3124
|
-
return (
|
|
1771
|
+
return (jsxRuntime.jsx("span", { className: classNames.weeknumber, style: styles.weeknumber, children: content }));
|
|
3125
1772
|
}
|
|
3126
1773
|
var label = labelWeekNumber(Number(weekNumber), { locale: locale });
|
|
3127
1774
|
var handleClick = function (e) {
|
|
3128
1775
|
onWeekNumberClick(weekNumber, dates, e);
|
|
3129
1776
|
};
|
|
3130
|
-
return (
|
|
1777
|
+
return (jsxRuntime.jsx(Button, { name: "week-number", "aria-label": label, className: classNames.weeknumber, style: styles.weeknumber, onClick: handleClick, children: content }));
|
|
3131
1778
|
}
|
|
3132
1779
|
|
|
3133
1780
|
/** Render a row in the calendar, with the days and the week number. */
|
|
@@ -3138,9 +1785,9 @@ function Row(props) {
|
|
|
3138
1785
|
var WeeknumberComponent = (_b = components === null || components === void 0 ? void 0 : components.WeekNumber) !== null && _b !== void 0 ? _b : WeekNumber;
|
|
3139
1786
|
var weekNumberCell;
|
|
3140
1787
|
if (showWeekNumber) {
|
|
3141
|
-
weekNumberCell = (
|
|
1788
|
+
weekNumberCell = (jsxRuntime.jsx("td", { className: classNames.cell, style: styles.cell, children: jsxRuntime.jsx(WeeknumberComponent, { number: props.weekNumber, dates: props.dates }) }));
|
|
3142
1789
|
}
|
|
3143
|
-
return (
|
|
1790
|
+
return (jsxRuntime.jsxs("tr", { className: classNames.row, style: styles.row, children: [weekNumberCell, props.dates.map(function (date) { return (jsxRuntime.jsx("td", { className: classNames.cell, style: styles.cell, role: "presentation", children: jsxRuntime.jsx(DayComponent, { displayMonth: props.displayMonth, date: date }) }, dateFns.getUnixTime(date))); })] }));
|
|
3144
1791
|
}
|
|
3145
1792
|
|
|
3146
1793
|
/** Return the weeks between two dates. */
|
|
@@ -3208,7 +1855,7 @@ function Table(props) {
|
|
|
3208
1855
|
var HeadComponent = (_a = components === null || components === void 0 ? void 0 : components.Head) !== null && _a !== void 0 ? _a : Head;
|
|
3209
1856
|
var RowComponent = (_b = components === null || components === void 0 ? void 0 : components.Row) !== null && _b !== void 0 ? _b : Row;
|
|
3210
1857
|
var FooterComponent = (_c = components === null || components === void 0 ? void 0 : components.Footer) !== null && _c !== void 0 ? _c : Footer;
|
|
3211
|
-
return (
|
|
1858
|
+
return (jsxRuntime.jsxs("table", { id: props.id, className: classNames.table, style: styles.table, role: "grid", "aria-labelledby": props['aria-labelledby'], children: [!hideHead && jsxRuntime.jsx(HeadComponent, {}), jsxRuntime.jsx("tbody", { className: classNames.tbody, style: styles.tbody, children: weeks.map(function (week) { return (jsxRuntime.jsx(RowComponent, { displayMonth: props.displayMonth, dates: week.dates, weekNumber: week.weekNumber }, week.weekNumber)); }) }), jsxRuntime.jsx(FooterComponent, { displayMonth: props.displayMonth })] }));
|
|
3212
1859
|
}
|
|
3213
1860
|
|
|
3214
1861
|
/*
|
|
@@ -3307,7 +1954,7 @@ function canUseDOM() {
|
|
|
3307
1954
|
* @param effect
|
|
3308
1955
|
* @param deps
|
|
3309
1956
|
*/
|
|
3310
|
-
var useIsomorphicLayoutEffect = canUseDOM() ?
|
|
1957
|
+
var useIsomorphicLayoutEffect = canUseDOM() ? react.useLayoutEffect : react.useEffect;
|
|
3311
1958
|
var serverHandoffComplete = false;
|
|
3312
1959
|
var id = 0;
|
|
3313
1960
|
function genId() {
|
|
@@ -3320,7 +1967,7 @@ function useId(providedId) {
|
|
|
3320
1967
|
// If this instance isn't part of the initial render, we don't have to do the
|
|
3321
1968
|
// double render/patch-up dance. We can just generate the ID and return it.
|
|
3322
1969
|
var initialId = providedId !== null && providedId !== void 0 ? providedId : (serverHandoffComplete ? genId() : null);
|
|
3323
|
-
var _b =
|
|
1970
|
+
var _b = react.useState(initialId), id = _b[0], setId = _b[1];
|
|
3324
1971
|
useIsomorphicLayoutEffect(function () {
|
|
3325
1972
|
if (id === null) {
|
|
3326
1973
|
// Patch the ID after render. We do this in `useLayoutEffect` to avoid any
|
|
@@ -3331,7 +1978,7 @@ function useId(providedId) {
|
|
|
3331
1978
|
}
|
|
3332
1979
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3333
1980
|
}, []);
|
|
3334
|
-
|
|
1981
|
+
react.useEffect(function () {
|
|
3335
1982
|
if (serverHandoffComplete === false) {
|
|
3336
1983
|
// Flag all future uses of `useId` to skip the update dance. This is in
|
|
3337
1984
|
// `useEffect` because it goes after `useLayoutEffect`, ensuring we don't
|
|
@@ -3374,7 +2021,7 @@ function Month(props) {
|
|
|
3374
2021
|
style = __assign(__assign({}, style), styles.caption_between);
|
|
3375
2022
|
}
|
|
3376
2023
|
var CaptionComponent = (_b = components === null || components === void 0 ? void 0 : components.Caption) !== null && _b !== void 0 ? _b : Caption;
|
|
3377
|
-
return (
|
|
2024
|
+
return (jsxRuntime.jsxs("div", { className: className.join(' '), style: style, children: [jsxRuntime.jsx(CaptionComponent, { id: captionId, displayMonth: props.displayMonth, displayIndex: props.displayIndex }), jsxRuntime.jsx(Table, { id: tableId, "aria-labelledby": captionId, displayMonth: props.displayMonth })] }, props.displayIndex));
|
|
3378
2025
|
}
|
|
3379
2026
|
|
|
3380
2027
|
/**
|
|
@@ -3382,7 +2029,7 @@ function Month(props) {
|
|
|
3382
2029
|
*/
|
|
3383
2030
|
function Months(props) {
|
|
3384
2031
|
var _a = useDayPicker(), classNames = _a.classNames, styles = _a.styles;
|
|
3385
|
-
return (
|
|
2032
|
+
return (jsxRuntime.jsx("div", { className: classNames.months, style: styles.months, children: props.children }));
|
|
3386
2033
|
}
|
|
3387
2034
|
|
|
3388
2035
|
/** Render the container with the months according to the number of months to display. */
|
|
@@ -3392,9 +2039,9 @@ function Root(_a) {
|
|
|
3392
2039
|
var dayPicker = useDayPicker();
|
|
3393
2040
|
var focusContext = useFocusContext();
|
|
3394
2041
|
var navigation = useNavigation();
|
|
3395
|
-
var _d =
|
|
2042
|
+
var _d = react.useState(false), hasInitialFocus = _d[0], setHasInitialFocus = _d[1];
|
|
3396
2043
|
// Focus the focus target when initialFocus is passed in
|
|
3397
|
-
|
|
2044
|
+
react.useEffect(function () {
|
|
3398
2045
|
if (!dayPicker.initialFocus)
|
|
3399
2046
|
return;
|
|
3400
2047
|
if (!focusContext.focusTarget)
|
|
@@ -3426,13 +2073,13 @@ function Root(_a) {
|
|
|
3426
2073
|
return __assign(__assign({}, attrs), (_a = {}, _a[key] = initialProps[key], _a));
|
|
3427
2074
|
}, {});
|
|
3428
2075
|
var MonthsComponent = (_c = (_b = initialProps.components) === null || _b === void 0 ? void 0 : _b.Months) !== null && _c !== void 0 ? _c : Months;
|
|
3429
|
-
return (
|
|
2076
|
+
return (jsxRuntime.jsx("div", __assign({ className: classNames.join(' '), style: style, dir: dayPicker.dir, id: dayPicker.id, nonce: initialProps.nonce, title: initialProps.title, lang: initialProps.lang }, dataAttributes, { children: jsxRuntime.jsx(MonthsComponent, { children: navigation.displayMonths.map(function (month, i) { return (jsxRuntime.jsx(Month, { displayIndex: i, displayMonth: month }, i)); }) }) })));
|
|
3430
2077
|
}
|
|
3431
2078
|
|
|
3432
2079
|
/** Provide the value for all the context providers. */
|
|
3433
2080
|
function RootProvider(props) {
|
|
3434
2081
|
var children = props.children, initialProps = __rest(props, ["children"]);
|
|
3435
|
-
return (
|
|
2082
|
+
return (jsxRuntime.jsx(DayPickerProvider, { initialProps: initialProps, children: jsxRuntime.jsx(NavigationProvider, { children: jsxRuntime.jsx(SelectSingleProvider, { initialProps: initialProps, children: jsxRuntime.jsx(SelectMultipleProvider, { initialProps: initialProps, children: jsxRuntime.jsx(SelectRangeProvider, { initialProps: initialProps, children: jsxRuntime.jsx(ModifiersProvider, { children: jsxRuntime.jsx(FocusProvider, { children: children }) }) }) }) }) }) }));
|
|
3436
2083
|
}
|
|
3437
2084
|
|
|
3438
2085
|
/**
|
|
@@ -3523,7 +2170,7 @@ function RootProvider(props) {
|
|
|
3523
2170
|
* ```
|
|
3524
2171
|
*/
|
|
3525
2172
|
function DayPicker(props) {
|
|
3526
|
-
return (
|
|
2173
|
+
return (jsxRuntime.jsx(RootProvider, __assign({}, props, { children: jsxRuntime.jsx(Root, { initialProps: props }) })));
|
|
3527
2174
|
}
|
|
3528
2175
|
|
|
3529
2176
|
/** @private */
|
|
@@ -3539,12 +2186,12 @@ function useInput(options) {
|
|
|
3539
2186
|
// Shortcut to the DateFns functions
|
|
3540
2187
|
var parseValue = function (value) { return dateFns.parse(value, format, today, { locale: locale$1 }); };
|
|
3541
2188
|
// Initialize states
|
|
3542
|
-
var _e =
|
|
3543
|
-
var _f =
|
|
2189
|
+
var _e = react.useState(defaultSelected !== null && defaultSelected !== void 0 ? defaultSelected : today), month = _e[0], setMonth = _e[1];
|
|
2190
|
+
var _f = react.useState(defaultSelected), selectedDay = _f[0], setSelectedDay = _f[1];
|
|
3544
2191
|
var defaultInputValue = defaultSelected
|
|
3545
2192
|
? dateFns.format(defaultSelected, format, { locale: locale$1 })
|
|
3546
2193
|
: '';
|
|
3547
|
-
var _g =
|
|
2194
|
+
var _g = react.useState(defaultInputValue), inputValue = _g[0], setInputValue = _g[1];
|
|
3548
2195
|
var reset = function () {
|
|
3549
2196
|
setSelectedDay(defaultSelected);
|
|
3550
2197
|
setMonth(defaultSelected !== null && defaultSelected !== void 0 ? defaultSelected : today);
|