thailife-react 0.0.22 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/cjs/index.js +508 -0
  2. package/dist/cjs/index.js.map +1 -0
  3. package/dist/esm/components/Autocomplete/Autocomplete.d.ts +18 -0
  4. package/dist/esm/components/Autocomplete/Autocomplete.d.ts.map +1 -0
  5. package/dist/esm/components/Autocomplete/index.d.ts +2 -0
  6. package/dist/esm/components/Autocomplete/index.d.ts.map +1 -0
  7. package/dist/esm/components/Button/Button.d.ts +14 -0
  8. package/dist/esm/components/Button/Button.d.ts.map +1 -0
  9. package/dist/esm/components/Button/index.d.ts +3 -0
  10. package/dist/esm/components/Button/index.d.ts.map +1 -0
  11. package/dist/esm/components/Checkbox/Checkbox.d.ts +12 -0
  12. package/dist/esm/components/Checkbox/Checkbox.d.ts.map +1 -0
  13. package/dist/esm/components/Checkbox/index.d.ts +3 -0
  14. package/dist/esm/components/Checkbox/index.d.ts.map +1 -0
  15. package/dist/esm/components/Datepicker/Datepicker.d.ts +23 -0
  16. package/dist/esm/components/Datepicker/Datepicker.d.ts.map +1 -0
  17. package/dist/esm/components/Datepicker/index.d.ts +3 -0
  18. package/dist/esm/components/Datepicker/index.d.ts.map +1 -0
  19. package/dist/esm/components/Input/Input.d.ts +27 -0
  20. package/dist/esm/components/Input/Input.d.ts.map +1 -0
  21. package/dist/esm/components/Input/index.d.ts +3 -0
  22. package/dist/esm/components/Input/index.d.ts.map +1 -0
  23. package/dist/esm/components/Radio/Radio.d.ts +12 -0
  24. package/dist/esm/components/Radio/Radio.d.ts.map +1 -0
  25. package/dist/esm/components/Radio/index.d.ts +3 -0
  26. package/dist/esm/components/Radio/index.d.ts.map +1 -0
  27. package/dist/esm/components/Select/Select.d.ts +16 -0
  28. package/dist/esm/components/Select/Select.d.ts.map +1 -0
  29. package/dist/esm/components/Select/index.d.ts +3 -0
  30. package/dist/esm/components/Select/index.d.ts.map +1 -0
  31. package/dist/esm/components/index.d.ts +8 -0
  32. package/dist/esm/components/index.d.ts.map +1 -0
  33. package/dist/esm/index.d.ts +3 -0
  34. package/dist/esm/index.d.ts.map +1 -0
  35. package/dist/esm/index.js +500 -0
  36. package/dist/esm/index.js.map +1 -0
  37. package/package.json +42 -73
  38. package/LICENSE +0 -21
  39. package/README.md +0 -118
  40. package/dist/components/Button/Button.d.ts +0 -12
  41. package/dist/components/Button/Button.d.ts.map +0 -1
  42. package/dist/components/Button/Button.stories.d.ts +0 -14
  43. package/dist/components/Button/Button.stories.d.ts.map +0 -1
  44. package/dist/components/Checkbox/Checkbox.d.ts +0 -18
  45. package/dist/components/Checkbox/Checkbox.d.ts.map +0 -1
  46. package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -15
  47. package/dist/components/Checkbox/Checkbox.stories.d.ts.map +0 -1
  48. package/dist/components/DatePicker/DatePicker.d.ts +0 -38
  49. package/dist/components/DatePicker/DatePicker.d.ts.map +0 -1
  50. package/dist/components/DatePicker/DatePicker.stories.d.ts +0 -17
  51. package/dist/components/DatePicker/DatePicker.stories.d.ts.map +0 -1
  52. package/dist/components/DatePicker/examples.d.ts +0 -4
  53. package/dist/components/DatePicker/examples.d.ts.map +0 -1
  54. package/dist/components/DatePicker/index.d.ts +0 -4
  55. package/dist/components/DatePicker/index.d.ts.map +0 -1
  56. package/dist/components/Input/Input.d.ts +0 -16
  57. package/dist/components/Input/Input.d.ts.map +0 -1
  58. package/dist/components/Input/Input.stories.d.ts +0 -15
  59. package/dist/components/Input/Input.stories.d.ts.map +0 -1
  60. package/dist/components/InputFile/InputFile.d.ts +0 -22
  61. package/dist/components/InputFile/InputFile.d.ts.map +0 -1
  62. package/dist/components/InputFile/InputFile.stories.d.ts +0 -15
  63. package/dist/components/InputFile/InputFile.stories.d.ts.map +0 -1
  64. package/dist/components/Radio/Radio.d.ts +0 -16
  65. package/dist/components/Radio/Radio.d.ts.map +0 -1
  66. package/dist/components/Radio/Radio.stories.d.ts +0 -14
  67. package/dist/components/Radio/Radio.stories.d.ts.map +0 -1
  68. package/dist/components/Select/Select.d.ts +0 -25
  69. package/dist/components/Select/Select.d.ts.map +0 -1
  70. package/dist/components/Select/Select.stories.d.ts +0 -15
  71. package/dist/components/Select/Select.stories.d.ts.map +0 -1
  72. package/dist/components/Textarea/Textarea.d.ts +0 -18
  73. package/dist/components/Textarea/Textarea.d.ts.map +0 -1
  74. package/dist/components/Textarea/Textarea.stories.d.ts +0 -15
  75. package/dist/components/Textarea/Textarea.stories.d.ts.map +0 -1
  76. package/dist/index.d.ts +0 -22
  77. package/dist/index.d.ts.map +0 -1
  78. package/dist/index.esm.js +0 -2368
  79. package/dist/index.esm.js.map +0 -1
  80. package/dist/index.js +0 -2399
  81. package/dist/index.js.map +0 -1
  82. package/dist/styles/index.css +0 -602
  83. package/dist/styles/index.d.ts +0 -77
  84. package/dist/styles/index.d.ts.map +0 -1
  85. package/dist/styles/theme.d.ts +0 -87
  86. package/dist/styles/theme.d.ts.map +0 -1
package/dist/index.esm.js DELETED
@@ -1,2368 +0,0 @@
1
- import * as React from 'react';
2
- import React__default, { forwardRef, createElement, useState, useRef, useEffect } from 'react';
3
- export { default as React, default } from 'react';
4
-
5
- function _defineProperty(e, r, t) {
6
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
7
- value: t,
8
- enumerable: true,
9
- configurable: true,
10
- writable: true
11
- }) : e[r] = t, e;
12
- }
13
- function ownKeys(e, r) {
14
- var t = Object.keys(e);
15
- if (Object.getOwnPropertySymbols) {
16
- var o = Object.getOwnPropertySymbols(e);
17
- r && (o = o.filter(function (r) {
18
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
19
- })), t.push.apply(t, o);
20
- }
21
- return t;
22
- }
23
- function _objectSpread2(e) {
24
- for (var r = 1; r < arguments.length; r++) {
25
- var t = null != arguments[r] ? arguments[r] : {};
26
- r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
27
- _defineProperty(e, r, t[r]);
28
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
29
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
30
- });
31
- }
32
- return e;
33
- }
34
- function _objectWithoutProperties(e, t) {
35
- if (null == e) return {};
36
- var o,
37
- r,
38
- i = _objectWithoutPropertiesLoose(e, t);
39
- if (Object.getOwnPropertySymbols) {
40
- var n = Object.getOwnPropertySymbols(e);
41
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
42
- }
43
- return i;
44
- }
45
- function _objectWithoutPropertiesLoose(r, e) {
46
- if (null == r) return {};
47
- var t = {};
48
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
49
- if (-1 !== e.indexOf(n)) continue;
50
- t[n] = r[n];
51
- }
52
- return t;
53
- }
54
- function _toPrimitive(t, r) {
55
- if ("object" != typeof t || !t) return t;
56
- var e = t[Symbol.toPrimitive];
57
- if (void 0 !== e) {
58
- var i = e.call(t, r);
59
- if ("object" != typeof i) return i;
60
- throw new TypeError("@@toPrimitive must return a primitive value.");
61
- }
62
- return ("string" === r ? String : Number)(t);
63
- }
64
- function _toPropertyKey(t) {
65
- var i = _toPrimitive(t, "string");
66
- return "symbol" == typeof i ? i : i + "";
67
- }
68
-
69
- function getDefaultExportFromNamespaceIfNotNamed (n) {
70
- return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
71
- }
72
-
73
- var jsxRuntime = {exports: {}};
74
-
75
- var reactJsxRuntime_production_min = {};
76
-
77
- var require$$0 = /*@__PURE__*/getDefaultExportFromNamespaceIfNotNamed(React);
78
-
79
- /**
80
- * @license React
81
- * react-jsx-runtime.production.min.js
82
- *
83
- * Copyright (c) Facebook, Inc. and its affiliates.
84
- *
85
- * This source code is licensed under the MIT license found in the
86
- * LICENSE file in the root directory of this source tree.
87
- */
88
-
89
- var hasRequiredReactJsxRuntime_production_min;
90
-
91
- function requireReactJsxRuntime_production_min () {
92
- if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
93
- hasRequiredReactJsxRuntime_production_min = 1;
94
- 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};
95
- 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;
96
- return reactJsxRuntime_production_min;
97
- }
98
-
99
- var reactJsxRuntime_development = {};
100
-
101
- /**
102
- * @license React
103
- * react-jsx-runtime.development.js
104
- *
105
- * Copyright (c) Facebook, Inc. and its affiliates.
106
- *
107
- * This source code is licensed under the MIT license found in the
108
- * LICENSE file in the root directory of this source tree.
109
- */
110
-
111
- var hasRequiredReactJsxRuntime_development;
112
-
113
- function requireReactJsxRuntime_development () {
114
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
115
- hasRequiredReactJsxRuntime_development = 1;
116
-
117
- if (process.env.NODE_ENV !== "production") {
118
- (function() {
119
-
120
- var React = require$$0;
121
-
122
- // ATTENTION
123
- // When adding new symbols to this file,
124
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
125
- // The Symbol used to tag the ReactElement-like types.
126
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
127
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
128
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
129
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
130
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
131
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
132
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
133
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
134
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
135
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
136
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
137
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
138
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
139
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
140
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
141
- function getIteratorFn(maybeIterable) {
142
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
143
- return null;
144
- }
145
-
146
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
147
-
148
- if (typeof maybeIterator === 'function') {
149
- return maybeIterator;
150
- }
151
-
152
- return null;
153
- }
154
-
155
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
156
-
157
- function error(format) {
158
- {
159
- {
160
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
161
- args[_key2 - 1] = arguments[_key2];
162
- }
163
-
164
- printWarning('error', format, args);
165
- }
166
- }
167
- }
168
-
169
- function printWarning(level, format, args) {
170
- // When changing this logic, you might want to also
171
- // update consoleWithStackDev.www.js as well.
172
- {
173
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
174
- var stack = ReactDebugCurrentFrame.getStackAddendum();
175
-
176
- if (stack !== '') {
177
- format += '%s';
178
- args = args.concat([stack]);
179
- } // eslint-disable-next-line react-internal/safe-string-coercion
180
-
181
-
182
- var argsWithFormat = args.map(function (item) {
183
- return String(item);
184
- }); // Careful: RN currently depends on this prefix
185
-
186
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
187
- // breaks IE9: https://github.com/facebook/react/issues/13610
188
- // eslint-disable-next-line react-internal/no-production-logging
189
-
190
- Function.prototype.apply.call(console[level], console, argsWithFormat);
191
- }
192
- }
193
-
194
- // -----------------------------------------------------------------------------
195
-
196
- var enableScopeAPI = false; // Experimental Create Event Handle API.
197
- var enableCacheElement = false;
198
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
199
-
200
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
201
- // stuff. Intended to enable React core members to more easily debug scheduling
202
- // issues in DEV builds.
203
-
204
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
205
-
206
- var REACT_MODULE_REFERENCE;
207
-
208
- {
209
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
210
- }
211
-
212
- function isValidElementType(type) {
213
- if (typeof type === 'string' || typeof type === 'function') {
214
- return true;
215
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
216
-
217
-
218
- 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 ) {
219
- return true;
220
- }
221
-
222
- if (typeof type === 'object' && type !== null) {
223
- 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
224
- // types supported by any Flight configuration anywhere since
225
- // we don't know which Flight build this will end up being used
226
- // with.
227
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
228
- return true;
229
- }
230
- }
231
-
232
- return false;
233
- }
234
-
235
- function getWrappedName(outerType, innerType, wrapperName) {
236
- var displayName = outerType.displayName;
237
-
238
- if (displayName) {
239
- return displayName;
240
- }
241
-
242
- var functionName = innerType.displayName || innerType.name || '';
243
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
244
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
245
-
246
-
247
- function getContextName(type) {
248
- return type.displayName || 'Context';
249
- } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
250
-
251
-
252
- function getComponentNameFromType(type) {
253
- if (type == null) {
254
- // Host root, text node or just invalid type.
255
- return null;
256
- }
257
-
258
- {
259
- if (typeof type.tag === 'number') {
260
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
261
- }
262
- }
263
-
264
- if (typeof type === 'function') {
265
- return type.displayName || type.name || null;
266
- }
267
-
268
- if (typeof type === 'string') {
269
- return type;
270
- }
271
-
272
- switch (type) {
273
- case REACT_FRAGMENT_TYPE:
274
- return 'Fragment';
275
-
276
- case REACT_PORTAL_TYPE:
277
- return 'Portal';
278
-
279
- case REACT_PROFILER_TYPE:
280
- return 'Profiler';
281
-
282
- case REACT_STRICT_MODE_TYPE:
283
- return 'StrictMode';
284
-
285
- case REACT_SUSPENSE_TYPE:
286
- return 'Suspense';
287
-
288
- case REACT_SUSPENSE_LIST_TYPE:
289
- return 'SuspenseList';
290
-
291
- }
292
-
293
- if (typeof type === 'object') {
294
- switch (type.$$typeof) {
295
- case REACT_CONTEXT_TYPE:
296
- var context = type;
297
- return getContextName(context) + '.Consumer';
298
-
299
- case REACT_PROVIDER_TYPE:
300
- var provider = type;
301
- return getContextName(provider._context) + '.Provider';
302
-
303
- case REACT_FORWARD_REF_TYPE:
304
- return getWrappedName(type, type.render, 'ForwardRef');
305
-
306
- case REACT_MEMO_TYPE:
307
- var outerName = type.displayName || null;
308
-
309
- if (outerName !== null) {
310
- return outerName;
311
- }
312
-
313
- return getComponentNameFromType(type.type) || 'Memo';
314
-
315
- case REACT_LAZY_TYPE:
316
- {
317
- var lazyComponent = type;
318
- var payload = lazyComponent._payload;
319
- var init = lazyComponent._init;
320
-
321
- try {
322
- return getComponentNameFromType(init(payload));
323
- } catch (x) {
324
- return null;
325
- }
326
- }
327
-
328
- // eslint-disable-next-line no-fallthrough
329
- }
330
- }
331
-
332
- return null;
333
- }
334
-
335
- var assign = Object.assign;
336
-
337
- // Helpers to patch console.logs to avoid logging during side-effect free
338
- // replaying on render function. This currently only patches the object
339
- // lazily which won't cover if the log function was extracted eagerly.
340
- // We could also eagerly patch the method.
341
- var disabledDepth = 0;
342
- var prevLog;
343
- var prevInfo;
344
- var prevWarn;
345
- var prevError;
346
- var prevGroup;
347
- var prevGroupCollapsed;
348
- var prevGroupEnd;
349
-
350
- function disabledLog() {}
351
-
352
- disabledLog.__reactDisabledLog = true;
353
- function disableLogs() {
354
- {
355
- if (disabledDepth === 0) {
356
- /* eslint-disable react-internal/no-production-logging */
357
- prevLog = console.log;
358
- prevInfo = console.info;
359
- prevWarn = console.warn;
360
- prevError = console.error;
361
- prevGroup = console.group;
362
- prevGroupCollapsed = console.groupCollapsed;
363
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
364
-
365
- var props = {
366
- configurable: true,
367
- enumerable: true,
368
- value: disabledLog,
369
- writable: true
370
- }; // $FlowFixMe Flow thinks console is immutable.
371
-
372
- Object.defineProperties(console, {
373
- info: props,
374
- log: props,
375
- warn: props,
376
- error: props,
377
- group: props,
378
- groupCollapsed: props,
379
- groupEnd: props
380
- });
381
- /* eslint-enable react-internal/no-production-logging */
382
- }
383
-
384
- disabledDepth++;
385
- }
386
- }
387
- function reenableLogs() {
388
- {
389
- disabledDepth--;
390
-
391
- if (disabledDepth === 0) {
392
- /* eslint-disable react-internal/no-production-logging */
393
- var props = {
394
- configurable: true,
395
- enumerable: true,
396
- writable: true
397
- }; // $FlowFixMe Flow thinks console is immutable.
398
-
399
- Object.defineProperties(console, {
400
- log: assign({}, props, {
401
- value: prevLog
402
- }),
403
- info: assign({}, props, {
404
- value: prevInfo
405
- }),
406
- warn: assign({}, props, {
407
- value: prevWarn
408
- }),
409
- error: assign({}, props, {
410
- value: prevError
411
- }),
412
- group: assign({}, props, {
413
- value: prevGroup
414
- }),
415
- groupCollapsed: assign({}, props, {
416
- value: prevGroupCollapsed
417
- }),
418
- groupEnd: assign({}, props, {
419
- value: prevGroupEnd
420
- })
421
- });
422
- /* eslint-enable react-internal/no-production-logging */
423
- }
424
-
425
- if (disabledDepth < 0) {
426
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
427
- }
428
- }
429
- }
430
-
431
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
432
- var prefix;
433
- function describeBuiltInComponentFrame(name, source, ownerFn) {
434
- {
435
- if (prefix === undefined) {
436
- // Extract the VM specific prefix used by each line.
437
- try {
438
- throw Error();
439
- } catch (x) {
440
- var match = x.stack.trim().match(/\n( *(at )?)/);
441
- prefix = match && match[1] || '';
442
- }
443
- } // We use the prefix to ensure our stacks line up with native stack frames.
444
-
445
-
446
- return '\n' + prefix + name;
447
- }
448
- }
449
- var reentry = false;
450
- var componentFrameCache;
451
-
452
- {
453
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
454
- componentFrameCache = new PossiblyWeakMap();
455
- }
456
-
457
- function describeNativeComponentFrame(fn, construct) {
458
- // If something asked for a stack inside a fake render, it should get ignored.
459
- if ( !fn || reentry) {
460
- return '';
461
- }
462
-
463
- {
464
- var frame = componentFrameCache.get(fn);
465
-
466
- if (frame !== undefined) {
467
- return frame;
468
- }
469
- }
470
-
471
- var control;
472
- reentry = true;
473
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
474
-
475
- Error.prepareStackTrace = undefined;
476
- var previousDispatcher;
477
-
478
- {
479
- previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
480
- // for warnings.
481
-
482
- ReactCurrentDispatcher.current = null;
483
- disableLogs();
484
- }
485
-
486
- try {
487
- // This should throw.
488
- if (construct) {
489
- // Something should be setting the props in the constructor.
490
- var Fake = function () {
491
- throw Error();
492
- }; // $FlowFixMe
493
-
494
-
495
- Object.defineProperty(Fake.prototype, 'props', {
496
- set: function () {
497
- // We use a throwing setter instead of frozen or non-writable props
498
- // because that won't throw in a non-strict mode function.
499
- throw Error();
500
- }
501
- });
502
-
503
- if (typeof Reflect === 'object' && Reflect.construct) {
504
- // We construct a different control for this case to include any extra
505
- // frames added by the construct call.
506
- try {
507
- Reflect.construct(Fake, []);
508
- } catch (x) {
509
- control = x;
510
- }
511
-
512
- Reflect.construct(fn, [], Fake);
513
- } else {
514
- try {
515
- Fake.call();
516
- } catch (x) {
517
- control = x;
518
- }
519
-
520
- fn.call(Fake.prototype);
521
- }
522
- } else {
523
- try {
524
- throw Error();
525
- } catch (x) {
526
- control = x;
527
- }
528
-
529
- fn();
530
- }
531
- } catch (sample) {
532
- // This is inlined manually because closure doesn't do it for us.
533
- if (sample && control && typeof sample.stack === 'string') {
534
- // This extracts the first frame from the sample that isn't also in the control.
535
- // Skipping one frame that we assume is the frame that calls the two.
536
- var sampleLines = sample.stack.split('\n');
537
- var controlLines = control.stack.split('\n');
538
- var s = sampleLines.length - 1;
539
- var c = controlLines.length - 1;
540
-
541
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
542
- // We expect at least one stack frame to be shared.
543
- // Typically this will be the root most one. However, stack frames may be
544
- // cut off due to maximum stack limits. In this case, one maybe cut off
545
- // earlier than the other. We assume that the sample is longer or the same
546
- // and there for cut off earlier. So we should find the root most frame in
547
- // the sample somewhere in the control.
548
- c--;
549
- }
550
-
551
- for (; s >= 1 && c >= 0; s--, c--) {
552
- // Next we find the first one that isn't the same which should be the
553
- // frame that called our sample function and the control.
554
- if (sampleLines[s] !== controlLines[c]) {
555
- // In V8, the first line is describing the message but other VMs don't.
556
- // If we're about to return the first line, and the control is also on the same
557
- // line, that's a pretty good indicator that our sample threw at same line as
558
- // the control. I.e. before we entered the sample frame. So we ignore this result.
559
- // This can happen if you passed a class to function component, or non-function.
560
- if (s !== 1 || c !== 1) {
561
- do {
562
- s--;
563
- c--; // We may still have similar intermediate frames from the construct call.
564
- // The next one that isn't the same should be our match though.
565
-
566
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
567
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
568
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
569
- // but we have a user-provided "displayName"
570
- // splice it in to make the stack more readable.
571
-
572
-
573
- if (fn.displayName && _frame.includes('<anonymous>')) {
574
- _frame = _frame.replace('<anonymous>', fn.displayName);
575
- }
576
-
577
- {
578
- if (typeof fn === 'function') {
579
- componentFrameCache.set(fn, _frame);
580
- }
581
- } // Return the line we found.
582
-
583
-
584
- return _frame;
585
- }
586
- } while (s >= 1 && c >= 0);
587
- }
588
-
589
- break;
590
- }
591
- }
592
- }
593
- } finally {
594
- reentry = false;
595
-
596
- {
597
- ReactCurrentDispatcher.current = previousDispatcher;
598
- reenableLogs();
599
- }
600
-
601
- Error.prepareStackTrace = previousPrepareStackTrace;
602
- } // Fallback to just using the name if we couldn't make it throw.
603
-
604
-
605
- var name = fn ? fn.displayName || fn.name : '';
606
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
607
-
608
- {
609
- if (typeof fn === 'function') {
610
- componentFrameCache.set(fn, syntheticFrame);
611
- }
612
- }
613
-
614
- return syntheticFrame;
615
- }
616
- function describeFunctionComponentFrame(fn, source, ownerFn) {
617
- {
618
- return describeNativeComponentFrame(fn, false);
619
- }
620
- }
621
-
622
- function shouldConstruct(Component) {
623
- var prototype = Component.prototype;
624
- return !!(prototype && prototype.isReactComponent);
625
- }
626
-
627
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
628
-
629
- if (type == null) {
630
- return '';
631
- }
632
-
633
- if (typeof type === 'function') {
634
- {
635
- return describeNativeComponentFrame(type, shouldConstruct(type));
636
- }
637
- }
638
-
639
- if (typeof type === 'string') {
640
- return describeBuiltInComponentFrame(type);
641
- }
642
-
643
- switch (type) {
644
- case REACT_SUSPENSE_TYPE:
645
- return describeBuiltInComponentFrame('Suspense');
646
-
647
- case REACT_SUSPENSE_LIST_TYPE:
648
- return describeBuiltInComponentFrame('SuspenseList');
649
- }
650
-
651
- if (typeof type === 'object') {
652
- switch (type.$$typeof) {
653
- case REACT_FORWARD_REF_TYPE:
654
- return describeFunctionComponentFrame(type.render);
655
-
656
- case REACT_MEMO_TYPE:
657
- // Memo may contain any component type so we recursively resolve it.
658
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
659
-
660
- case REACT_LAZY_TYPE:
661
- {
662
- var lazyComponent = type;
663
- var payload = lazyComponent._payload;
664
- var init = lazyComponent._init;
665
-
666
- try {
667
- // Lazy may contain any component type so we recursively resolve it.
668
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
669
- } catch (x) {}
670
- }
671
- }
672
- }
673
-
674
- return '';
675
- }
676
-
677
- var hasOwnProperty = Object.prototype.hasOwnProperty;
678
-
679
- var loggedTypeFailures = {};
680
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
681
-
682
- function setCurrentlyValidatingElement(element) {
683
- {
684
- if (element) {
685
- var owner = element._owner;
686
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
687
- ReactDebugCurrentFrame.setExtraStackFrame(stack);
688
- } else {
689
- ReactDebugCurrentFrame.setExtraStackFrame(null);
690
- }
691
- }
692
- }
693
-
694
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
695
- {
696
- // $FlowFixMe This is okay but Flow doesn't know it.
697
- var has = Function.call.bind(hasOwnProperty);
698
-
699
- for (var typeSpecName in typeSpecs) {
700
- if (has(typeSpecs, typeSpecName)) {
701
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
702
- // fail the render phase where it didn't fail before. So we log it.
703
- // After these have been cleaned up, we'll let them throw.
704
-
705
- try {
706
- // This is intentionally an invariant that gets caught. It's the same
707
- // behavior as without this statement except with a better message.
708
- if (typeof typeSpecs[typeSpecName] !== 'function') {
709
- // eslint-disable-next-line react-internal/prod-error-codes
710
- 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`.');
711
- err.name = 'Invariant Violation';
712
- throw err;
713
- }
714
-
715
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
716
- } catch (ex) {
717
- error$1 = ex;
718
- }
719
-
720
- if (error$1 && !(error$1 instanceof Error)) {
721
- setCurrentlyValidatingElement(element);
722
-
723
- 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);
724
-
725
- setCurrentlyValidatingElement(null);
726
- }
727
-
728
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
729
- // Only monitor this failure once because there tends to be a lot of the
730
- // same error.
731
- loggedTypeFailures[error$1.message] = true;
732
- setCurrentlyValidatingElement(element);
733
-
734
- error('Failed %s type: %s', location, error$1.message);
735
-
736
- setCurrentlyValidatingElement(null);
737
- }
738
- }
739
- }
740
- }
741
- }
742
-
743
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
744
-
745
- function isArray(a) {
746
- return isArrayImpl(a);
747
- }
748
-
749
- /*
750
- * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
751
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
752
- *
753
- * The functions in this module will throw an easier-to-understand,
754
- * easier-to-debug exception with a clear errors message message explaining the
755
- * problem. (Instead of a confusing exception thrown inside the implementation
756
- * of the `value` object).
757
- */
758
- // $FlowFixMe only called in DEV, so void return is not possible.
759
- function typeName(value) {
760
- {
761
- // toStringTag is needed for namespaced types like Temporal.Instant
762
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
763
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
764
- return type;
765
- }
766
- } // $FlowFixMe only called in DEV, so void return is not possible.
767
-
768
-
769
- function willCoercionThrow(value) {
770
- {
771
- try {
772
- testStringCoercion(value);
773
- return false;
774
- } catch (e) {
775
- return true;
776
- }
777
- }
778
- }
779
-
780
- function testStringCoercion(value) {
781
- // If you ended up here by following an exception call stack, here's what's
782
- // happened: you supplied an object or symbol value to React (as a prop, key,
783
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
784
- // coerce it to a string using `'' + value`, an exception was thrown.
785
- //
786
- // The most common types that will cause this exception are `Symbol` instances
787
- // and Temporal objects like `Temporal.Instant`. But any object that has a
788
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
789
- // exception. (Library authors do this to prevent users from using built-in
790
- // numeric operators like `+` or comparison operators like `>=` because custom
791
- // methods are needed to perform accurate arithmetic or comparison.)
792
- //
793
- // To fix the problem, coerce this object or symbol value to a string before
794
- // passing it to React. The most reliable way is usually `String(value)`.
795
- //
796
- // To find which value is throwing, check the browser or debugger console.
797
- // Before this exception was thrown, there should be `console.error` output
798
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
799
- // problem and how that type was used: key, atrribute, input value prop, etc.
800
- // In most cases, this console output also shows the component and its
801
- // ancestor components where the exception happened.
802
- //
803
- // eslint-disable-next-line react-internal/safe-string-coercion
804
- return '' + value;
805
- }
806
- function checkKeyStringCoercion(value) {
807
- {
808
- if (willCoercionThrow(value)) {
809
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
810
-
811
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
812
- }
813
- }
814
- }
815
-
816
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
817
- var RESERVED_PROPS = {
818
- key: true,
819
- ref: true,
820
- __self: true,
821
- __source: true
822
- };
823
- var specialPropKeyWarningShown;
824
- var specialPropRefWarningShown;
825
-
826
- function hasValidRef(config) {
827
- {
828
- if (hasOwnProperty.call(config, 'ref')) {
829
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
830
-
831
- if (getter && getter.isReactWarning) {
832
- return false;
833
- }
834
- }
835
- }
836
-
837
- return config.ref !== undefined;
838
- }
839
-
840
- function hasValidKey(config) {
841
- {
842
- if (hasOwnProperty.call(config, 'key')) {
843
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
844
-
845
- if (getter && getter.isReactWarning) {
846
- return false;
847
- }
848
- }
849
- }
850
-
851
- return config.key !== undefined;
852
- }
853
-
854
- function warnIfStringRefCannotBeAutoConverted(config, self) {
855
- {
856
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && self) ;
857
- }
858
- }
859
-
860
- function defineKeyPropWarningGetter(props, displayName) {
861
- {
862
- var warnAboutAccessingKey = function () {
863
- if (!specialPropKeyWarningShown) {
864
- specialPropKeyWarningShown = true;
865
-
866
- 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);
867
- }
868
- };
869
-
870
- warnAboutAccessingKey.isReactWarning = true;
871
- Object.defineProperty(props, 'key', {
872
- get: warnAboutAccessingKey,
873
- configurable: true
874
- });
875
- }
876
- }
877
-
878
- function defineRefPropWarningGetter(props, displayName) {
879
- {
880
- var warnAboutAccessingRef = function () {
881
- if (!specialPropRefWarningShown) {
882
- specialPropRefWarningShown = true;
883
-
884
- 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);
885
- }
886
- };
887
-
888
- warnAboutAccessingRef.isReactWarning = true;
889
- Object.defineProperty(props, 'ref', {
890
- get: warnAboutAccessingRef,
891
- configurable: true
892
- });
893
- }
894
- }
895
- /**
896
- * Factory method to create a new React element. This no longer adheres to
897
- * the class pattern, so do not use new to call it. Also, instanceof check
898
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
899
- * if something is a React Element.
900
- *
901
- * @param {*} type
902
- * @param {*} props
903
- * @param {*} key
904
- * @param {string|object} ref
905
- * @param {*} owner
906
- * @param {*} self A *temporary* helper to detect places where `this` is
907
- * different from the `owner` when React.createElement is called, so that we
908
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
909
- * functions, and as long as `this` and owner are the same, there will be no
910
- * change in behavior.
911
- * @param {*} source An annotation object (added by a transpiler or otherwise)
912
- * indicating filename, line number, and/or other information.
913
- * @internal
914
- */
915
-
916
-
917
- var ReactElement = function (type, key, ref, self, source, owner, props) {
918
- var element = {
919
- // This tag allows us to uniquely identify this as a React Element
920
- $$typeof: REACT_ELEMENT_TYPE,
921
- // Built-in properties that belong on the element
922
- type: type,
923
- key: key,
924
- ref: ref,
925
- props: props,
926
- // Record the component responsible for creating this element.
927
- _owner: owner
928
- };
929
-
930
- {
931
- // The validation flag is currently mutative. We put it on
932
- // an external backing store so that we can freeze the whole object.
933
- // This can be replaced with a WeakMap once they are implemented in
934
- // commonly used development environments.
935
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
936
- // the validation flag non-enumerable (where possible, which should
937
- // include every environment we run tests in), so the test framework
938
- // ignores it.
939
-
940
- Object.defineProperty(element._store, 'validated', {
941
- configurable: false,
942
- enumerable: false,
943
- writable: true,
944
- value: false
945
- }); // self and source are DEV only properties.
946
-
947
- Object.defineProperty(element, '_self', {
948
- configurable: false,
949
- enumerable: false,
950
- writable: false,
951
- value: self
952
- }); // Two elements created in two different places should be considered
953
- // equal for testing purposes and therefore we hide it from enumeration.
954
-
955
- Object.defineProperty(element, '_source', {
956
- configurable: false,
957
- enumerable: false,
958
- writable: false,
959
- value: source
960
- });
961
-
962
- if (Object.freeze) {
963
- Object.freeze(element.props);
964
- Object.freeze(element);
965
- }
966
- }
967
-
968
- return element;
969
- };
970
- /**
971
- * https://github.com/reactjs/rfcs/pull/107
972
- * @param {*} type
973
- * @param {object} props
974
- * @param {string} key
975
- */
976
-
977
- function jsxDEV(type, config, maybeKey, source, self) {
978
- {
979
- var propName; // Reserved names are extracted
980
-
981
- var props = {};
982
- var key = null;
983
- var ref = null; // Currently, key can be spread in as a prop. This causes a potential
984
- // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
985
- // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
986
- // but as an intermediary step, we will use jsxDEV for everything except
987
- // <div {...props} key="Hi" />, because we aren't currently able to tell if
988
- // key is explicitly declared to be undefined or not.
989
-
990
- if (maybeKey !== undefined) {
991
- {
992
- checkKeyStringCoercion(maybeKey);
993
- }
994
-
995
- key = '' + maybeKey;
996
- }
997
-
998
- if (hasValidKey(config)) {
999
- {
1000
- checkKeyStringCoercion(config.key);
1001
- }
1002
-
1003
- key = '' + config.key;
1004
- }
1005
-
1006
- if (hasValidRef(config)) {
1007
- ref = config.ref;
1008
- warnIfStringRefCannotBeAutoConverted(config, self);
1009
- } // Remaining properties are added to a new props object
1010
-
1011
-
1012
- for (propName in config) {
1013
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1014
- props[propName] = config[propName];
1015
- }
1016
- } // Resolve default props
1017
-
1018
-
1019
- if (type && type.defaultProps) {
1020
- var defaultProps = type.defaultProps;
1021
-
1022
- for (propName in defaultProps) {
1023
- if (props[propName] === undefined) {
1024
- props[propName] = defaultProps[propName];
1025
- }
1026
- }
1027
- }
1028
-
1029
- if (key || ref) {
1030
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1031
-
1032
- if (key) {
1033
- defineKeyPropWarningGetter(props, displayName);
1034
- }
1035
-
1036
- if (ref) {
1037
- defineRefPropWarningGetter(props, displayName);
1038
- }
1039
- }
1040
-
1041
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1042
- }
1043
- }
1044
-
1045
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
1046
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1047
-
1048
- function setCurrentlyValidatingElement$1(element) {
1049
- {
1050
- if (element) {
1051
- var owner = element._owner;
1052
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1053
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1054
- } else {
1055
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1056
- }
1057
- }
1058
- }
1059
-
1060
- var propTypesMisspellWarningShown;
1061
-
1062
- {
1063
- propTypesMisspellWarningShown = false;
1064
- }
1065
- /**
1066
- * Verifies the object is a ReactElement.
1067
- * See https://reactjs.org/docs/react-api.html#isvalidelement
1068
- * @param {?object} object
1069
- * @return {boolean} True if `object` is a ReactElement.
1070
- * @final
1071
- */
1072
-
1073
-
1074
- function isValidElement(object) {
1075
- {
1076
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1077
- }
1078
- }
1079
-
1080
- function getDeclarationErrorAddendum() {
1081
- {
1082
- if (ReactCurrentOwner$1.current) {
1083
- var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1084
-
1085
- if (name) {
1086
- return '\n\nCheck the render method of `' + name + '`.';
1087
- }
1088
- }
1089
-
1090
- return '';
1091
- }
1092
- }
1093
-
1094
- function getSourceInfoErrorAddendum(source) {
1095
- {
1096
-
1097
- return '';
1098
- }
1099
- }
1100
- /**
1101
- * Warn if there's no key explicitly set on dynamic arrays of children or
1102
- * object keys are not valid. This allows us to keep track of children between
1103
- * updates.
1104
- */
1105
-
1106
-
1107
- var ownerHasKeyUseWarning = {};
1108
-
1109
- function getCurrentComponentErrorInfo(parentType) {
1110
- {
1111
- var info = getDeclarationErrorAddendum();
1112
-
1113
- if (!info) {
1114
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1115
-
1116
- if (parentName) {
1117
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1118
- }
1119
- }
1120
-
1121
- return info;
1122
- }
1123
- }
1124
- /**
1125
- * Warn if the element doesn't have an explicit key assigned to it.
1126
- * This element is in an array. The array could grow and shrink or be
1127
- * reordered. All children that haven't already been validated are required to
1128
- * have a "key" property assigned to it. Error statuses are cached so a warning
1129
- * will only be shown once.
1130
- *
1131
- * @internal
1132
- * @param {ReactElement} element Element that requires a key.
1133
- * @param {*} parentType element's parent's type.
1134
- */
1135
-
1136
-
1137
- function validateExplicitKey(element, parentType) {
1138
- {
1139
- if (!element._store || element._store.validated || element.key != null) {
1140
- return;
1141
- }
1142
-
1143
- element._store.validated = true;
1144
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1145
-
1146
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1147
- return;
1148
- }
1149
-
1150
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1151
- // property, it may be the creator of the child that's responsible for
1152
- // assigning it a key.
1153
-
1154
- var childOwner = '';
1155
-
1156
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1157
- // Give the component that originally created this child.
1158
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1159
- }
1160
-
1161
- setCurrentlyValidatingElement$1(element);
1162
-
1163
- 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);
1164
-
1165
- setCurrentlyValidatingElement$1(null);
1166
- }
1167
- }
1168
- /**
1169
- * Ensure that every element either is passed in a static location, in an
1170
- * array with an explicit keys property defined, or in an object literal
1171
- * with valid key property.
1172
- *
1173
- * @internal
1174
- * @param {ReactNode} node Statically passed child of any type.
1175
- * @param {*} parentType node's parent's type.
1176
- */
1177
-
1178
-
1179
- function validateChildKeys(node, parentType) {
1180
- {
1181
- if (typeof node !== 'object') {
1182
- return;
1183
- }
1184
-
1185
- if (isArray(node)) {
1186
- for (var i = 0; i < node.length; i++) {
1187
- var child = node[i];
1188
-
1189
- if (isValidElement(child)) {
1190
- validateExplicitKey(child, parentType);
1191
- }
1192
- }
1193
- } else if (isValidElement(node)) {
1194
- // This element was passed in a valid location.
1195
- if (node._store) {
1196
- node._store.validated = true;
1197
- }
1198
- } else if (node) {
1199
- var iteratorFn = getIteratorFn(node);
1200
-
1201
- if (typeof iteratorFn === 'function') {
1202
- // Entry iterators used to provide implicit keys,
1203
- // but now we print a separate warning for them later.
1204
- if (iteratorFn !== node.entries) {
1205
- var iterator = iteratorFn.call(node);
1206
- var step;
1207
-
1208
- while (!(step = iterator.next()).done) {
1209
- if (isValidElement(step.value)) {
1210
- validateExplicitKey(step.value, parentType);
1211
- }
1212
- }
1213
- }
1214
- }
1215
- }
1216
- }
1217
- }
1218
- /**
1219
- * Given an element, validate that its props follow the propTypes definition,
1220
- * provided by the type.
1221
- *
1222
- * @param {ReactElement} element
1223
- */
1224
-
1225
-
1226
- function validatePropTypes(element) {
1227
- {
1228
- var type = element.type;
1229
-
1230
- if (type === null || type === undefined || typeof type === 'string') {
1231
- return;
1232
- }
1233
-
1234
- var propTypes;
1235
-
1236
- if (typeof type === 'function') {
1237
- propTypes = type.propTypes;
1238
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1239
- // Inner props are checked in the reconciler.
1240
- type.$$typeof === REACT_MEMO_TYPE)) {
1241
- propTypes = type.propTypes;
1242
- } else {
1243
- return;
1244
- }
1245
-
1246
- if (propTypes) {
1247
- // Intentionally inside to avoid triggering lazy initializers:
1248
- var name = getComponentNameFromType(type);
1249
- checkPropTypes(propTypes, element.props, 'prop', name, element);
1250
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1251
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1252
-
1253
- var _name = getComponentNameFromType(type);
1254
-
1255
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1256
- }
1257
-
1258
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1259
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1260
- }
1261
- }
1262
- }
1263
- /**
1264
- * Given a fragment, validate that it can only be provided with fragment props
1265
- * @param {ReactElement} fragment
1266
- */
1267
-
1268
-
1269
- function validateFragmentProps(fragment) {
1270
- {
1271
- var keys = Object.keys(fragment.props);
1272
-
1273
- for (var i = 0; i < keys.length; i++) {
1274
- var key = keys[i];
1275
-
1276
- if (key !== 'children' && key !== 'key') {
1277
- setCurrentlyValidatingElement$1(fragment);
1278
-
1279
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1280
-
1281
- setCurrentlyValidatingElement$1(null);
1282
- break;
1283
- }
1284
- }
1285
-
1286
- if (fragment.ref !== null) {
1287
- setCurrentlyValidatingElement$1(fragment);
1288
-
1289
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
1290
-
1291
- setCurrentlyValidatingElement$1(null);
1292
- }
1293
- }
1294
- }
1295
-
1296
- var didWarnAboutKeySpread = {};
1297
- function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1298
- {
1299
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1300
- // succeed and there will likely be errors in render.
1301
-
1302
- if (!validType) {
1303
- var info = '';
1304
-
1305
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1306
- 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.";
1307
- }
1308
-
1309
- var sourceInfo = getSourceInfoErrorAddendum();
1310
-
1311
- if (sourceInfo) {
1312
- info += sourceInfo;
1313
- } else {
1314
- info += getDeclarationErrorAddendum();
1315
- }
1316
-
1317
- var typeString;
1318
-
1319
- if (type === null) {
1320
- typeString = 'null';
1321
- } else if (isArray(type)) {
1322
- typeString = 'array';
1323
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1324
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1325
- info = ' Did you accidentally export a JSX literal instead of a component?';
1326
- } else {
1327
- typeString = typeof type;
1328
- }
1329
-
1330
- 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);
1331
- }
1332
-
1333
- var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1334
- // TODO: Drop this when these are no longer allowed as the type argument.
1335
-
1336
- if (element == null) {
1337
- return element;
1338
- } // Skip key warning if the type isn't valid since our key validation logic
1339
- // doesn't expect a non-string/function type and can throw confusing errors.
1340
- // We don't want exception behavior to differ between dev and prod.
1341
- // (Rendering will throw with a helpful message and as soon as the type is
1342
- // fixed, the key warnings will appear.)
1343
-
1344
-
1345
- if (validType) {
1346
- var children = props.children;
1347
-
1348
- if (children !== undefined) {
1349
- if (isStaticChildren) {
1350
- if (isArray(children)) {
1351
- for (var i = 0; i < children.length; i++) {
1352
- validateChildKeys(children[i], type);
1353
- }
1354
-
1355
- if (Object.freeze) {
1356
- Object.freeze(children);
1357
- }
1358
- } else {
1359
- 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.');
1360
- }
1361
- } else {
1362
- validateChildKeys(children, type);
1363
- }
1364
- }
1365
- }
1366
-
1367
- {
1368
- if (hasOwnProperty.call(props, 'key')) {
1369
- var componentName = getComponentNameFromType(type);
1370
- var keys = Object.keys(props).filter(function (k) {
1371
- return k !== 'key';
1372
- });
1373
- var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
1374
-
1375
- if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1376
- var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
1377
-
1378
- 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);
1379
-
1380
- didWarnAboutKeySpread[componentName + beforeExample] = true;
1381
- }
1382
- }
1383
- }
1384
-
1385
- if (type === REACT_FRAGMENT_TYPE) {
1386
- validateFragmentProps(element);
1387
- } else {
1388
- validatePropTypes(element);
1389
- }
1390
-
1391
- return element;
1392
- }
1393
- } // These two functions exist to still get child warnings in dev
1394
- // even with the prod transform. This means that jsxDEV is purely
1395
- // opt-in behavior for better messages but that we won't stop
1396
- // giving you warnings if you use production apis.
1397
-
1398
- function jsxWithValidationStatic(type, props, key) {
1399
- {
1400
- return jsxWithValidation(type, props, key, true);
1401
- }
1402
- }
1403
- function jsxWithValidationDynamic(type, props, key) {
1404
- {
1405
- return jsxWithValidation(type, props, key, false);
1406
- }
1407
- }
1408
-
1409
- var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1410
- // for now we can ship identical prod functions
1411
-
1412
- var jsxs = jsxWithValidationStatic ;
1413
-
1414
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1415
- reactJsxRuntime_development.jsx = jsx;
1416
- reactJsxRuntime_development.jsxs = jsxs;
1417
- })();
1418
- }
1419
- return reactJsxRuntime_development;
1420
- }
1421
-
1422
- if (process.env.NODE_ENV === 'production') {
1423
- jsxRuntime.exports = requireReactJsxRuntime_production_min();
1424
- } else {
1425
- jsxRuntime.exports = requireReactJsxRuntime_development();
1426
- }
1427
-
1428
- var jsxRuntimeExports = jsxRuntime.exports;
1429
-
1430
- // Export CSS classes for external usage
1431
- const cssClasses = {
1432
- // Button
1433
- button: "btn",
1434
- buttonContained: "btn--contained",
1435
- buttonOutlined: "btn--outlined",
1436
- buttonLink: "btn--link",
1437
- buttonSmall: "btn--sm",
1438
- buttonMedium: "btn--md",
1439
- buttonLarge: "btn--lg",
1440
- buttonError: "btn--error",
1441
- buttonDark: "btn--dark",
1442
- buttonLight: "btn--light",
1443
- buttonFullWidth: "btn--full-width",
1444
- // Input
1445
- inputContainer: "input-container",
1446
- inputContainerFullWidth: "input-container--full-width",
1447
- inputLabel: "input-label",
1448
- input: "input",
1449
- inputError: "input--error",
1450
- inputFullWidth: "input--full-width",
1451
- inputHelperText: "input-helper-text",
1452
- inputHelperTextError: "input-helper-text--error",
1453
- // Checkbox
1454
- checkboxContainer: "checkbox-container",
1455
- checkboxContainerFullWidth: "checkbox-container--full-width",
1456
- checkboxWrapper: "checkbox-wrapper",
1457
- checkbox: "checkbox",
1458
- checkboxError: "checkbox--error",
1459
- checkboxLabelContainer: "checkbox-label-container",
1460
- checkboxLabel: "checkbox-label",
1461
- // Radio
1462
- radioContainer: "radio-container",
1463
- radioContainerFullWidth: "radio-container--full-width",
1464
- radioWrapper: "radio-wrapper",
1465
- radio: "radio",
1466
- radioError: "radio--error",
1467
- radioLabelContainer: "radio-label-container",
1468
- radioLabel: "radio-label",
1469
- // Select
1470
- selectContainer: "select-container",
1471
- selectContainerFullWidth: "select-container--full-width",
1472
- selectLabel: "select-label",
1473
- selectWrapper: "select-wrapper",
1474
- select: "select",
1475
- selectError: "select--error",
1476
- selectFullWidth: "select--full-width",
1477
- selectIcon: "select-icon",
1478
- // Textarea
1479
- textareaContainer: "textarea-container",
1480
- textareaContainerFullWidth: "textarea-container--full-width",
1481
- textareaLabel: "textarea-label",
1482
- textarea: "textarea",
1483
- textareaError: "textarea--error",
1484
- textareaFullWidth: "textarea--full-width",
1485
- // InputFile
1486
- inputFileContainer: "input-file-container",
1487
- inputFileContainerFullWidth: "input-file-container--full-width",
1488
- inputFileLabel: "input-file-label",
1489
- inputFileWrapper: "input-file-wrapper",
1490
- inputFileHidden: "input-file-hidden",
1491
- inputFileUploadArea: "input-file-upload-area",
1492
- inputFileUploadAreaError: "input-file-upload-area--error",
1493
- inputFileUploadAreaFullWidth: "input-file-upload-area--full-width",
1494
- inputFileButtonText: "input-file-button-text",
1495
- inputFileMultipleText: "input-file-multiple-text",
1496
- // Utility
1497
- textCenter: "text-center",
1498
- textLeft: "text-left",
1499
- textRight: "text-right",
1500
- fontBold: "font-bold",
1501
- fontNormal: "font-normal",
1502
- fontLight: "font-light",
1503
- rounded: "rounded",
1504
- roundedSm: "rounded-sm",
1505
- roundedLg: "rounded-lg",
1506
- roundedFull: "rounded-full",
1507
- shadow: "shadow",
1508
- shadowSm: "shadow-sm",
1509
- shadowMd: "shadow-md",
1510
- shadowLg: "shadow-lg",
1511
- shadowXl: "shadow-xl"
1512
- };
1513
-
1514
- const _excluded$8 = ["className", "color", "variant", "size", "fullWidth", "loading", "disabled", "children"];
1515
- const Button = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
1516
- let {
1517
- className,
1518
- color = "primary",
1519
- variant = "contained",
1520
- size = "md",
1521
- fullWidth = false,
1522
- loading = false,
1523
- disabled,
1524
- children
1525
- } = _ref,
1526
- props = _objectWithoutProperties(_ref, _excluded$8);
1527
- const baseClass = cssClasses.button;
1528
- const variantClass = variant === "contained" ? cssClasses.buttonContained : variant === "outlined" ? cssClasses.buttonOutlined : cssClasses.buttonLink;
1529
- const sizeClass = size === "sm" ? cssClasses.buttonSmall : size === "md" ? cssClasses.buttonMedium : cssClasses.buttonLarge;
1530
- const colorClass = color === "error" ? cssClasses.buttonError : color === "dark" ? cssClasses.buttonDark : color === "light" ? cssClasses.buttonLight : "";
1531
- const fullWidthClass = fullWidth ? cssClasses.buttonFullWidth : "";
1532
- const combinedClasses = [baseClass, variantClass, sizeClass, colorClass, fullWidthClass, className].filter(Boolean).join(" ");
1533
- return jsxRuntimeExports.jsx("button", _objectSpread2(_objectSpread2({
1534
- className: combinedClasses,
1535
- disabled: disabled || loading,
1536
- ref: ref
1537
- }, props), {}, {
1538
- children: children
1539
- }));
1540
- });
1541
- Button.displayName = "Button";
1542
-
1543
- const _excluded$7 = ["className", "type", "label", "error", "helperText", "size", "fullWidth", "id"];
1544
- const Input = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
1545
- let {
1546
- className,
1547
- type = "text",
1548
- label,
1549
- error,
1550
- helperText,
1551
- size = "md",
1552
- fullWidth = false,
1553
- id
1554
- } = _ref,
1555
- props = _objectWithoutProperties(_ref, _excluded$7);
1556
- const inputId = id || "input-".concat(Math.random().toString(36).substr(2, 9));
1557
- const containerClass = fullWidth ? cssClasses.inputContainerFullWidth : cssClasses.inputContainer;
1558
- const inputClass = error ? "".concat(cssClasses.input, " ").concat(cssClasses.inputError) : cssClasses.input;
1559
- const inputFullWidthClass = fullWidth ? cssClasses.inputFullWidth : "";
1560
- const helperTextClass = error ? cssClasses.inputHelperTextError : cssClasses.inputHelperText;
1561
- return jsxRuntimeExports.jsxs("div", {
1562
- className: containerClass,
1563
- children: [label && jsxRuntimeExports.jsx("label", {
1564
- className: cssClasses.inputLabel,
1565
- htmlFor: inputId,
1566
- children: label
1567
- }), jsxRuntimeExports.jsx("input", _objectSpread2({
1568
- type: type,
1569
- className: "".concat(inputClass, " ").concat(inputFullWidthClass),
1570
- ref: ref,
1571
- id: inputId
1572
- }, props)), (error || helperText) && jsxRuntimeExports.jsx("p", {
1573
- className: helperTextClass,
1574
- children: error || helperText
1575
- })]
1576
- });
1577
- });
1578
- Input.displayName = "Input";
1579
-
1580
- const _excluded$6 = ["className", "label", "error", "helperText", "size", "fullWidth", "rows", "id"];
1581
- const Textarea = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
1582
- let {
1583
- className,
1584
- label,
1585
- error,
1586
- helperText,
1587
- size = "md",
1588
- fullWidth = false,
1589
- rows = 3,
1590
- id
1591
- } = _ref,
1592
- props = _objectWithoutProperties(_ref, _excluded$6);
1593
- const textareaId = id || "textarea-".concat(Math.random().toString(36).substr(2, 9));
1594
- const containerClass = fullWidth ? cssClasses.textareaContainerFullWidth : cssClasses.textareaContainer;
1595
- const textareaClass = error ? "".concat(cssClasses.textarea, " ").concat(cssClasses.textareaError) : cssClasses.textarea;
1596
- const textareaFullWidthClass = fullWidth ? cssClasses.textareaFullWidth : "";
1597
- const helperTextClass = error ? cssClasses.inputHelperTextError : cssClasses.inputHelperText;
1598
- return jsxRuntimeExports.jsxs("div", {
1599
- className: containerClass,
1600
- children: [label && jsxRuntimeExports.jsx("label", {
1601
- className: cssClasses.textareaLabel,
1602
- htmlFor: textareaId,
1603
- children: label
1604
- }), jsxRuntimeExports.jsx("textarea", _objectSpread2({
1605
- className: "".concat(textareaClass, " ").concat(textareaFullWidthClass),
1606
- ref: ref,
1607
- id: textareaId,
1608
- rows: rows
1609
- }, props)), (error || helperText) && jsxRuntimeExports.jsx("p", {
1610
- className: helperTextClass,
1611
- children: error || helperText
1612
- })]
1613
- });
1614
- });
1615
- Textarea.displayName = "Textarea";
1616
-
1617
- const _excluded$5 = ["className", "label", "error", "helperText", "size", "fullWidth", "multiple", "accept", "buttonText", "id"];
1618
- const InputFile = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
1619
- let {
1620
- className,
1621
- label,
1622
- error,
1623
- helperText,
1624
- size = "md",
1625
- fullWidth = false,
1626
- multiple = false,
1627
- accept,
1628
- buttonText = "Choose File",
1629
- id
1630
- } = _ref,
1631
- props = _objectWithoutProperties(_ref, _excluded$5);
1632
- const inputId = id || "input-file-".concat(Math.random().toString(36).substr(2, 9));
1633
- const containerClass = fullWidth ? cssClasses.inputFileContainerFullWidth : cssClasses.inputFileContainer;
1634
- const uploadAreaClass = error ? "".concat(cssClasses.inputFileUploadArea, " ").concat(cssClasses.inputFileUploadAreaError) : cssClasses.inputFileUploadArea;
1635
- const uploadAreaFullWidthClass = fullWidth ? cssClasses.inputFileUploadAreaFullWidth : "";
1636
- const helperTextClass = error ? cssClasses.inputHelperTextError : cssClasses.inputHelperText;
1637
- return jsxRuntimeExports.jsxs("div", {
1638
- className: containerClass,
1639
- children: [label && jsxRuntimeExports.jsx("label", {
1640
- className: cssClasses.inputFileLabel,
1641
- htmlFor: inputId,
1642
- children: label
1643
- }), jsxRuntimeExports.jsxs("div", {
1644
- className: cssClasses.inputFileWrapper,
1645
- children: [jsxRuntimeExports.jsx("input", _objectSpread2({
1646
- type: "file",
1647
- className: cssClasses.inputFileHidden,
1648
- ref: ref,
1649
- id: inputId,
1650
- multiple: multiple,
1651
- accept: accept
1652
- }, props)), jsxRuntimeExports.jsxs("div", {
1653
- className: "".concat(uploadAreaClass, " ").concat(uploadAreaFullWidthClass),
1654
- children: [jsxRuntimeExports.jsx("span", {
1655
- className: cssClasses.inputFileButtonText,
1656
- children: buttonText
1657
- }), multiple && jsxRuntimeExports.jsx("span", {
1658
- className: cssClasses.inputFileMultipleText,
1659
- children: "or drag and drop"
1660
- })]
1661
- })]
1662
- }), (error || helperText) && jsxRuntimeExports.jsx("p", {
1663
- className: helperTextClass,
1664
- children: error || helperText
1665
- })]
1666
- });
1667
- });
1668
- InputFile.displayName = "InputFile";
1669
-
1670
- const _excluded$4 = ["className", "label", "error", "helperText", "size", "fullWidth", "indeterminate", "id"];
1671
- const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
1672
- let {
1673
- className,
1674
- label,
1675
- error,
1676
- helperText,
1677
- size = "md",
1678
- fullWidth = false,
1679
- indeterminate = false,
1680
- id
1681
- } = _ref,
1682
- props = _objectWithoutProperties(_ref, _excluded$4);
1683
- const checkboxId = id || "checkbox-".concat(Math.random().toString(36).substr(2, 9));
1684
- React__default.useEffect(() => {
1685
- if (ref && typeof ref === "object" && ref.current) {
1686
- ref.current.indeterminate = indeterminate;
1687
- }
1688
- }, [indeterminate, ref]);
1689
- const containerClass = fullWidth ? cssClasses.checkboxContainerFullWidth : cssClasses.checkboxContainer;
1690
- const checkboxClass = error ? "".concat(cssClasses.checkbox, " ").concat(cssClasses.checkboxError) : cssClasses.checkbox;
1691
- const helperTextClass = error ? cssClasses.inputHelperTextError : cssClasses.inputHelperText;
1692
- return jsxRuntimeExports.jsxs("div", {
1693
- className: containerClass,
1694
- children: [jsxRuntimeExports.jsx("div", {
1695
- className: cssClasses.checkboxWrapper,
1696
- children: jsxRuntimeExports.jsx("input", _objectSpread2({
1697
- type: "checkbox",
1698
- className: checkboxClass,
1699
- ref: ref,
1700
- id: checkboxId
1701
- }, props))
1702
- }), jsxRuntimeExports.jsxs("div", {
1703
- className: cssClasses.checkboxLabelContainer,
1704
- children: [label && jsxRuntimeExports.jsx("label", {
1705
- className: cssClasses.checkboxLabel,
1706
- htmlFor: checkboxId,
1707
- children: label
1708
- }), (error || helperText) && jsxRuntimeExports.jsx("p", {
1709
- className: helperTextClass,
1710
- children: error || helperText
1711
- })]
1712
- })]
1713
- });
1714
- });
1715
- Checkbox.displayName = "Checkbox";
1716
-
1717
- const _excluded$3 = ["className", "label", "error", "helperText", "size", "fullWidth", "id"];
1718
- const Radio = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
1719
- let {
1720
- className,
1721
- label,
1722
- error,
1723
- helperText,
1724
- size = "md",
1725
- fullWidth = false,
1726
- id
1727
- } = _ref,
1728
- props = _objectWithoutProperties(_ref, _excluded$3);
1729
- const radioId = id || "radio-".concat(Math.random().toString(36).substr(2, 9));
1730
- const containerClass = fullWidth ? cssClasses.radioContainerFullWidth : cssClasses.radioContainer;
1731
- const radioClass = error ? "".concat(cssClasses.radio, " ").concat(cssClasses.radioError) : cssClasses.radio;
1732
- const helperTextClass = error ? cssClasses.inputHelperTextError : cssClasses.inputHelperText;
1733
- return jsxRuntimeExports.jsxs("div", {
1734
- className: containerClass,
1735
- children: [jsxRuntimeExports.jsx("div", {
1736
- className: cssClasses.radioWrapper,
1737
- children: jsxRuntimeExports.jsx("input", _objectSpread2({
1738
- type: "radio",
1739
- className: radioClass,
1740
- ref: ref,
1741
- id: radioId
1742
- }, props))
1743
- }), jsxRuntimeExports.jsxs("div", {
1744
- className: cssClasses.radioLabelContainer,
1745
- children: [label && jsxRuntimeExports.jsx("label", {
1746
- className: cssClasses.radioLabel,
1747
- htmlFor: radioId,
1748
- children: label
1749
- }), (error || helperText) && jsxRuntimeExports.jsx("p", {
1750
- className: helperTextClass,
1751
- children: error || helperText
1752
- })]
1753
- })]
1754
- });
1755
- });
1756
- Radio.displayName = "Radio";
1757
-
1758
- const _excluded$2 = ["className", "label", "error", "helperText", "size", "fullWidth", "options", "placeholder", "id"];
1759
- const Select = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
1760
- let {
1761
- className,
1762
- label,
1763
- error,
1764
- helperText,
1765
- size = "md",
1766
- fullWidth = false,
1767
- options,
1768
- placeholder,
1769
- id
1770
- } = _ref,
1771
- props = _objectWithoutProperties(_ref, _excluded$2);
1772
- const selectId = id || "select-".concat(Math.random().toString(36).substr(2, 9));
1773
- const containerClass = fullWidth ? cssClasses.selectContainerFullWidth : cssClasses.selectContainer;
1774
- const selectClass = error ? "".concat(cssClasses.select, " ").concat(cssClasses.selectError) : cssClasses.select;
1775
- const selectFullWidthClass = fullWidth ? cssClasses.selectFullWidth : "";
1776
- const helperTextClass = error ? cssClasses.inputHelperTextError : cssClasses.inputHelperText;
1777
- return jsxRuntimeExports.jsxs("div", {
1778
- className: containerClass,
1779
- children: [label && jsxRuntimeExports.jsx("label", {
1780
- className: cssClasses.selectLabel,
1781
- htmlFor: selectId,
1782
- children: label
1783
- }), jsxRuntimeExports.jsxs("div", {
1784
- className: cssClasses.selectWrapper,
1785
- children: [jsxRuntimeExports.jsxs("select", _objectSpread2(_objectSpread2({
1786
- className: "".concat(selectClass, " ").concat(selectFullWidthClass),
1787
- ref: ref,
1788
- id: selectId
1789
- }, props), {}, {
1790
- children: [placeholder && jsxRuntimeExports.jsx("option", {
1791
- value: "",
1792
- disabled: true,
1793
- children: placeholder
1794
- }), options.map(option => jsxRuntimeExports.jsx("option", {
1795
- value: option.value,
1796
- disabled: option.disabled,
1797
- children: option.label
1798
- }, option.value))]
1799
- })), jsxRuntimeExports.jsx("div", {
1800
- className: cssClasses.selectIcon,
1801
- children: jsxRuntimeExports.jsx("svg", {
1802
- width: "16",
1803
- height: "16",
1804
- fill: "none",
1805
- stroke: "currentColor",
1806
- viewBox: "0 0 24 24",
1807
- style: {
1808
- color: "#9ca3af"
1809
- },
1810
- children: jsxRuntimeExports.jsx("path", {
1811
- strokeLinecap: "round",
1812
- strokeLinejoin: "round",
1813
- strokeWidth: 2,
1814
- d: "M19 9l-7 7-7-7"
1815
- })
1816
- })
1817
- })]
1818
- }), (error || helperText) && jsxRuntimeExports.jsx("p", {
1819
- className: helperTextClass,
1820
- children: error || helperText
1821
- })]
1822
- });
1823
- });
1824
- Select.displayName = "Select";
1825
-
1826
- /**
1827
- * @license lucide-react v0.542.0 - ISC
1828
- *
1829
- * This source code is licensed under the ISC license.
1830
- * See the LICENSE file in the root directory of this source tree.
1831
- */
1832
-
1833
- const toKebabCase = string => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1834
- const toCamelCase = string => string.replace(/^([A-Z])|[\s-_]+(\w)/g, (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase());
1835
- const toPascalCase = string => {
1836
- const camelCase = toCamelCase(string);
1837
- return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
1838
- };
1839
- const mergeClasses = function () {
1840
- for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {
1841
- classes[_key] = arguments[_key];
1842
- }
1843
- return classes.filter((className, index, array) => {
1844
- return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
1845
- }).join(" ").trim();
1846
- };
1847
- const hasA11yProp = props => {
1848
- for (const prop in props) {
1849
- if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
1850
- return true;
1851
- }
1852
- }
1853
- };
1854
-
1855
- /**
1856
- * @license lucide-react v0.542.0 - ISC
1857
- *
1858
- * This source code is licensed under the ISC license.
1859
- * See the LICENSE file in the root directory of this source tree.
1860
- */
1861
-
1862
- var defaultAttributes = {
1863
- xmlns: "http://www.w3.org/2000/svg",
1864
- width: 24,
1865
- height: 24,
1866
- viewBox: "0 0 24 24",
1867
- fill: "none",
1868
- stroke: "currentColor",
1869
- strokeWidth: 2,
1870
- strokeLinecap: "round",
1871
- strokeLinejoin: "round"
1872
- };
1873
-
1874
- const _excluded$1 = ["color", "size", "strokeWidth", "absoluteStrokeWidth", "className", "children", "iconNode"];
1875
- const Icon = /*#__PURE__*/forwardRef((_ref, ref) => {
1876
- let {
1877
- color = "currentColor",
1878
- size = 24,
1879
- strokeWidth = 2,
1880
- absoluteStrokeWidth,
1881
- className = "",
1882
- children,
1883
- iconNode
1884
- } = _ref,
1885
- rest = _objectWithoutProperties(_ref, _excluded$1);
1886
- return /*#__PURE__*/createElement("svg", _objectSpread2(_objectSpread2(_objectSpread2({
1887
- ref
1888
- }, defaultAttributes), {}, {
1889
- width: size,
1890
- height: size,
1891
- stroke: color,
1892
- strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
1893
- className: mergeClasses("lucide", className)
1894
- }, !children && !hasA11yProp(rest) && {
1895
- "aria-hidden": "true"
1896
- }), rest), [...iconNode.map(_ref2 => {
1897
- let [tag, attrs] = _ref2;
1898
- return /*#__PURE__*/createElement(tag, attrs);
1899
- }), ...(Array.isArray(children) ? children : [children])]);
1900
- });
1901
-
1902
- const _excluded = ["className"];
1903
- const createLucideIcon = (iconName, iconNode) => {
1904
- const Component = /*#__PURE__*/forwardRef((_ref, ref) => {
1905
- let {
1906
- className
1907
- } = _ref,
1908
- props = _objectWithoutProperties(_ref, _excluded);
1909
- return /*#__PURE__*/createElement(Icon, _objectSpread2({
1910
- ref,
1911
- iconNode,
1912
- className: mergeClasses("lucide-".concat(toKebabCase(toPascalCase(iconName))), "lucide-".concat(iconName), className)
1913
- }, props));
1914
- });
1915
- Component.displayName = toPascalCase(iconName);
1916
- return Component;
1917
- };
1918
-
1919
- /**
1920
- * @license lucide-react v0.542.0 - ISC
1921
- *
1922
- * This source code is licensed under the ISC license.
1923
- * See the LICENSE file in the root directory of this source tree.
1924
- */
1925
-
1926
- const __iconNode = [["path", {
1927
- d: "M8 2v4",
1928
- key: "1cmpym"
1929
- }], ["path", {
1930
- d: "M16 2v4",
1931
- key: "4m81vk"
1932
- }], ["rect", {
1933
- width: "18",
1934
- height: "18",
1935
- x: "3",
1936
- y: "4",
1937
- rx: "2",
1938
- key: "1hopcy"
1939
- }], ["path", {
1940
- d: "M3 10h18",
1941
- key: "8toen8"
1942
- }], ["path", {
1943
- d: "M8 14h.01",
1944
- key: "6423bh"
1945
- }], ["path", {
1946
- d: "M12 14h.01",
1947
- key: "1etili"
1948
- }], ["path", {
1949
- d: "M16 14h.01",
1950
- key: "1gbofw"
1951
- }], ["path", {
1952
- d: "M8 18h.01",
1953
- key: "lrp35t"
1954
- }], ["path", {
1955
- d: "M12 18h.01",
1956
- key: "mhygvu"
1957
- }], ["path", {
1958
- d: "M16 18h.01",
1959
- key: "kzsmim"
1960
- }]];
1961
- const CalendarDays = createLucideIcon("calendar-days", __iconNode);
1962
-
1963
- // Translations
1964
- const translations = {
1965
- th: {
1966
- months: ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'],
1967
- weekdaysShort: ['อา', 'จ', 'อ', 'พ', 'พฤ', 'ศ', 'ส'],
1968
- today: 'วันนี้',
1969
- clear: 'ล้าง',
1970
- ok: 'ตกลง',
1971
- hour: 'ชั่วโมง',
1972
- minute: 'นาที'
1973
- },
1974
- en: {
1975
- months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
1976
- weekdaysShort: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1977
- today: 'Today',
1978
- clear: 'Clear',
1979
- ok: 'OK',
1980
- hour: 'Hour',
1981
- minute: 'Minute'
1982
- }
1983
- };
1984
- // Utility functions
1985
- const convertYear = (year, fromType, toType) => {
1986
- return year + 543;
1987
- };
1988
- const formatDate = (date, format, yearType) => {
1989
- if (!date || isNaN(date.getTime())) return '';
1990
- const day = String(date.getDate()).padStart(2, '0');
1991
- const month = String(date.getMonth() + 1).padStart(2, '0');
1992
- const year = yearType === 'be' ? convertYear(date.getFullYear()) : date.getFullYear();
1993
- const hours = String(date.getHours()).padStart(2, '0');
1994
- const minutes = String(date.getMinutes()).padStart(2, '0');
1995
- let formatted = format.replace('DD', day).replace('MM', month).replace('YYYY', year.toString()).replace('HH', hours).replace('mm', minutes);
1996
- return formatted;
1997
- };
1998
- const isSameDay = (date1, date2) => {
1999
- return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
2000
- };
2001
- // New utility function to check for disabled dates
2002
- const isDisabled = (date, disabledPast, disabledFuture) => {
2003
- const today = new Date();
2004
- const dateOnly = new Date(date.getFullYear(), date.getMonth(), date.getDate());
2005
- const todayOnly = new Date(today.getFullYear(), today.getMonth(), today.getDate());
2006
- if (disabledPast && dateOnly < todayOnly) {
2007
- return true;
2008
- }
2009
- if (disabledFuture && dateOnly > todayOnly) {
2010
- return true;
2011
- }
2012
- return false;
2013
- };
2014
- const DatePicker = (_ref, props) => {
2015
- let {
2016
- format = 'DD/MM/YYYY',
2017
- language = 'en',
2018
- yearType = 'ad',
2019
- value = null,
2020
- onChange,
2021
- placeholder = '',
2022
- disabled = false,
2023
- className = '',
2024
- showClear = true,
2025
- showToday = true,
2026
- disabledPast = false,
2027
- // Default to false
2028
- disabledFuture = false // Default to false
2029
- } = _ref;
2030
- // State
2031
- const [isOpen, setIsOpen] = useState(false);
2032
- const [selectedDate, setSelectedDate] = useState(null);
2033
- const [currentMonth, setCurrentMonth] = useState(new Date().getMonth());
2034
- const [currentYear, setCurrentYear] = useState(new Date().getFullYear());
2035
- const [inputValue, setInputValue] = useState('');
2036
- const [timeHour, setTimeHour] = useState(0);
2037
- const [timeMinute, setTimeMinute] = useState(0);
2038
- // Refs
2039
- const containerRef = useRef(null);
2040
- // Constants
2041
- const includeTime = format.includes('HH:mm');
2042
- const t = translations[language];
2043
- // Initialize from value prop
2044
- useEffect(() => {
2045
- if (value) {
2046
- const date = new Date(value);
2047
- if (!isNaN(date.getTime())) {
2048
- setSelectedDate(date);
2049
- setCurrentMonth(date.getMonth());
2050
- setCurrentYear(date.getFullYear());
2051
- setTimeHour(date.getHours());
2052
- setTimeMinute(date.getMinutes());
2053
- setInputValue(formatDate(date, format, yearType));
2054
- }
2055
- } else {
2056
- setSelectedDate(null);
2057
- setInputValue('');
2058
- }
2059
- }, [value, format, yearType]);
2060
- // Handle date selection
2061
- const handleDateSelect = (day, year, month) => {
2062
- const newDate = new Date(year, month, day, timeHour, timeMinute);
2063
- // Check if the selected date is disabled before proceeding
2064
- if (isDisabled(newDate, disabledPast, disabledFuture)) {
2065
- return;
2066
- }
2067
- setSelectedDate(newDate);
2068
- setInputValue(formatDate(newDate, format, yearType));
2069
- onChange === null || onChange === void 0 || onChange(newDate);
2070
- if (!includeTime) {
2071
- setIsOpen(false);
2072
- }
2073
- };
2074
- // Handle time change
2075
- const handleTimeChange = (type, newValue) => {
2076
- if (type === 'hour') {
2077
- setTimeHour(newValue);
2078
- } else {
2079
- setTimeMinute(newValue);
2080
- }
2081
- if (selectedDate) {
2082
- const newDate = new Date(selectedDate);
2083
- if (type === 'hour') {
2084
- newDate.setHours(newValue);
2085
- } else {
2086
- newDate.setMinutes(newValue);
2087
- }
2088
- setSelectedDate(newDate);
2089
- setInputValue(formatDate(newDate, format, yearType));
2090
- onChange === null || onChange === void 0 || onChange(newDate);
2091
- }
2092
- };
2093
- // Handle today button
2094
- const handleToday = () => {
2095
- const today = new Date();
2096
- if (isDisabled(today, disabledPast, disabledFuture)) {
2097
- return;
2098
- }
2099
- setSelectedDate(today);
2100
- setCurrentMonth(today.getMonth());
2101
- setCurrentYear(today.getFullYear());
2102
- setTimeHour(today.getHours());
2103
- setTimeMinute(today.getMinutes());
2104
- setInputValue(formatDate(today, format, yearType));
2105
- onChange === null || onChange === void 0 || onChange(today);
2106
- if (!includeTime) {
2107
- setIsOpen(false);
2108
- }
2109
- };
2110
- // Handle clear button
2111
- const handleClear = () => {
2112
- setSelectedDate(null);
2113
- setInputValue('');
2114
- onChange === null || onChange === void 0 || onChange(null);
2115
- setIsOpen(false);
2116
- };
2117
- // Handle confirm (for time picker)
2118
- const handleConfirm = () => {
2119
- setIsOpen(false);
2120
- };
2121
- // Navigation handlers
2122
- const goToPreviousMonth = () => {
2123
- if (currentMonth === 0) {
2124
- setCurrentMonth(11);
2125
- setCurrentYear(currentYear - 1);
2126
- } else {
2127
- setCurrentMonth(currentMonth - 1);
2128
- }
2129
- };
2130
- const goToNextMonth = () => {
2131
- if (currentMonth === 11) {
2132
- setCurrentMonth(0);
2133
- setCurrentYear(currentYear + 1);
2134
- } else {
2135
- setCurrentMonth(currentMonth + 1);
2136
- }
2137
- };
2138
- const goToPreviousYear = () => {
2139
- setCurrentYear(currentYear - 1);
2140
- };
2141
- const goToNextYear = () => {
2142
- setCurrentYear(currentYear + 1);
2143
- };
2144
- // Generate calendar days
2145
- const generateCalendarDays = () => {
2146
- const firstDayOfMonth = new Date(currentYear, currentMonth, 1);
2147
- const lastDayOfMonth = new Date(currentYear, currentMonth + 1, 0);
2148
- const firstDayOfWeek = firstDayOfMonth.getDay();
2149
- const daysInMonth = lastDayOfMonth.getDate();
2150
- const days = [];
2151
- // Previous month days
2152
- const prevMonth = new Date(currentYear, currentMonth - 1, 0);
2153
- const daysFromPrevMonth = firstDayOfWeek;
2154
- for (let i = daysFromPrevMonth - 1; i >= 0; i--) {
2155
- days.push({
2156
- day: prevMonth.getDate() - i,
2157
- isCurrentMonth: false,
2158
- isOtherMonth: true,
2159
- month: currentMonth - 1,
2160
- year: currentYear
2161
- });
2162
- }
2163
- // Current month days
2164
- for (let day = 1; day <= daysInMonth; day++) {
2165
- days.push({
2166
- day,
2167
- isCurrentMonth: true,
2168
- isOtherMonth: false,
2169
- month: currentMonth,
2170
- year: currentYear
2171
- });
2172
- }
2173
- // Next month days
2174
- const remainingDays = 42 - days.length;
2175
- for (let day = 1; day <= remainingDays; day++) {
2176
- days.push({
2177
- day,
2178
- isCurrentMonth: false,
2179
- isOtherMonth: true,
2180
- month: currentMonth + 1,
2181
- year: currentYear
2182
- });
2183
- }
2184
- return days;
2185
- };
2186
- // Click outside handler
2187
- useEffect(() => {
2188
- const handleClickOutside = event => {
2189
- if (containerRef.current && !containerRef.current.contains(event.target)) {
2190
- setIsOpen(false);
2191
- }
2192
- };
2193
- if (isOpen) {
2194
- document.addEventListener('mousedown', handleClickOutside);
2195
- }
2196
- return () => {
2197
- document.removeEventListener('mousedown', handleClickOutside);
2198
- };
2199
- }, [isOpen]);
2200
- const calendarDays = generateCalendarDays();
2201
- const today = new Date();
2202
- const displayYear = yearType === 'be' ? convertYear(currentYear) : currentYear;
2203
- return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
2204
- children: [jsxRuntimeExports.jsx("style", {
2205
- children: "\n .datetime-picker {\n position: relative;\n display: inline-block;\n width: 100%;\n max-width: 300px;\n}\n\n.datetime-picker-input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.datetime-picker-input {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid #e1e5e9;\n font-size: 14px;\n background-color: #ffffff;\n cursor: pointer;\n transition: border-color 0.2s ease;\n box-sizing: border-box;\n}\n\n.datetime-picker-input:hover {\n border-color: #d1d5db;\n}\n\n.datetime-picker-input:focus {\n outline: none;\n border-color: #3b82f6;\n}\n\n.datetime-picker-input:disabled {\n background-color: #f9fafb;\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.datetime-picker-icon {\n position: absolute;\n right: 6px;\n top: 6px;\n font-size: 16px;\n pointer-events: none;\n color: #666666;\n}\n\n.datetime-picker-dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 1000;\n margin-top: 4px;\n background: #ffffff;\n border: 1px solid #e1e5e9;\n /* border-radius: 8px; */\n box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);\n padding: 16px;\n min-width: 320px;\n}\n\n.calendar-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 16px;\n}\n\n.nav-button {\n background: none;\n border: none;\n padding: 8px;\n /* border-radius: 4px; */\n cursor: pointer;\n font-size: 18px;\n color: #6b7280;\n transition: all 0.2s ease;\n}\n\n.nav-button:hover {\n background-color: #f3f4f6;\n color: #374151;\n}\n\n.current-month-year {\n font-size: 16px;\n font-weight: 600;\n color: #374151;\n min-width: 140px;\n text-align: center;\n}\n\n.weekdays {\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n gap: 2px;\n margin-bottom: 8px;\n}\n\n.weekday {\n text-align: center;\n padding: 8px 4px;\n font-size: 12px;\n font-weight: 600;\n color: #6b7280;\n text-transform: uppercase;\n}\n\n.calendar-days {\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n gap: 2px;\n margin-bottom: 16px;\n}\n\n.calendar-day {\n background: none;\n border: none;\n padding: 8px;\n text-align: center;\n cursor: pointer;\n /* border-radius: 4px; */\n font-size: 14px;\n color: #374151;\n transition: all 0.2s ease;\n min-height: 32px;\n}\n\n.calendar-day:hover {\n background-color: #f3f4f6;\n}\n\n.calendar-day.other-month {\n color: #9ca3af;\n}\n\n.calendar-day.selected {\n background-color: #007ac2;\n color: #ffffff;\n}\n\n.calendar-day.today {\n background-color: #e2f3fe;\n color: #007ac2;\n font-weight: 600;\n}\n\n.calendar-day.selected.today {\n background-color: #007ac2;\n color: #ffffff;\n}\n\n.calendar-day.disabled {\n color: #dcdcdc;\n cursor: not-allowed;\n}\n\n.calendar-day:hover.disabled {\n background-color: none;\n}\n\n.time-picker {\n display: flex;\n gap: 16px;\n padding: 16px 0;\n border-top: 1px solid #e5e7eb;\n border-bottom: 1px solid #e5e7eb;\n margin: 16px 0;\n}\n\n.time-picker-section {\n flex: 1;\n}\n\n.time-picker-section label {\n display: block;\n font-size: 12px;\n font-weight: 600;\n color: #6b7280;\n margin-bottom: 4px;\n}\n\n.time-select {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid #d1d5db;\n /* border-radius: 4px; */\n font-size: 14px;\n background-color: #ffffff;\n box-sizing: border-box;\n}\n\n.calendar-footer {\n display: flex;\n justify-content: space-between;\n gap: 8px;\n}\n\n.footer-button {\n padding: 6px 12px;\n border: 1px solid #d1d5db;\n /* border-radius: 4px; */\n background: #ffffff;\n cursor: pointer;\n font-size: 12px;\n transition: all 0.2s ease;\n}\n\n.footer-button:hover {\n background-color: #f9fafb;\n}\n\n.today-button {\n color: #007ac2;\n border-color: #007ac2;\n}\n\n.today-button:hover {\n background-color: #ecfdf5;\n}\n\n.clear-button {\n color: #007ac2;\n border-color: #007ac2;\n}\n\n.clear-button:hover {\n background-color: #fef2f2;\n}\n\n.confirm-button {\n color: #007ac2;\n border-color: #007ac2;\n}\n\n.confirm-button:hover {\n background-color: #eff6ff;\n}\n\n "
2206
- }), jsxRuntimeExports.jsxs("div", {
2207
- ref: containerRef,
2208
- className: "datetime-picker ".concat(className),
2209
- children: [jsxRuntimeExports.jsxs("div", {
2210
- className: "datetime-picker-input-wrapper",
2211
- children: [jsxRuntimeExports.jsx("input", _objectSpread2({
2212
- type: "text",
2213
- value: inputValue,
2214
- placeholder: placeholder || format,
2215
- disabled: disabled,
2216
- readOnly: true,
2217
- onClick: () => !disabled && setIsOpen(true),
2218
- className: "datetime-picker-input"
2219
- }, props)), jsxRuntimeExports.jsx("div", {
2220
- className: "datetime-picker-icon",
2221
- children: jsxRuntimeExports.jsx(CalendarDays, {
2222
- size: "18"
2223
- })
2224
- })]
2225
- }), isOpen && jsxRuntimeExports.jsx("div", {
2226
- className: "datetime-picker-dropdown",
2227
- children: jsxRuntimeExports.jsxs("div", {
2228
- className: "datetime-picker-calendar",
2229
- children: [jsxRuntimeExports.jsxs("div", {
2230
- className: "calendar-header",
2231
- children: [jsxRuntimeExports.jsx("button", {
2232
- type: "button",
2233
- onClick: goToPreviousYear,
2234
- className: "nav-button",
2235
- children: "\u27EA"
2236
- }), jsxRuntimeExports.jsx("button", {
2237
- type: "button",
2238
- onClick: goToPreviousMonth,
2239
- className: "nav-button",
2240
- children: "\u27E8"
2241
- }), jsxRuntimeExports.jsxs("div", {
2242
- className: "current-month-year",
2243
- children: [t.months[currentMonth], " ", displayYear]
2244
- }), jsxRuntimeExports.jsx("button", {
2245
- type: "button",
2246
- onClick: goToNextMonth,
2247
- className: "nav-button",
2248
- children: "\u27E9"
2249
- }), jsxRuntimeExports.jsx("button", {
2250
- type: "button",
2251
- onClick: goToNextYear,
2252
- className: "nav-button",
2253
- children: "\u27EB"
2254
- })]
2255
- }), jsxRuntimeExports.jsx("div", {
2256
- className: "weekdays",
2257
- children: t.weekdaysShort.map((day, index) => jsxRuntimeExports.jsx("div", {
2258
- className: "weekday",
2259
- children: day
2260
- }, index))
2261
- }), jsxRuntimeExports.jsx("div", {
2262
- className: "calendar-days",
2263
- children: calendarDays.map((dateInfo, index) => {
2264
- let actualDate;
2265
- // Determine the correct date object for the day
2266
- if (dateInfo.isCurrentMonth) {
2267
- actualDate = new Date(currentYear, currentMonth, dateInfo.day);
2268
- } else if (index < 7 && dateInfo.day > 20) {
2269
- actualDate = new Date(currentYear, currentMonth - 1, dateInfo.day);
2270
- } else {
2271
- actualDate = new Date(currentYear, currentMonth + 1, dateInfo.day);
2272
- }
2273
- const isSelected = selectedDate && isSameDay(actualDate, selectedDate);
2274
- const isToday = isSameDay(actualDate, today);
2275
- const isDayDisabled = isDisabled(actualDate, disabledPast, disabledFuture);
2276
- return jsxRuntimeExports.jsx("button", {
2277
- type: "button",
2278
- onClick: () => {
2279
- if (dateInfo.isCurrentMonth) {
2280
- handleDateSelect(dateInfo.day, currentYear, currentMonth);
2281
- } else if (index < 7 && dateInfo.day > 20) {
2282
- // Navigate to previous month and select date
2283
- const prevMonth = currentMonth === 0 ? 11 : currentMonth - 1;
2284
- const prevYear = currentMonth === 0 ? currentYear - 1 : currentYear;
2285
- const newDate = new Date(prevYear, prevMonth, dateInfo.day);
2286
- if (isDisabled(newDate, disabledPast, disabledFuture)) return;
2287
- setCurrentMonth(prevMonth);
2288
- setCurrentYear(prevYear);
2289
- handleDateSelect(dateInfo.day, prevYear, prevMonth);
2290
- } else {
2291
- // Navigate to next month and select date
2292
- const nextMonth = currentMonth === 11 ? 0 : currentMonth + 1;
2293
- const nextYear = currentMonth === 11 ? currentYear + 1 : currentYear;
2294
- const newDate = new Date(nextYear, nextMonth, dateInfo.day);
2295
- if (isDisabled(newDate, disabledPast, disabledFuture)) return;
2296
- setCurrentMonth(nextMonth);
2297
- setCurrentYear(nextYear);
2298
- handleDateSelect(dateInfo.day, nextYear, nextMonth);
2299
- }
2300
- },
2301
- disabled: isDayDisabled,
2302
- className: "\n calendar-day\n ".concat(dateInfo.isOtherMonth ? 'other-month' : '', "\n ").concat(isSelected ? 'selected' : '', "\n ").concat(isToday ? 'today' : '', "\n ").concat(isDayDisabled ? 'disabled' : '', "\n ").trim(),
2303
- children: dateInfo.day
2304
- }, index);
2305
- })
2306
- }), includeTime && jsxRuntimeExports.jsxs("div", {
2307
- className: "time-picker",
2308
- children: [jsxRuntimeExports.jsxs("div", {
2309
- className: "time-picker-section",
2310
- children: [jsxRuntimeExports.jsx("label", {
2311
- children: t.hour
2312
- }), jsxRuntimeExports.jsx("select", {
2313
- value: timeHour,
2314
- onChange: e => handleTimeChange('hour', parseInt(e.target.value)),
2315
- className: "time-select",
2316
- children: Array.from({
2317
- length: 24
2318
- }, (_, i) => jsxRuntimeExports.jsx("option", {
2319
- value: i,
2320
- children: String(i).padStart(2, '0')
2321
- }, i))
2322
- })]
2323
- }), jsxRuntimeExports.jsxs("div", {
2324
- className: "time-picker-section",
2325
- children: [jsxRuntimeExports.jsx("label", {
2326
- children: t.minute
2327
- }), jsxRuntimeExports.jsx("select", {
2328
- value: timeMinute,
2329
- onChange: e => handleTimeChange('minute', parseInt(e.target.value)),
2330
- className: "time-select",
2331
- children: Array.from({
2332
- length: 60
2333
- }, (_, i) => jsxRuntimeExports.jsx("option", {
2334
- value: i,
2335
- children: String(i).padStart(2, '0')
2336
- }, i))
2337
- })]
2338
- })]
2339
- }), jsxRuntimeExports.jsxs("div", {
2340
- className: "calendar-footer",
2341
- children: [showToday && jsxRuntimeExports.jsx("button", {
2342
- type: "button",
2343
- onClick: handleToday,
2344
- disabled: isDisabled(today, disabledPast, disabledFuture),
2345
- className: "footer-button today-button ".concat(isDisabled(today, disabledPast, disabledFuture) ? 'disabled' : ''),
2346
- children: t.today
2347
- }), showClear && jsxRuntimeExports.jsx("button", {
2348
- type: "button",
2349
- onClick: handleClear,
2350
- className: "footer-button clear-button",
2351
- children: t.clear
2352
- }), includeTime && jsxRuntimeExports.jsx("button", {
2353
- type: "button",
2354
- onClick: handleConfirm,
2355
- className: "footer-button confirm-button",
2356
- children: t.ok
2357
- })]
2358
- })]
2359
- })
2360
- })]
2361
- })]
2362
- });
2363
- };
2364
-
2365
- // Ensure React is available before importing components
2366
-
2367
- export { Button, Checkbox, DatePicker, Input, InputFile, Radio, Select, Textarea, cssClasses };
2368
- //# sourceMappingURL=index.esm.js.map