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