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