jattac.libs.web.zest-button 1.5.2 → 1.5.3
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 +4 -0
- package/dist/index.cjs.js +70 -1424
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +43 -1397
- package/dist/index.esm.js.map +1 -1
- package/documentation/breaking-changes.md +19 -0
- package/documentation/development.md +13 -1
- package/package.json +12 -3
package/dist/index.cjs.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
6
7
|
var fa6 = require('react-icons/fa6');
|
|
7
8
|
var fa = require('react-icons/fa');
|
|
8
9
|
var DropdownMenu = require('@radix-ui/react-dropdown-menu');
|
|
@@ -26,1361 +27,6 @@ function _interopNamespaceDefault(e) {
|
|
|
26
27
|
|
|
27
28
|
var DropdownMenu__namespace = /*#__PURE__*/_interopNamespaceDefault(DropdownMenu);
|
|
28
29
|
|
|
29
|
-
var jsxRuntime = {exports: {}};
|
|
30
|
-
|
|
31
|
-
var reactJsxRuntime_production_min = {};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-jsx-runtime.production.min.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
var hasRequiredReactJsxRuntime_production_min;
|
|
44
|
-
|
|
45
|
-
function requireReactJsxRuntime_production_min () {
|
|
46
|
-
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
47
|
-
hasRequiredReactJsxRuntime_production_min = 1;
|
|
48
|
-
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:true,ref:true,__self:true,__source:true};
|
|
49
|
-
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;
|
|
50
|
-
return reactJsxRuntime_production_min;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var reactJsxRuntime_development = {};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @license React
|
|
57
|
-
* react-jsx-runtime.development.js
|
|
58
|
-
*
|
|
59
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
60
|
-
*
|
|
61
|
-
* This source code is licensed under the MIT license found in the
|
|
62
|
-
* LICENSE file in the root directory of this source tree.
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
|
-
var hasRequiredReactJsxRuntime_development;
|
|
66
|
-
|
|
67
|
-
function requireReactJsxRuntime_development () {
|
|
68
|
-
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
69
|
-
hasRequiredReactJsxRuntime_development = 1;
|
|
70
|
-
|
|
71
|
-
if (process.env.NODE_ENV !== "production") {
|
|
72
|
-
(function() {
|
|
73
|
-
|
|
74
|
-
var React = require$$0;
|
|
75
|
-
|
|
76
|
-
// ATTENTION
|
|
77
|
-
// When adding new symbols to this file,
|
|
78
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
79
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
80
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
81
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
82
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
83
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
84
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
85
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
86
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
87
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
88
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
89
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
90
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
91
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
92
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
93
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
94
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
95
|
-
function getIteratorFn(maybeIterable) {
|
|
96
|
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
101
|
-
|
|
102
|
-
if (typeof maybeIterator === 'function') {
|
|
103
|
-
return maybeIterator;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
110
|
-
|
|
111
|
-
function error(format) {
|
|
112
|
-
{
|
|
113
|
-
{
|
|
114
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
115
|
-
args[_key2 - 1] = arguments[_key2];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
printWarning('error', format, args);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function printWarning(level, format, args) {
|
|
124
|
-
// When changing this logic, you might want to also
|
|
125
|
-
// update consoleWithStackDev.www.js as well.
|
|
126
|
-
{
|
|
127
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
128
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
129
|
-
|
|
130
|
-
if (stack !== '') {
|
|
131
|
-
format += '%s';
|
|
132
|
-
args = args.concat([stack]);
|
|
133
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
var argsWithFormat = args.map(function (item) {
|
|
137
|
-
return String(item);
|
|
138
|
-
}); // Careful: RN currently depends on this prefix
|
|
139
|
-
|
|
140
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
141
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
142
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
143
|
-
|
|
144
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// -----------------------------------------------------------------------------
|
|
149
|
-
|
|
150
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
151
|
-
var enableCacheElement = false;
|
|
152
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
153
|
-
|
|
154
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
155
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
156
|
-
// issues in DEV builds.
|
|
157
|
-
|
|
158
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
159
|
-
|
|
160
|
-
var REACT_MODULE_REFERENCE;
|
|
161
|
-
|
|
162
|
-
{
|
|
163
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function isValidElementType(type) {
|
|
167
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
168
|
-
return true;
|
|
169
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
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 ) {
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (typeof type === 'object' && type !== null) {
|
|
177
|
-
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
|
|
178
|
-
// types supported by any Flight configuration anywhere since
|
|
179
|
-
// we don't know which Flight build this will end up being used
|
|
180
|
-
// with.
|
|
181
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
190
|
-
var displayName = outerType.displayName;
|
|
191
|
-
|
|
192
|
-
if (displayName) {
|
|
193
|
-
return displayName;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
197
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
198
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
function getContextName(type) {
|
|
202
|
-
return type.displayName || 'Context';
|
|
203
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
function getComponentNameFromType(type) {
|
|
207
|
-
if (type == null) {
|
|
208
|
-
// Host root, text node or just invalid type.
|
|
209
|
-
return null;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
{
|
|
213
|
-
if (typeof type.tag === 'number') {
|
|
214
|
-
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (typeof type === 'function') {
|
|
219
|
-
return type.displayName || type.name || null;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (typeof type === 'string') {
|
|
223
|
-
return type;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
switch (type) {
|
|
227
|
-
case REACT_FRAGMENT_TYPE:
|
|
228
|
-
return 'Fragment';
|
|
229
|
-
|
|
230
|
-
case REACT_PORTAL_TYPE:
|
|
231
|
-
return 'Portal';
|
|
232
|
-
|
|
233
|
-
case REACT_PROFILER_TYPE:
|
|
234
|
-
return 'Profiler';
|
|
235
|
-
|
|
236
|
-
case REACT_STRICT_MODE_TYPE:
|
|
237
|
-
return 'StrictMode';
|
|
238
|
-
|
|
239
|
-
case REACT_SUSPENSE_TYPE:
|
|
240
|
-
return 'Suspense';
|
|
241
|
-
|
|
242
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
243
|
-
return 'SuspenseList';
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (typeof type === 'object') {
|
|
248
|
-
switch (type.$$typeof) {
|
|
249
|
-
case REACT_CONTEXT_TYPE:
|
|
250
|
-
var context = type;
|
|
251
|
-
return getContextName(context) + '.Consumer';
|
|
252
|
-
|
|
253
|
-
case REACT_PROVIDER_TYPE:
|
|
254
|
-
var provider = type;
|
|
255
|
-
return getContextName(provider._context) + '.Provider';
|
|
256
|
-
|
|
257
|
-
case REACT_FORWARD_REF_TYPE:
|
|
258
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
259
|
-
|
|
260
|
-
case REACT_MEMO_TYPE:
|
|
261
|
-
var outerName = type.displayName || null;
|
|
262
|
-
|
|
263
|
-
if (outerName !== null) {
|
|
264
|
-
return outerName;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
268
|
-
|
|
269
|
-
case REACT_LAZY_TYPE:
|
|
270
|
-
{
|
|
271
|
-
var lazyComponent = type;
|
|
272
|
-
var payload = lazyComponent._payload;
|
|
273
|
-
var init = lazyComponent._init;
|
|
274
|
-
|
|
275
|
-
try {
|
|
276
|
-
return getComponentNameFromType(init(payload));
|
|
277
|
-
} catch (x) {
|
|
278
|
-
return null;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// eslint-disable-next-line no-fallthrough
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
var assign = Object.assign;
|
|
290
|
-
|
|
291
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
292
|
-
// replaying on render function. This currently only patches the object
|
|
293
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
294
|
-
// We could also eagerly patch the method.
|
|
295
|
-
var disabledDepth = 0;
|
|
296
|
-
var prevLog;
|
|
297
|
-
var prevInfo;
|
|
298
|
-
var prevWarn;
|
|
299
|
-
var prevError;
|
|
300
|
-
var prevGroup;
|
|
301
|
-
var prevGroupCollapsed;
|
|
302
|
-
var prevGroupEnd;
|
|
303
|
-
|
|
304
|
-
function disabledLog() {}
|
|
305
|
-
|
|
306
|
-
disabledLog.__reactDisabledLog = true;
|
|
307
|
-
function disableLogs() {
|
|
308
|
-
{
|
|
309
|
-
if (disabledDepth === 0) {
|
|
310
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
311
|
-
prevLog = console.log;
|
|
312
|
-
prevInfo = console.info;
|
|
313
|
-
prevWarn = console.warn;
|
|
314
|
-
prevError = console.error;
|
|
315
|
-
prevGroup = console.group;
|
|
316
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
317
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
318
|
-
|
|
319
|
-
var props = {
|
|
320
|
-
configurable: true,
|
|
321
|
-
enumerable: true,
|
|
322
|
-
value: disabledLog,
|
|
323
|
-
writable: true
|
|
324
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
325
|
-
|
|
326
|
-
Object.defineProperties(console, {
|
|
327
|
-
info: props,
|
|
328
|
-
log: props,
|
|
329
|
-
warn: props,
|
|
330
|
-
error: props,
|
|
331
|
-
group: props,
|
|
332
|
-
groupCollapsed: props,
|
|
333
|
-
groupEnd: props
|
|
334
|
-
});
|
|
335
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
disabledDepth++;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
function reenableLogs() {
|
|
342
|
-
{
|
|
343
|
-
disabledDepth--;
|
|
344
|
-
|
|
345
|
-
if (disabledDepth === 0) {
|
|
346
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
347
|
-
var props = {
|
|
348
|
-
configurable: true,
|
|
349
|
-
enumerable: true,
|
|
350
|
-
writable: true
|
|
351
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
352
|
-
|
|
353
|
-
Object.defineProperties(console, {
|
|
354
|
-
log: assign({}, props, {
|
|
355
|
-
value: prevLog
|
|
356
|
-
}),
|
|
357
|
-
info: assign({}, props, {
|
|
358
|
-
value: prevInfo
|
|
359
|
-
}),
|
|
360
|
-
warn: assign({}, props, {
|
|
361
|
-
value: prevWarn
|
|
362
|
-
}),
|
|
363
|
-
error: assign({}, props, {
|
|
364
|
-
value: prevError
|
|
365
|
-
}),
|
|
366
|
-
group: assign({}, props, {
|
|
367
|
-
value: prevGroup
|
|
368
|
-
}),
|
|
369
|
-
groupCollapsed: assign({}, props, {
|
|
370
|
-
value: prevGroupCollapsed
|
|
371
|
-
}),
|
|
372
|
-
groupEnd: assign({}, props, {
|
|
373
|
-
value: prevGroupEnd
|
|
374
|
-
})
|
|
375
|
-
});
|
|
376
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
if (disabledDepth < 0) {
|
|
380
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
386
|
-
var prefix;
|
|
387
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
388
|
-
{
|
|
389
|
-
if (prefix === undefined) {
|
|
390
|
-
// Extract the VM specific prefix used by each line.
|
|
391
|
-
try {
|
|
392
|
-
throw Error();
|
|
393
|
-
} catch (x) {
|
|
394
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
395
|
-
prefix = match && match[1] || '';
|
|
396
|
-
}
|
|
397
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
return '\n' + prefix + name;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
var reentry = false;
|
|
404
|
-
var componentFrameCache;
|
|
405
|
-
|
|
406
|
-
{
|
|
407
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
408
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
412
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
413
|
-
if ( !fn || reentry) {
|
|
414
|
-
return '';
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
{
|
|
418
|
-
var frame = componentFrameCache.get(fn);
|
|
419
|
-
|
|
420
|
-
if (frame !== undefined) {
|
|
421
|
-
return frame;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
var control;
|
|
426
|
-
reentry = true;
|
|
427
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
428
|
-
|
|
429
|
-
Error.prepareStackTrace = undefined;
|
|
430
|
-
var previousDispatcher;
|
|
431
|
-
|
|
432
|
-
{
|
|
433
|
-
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
434
|
-
// for warnings.
|
|
435
|
-
|
|
436
|
-
ReactCurrentDispatcher.current = null;
|
|
437
|
-
disableLogs();
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
try {
|
|
441
|
-
// This should throw.
|
|
442
|
-
if (construct) {
|
|
443
|
-
// Something should be setting the props in the constructor.
|
|
444
|
-
var Fake = function () {
|
|
445
|
-
throw Error();
|
|
446
|
-
}; // $FlowFixMe
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
450
|
-
set: function () {
|
|
451
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
452
|
-
// because that won't throw in a non-strict mode function.
|
|
453
|
-
throw Error();
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
458
|
-
// We construct a different control for this case to include any extra
|
|
459
|
-
// frames added by the construct call.
|
|
460
|
-
try {
|
|
461
|
-
Reflect.construct(Fake, []);
|
|
462
|
-
} catch (x) {
|
|
463
|
-
control = x;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
Reflect.construct(fn, [], Fake);
|
|
467
|
-
} else {
|
|
468
|
-
try {
|
|
469
|
-
Fake.call();
|
|
470
|
-
} catch (x) {
|
|
471
|
-
control = x;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
fn.call(Fake.prototype);
|
|
475
|
-
}
|
|
476
|
-
} else {
|
|
477
|
-
try {
|
|
478
|
-
throw Error();
|
|
479
|
-
} catch (x) {
|
|
480
|
-
control = x;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
fn();
|
|
484
|
-
}
|
|
485
|
-
} catch (sample) {
|
|
486
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
487
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
488
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
489
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
490
|
-
var sampleLines = sample.stack.split('\n');
|
|
491
|
-
var controlLines = control.stack.split('\n');
|
|
492
|
-
var s = sampleLines.length - 1;
|
|
493
|
-
var c = controlLines.length - 1;
|
|
494
|
-
|
|
495
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
496
|
-
// We expect at least one stack frame to be shared.
|
|
497
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
498
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
499
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
500
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
501
|
-
// the sample somewhere in the control.
|
|
502
|
-
c--;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
506
|
-
// Next we find the first one that isn't the same which should be the
|
|
507
|
-
// frame that called our sample function and the control.
|
|
508
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
509
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
510
|
-
// If we're about to return the first line, and the control is also on the same
|
|
511
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
512
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
513
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
514
|
-
if (s !== 1 || c !== 1) {
|
|
515
|
-
do {
|
|
516
|
-
s--;
|
|
517
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
518
|
-
// The next one that isn't the same should be our match though.
|
|
519
|
-
|
|
520
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
521
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
522
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
523
|
-
// but we have a user-provided "displayName"
|
|
524
|
-
// splice it in to make the stack more readable.
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
528
|
-
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
{
|
|
532
|
-
if (typeof fn === 'function') {
|
|
533
|
-
componentFrameCache.set(fn, _frame);
|
|
534
|
-
}
|
|
535
|
-
} // Return the line we found.
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
return _frame;
|
|
539
|
-
}
|
|
540
|
-
} while (s >= 1 && c >= 0);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
break;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
} finally {
|
|
548
|
-
reentry = false;
|
|
549
|
-
|
|
550
|
-
{
|
|
551
|
-
ReactCurrentDispatcher.current = previousDispatcher;
|
|
552
|
-
reenableLogs();
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
556
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
560
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
561
|
-
|
|
562
|
-
{
|
|
563
|
-
if (typeof fn === 'function') {
|
|
564
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
return syntheticFrame;
|
|
569
|
-
}
|
|
570
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
571
|
-
{
|
|
572
|
-
return describeNativeComponentFrame(fn, false);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
function shouldConstruct(Component) {
|
|
577
|
-
var prototype = Component.prototype;
|
|
578
|
-
return !!(prototype && prototype.isReactComponent);
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
582
|
-
|
|
583
|
-
if (type == null) {
|
|
584
|
-
return '';
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
if (typeof type === 'function') {
|
|
588
|
-
{
|
|
589
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
if (typeof type === 'string') {
|
|
594
|
-
return describeBuiltInComponentFrame(type);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
switch (type) {
|
|
598
|
-
case REACT_SUSPENSE_TYPE:
|
|
599
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
600
|
-
|
|
601
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
602
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
if (typeof type === 'object') {
|
|
606
|
-
switch (type.$$typeof) {
|
|
607
|
-
case REACT_FORWARD_REF_TYPE:
|
|
608
|
-
return describeFunctionComponentFrame(type.render);
|
|
609
|
-
|
|
610
|
-
case REACT_MEMO_TYPE:
|
|
611
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
612
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
613
|
-
|
|
614
|
-
case REACT_LAZY_TYPE:
|
|
615
|
-
{
|
|
616
|
-
var lazyComponent = type;
|
|
617
|
-
var payload = lazyComponent._payload;
|
|
618
|
-
var init = lazyComponent._init;
|
|
619
|
-
|
|
620
|
-
try {
|
|
621
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
622
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
623
|
-
} catch (x) {}
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
return '';
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
632
|
-
|
|
633
|
-
var loggedTypeFailures = {};
|
|
634
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
635
|
-
|
|
636
|
-
function setCurrentlyValidatingElement(element) {
|
|
637
|
-
{
|
|
638
|
-
if (element) {
|
|
639
|
-
var owner = element._owner;
|
|
640
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
641
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
642
|
-
} else {
|
|
643
|
-
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
649
|
-
{
|
|
650
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
651
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
652
|
-
|
|
653
|
-
for (var typeSpecName in typeSpecs) {
|
|
654
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
655
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
656
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
657
|
-
// After these have been cleaned up, we'll let them throw.
|
|
658
|
-
|
|
659
|
-
try {
|
|
660
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
661
|
-
// behavior as without this statement except with a better message.
|
|
662
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
663
|
-
// eslint-disable-next-line react-internal/prod-error-codes
|
|
664
|
-
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`.');
|
|
665
|
-
err.name = 'Invariant Violation';
|
|
666
|
-
throw err;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
670
|
-
} catch (ex) {
|
|
671
|
-
error$1 = ex;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
675
|
-
setCurrentlyValidatingElement(element);
|
|
676
|
-
|
|
677
|
-
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);
|
|
678
|
-
|
|
679
|
-
setCurrentlyValidatingElement(null);
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
683
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
684
|
-
// same error.
|
|
685
|
-
loggedTypeFailures[error$1.message] = true;
|
|
686
|
-
setCurrentlyValidatingElement(element);
|
|
687
|
-
|
|
688
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
689
|
-
|
|
690
|
-
setCurrentlyValidatingElement(null);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
698
|
-
|
|
699
|
-
function isArray(a) {
|
|
700
|
-
return isArrayImpl(a);
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
/*
|
|
704
|
-
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
705
|
-
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
706
|
-
*
|
|
707
|
-
* The functions in this module will throw an easier-to-understand,
|
|
708
|
-
* easier-to-debug exception with a clear errors message message explaining the
|
|
709
|
-
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
710
|
-
* of the `value` object).
|
|
711
|
-
*/
|
|
712
|
-
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
713
|
-
function typeName(value) {
|
|
714
|
-
{
|
|
715
|
-
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
716
|
-
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
717
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
718
|
-
return type;
|
|
719
|
-
}
|
|
720
|
-
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
function willCoercionThrow(value) {
|
|
724
|
-
{
|
|
725
|
-
try {
|
|
726
|
-
testStringCoercion(value);
|
|
727
|
-
return false;
|
|
728
|
-
} catch (e) {
|
|
729
|
-
return true;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
function testStringCoercion(value) {
|
|
735
|
-
// If you ended up here by following an exception call stack, here's what's
|
|
736
|
-
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
737
|
-
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
738
|
-
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
739
|
-
//
|
|
740
|
-
// The most common types that will cause this exception are `Symbol` instances
|
|
741
|
-
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
742
|
-
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
743
|
-
// exception. (Library authors do this to prevent users from using built-in
|
|
744
|
-
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
745
|
-
// methods are needed to perform accurate arithmetic or comparison.)
|
|
746
|
-
//
|
|
747
|
-
// To fix the problem, coerce this object or symbol value to a string before
|
|
748
|
-
// passing it to React. The most reliable way is usually `String(value)`.
|
|
749
|
-
//
|
|
750
|
-
// To find which value is throwing, check the browser or debugger console.
|
|
751
|
-
// Before this exception was thrown, there should be `console.error` output
|
|
752
|
-
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
753
|
-
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
754
|
-
// In most cases, this console output also shows the component and its
|
|
755
|
-
// ancestor components where the exception happened.
|
|
756
|
-
//
|
|
757
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
758
|
-
return '' + value;
|
|
759
|
-
}
|
|
760
|
-
function checkKeyStringCoercion(value) {
|
|
761
|
-
{
|
|
762
|
-
if (willCoercionThrow(value)) {
|
|
763
|
-
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
764
|
-
|
|
765
|
-
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
771
|
-
var RESERVED_PROPS = {
|
|
772
|
-
key: true,
|
|
773
|
-
ref: true,
|
|
774
|
-
__self: true,
|
|
775
|
-
__source: true
|
|
776
|
-
};
|
|
777
|
-
var specialPropKeyWarningShown;
|
|
778
|
-
var specialPropRefWarningShown;
|
|
779
|
-
|
|
780
|
-
function hasValidRef(config) {
|
|
781
|
-
{
|
|
782
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
|
783
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
784
|
-
|
|
785
|
-
if (getter && getter.isReactWarning) {
|
|
786
|
-
return false;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
return config.ref !== undefined;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
function hasValidKey(config) {
|
|
795
|
-
{
|
|
796
|
-
if (hasOwnProperty.call(config, 'key')) {
|
|
797
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
798
|
-
|
|
799
|
-
if (getter && getter.isReactWarning) {
|
|
800
|
-
return false;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
return config.key !== undefined;
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
809
|
-
{
|
|
810
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self) ;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
815
|
-
{
|
|
816
|
-
var warnAboutAccessingKey = function () {
|
|
817
|
-
if (!specialPropKeyWarningShown) {
|
|
818
|
-
specialPropKeyWarningShown = true;
|
|
819
|
-
|
|
820
|
-
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);
|
|
821
|
-
}
|
|
822
|
-
};
|
|
823
|
-
|
|
824
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
825
|
-
Object.defineProperty(props, 'key', {
|
|
826
|
-
get: warnAboutAccessingKey,
|
|
827
|
-
configurable: true
|
|
828
|
-
});
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
833
|
-
{
|
|
834
|
-
var warnAboutAccessingRef = function () {
|
|
835
|
-
if (!specialPropRefWarningShown) {
|
|
836
|
-
specialPropRefWarningShown = true;
|
|
837
|
-
|
|
838
|
-
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);
|
|
839
|
-
}
|
|
840
|
-
};
|
|
841
|
-
|
|
842
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
843
|
-
Object.defineProperty(props, 'ref', {
|
|
844
|
-
get: warnAboutAccessingRef,
|
|
845
|
-
configurable: true
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
851
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
852
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
853
|
-
* if something is a React Element.
|
|
854
|
-
*
|
|
855
|
-
* @param {*} type
|
|
856
|
-
* @param {*} props
|
|
857
|
-
* @param {*} key
|
|
858
|
-
* @param {string|object} ref
|
|
859
|
-
* @param {*} owner
|
|
860
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
861
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
862
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
863
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
864
|
-
* change in behavior.
|
|
865
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
866
|
-
* indicating filename, line number, and/or other information.
|
|
867
|
-
* @internal
|
|
868
|
-
*/
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
872
|
-
var element = {
|
|
873
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
874
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
875
|
-
// Built-in properties that belong on the element
|
|
876
|
-
type: type,
|
|
877
|
-
key: key,
|
|
878
|
-
ref: ref,
|
|
879
|
-
props: props,
|
|
880
|
-
// Record the component responsible for creating this element.
|
|
881
|
-
_owner: owner
|
|
882
|
-
};
|
|
883
|
-
|
|
884
|
-
{
|
|
885
|
-
// The validation flag is currently mutative. We put it on
|
|
886
|
-
// an external backing store so that we can freeze the whole object.
|
|
887
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
888
|
-
// commonly used development environments.
|
|
889
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
890
|
-
// the validation flag non-enumerable (where possible, which should
|
|
891
|
-
// include every environment we run tests in), so the test framework
|
|
892
|
-
// ignores it.
|
|
893
|
-
|
|
894
|
-
Object.defineProperty(element._store, 'validated', {
|
|
895
|
-
configurable: false,
|
|
896
|
-
enumerable: false,
|
|
897
|
-
writable: true,
|
|
898
|
-
value: false
|
|
899
|
-
}); // self and source are DEV only properties.
|
|
900
|
-
|
|
901
|
-
Object.defineProperty(element, '_self', {
|
|
902
|
-
configurable: false,
|
|
903
|
-
enumerable: false,
|
|
904
|
-
writable: false,
|
|
905
|
-
value: self
|
|
906
|
-
}); // Two elements created in two different places should be considered
|
|
907
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
908
|
-
|
|
909
|
-
Object.defineProperty(element, '_source', {
|
|
910
|
-
configurable: false,
|
|
911
|
-
enumerable: false,
|
|
912
|
-
writable: false,
|
|
913
|
-
value: source
|
|
914
|
-
});
|
|
915
|
-
|
|
916
|
-
if (Object.freeze) {
|
|
917
|
-
Object.freeze(element.props);
|
|
918
|
-
Object.freeze(element);
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
return element;
|
|
923
|
-
};
|
|
924
|
-
/**
|
|
925
|
-
* https://github.com/reactjs/rfcs/pull/107
|
|
926
|
-
* @param {*} type
|
|
927
|
-
* @param {object} props
|
|
928
|
-
* @param {string} key
|
|
929
|
-
*/
|
|
930
|
-
|
|
931
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
932
|
-
{
|
|
933
|
-
var propName; // Reserved names are extracted
|
|
934
|
-
|
|
935
|
-
var props = {};
|
|
936
|
-
var key = null;
|
|
937
|
-
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
938
|
-
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
939
|
-
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
940
|
-
// but as an intermediary step, we will use jsxDEV for everything except
|
|
941
|
-
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
942
|
-
// key is explicitly declared to be undefined or not.
|
|
943
|
-
|
|
944
|
-
if (maybeKey !== undefined) {
|
|
945
|
-
{
|
|
946
|
-
checkKeyStringCoercion(maybeKey);
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
key = '' + maybeKey;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
if (hasValidKey(config)) {
|
|
953
|
-
{
|
|
954
|
-
checkKeyStringCoercion(config.key);
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
key = '' + config.key;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
if (hasValidRef(config)) {
|
|
961
|
-
ref = config.ref;
|
|
962
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
963
|
-
} // Remaining properties are added to a new props object
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
for (propName in config) {
|
|
967
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
968
|
-
props[propName] = config[propName];
|
|
969
|
-
}
|
|
970
|
-
} // Resolve default props
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
if (type && type.defaultProps) {
|
|
974
|
-
var defaultProps = type.defaultProps;
|
|
975
|
-
|
|
976
|
-
for (propName in defaultProps) {
|
|
977
|
-
if (props[propName] === undefined) {
|
|
978
|
-
props[propName] = defaultProps[propName];
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
if (key || ref) {
|
|
984
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
985
|
-
|
|
986
|
-
if (key) {
|
|
987
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
if (ref) {
|
|
991
|
-
defineRefPropWarningGetter(props, displayName);
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
1000
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1001
|
-
|
|
1002
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
1003
|
-
{
|
|
1004
|
-
if (element) {
|
|
1005
|
-
var owner = element._owner;
|
|
1006
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1007
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
1008
|
-
} else {
|
|
1009
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
var propTypesMisspellWarningShown;
|
|
1015
|
-
|
|
1016
|
-
{
|
|
1017
|
-
propTypesMisspellWarningShown = false;
|
|
1018
|
-
}
|
|
1019
|
-
/**
|
|
1020
|
-
* Verifies the object is a ReactElement.
|
|
1021
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1022
|
-
* @param {?object} object
|
|
1023
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
1024
|
-
* @final
|
|
1025
|
-
*/
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
function isValidElement(object) {
|
|
1029
|
-
{
|
|
1030
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
function getDeclarationErrorAddendum() {
|
|
1035
|
-
{
|
|
1036
|
-
if (ReactCurrentOwner$1.current) {
|
|
1037
|
-
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
1038
|
-
|
|
1039
|
-
if (name) {
|
|
1040
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
return '';
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
function getSourceInfoErrorAddendum(source) {
|
|
1049
|
-
{
|
|
1050
|
-
|
|
1051
|
-
return '';
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
/**
|
|
1055
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1056
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
1057
|
-
* updates.
|
|
1058
|
-
*/
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
var ownerHasKeyUseWarning = {};
|
|
1062
|
-
|
|
1063
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
1064
|
-
{
|
|
1065
|
-
var info = getDeclarationErrorAddendum();
|
|
1066
|
-
|
|
1067
|
-
if (!info) {
|
|
1068
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1069
|
-
|
|
1070
|
-
if (parentName) {
|
|
1071
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
return info;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
/**
|
|
1079
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1080
|
-
* This element is in an array. The array could grow and shrink or be
|
|
1081
|
-
* reordered. All children that haven't already been validated are required to
|
|
1082
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1083
|
-
* will only be shown once.
|
|
1084
|
-
*
|
|
1085
|
-
* @internal
|
|
1086
|
-
* @param {ReactElement} element Element that requires a key.
|
|
1087
|
-
* @param {*} parentType element's parent's type.
|
|
1088
|
-
*/
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
function validateExplicitKey(element, parentType) {
|
|
1092
|
-
{
|
|
1093
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
1094
|
-
return;
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
element._store.validated = true;
|
|
1098
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1099
|
-
|
|
1100
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1101
|
-
return;
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
1105
|
-
// property, it may be the creator of the child that's responsible for
|
|
1106
|
-
// assigning it a key.
|
|
1107
|
-
|
|
1108
|
-
var childOwner = '';
|
|
1109
|
-
|
|
1110
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
1111
|
-
// Give the component that originally created this child.
|
|
1112
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
setCurrentlyValidatingElement$1(element);
|
|
1116
|
-
|
|
1117
|
-
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);
|
|
1118
|
-
|
|
1119
|
-
setCurrentlyValidatingElement$1(null);
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* Ensure that every element either is passed in a static location, in an
|
|
1124
|
-
* array with an explicit keys property defined, or in an object literal
|
|
1125
|
-
* with valid key property.
|
|
1126
|
-
*
|
|
1127
|
-
* @internal
|
|
1128
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
1129
|
-
* @param {*} parentType node's parent's type.
|
|
1130
|
-
*/
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
function validateChildKeys(node, parentType) {
|
|
1134
|
-
{
|
|
1135
|
-
if (typeof node !== 'object') {
|
|
1136
|
-
return;
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
if (isArray(node)) {
|
|
1140
|
-
for (var i = 0; i < node.length; i++) {
|
|
1141
|
-
var child = node[i];
|
|
1142
|
-
|
|
1143
|
-
if (isValidElement(child)) {
|
|
1144
|
-
validateExplicitKey(child, parentType);
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
} else if (isValidElement(node)) {
|
|
1148
|
-
// This element was passed in a valid location.
|
|
1149
|
-
if (node._store) {
|
|
1150
|
-
node._store.validated = true;
|
|
1151
|
-
}
|
|
1152
|
-
} else if (node) {
|
|
1153
|
-
var iteratorFn = getIteratorFn(node);
|
|
1154
|
-
|
|
1155
|
-
if (typeof iteratorFn === 'function') {
|
|
1156
|
-
// Entry iterators used to provide implicit keys,
|
|
1157
|
-
// but now we print a separate warning for them later.
|
|
1158
|
-
if (iteratorFn !== node.entries) {
|
|
1159
|
-
var iterator = iteratorFn.call(node);
|
|
1160
|
-
var step;
|
|
1161
|
-
|
|
1162
|
-
while (!(step = iterator.next()).done) {
|
|
1163
|
-
if (isValidElement(step.value)) {
|
|
1164
|
-
validateExplicitKey(step.value, parentType);
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
/**
|
|
1173
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
1174
|
-
* provided by the type.
|
|
1175
|
-
*
|
|
1176
|
-
* @param {ReactElement} element
|
|
1177
|
-
*/
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
function validatePropTypes(element) {
|
|
1181
|
-
{
|
|
1182
|
-
var type = element.type;
|
|
1183
|
-
|
|
1184
|
-
if (type === null || type === undefined || typeof type === 'string') {
|
|
1185
|
-
return;
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
var propTypes;
|
|
1189
|
-
|
|
1190
|
-
if (typeof type === 'function') {
|
|
1191
|
-
propTypes = type.propTypes;
|
|
1192
|
-
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1193
|
-
// Inner props are checked in the reconciler.
|
|
1194
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1195
|
-
propTypes = type.propTypes;
|
|
1196
|
-
} else {
|
|
1197
|
-
return;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
if (propTypes) {
|
|
1201
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
1202
|
-
var name = getComponentNameFromType(type);
|
|
1203
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
1204
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1205
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1206
|
-
|
|
1207
|
-
var _name = getComponentNameFromType(type);
|
|
1208
|
-
|
|
1209
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
1213
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
/**
|
|
1218
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
1219
|
-
* @param {ReactElement} fragment
|
|
1220
|
-
*/
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
function validateFragmentProps(fragment) {
|
|
1224
|
-
{
|
|
1225
|
-
var keys = Object.keys(fragment.props);
|
|
1226
|
-
|
|
1227
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1228
|
-
var key = keys[i];
|
|
1229
|
-
|
|
1230
|
-
if (key !== 'children' && key !== 'key') {
|
|
1231
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1232
|
-
|
|
1233
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1234
|
-
|
|
1235
|
-
setCurrentlyValidatingElement$1(null);
|
|
1236
|
-
break;
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
if (fragment.ref !== null) {
|
|
1241
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1242
|
-
|
|
1243
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1244
|
-
|
|
1245
|
-
setCurrentlyValidatingElement$1(null);
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
var didWarnAboutKeySpread = {};
|
|
1251
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1252
|
-
{
|
|
1253
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1254
|
-
// succeed and there will likely be errors in render.
|
|
1255
|
-
|
|
1256
|
-
if (!validType) {
|
|
1257
|
-
var info = '';
|
|
1258
|
-
|
|
1259
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1260
|
-
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.";
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
var sourceInfo = getSourceInfoErrorAddendum();
|
|
1264
|
-
|
|
1265
|
-
if (sourceInfo) {
|
|
1266
|
-
info += sourceInfo;
|
|
1267
|
-
} else {
|
|
1268
|
-
info += getDeclarationErrorAddendum();
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
var typeString;
|
|
1272
|
-
|
|
1273
|
-
if (type === null) {
|
|
1274
|
-
typeString = 'null';
|
|
1275
|
-
} else if (isArray(type)) {
|
|
1276
|
-
typeString = 'array';
|
|
1277
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1278
|
-
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
1279
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1280
|
-
} else {
|
|
1281
|
-
typeString = typeof type;
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
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);
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1288
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1289
|
-
|
|
1290
|
-
if (element == null) {
|
|
1291
|
-
return element;
|
|
1292
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1293
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1294
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
1295
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1296
|
-
// fixed, the key warnings will appear.)
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
if (validType) {
|
|
1300
|
-
var children = props.children;
|
|
1301
|
-
|
|
1302
|
-
if (children !== undefined) {
|
|
1303
|
-
if (isStaticChildren) {
|
|
1304
|
-
if (isArray(children)) {
|
|
1305
|
-
for (var i = 0; i < children.length; i++) {
|
|
1306
|
-
validateChildKeys(children[i], type);
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
if (Object.freeze) {
|
|
1310
|
-
Object.freeze(children);
|
|
1311
|
-
}
|
|
1312
|
-
} else {
|
|
1313
|
-
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.');
|
|
1314
|
-
}
|
|
1315
|
-
} else {
|
|
1316
|
-
validateChildKeys(children, type);
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
{
|
|
1322
|
-
if (hasOwnProperty.call(props, 'key')) {
|
|
1323
|
-
var componentName = getComponentNameFromType(type);
|
|
1324
|
-
var keys = Object.keys(props).filter(function (k) {
|
|
1325
|
-
return k !== 'key';
|
|
1326
|
-
});
|
|
1327
|
-
var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
|
|
1328
|
-
|
|
1329
|
-
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
1330
|
-
var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
|
|
1331
|
-
|
|
1332
|
-
error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
|
1333
|
-
|
|
1334
|
-
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
1340
|
-
validateFragmentProps(element);
|
|
1341
|
-
} else {
|
|
1342
|
-
validatePropTypes(element);
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
return element;
|
|
1346
|
-
}
|
|
1347
|
-
} // These two functions exist to still get child warnings in dev
|
|
1348
|
-
// even with the prod transform. This means that jsxDEV is purely
|
|
1349
|
-
// opt-in behavior for better messages but that we won't stop
|
|
1350
|
-
// giving you warnings if you use production apis.
|
|
1351
|
-
|
|
1352
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
1353
|
-
{
|
|
1354
|
-
return jsxWithValidation(type, props, key, true);
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
function jsxWithValidationDynamic(type, props, key) {
|
|
1358
|
-
{
|
|
1359
|
-
return jsxWithValidation(type, props, key, false);
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
1364
|
-
// for now we can ship identical prod functions
|
|
1365
|
-
|
|
1366
|
-
var jsxs = jsxWithValidationStatic ;
|
|
1367
|
-
|
|
1368
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
1369
|
-
reactJsxRuntime_development.jsx = jsx;
|
|
1370
|
-
reactJsxRuntime_development.jsxs = jsxs;
|
|
1371
|
-
})();
|
|
1372
|
-
}
|
|
1373
|
-
return reactJsxRuntime_development;
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1377
|
-
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
1378
|
-
} else {
|
|
1379
|
-
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
var jsxRuntimeExports = jsxRuntime.exports;
|
|
1383
|
-
|
|
1384
30
|
function styleInject(css, ref) {
|
|
1385
31
|
if ( ref === void 0 ) ref = {};
|
|
1386
32
|
var insertAt = ref.insertAt;
|
|
@@ -1413,10 +59,10 @@ var styles = {"force-light":"ZestButton-module_force-light__zZTIZ","force-dark":
|
|
|
1413
59
|
styleInject(css_248z);
|
|
1414
60
|
|
|
1415
61
|
// Create the Zest Context with a default empty configuration
|
|
1416
|
-
const ZestButtonConfigContext =
|
|
62
|
+
const ZestButtonConfigContext = React.createContext(undefined);
|
|
1417
63
|
// Custom hook to use the Zest Context
|
|
1418
64
|
const useZestButtonConfig = () => {
|
|
1419
|
-
const context =
|
|
65
|
+
const context = React.useContext(ZestButtonConfigContext);
|
|
1420
66
|
// Optional: Add a check here if context is undefined, meaning provider is not used
|
|
1421
67
|
// if (context === undefined) {
|
|
1422
68
|
// console.warn("useZestButtonConfig must be used within a ZestButtonConfigProvider. Falling back to default ZestButton props.");
|
|
@@ -1429,20 +75,20 @@ const semanticTypeButtonConfigDefaults = {
|
|
|
1429
75
|
'add': {
|
|
1430
76
|
visualOptions: {
|
|
1431
77
|
variant: 'standard',
|
|
1432
|
-
iconLeft:
|
|
78
|
+
iconLeft: jsxRuntime.jsx(fa.FaPlus, {}),
|
|
1433
79
|
},
|
|
1434
80
|
},
|
|
1435
81
|
'new': {
|
|
1436
82
|
visualOptions: {
|
|
1437
83
|
variant: 'standard',
|
|
1438
|
-
iconLeft:
|
|
84
|
+
iconLeft: jsxRuntime.jsx(fa.FaPlus, {}),
|
|
1439
85
|
},
|
|
1440
86
|
},
|
|
1441
87
|
// Save / Submit
|
|
1442
88
|
'save': {
|
|
1443
89
|
visualOptions: {
|
|
1444
90
|
variant: 'success',
|
|
1445
|
-
iconLeft:
|
|
91
|
+
iconLeft: jsxRuntime.jsx(fa.FaSave, {}),
|
|
1446
92
|
},
|
|
1447
93
|
busyOptions: { minBusyDurationMs: 500 }, // Default busy duration for saves
|
|
1448
94
|
successOptions: { showCheckmark: true },
|
|
@@ -1450,7 +96,7 @@ const semanticTypeButtonConfigDefaults = {
|
|
|
1450
96
|
'submit': {
|
|
1451
97
|
visualOptions: {
|
|
1452
98
|
variant: 'success',
|
|
1453
|
-
iconLeft:
|
|
99
|
+
iconLeft: jsxRuntime.jsx(fa.FaSave, {}),
|
|
1454
100
|
},
|
|
1455
101
|
busyOptions: { minBusyDurationMs: 500 },
|
|
1456
102
|
successOptions: { showCheckmark: true },
|
|
@@ -1459,20 +105,20 @@ const semanticTypeButtonConfigDefaults = {
|
|
|
1459
105
|
'edit': {
|
|
1460
106
|
visualOptions: {
|
|
1461
107
|
variant: 'standard',
|
|
1462
|
-
iconLeft:
|
|
108
|
+
iconLeft: jsxRuntime.jsx(fa.FaEdit, {}),
|
|
1463
109
|
},
|
|
1464
110
|
},
|
|
1465
111
|
'update': {
|
|
1466
112
|
visualOptions: {
|
|
1467
113
|
variant: 'standard',
|
|
1468
|
-
iconLeft:
|
|
114
|
+
iconLeft: jsxRuntime.jsx(fa.FaEdit, {}),
|
|
1469
115
|
},
|
|
1470
116
|
},
|
|
1471
117
|
// Delete / Remove
|
|
1472
118
|
'delete': {
|
|
1473
119
|
visualOptions: {
|
|
1474
120
|
variant: 'danger',
|
|
1475
|
-
iconLeft:
|
|
121
|
+
iconLeft: jsxRuntime.jsx(fa.FaTrash, {}),
|
|
1476
122
|
},
|
|
1477
123
|
confirmOptions: {
|
|
1478
124
|
displayLabel: 'Confirm Delete',
|
|
@@ -1483,7 +129,7 @@ const semanticTypeButtonConfigDefaults = {
|
|
|
1483
129
|
'remove': {
|
|
1484
130
|
visualOptions: {
|
|
1485
131
|
variant: 'danger',
|
|
1486
|
-
iconLeft:
|
|
132
|
+
iconLeft: jsxRuntime.jsx(fa.FaTrash, {}),
|
|
1487
133
|
},
|
|
1488
134
|
confirmOptions: {
|
|
1489
135
|
displayLabel: 'Confirm Remove',
|
|
@@ -1496,14 +142,14 @@ const semanticTypeButtonConfigDefaults = {
|
|
|
1496
142
|
buttonStyle: 'outline', // Moved here
|
|
1497
143
|
visualOptions: {
|
|
1498
144
|
variant: 'standard',
|
|
1499
|
-
iconLeft:
|
|
145
|
+
iconLeft: jsxRuntime.jsx(fa.FaTimes, {}),
|
|
1500
146
|
},
|
|
1501
147
|
},
|
|
1502
148
|
'close': {
|
|
1503
149
|
buttonStyle: 'outline', // Moved here
|
|
1504
150
|
visualOptions: {
|
|
1505
151
|
variant: 'standard',
|
|
1506
|
-
iconLeft:
|
|
152
|
+
iconLeft: jsxRuntime.jsx(fa.FaTimes, {}),
|
|
1507
153
|
},
|
|
1508
154
|
},
|
|
1509
155
|
// View / Details
|
|
@@ -1511,42 +157,42 @@ const semanticTypeButtonConfigDefaults = {
|
|
|
1511
157
|
buttonStyle: 'text', // Moved here
|
|
1512
158
|
visualOptions: {
|
|
1513
159
|
variant: 'standard',
|
|
1514
|
-
iconRight:
|
|
160
|
+
iconRight: jsxRuntime.jsx(fa.FaArrowRight, {}),
|
|
1515
161
|
},
|
|
1516
162
|
},
|
|
1517
163
|
'details': {
|
|
1518
164
|
buttonStyle: 'text', // Moved here
|
|
1519
165
|
visualOptions: {
|
|
1520
166
|
variant: 'standard',
|
|
1521
|
-
iconRight:
|
|
167
|
+
iconRight: jsxRuntime.jsx(fa.FaArrowRight, {}),
|
|
1522
168
|
},
|
|
1523
169
|
},
|
|
1524
170
|
// Download
|
|
1525
171
|
'download': {
|
|
1526
172
|
visualOptions: {
|
|
1527
173
|
variant: 'standard',
|
|
1528
|
-
iconLeft:
|
|
174
|
+
iconLeft: jsxRuntime.jsx(fa.FaDownload, {}),
|
|
1529
175
|
},
|
|
1530
176
|
},
|
|
1531
177
|
// Upload
|
|
1532
178
|
'upload': {
|
|
1533
179
|
visualOptions: {
|
|
1534
180
|
variant: 'standard',
|
|
1535
|
-
iconLeft:
|
|
181
|
+
iconLeft: jsxRuntime.jsx(fa.FaUpload, {}),
|
|
1536
182
|
},
|
|
1537
183
|
},
|
|
1538
184
|
// Refresh / Reload
|
|
1539
185
|
'refresh': {
|
|
1540
186
|
visualOptions: {
|
|
1541
187
|
variant: 'standard',
|
|
1542
|
-
iconLeft:
|
|
188
|
+
iconLeft: jsxRuntime.jsx(fa.FaSyncAlt, {}),
|
|
1543
189
|
},
|
|
1544
190
|
busyOptions: { minBusyDurationMs: 500 },
|
|
1545
191
|
},
|
|
1546
192
|
'reload': {
|
|
1547
193
|
visualOptions: {
|
|
1548
194
|
variant: 'standard',
|
|
1549
|
-
iconLeft:
|
|
195
|
+
iconLeft: jsxRuntime.jsx(fa.FaSyncAlt, {}),
|
|
1550
196
|
},
|
|
1551
197
|
busyOptions: { minBusyDurationMs: 500 },
|
|
1552
198
|
},
|
|
@@ -1554,14 +200,14 @@ const semanticTypeButtonConfigDefaults = {
|
|
|
1554
200
|
'print': {
|
|
1555
201
|
visualOptions: {
|
|
1556
202
|
variant: 'standard',
|
|
1557
|
-
iconLeft:
|
|
203
|
+
iconLeft: jsxRuntime.jsx(fa.FaPrint, {}),
|
|
1558
204
|
},
|
|
1559
205
|
},
|
|
1560
206
|
// Share
|
|
1561
207
|
'share': {
|
|
1562
208
|
visualOptions: {
|
|
1563
209
|
variant: 'standard',
|
|
1564
|
-
iconLeft:
|
|
210
|
+
iconLeft: jsxRuntime.jsx(fa.FaShareAlt, {}),
|
|
1565
211
|
},
|
|
1566
212
|
},
|
|
1567
213
|
// Confirm (generic)
|
|
@@ -1618,14 +264,14 @@ const useZestConfig = (localZestProps) => {
|
|
|
1618
264
|
};
|
|
1619
265
|
|
|
1620
266
|
const useBusyState = ({ busyOptions, successOptions }) => {
|
|
1621
|
-
const [internalBusy, setInternalBusy] =
|
|
1622
|
-
const [wasSuccessful, setWasSuccessful] =
|
|
1623
|
-
const [wasFailed, setWasFailed] =
|
|
1624
|
-
const failTimeoutRef =
|
|
267
|
+
const [internalBusy, setInternalBusy] = React.useState(false);
|
|
268
|
+
const [wasSuccessful, setWasSuccessful] = React.useState(false);
|
|
269
|
+
const [wasFailed, setWasFailed] = React.useState(false);
|
|
270
|
+
const failTimeoutRef = React.useRef(null);
|
|
1625
271
|
const { handleInternally = true, preventRageClick = true, minBusyDurationMs = 500, } = busyOptions || {};
|
|
1626
272
|
const { showCheckmark = true, showFailIcon = true, autoResetAfterMs = 2000, } = successOptions || {};
|
|
1627
273
|
// Edge Case 4: Add warnings for very short durations in development
|
|
1628
|
-
|
|
274
|
+
React.useEffect(() => {
|
|
1629
275
|
if (process.env.NODE_ENV === 'development') {
|
|
1630
276
|
if (minBusyDurationMs > 0 && minBusyDurationMs < 100) {
|
|
1631
277
|
console.warn(`ZestButton: 'minBusyDurationMs' is set to ${minBusyDurationMs}ms. Very short durations can lead to visual flickering and a poor user experience. Consider a value of 100ms or more.`);
|
|
@@ -1636,7 +282,7 @@ const useBusyState = ({ busyOptions, successOptions }) => {
|
|
|
1636
282
|
}
|
|
1637
283
|
}, [minBusyDurationMs, autoResetAfterMs]);
|
|
1638
284
|
// auto-reset success/failure state
|
|
1639
|
-
|
|
285
|
+
React.useEffect(() => {
|
|
1640
286
|
if ((wasSuccessful || wasFailed) && autoResetAfterMs) {
|
|
1641
287
|
const timeout = setTimeout(() => {
|
|
1642
288
|
setWasSuccessful(false);
|
|
@@ -1650,7 +296,7 @@ const useBusyState = ({ busyOptions, successOptions }) => {
|
|
|
1650
296
|
}
|
|
1651
297
|
}, [wasSuccessful, wasFailed, autoResetAfterMs]);
|
|
1652
298
|
// Cleanup for failTimeoutRef on unmount
|
|
1653
|
-
|
|
299
|
+
React.useEffect(() => {
|
|
1654
300
|
return () => {
|
|
1655
301
|
if (failTimeoutRef.current) {
|
|
1656
302
|
clearTimeout(failTimeoutRef.current);
|
|
@@ -1698,15 +344,15 @@ const useBusyState = ({ busyOptions, successOptions }) => {
|
|
|
1698
344
|
};
|
|
1699
345
|
|
|
1700
346
|
const useConfirmation = ({ confirmOptions, originalChildren, onConfirmFail }) => {
|
|
1701
|
-
const [awaitingConfirm, setAwaitingConfirm] =
|
|
1702
|
-
const [currentChildren, setCurrentChildren] =
|
|
1703
|
-
const confirmIntervalRef =
|
|
1704
|
-
|
|
347
|
+
const [awaitingConfirm, setAwaitingConfirm] = React.useState(false);
|
|
348
|
+
const [currentChildren, setCurrentChildren] = React.useState(originalChildren);
|
|
349
|
+
const confirmIntervalRef = React.useRef(null);
|
|
350
|
+
React.useEffect(() => {
|
|
1705
351
|
if (!awaitingConfirm) {
|
|
1706
352
|
setCurrentChildren(originalChildren);
|
|
1707
353
|
}
|
|
1708
354
|
}, [originalChildren, awaitingConfirm]);
|
|
1709
|
-
const stopConfirmation =
|
|
355
|
+
const stopConfirmation = React.useCallback(() => {
|
|
1710
356
|
if (confirmIntervalRef.current) {
|
|
1711
357
|
clearInterval(confirmIntervalRef.current);
|
|
1712
358
|
confirmIntervalRef.current = null;
|
|
@@ -1714,7 +360,7 @@ const useConfirmation = ({ confirmOptions, originalChildren, onConfirmFail }) =>
|
|
|
1714
360
|
setCurrentChildren(originalChildren);
|
|
1715
361
|
setAwaitingConfirm(false);
|
|
1716
362
|
}, [originalChildren]);
|
|
1717
|
-
const startConfirmation =
|
|
363
|
+
const startConfirmation = React.useCallback(() => {
|
|
1718
364
|
if (!confirmOptions)
|
|
1719
365
|
return;
|
|
1720
366
|
setAwaitingConfirm(true);
|
|
@@ -1733,7 +379,7 @@ const useConfirmation = ({ confirmOptions, originalChildren, onConfirmFail }) =>
|
|
|
1733
379
|
}
|
|
1734
380
|
}, 1000);
|
|
1735
381
|
}, [confirmOptions, onConfirmFail, stopConfirmation]);
|
|
1736
|
-
|
|
382
|
+
React.useEffect(() => {
|
|
1737
383
|
return () => {
|
|
1738
384
|
if (confirmIntervalRef.current) {
|
|
1739
385
|
clearInterval(confirmIntervalRef.current);
|
|
@@ -1749,8 +395,8 @@ const useConfirmation = ({ confirmOptions, originalChildren, onConfirmFail }) =>
|
|
|
1749
395
|
};
|
|
1750
396
|
|
|
1751
397
|
const useThemeDetection = () => {
|
|
1752
|
-
const [systemTheme, setSystemTheme] =
|
|
1753
|
-
|
|
398
|
+
const [systemTheme, setSystemTheme] = React.useState('light');
|
|
399
|
+
React.useEffect(() => {
|
|
1754
400
|
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
1755
401
|
const handleChange = () => {
|
|
1756
402
|
setSystemTheme(mediaQuery.matches ? 'dark' : 'light');
|
|
@@ -1762,8 +408,8 @@ const useThemeDetection = () => {
|
|
|
1762
408
|
return systemTheme;
|
|
1763
409
|
};
|
|
1764
410
|
|
|
1765
|
-
const AnimatedCheckmark$1 = () => (
|
|
1766
|
-
const AnimatedX$1 = () => (
|
|
411
|
+
const AnimatedCheckmark$1 = () => (jsxRuntime.jsx("svg", { className: styles.animatedCheck, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7" }) }));
|
|
412
|
+
const AnimatedX$1 = () => (jsxRuntime.jsxs("svg", { className: styles.animatedX, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntime.jsx("path", { d: "M6 6L18 18" }), jsxRuntime.jsx("path", { d: "M6 18L18 6" })] }));
|
|
1767
413
|
const ZestDropdownMenuItem = ({ option, disabled: externallyDisabled = false, onBusyChange, }) => {
|
|
1768
414
|
const { label, icon, disabled: optionDisabled = false, onClick, busyOptions = {}, successOptions = {}, confirmOptions, } = option;
|
|
1769
415
|
const { handleInternally, minBusyDurationMs, showCheckmark, showFailIcon, internalBusy, wasSuccessful, wasFailed, startBusy, endBusy, } = useBusyState({ busyOptions, successOptions });
|
|
@@ -1772,7 +418,7 @@ const ZestDropdownMenuItem = ({ option, disabled: externallyDisabled = false, on
|
|
|
1772
418
|
originalChildren: label,
|
|
1773
419
|
onConfirmFail: () => endBusy(false),
|
|
1774
420
|
});
|
|
1775
|
-
|
|
421
|
+
React.useEffect(() => {
|
|
1776
422
|
onBusyChange?.(internalBusy);
|
|
1777
423
|
// Radix can unmount this item mid-flight (e.g. an outside pointerdown dismissing the
|
|
1778
424
|
// dropdown while this item's own async onClick is still pending) - without this cleanup, the
|
|
@@ -1838,32 +484,32 @@ const ZestDropdownMenuItem = ({ option, disabled: externallyDisabled = false, on
|
|
|
1838
484
|
};
|
|
1839
485
|
const renderIcon = () => {
|
|
1840
486
|
if (internalBusy) {
|
|
1841
|
-
return (
|
|
487
|
+
return (jsxRuntime.jsx("span", { className: `${styles.icon} ${styles.fadeIn}`, children: jsxRuntime.jsx(fa6.FaSpinner, { className: styles.spinner }) }));
|
|
1842
488
|
}
|
|
1843
489
|
if (wasSuccessful && showCheckmark) {
|
|
1844
|
-
return (
|
|
490
|
+
return (jsxRuntime.jsx("span", { className: `${styles.icon} ${styles.fadeIn}`, children: jsxRuntime.jsx(AnimatedCheckmark$1, {}) }));
|
|
1845
491
|
}
|
|
1846
492
|
if (wasFailed && showFailIcon) {
|
|
1847
|
-
return (
|
|
493
|
+
return (jsxRuntime.jsx("span", { className: `${styles.icon} ${styles.fadeIn}`, children: jsxRuntime.jsx(AnimatedX$1, {}) }));
|
|
1848
494
|
}
|
|
1849
495
|
if (icon) {
|
|
1850
|
-
return
|
|
496
|
+
return jsxRuntime.jsx("span", { className: styles.icon, children: icon });
|
|
1851
497
|
}
|
|
1852
498
|
return null;
|
|
1853
499
|
};
|
|
1854
|
-
return (
|
|
500
|
+
return (jsxRuntime.jsxs(DropdownMenu__namespace.Item, { className: [
|
|
1855
501
|
styles.dropdownMenuItem,
|
|
1856
502
|
isDisabled ? styles.disabled : "",
|
|
1857
503
|
wasFailed ? styles.shake : "",
|
|
1858
504
|
]
|
|
1859
505
|
.join(" ")
|
|
1860
|
-
.trim(), disabled: isDisabled, onSelect: handleSelect, children: [renderIcon(),
|
|
506
|
+
.trim(), disabled: isDisabled, onSelect: handleSelect, children: [renderIcon(), jsxRuntime.jsx("span", { className: styles.dropdownMenuItemLabel, children: currentChildren })] }));
|
|
1861
507
|
};
|
|
1862
508
|
|
|
1863
509
|
const ZestDropdownMenu = ({ options, ariaLabel, open, onOpenChange, disabled = false, onAnyItemBusyChange, variant, size, buttonStyle, effectiveTheme, effectiveMenuTheme, menuMinWidth, }) => {
|
|
1864
510
|
const resolvedMenuTheme = effectiveMenuTheme ?? effectiveTheme;
|
|
1865
|
-
const busyKeysRef =
|
|
1866
|
-
const handleItemBusyChange =
|
|
511
|
+
const busyKeysRef = React.useRef(new Set());
|
|
512
|
+
const handleItemBusyChange = React.useCallback((key, busy) => {
|
|
1867
513
|
const busyKeys = busyKeysRef.current;
|
|
1868
514
|
const wasAnyBusy = busyKeys.size > 0;
|
|
1869
515
|
if (busy) {
|
|
@@ -1877,7 +523,7 @@ const ZestDropdownMenu = ({ options, ariaLabel, open, onOpenChange, disabled = f
|
|
|
1877
523
|
onAnyItemBusyChange?.(isAnyBusy);
|
|
1878
524
|
}
|
|
1879
525
|
}, [onAnyItemBusyChange]);
|
|
1880
|
-
return (
|
|
526
|
+
return (jsxRuntime.jsxs(DropdownMenu__namespace.Root, { open: open, onOpenChange: onOpenChange, modal: false, children: [jsxRuntime.jsx(DropdownMenu__namespace.Trigger, { asChild: true, disabled: disabled, children: jsxRuntime.jsx("button", { type: "button", "aria-label": ariaLabel, disabled: disabled, className: [
|
|
1881
527
|
styles.button,
|
|
1882
528
|
styles.dropdownTrigger,
|
|
1883
529
|
styles[buttonStyle],
|
|
@@ -1887,19 +533,19 @@ const ZestDropdownMenu = ({ options, ariaLabel, open, onOpenChange, disabled = f
|
|
|
1887
533
|
effectiveTheme === "light" ? styles["force-light"] : styles["force-dark"],
|
|
1888
534
|
]
|
|
1889
535
|
.join(" ")
|
|
1890
|
-
.trim(), children:
|
|
536
|
+
.trim(), children: jsxRuntime.jsx(fa6.FaChevronDown, { className: [styles.dropdownChevron, open ? styles.dropdownChevronOpen : ""]
|
|
1891
537
|
.join(" ")
|
|
1892
|
-
.trim() }) }) }),
|
|
538
|
+
.trim() }) }) }), jsxRuntime.jsx(DropdownMenu__namespace.Portal, { children: jsxRuntime.jsx(DropdownMenu__namespace.Content, { className: [
|
|
1893
539
|
styles.dropdownMenuContent,
|
|
1894
540
|
resolvedMenuTheme === "light" ? styles["force-light"] : styles["force-dark"],
|
|
1895
541
|
].join(" "), style: menuMinWidth !== undefined
|
|
1896
542
|
? { minWidth: typeof menuMinWidth === "number" ? `${menuMinWidth}px` : menuMinWidth }
|
|
1897
|
-
: undefined, sideOffset: 4, align: "end", collisionPadding: 8, children: options.map((option, index) => (
|
|
543
|
+
: undefined, sideOffset: 4, align: "end", collisionPadding: 8, children: options.map((option, index) => (jsxRuntime.jsx(ZestDropdownMenuItem, { option: option, disabled: disabled, onBusyChange: (busy) => handleItemBusyChange(option.key ?? index, busy) }, option.key ?? index))) }) })] }));
|
|
1898
544
|
};
|
|
1899
545
|
|
|
1900
546
|
// --- Components ---
|
|
1901
|
-
const AnimatedCheckmark = () => (
|
|
1902
|
-
const AnimatedX = () => (
|
|
547
|
+
const AnimatedCheckmark = () => (jsxRuntime.jsx("svg", { className: styles.animatedCheck, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7" }) }));
|
|
548
|
+
const AnimatedX = () => (jsxRuntime.jsxs("svg", { className: styles.animatedX, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntime.jsx("path", { d: "M6 6L18 18" }), jsxRuntime.jsx("path", { d: "M6 18L18 6" })] }));
|
|
1903
549
|
const ZestButton = ({ className = "", disabled, children, onClick, zest: localZestProps, ...props }) => {
|
|
1904
550
|
const effectiveZestConfig = useZestConfig(localZestProps);
|
|
1905
551
|
const { visualOptions = {}, busyOptions = {}, successOptions = {}, confirmOptions, isDefault = false, theme = 'system', buttonStyle = 'solid', dropdownOptions, dropdownAriaLabel = "More options", dropdownTheme, dropdownWidth, } = effectiveZestConfig;
|
|
@@ -1910,7 +556,7 @@ const ZestButton = ({ className = "", disabled, children, onClick, zest: localZe
|
|
|
1910
556
|
originalChildren: children,
|
|
1911
557
|
onConfirmFail: () => endBusy(false),
|
|
1912
558
|
});
|
|
1913
|
-
const buttonRef =
|
|
559
|
+
const buttonRef = React.useRef(null);
|
|
1914
560
|
const systemTheme = useThemeDetection();
|
|
1915
561
|
const effectiveTheme = theme === 'system' ? systemTheme : theme;
|
|
1916
562
|
// Dropdown menus follow the OS/browser theme by default, independently of
|
|
@@ -1920,11 +566,11 @@ const ZestButton = ({ className = "", disabled, children, onClick, zest: localZe
|
|
|
1920
566
|
const resolvedDropdownTheme = dropdownTheme ?? 'system';
|
|
1921
567
|
const effectiveDropdownTheme = resolvedDropdownTheme === 'system' ? systemTheme : resolvedDropdownTheme;
|
|
1922
568
|
const hasDropdown = Boolean(dropdownOptions && dropdownOptions.length > 0);
|
|
1923
|
-
const [dropdownOpen, setDropdownOpen] =
|
|
1924
|
-
const [anyDropdownItemBusy, setAnyDropdownItemBusy] =
|
|
1925
|
-
const splitContainerRef =
|
|
1926
|
-
const [measuredControlWidth, setMeasuredControlWidth] =
|
|
1927
|
-
|
|
569
|
+
const [dropdownOpen, setDropdownOpen] = React.useState(false);
|
|
570
|
+
const [anyDropdownItemBusy, setAnyDropdownItemBusy] = React.useState(false);
|
|
571
|
+
const splitContainerRef = React.useRef(null);
|
|
572
|
+
const [measuredControlWidth, setMeasuredControlWidth] = React.useState(undefined);
|
|
573
|
+
React.useLayoutEffect(() => {
|
|
1928
574
|
if (!hasDropdown || !splitContainerRef.current)
|
|
1929
575
|
return;
|
|
1930
576
|
const el = splitContainerRef.current;
|
|
@@ -1993,7 +639,7 @@ const ZestButton = ({ className = "", disabled, children, onClick, zest: localZe
|
|
|
1993
639
|
handleClick(e);
|
|
1994
640
|
}
|
|
1995
641
|
};
|
|
1996
|
-
|
|
642
|
+
React.useEffect(() => {
|
|
1997
643
|
if (!isDefault || isDisabled || dropdownOpen)
|
|
1998
644
|
return;
|
|
1999
645
|
const listener = (e) => {
|
|
@@ -2014,20 +660,20 @@ const ZestButton = ({ className = "", disabled, children, onClick, zest: localZe
|
|
|
2014
660
|
}, [isDefault, isDisabled, dropdownOpen]);
|
|
2015
661
|
const renderLeftIcon = () => {
|
|
2016
662
|
if (effectiveBusy) {
|
|
2017
|
-
return (
|
|
663
|
+
return (jsxRuntime.jsx("span", { className: `${styles.icon} ${styles.fadeIn}`, children: jsxRuntime.jsx(fa6.FaSpinner, { className: styles.spinner }) }));
|
|
2018
664
|
}
|
|
2019
665
|
if (wasSuccessful && showCheckmark) {
|
|
2020
|
-
return (
|
|
666
|
+
return (jsxRuntime.jsx("span", { className: `${styles.icon} ${styles.fadeIn}`, children: jsxRuntime.jsx(AnimatedCheckmark, {}) }));
|
|
2021
667
|
}
|
|
2022
668
|
if (wasFailed && showFailIcon) {
|
|
2023
|
-
return (
|
|
669
|
+
return (jsxRuntime.jsx("span", { className: `${styles.icon} ${styles.fadeIn}`, children: jsxRuntime.jsx(AnimatedX, {}) }));
|
|
2024
670
|
}
|
|
2025
671
|
if (iconLeft) {
|
|
2026
|
-
return
|
|
672
|
+
return jsxRuntime.jsx("span", { className: styles.icon, children: iconLeft });
|
|
2027
673
|
}
|
|
2028
674
|
return null;
|
|
2029
675
|
};
|
|
2030
|
-
const buttonElement = (
|
|
676
|
+
const buttonElement = (jsxRuntime.jsx("button", { ref: buttonRef, className: [
|
|
2031
677
|
styles.button,
|
|
2032
678
|
styles[buttonStyle],
|
|
2033
679
|
styles[variant],
|
|
@@ -2038,15 +684,15 @@ const ZestButton = ({ className = "", disabled, children, onClick, zest: localZe
|
|
|
2038
684
|
effectiveTheme === 'light' ? styles['force-light'] : styles['force-dark'],
|
|
2039
685
|
hasDropdown ? styles.splitButtonMain : "",
|
|
2040
686
|
className,
|
|
2041
|
-
].join(" "), disabled: isDisabled, "aria-busy": effectiveBusy, onClick: handleConfirmClick, ...props, children:
|
|
687
|
+
].join(" "), disabled: isDisabled, "aria-busy": effectiveBusy, onClick: handleConfirmClick, ...props, children: jsxRuntime.jsxs("span", { className: styles.inner, children: [renderLeftIcon(), jsxRuntime.jsxs("span", { className: styles.content, children: [currentChildren, iconRight && jsxRuntime.jsx("span", { className: styles.icon, children: iconRight })] })] }) }));
|
|
2042
688
|
if (!hasDropdown) {
|
|
2043
689
|
return buttonElement;
|
|
2044
690
|
}
|
|
2045
|
-
return (
|
|
691
|
+
return (jsxRuntime.jsxs("div", { className: styles.splitButtonContainer, ref: splitContainerRef, children: [buttonElement, jsxRuntime.jsx(ZestDropdownMenu, { options: dropdownOptions, ariaLabel: dropdownAriaLabel, open: dropdownOpen, onOpenChange: setDropdownOpen, disabled: isDisabled, onAnyItemBusyChange: setAnyDropdownItemBusy, variant: variant, size: size, buttonStyle: buttonStyle, effectiveTheme: effectiveTheme, effectiveMenuTheme: effectiveDropdownTheme, menuMinWidth: resolvedMenuMinWidth })] }));
|
|
2046
692
|
};
|
|
2047
693
|
|
|
2048
694
|
const ZestButtonConfigProvider = ({ config, children }) => {
|
|
2049
|
-
return (
|
|
695
|
+
return (jsxRuntime.jsx(ZestButtonConfigContext.Provider, { value: config, children: children }));
|
|
2050
696
|
};
|
|
2051
697
|
|
|
2052
698
|
exports.ZestButtonConfigProvider = ZestButtonConfigProvider;
|