@saas-ui/forms 2.0.0-next.3 → 2.0.0-next.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +53 -6
  3. package/dist/ajv/index.d.ts +1 -1
  4. package/dist/ajv/index.js.map +1 -1
  5. package/dist/ajv/index.mjs.map +1 -1
  6. package/dist/index.d.ts +265 -166
  7. package/dist/index.js +2821 -556
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +2814 -555
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/yup/index.d.ts +98 -6
  12. package/dist/yup/index.js.map +1 -1
  13. package/dist/yup/index.mjs.map +1 -1
  14. package/dist/zod/index.d.ts +97 -4
  15. package/dist/zod/index.js.map +1 -1
  16. package/dist/zod/index.mjs.map +1 -1
  17. package/package.json +5 -3
  18. package/src/array-field.tsx +50 -30
  19. package/src/auto-form.tsx +7 -3
  20. package/src/base-field.tsx +59 -0
  21. package/src/create-field.tsx +143 -0
  22. package/src/create-form.tsx +31 -0
  23. package/src/default-fields.tsx +146 -0
  24. package/src/display-field.tsx +8 -9
  25. package/src/display-if.tsx +6 -5
  26. package/src/field-resolver.ts +1 -1
  27. package/src/field.tsx +14 -444
  28. package/src/fields-context.tsx +23 -0
  29. package/src/fields.tsx +18 -8
  30. package/src/form.tsx +27 -37
  31. package/src/index.ts +38 -0
  32. package/src/input-right-button/input-right-button.stories.tsx +1 -1
  33. package/src/input-right-button/input-right-button.tsx +0 -2
  34. package/src/layout.tsx +16 -11
  35. package/src/number-input/number-input.tsx +9 -5
  36. package/src/object-field.tsx +8 -7
  37. package/src/password-input/password-input.stories.tsx +23 -2
  38. package/src/password-input/password-input.tsx +5 -5
  39. package/src/pin-input/pin-input.tsx +1 -5
  40. package/src/radio/radio-input.stories.tsx +1 -1
  41. package/src/radio/radio-input.tsx +12 -10
  42. package/src/select/native-select.tsx +1 -4
  43. package/src/select/select.test.tsx +1 -1
  44. package/src/select/select.tsx +18 -14
  45. package/src/step-form.tsx +29 -11
  46. package/src/submit-button.tsx +5 -1
  47. package/src/types.ts +91 -0
  48. package/src/utils.ts +15 -0
  49. /package/src/radio/{radio.test.tsx → radio-input.test.tsx} +0 -0
package/dist/index.js CHANGED
@@ -1,14 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var React8 = require('react');
4
- var utils = require('@chakra-ui/utils');
5
3
  var reactHookForm = require('react-hook-form');
6
4
  var react = require('@chakra-ui/react');
7
- var icons = require('@chakra-ui/icons');
8
- var reactUtils = require('@chakra-ui/react-utils');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var React12 = require('react');
9
7
  var core = require('@saas-ui/core');
8
+ var react$1 = require('@emotion/react');
9
+ var utils = require('@chakra-ui/utils');
10
+ var createStyled = require('@emotion/styled');
11
+ var reactUtils = require('@chakra-ui/react-utils');
12
+
13
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
14
 
11
- function _interopNamespaceDefault(e) {
15
+ function _interopNamespace(e) {
16
+ if (e && e.__esModule) return e;
12
17
  var n = Object.create(null);
13
18
  if (e) {
14
19
  Object.keys(e).forEach(function (k) {
@@ -25,70 +30,2404 @@ function _interopNamespaceDefault(e) {
25
30
  return Object.freeze(n);
26
31
  }
27
32
 
28
- var React8__namespace = /*#__PURE__*/_interopNamespaceDefault(React8);
33
+ var React12__namespace = /*#__PURE__*/_interopNamespace(React12);
34
+ var createStyled__default = /*#__PURE__*/_interopDefault(createStyled);
35
+
36
+ var __create = Object.create;
37
+ var __defProp = Object.defineProperty;
38
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
39
+ var __getOwnPropNames = Object.getOwnPropertyNames;
40
+ var __getProtoOf = Object.getPrototypeOf;
41
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
42
+ var __commonJS = (cb, mod) => function __require() {
43
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
44
+ };
45
+ var __copyProps = (to, from, except, desc) => {
46
+ if (from && typeof from === "object" || typeof from === "function") {
47
+ for (let key of __getOwnPropNames(from))
48
+ if (!__hasOwnProp.call(to, key) && key !== except)
49
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
50
+ }
51
+ return to;
52
+ };
53
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
54
+ // If the importer is in node compatibility mode or this is not an ESM
55
+ // file that has been converted to a CommonJS file using a Babel-
56
+ // compatible transform (i.e. "__esModule" has not been set), then set
57
+ // "default" to the CommonJS "module.exports" for node compatibility.
58
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
59
+ mod
60
+ ));
61
+
62
+ // ../../node_modules/lodash.mergewith/index.js
63
+ var require_lodash = __commonJS({
64
+ "../../node_modules/lodash.mergewith/index.js"(exports, module) {
65
+ var LARGE_ARRAY_SIZE = 200;
66
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
67
+ var HOT_COUNT = 800;
68
+ var HOT_SPAN = 16;
69
+ var MAX_SAFE_INTEGER = 9007199254740991;
70
+ var argsTag = "[object Arguments]";
71
+ var arrayTag = "[object Array]";
72
+ var asyncTag = "[object AsyncFunction]";
73
+ var boolTag = "[object Boolean]";
74
+ var dateTag = "[object Date]";
75
+ var errorTag = "[object Error]";
76
+ var funcTag = "[object Function]";
77
+ var genTag = "[object GeneratorFunction]";
78
+ var mapTag = "[object Map]";
79
+ var numberTag = "[object Number]";
80
+ var nullTag = "[object Null]";
81
+ var objectTag = "[object Object]";
82
+ var proxyTag = "[object Proxy]";
83
+ var regexpTag = "[object RegExp]";
84
+ var setTag = "[object Set]";
85
+ var stringTag = "[object String]";
86
+ var undefinedTag = "[object Undefined]";
87
+ var weakMapTag = "[object WeakMap]";
88
+ var arrayBufferTag = "[object ArrayBuffer]";
89
+ var dataViewTag = "[object DataView]";
90
+ var float32Tag = "[object Float32Array]";
91
+ var float64Tag = "[object Float64Array]";
92
+ var int8Tag = "[object Int8Array]";
93
+ var int16Tag = "[object Int16Array]";
94
+ var int32Tag = "[object Int32Array]";
95
+ var uint8Tag = "[object Uint8Array]";
96
+ var uint8ClampedTag = "[object Uint8ClampedArray]";
97
+ var uint16Tag = "[object Uint16Array]";
98
+ var uint32Tag = "[object Uint32Array]";
99
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
100
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
101
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
102
+ var typedArrayTags = {};
103
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
104
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
105
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
106
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
107
+ var root = freeGlobal || freeSelf || Function("return this")();
108
+ var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
109
+ var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
110
+ var moduleExports = freeModule && freeModule.exports === freeExports;
111
+ var freeProcess = moduleExports && freeGlobal.process;
112
+ var nodeUtil = function() {
113
+ try {
114
+ var types = freeModule && freeModule.require && freeModule.require("util").types;
115
+ if (types) {
116
+ return types;
117
+ }
118
+ return freeProcess && freeProcess.binding && freeProcess.binding("util");
119
+ } catch (e) {
120
+ }
121
+ }();
122
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
123
+ function apply(func, thisArg, args) {
124
+ switch (args.length) {
125
+ case 0:
126
+ return func.call(thisArg);
127
+ case 1:
128
+ return func.call(thisArg, args[0]);
129
+ case 2:
130
+ return func.call(thisArg, args[0], args[1]);
131
+ case 3:
132
+ return func.call(thisArg, args[0], args[1], args[2]);
133
+ }
134
+ return func.apply(thisArg, args);
135
+ }
136
+ function baseTimes(n, iteratee) {
137
+ var index = -1, result = Array(n);
138
+ while (++index < n) {
139
+ result[index] = iteratee(index);
140
+ }
141
+ return result;
142
+ }
143
+ function baseUnary(func) {
144
+ return function(value) {
145
+ return func(value);
146
+ };
147
+ }
148
+ function getValue(object, key) {
149
+ return object == null ? void 0 : object[key];
150
+ }
151
+ function overArg(func, transform2) {
152
+ return function(arg) {
153
+ return func(transform2(arg));
154
+ };
155
+ }
156
+ var arrayProto = Array.prototype;
157
+ var funcProto = Function.prototype;
158
+ var objectProto = Object.prototype;
159
+ var coreJsData = root["__core-js_shared__"];
160
+ var funcToString = funcProto.toString;
161
+ var hasOwnProperty = objectProto.hasOwnProperty;
162
+ var maskSrcKey = function() {
163
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
164
+ return uid ? "Symbol(src)_1." + uid : "";
165
+ }();
166
+ var nativeObjectToString = objectProto.toString;
167
+ var objectCtorString = funcToString.call(Object);
168
+ var reIsNative = RegExp(
169
+ "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
170
+ );
171
+ var Buffer2 = moduleExports ? root.Buffer : void 0;
172
+ var Symbol2 = root.Symbol;
173
+ var Uint8Array2 = root.Uint8Array;
174
+ var allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
175
+ var getPrototype = overArg(Object.getPrototypeOf, Object);
176
+ var objectCreate = Object.create;
177
+ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
178
+ var splice = arrayProto.splice;
179
+ var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
180
+ var defineProperty = function() {
181
+ try {
182
+ var func = getNative(Object, "defineProperty");
183
+ func({}, "", {});
184
+ return func;
185
+ } catch (e) {
186
+ }
187
+ }();
188
+ var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
189
+ var nativeMax = Math.max;
190
+ var nativeNow = Date.now;
191
+ var Map2 = getNative(root, "Map");
192
+ var nativeCreate = getNative(Object, "create");
193
+ var baseCreate = function() {
194
+ function object() {
195
+ }
196
+ return function(proto) {
197
+ if (!isObject2(proto)) {
198
+ return {};
199
+ }
200
+ if (objectCreate) {
201
+ return objectCreate(proto);
202
+ }
203
+ object.prototype = proto;
204
+ var result = new object();
205
+ object.prototype = void 0;
206
+ return result;
207
+ };
208
+ }();
209
+ function Hash(entries) {
210
+ var index = -1, length = entries == null ? 0 : entries.length;
211
+ this.clear();
212
+ while (++index < length) {
213
+ var entry = entries[index];
214
+ this.set(entry[0], entry[1]);
215
+ }
216
+ }
217
+ function hashClear() {
218
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
219
+ this.size = 0;
220
+ }
221
+ function hashDelete(key) {
222
+ var result = this.has(key) && delete this.__data__[key];
223
+ this.size -= result ? 1 : 0;
224
+ return result;
225
+ }
226
+ function hashGet(key) {
227
+ var data = this.__data__;
228
+ if (nativeCreate) {
229
+ var result = data[key];
230
+ return result === HASH_UNDEFINED ? void 0 : result;
231
+ }
232
+ return hasOwnProperty.call(data, key) ? data[key] : void 0;
233
+ }
234
+ function hashHas(key) {
235
+ var data = this.__data__;
236
+ return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
237
+ }
238
+ function hashSet(key, value) {
239
+ var data = this.__data__;
240
+ this.size += this.has(key) ? 0 : 1;
241
+ data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
242
+ return this;
243
+ }
244
+ Hash.prototype.clear = hashClear;
245
+ Hash.prototype["delete"] = hashDelete;
246
+ Hash.prototype.get = hashGet;
247
+ Hash.prototype.has = hashHas;
248
+ Hash.prototype.set = hashSet;
249
+ function ListCache(entries) {
250
+ var index = -1, length = entries == null ? 0 : entries.length;
251
+ this.clear();
252
+ while (++index < length) {
253
+ var entry = entries[index];
254
+ this.set(entry[0], entry[1]);
255
+ }
256
+ }
257
+ function listCacheClear() {
258
+ this.__data__ = [];
259
+ this.size = 0;
260
+ }
261
+ function listCacheDelete(key) {
262
+ var data = this.__data__, index = assocIndexOf(data, key);
263
+ if (index < 0) {
264
+ return false;
265
+ }
266
+ var lastIndex = data.length - 1;
267
+ if (index == lastIndex) {
268
+ data.pop();
269
+ } else {
270
+ splice.call(data, index, 1);
271
+ }
272
+ --this.size;
273
+ return true;
274
+ }
275
+ function listCacheGet(key) {
276
+ var data = this.__data__, index = assocIndexOf(data, key);
277
+ return index < 0 ? void 0 : data[index][1];
278
+ }
279
+ function listCacheHas(key) {
280
+ return assocIndexOf(this.__data__, key) > -1;
281
+ }
282
+ function listCacheSet(key, value) {
283
+ var data = this.__data__, index = assocIndexOf(data, key);
284
+ if (index < 0) {
285
+ ++this.size;
286
+ data.push([key, value]);
287
+ } else {
288
+ data[index][1] = value;
289
+ }
290
+ return this;
291
+ }
292
+ ListCache.prototype.clear = listCacheClear;
293
+ ListCache.prototype["delete"] = listCacheDelete;
294
+ ListCache.prototype.get = listCacheGet;
295
+ ListCache.prototype.has = listCacheHas;
296
+ ListCache.prototype.set = listCacheSet;
297
+ function MapCache(entries) {
298
+ var index = -1, length = entries == null ? 0 : entries.length;
299
+ this.clear();
300
+ while (++index < length) {
301
+ var entry = entries[index];
302
+ this.set(entry[0], entry[1]);
303
+ }
304
+ }
305
+ function mapCacheClear() {
306
+ this.size = 0;
307
+ this.__data__ = {
308
+ "hash": new Hash(),
309
+ "map": new (Map2 || ListCache)(),
310
+ "string": new Hash()
311
+ };
312
+ }
313
+ function mapCacheDelete(key) {
314
+ var result = getMapData(this, key)["delete"](key);
315
+ this.size -= result ? 1 : 0;
316
+ return result;
317
+ }
318
+ function mapCacheGet(key) {
319
+ return getMapData(this, key).get(key);
320
+ }
321
+ function mapCacheHas(key) {
322
+ return getMapData(this, key).has(key);
323
+ }
324
+ function mapCacheSet(key, value) {
325
+ var data = getMapData(this, key), size = data.size;
326
+ data.set(key, value);
327
+ this.size += data.size == size ? 0 : 1;
328
+ return this;
329
+ }
330
+ MapCache.prototype.clear = mapCacheClear;
331
+ MapCache.prototype["delete"] = mapCacheDelete;
332
+ MapCache.prototype.get = mapCacheGet;
333
+ MapCache.prototype.has = mapCacheHas;
334
+ MapCache.prototype.set = mapCacheSet;
335
+ function Stack2(entries) {
336
+ var data = this.__data__ = new ListCache(entries);
337
+ this.size = data.size;
338
+ }
339
+ function stackClear() {
340
+ this.__data__ = new ListCache();
341
+ this.size = 0;
342
+ }
343
+ function stackDelete(key) {
344
+ var data = this.__data__, result = data["delete"](key);
345
+ this.size = data.size;
346
+ return result;
347
+ }
348
+ function stackGet(key) {
349
+ return this.__data__.get(key);
350
+ }
351
+ function stackHas(key) {
352
+ return this.__data__.has(key);
353
+ }
354
+ function stackSet(key, value) {
355
+ var data = this.__data__;
356
+ if (data instanceof ListCache) {
357
+ var pairs = data.__data__;
358
+ if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
359
+ pairs.push([key, value]);
360
+ this.size = ++data.size;
361
+ return this;
362
+ }
363
+ data = this.__data__ = new MapCache(pairs);
364
+ }
365
+ data.set(key, value);
366
+ this.size = data.size;
367
+ return this;
368
+ }
369
+ Stack2.prototype.clear = stackClear;
370
+ Stack2.prototype["delete"] = stackDelete;
371
+ Stack2.prototype.get = stackGet;
372
+ Stack2.prototype.has = stackHas;
373
+ Stack2.prototype.set = stackSet;
374
+ function arrayLikeKeys(value, inherited) {
375
+ var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
376
+ for (var key in value) {
377
+ if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
378
+ (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
379
+ isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
380
+ isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
381
+ isIndex(key, length)))) {
382
+ result.push(key);
383
+ }
384
+ }
385
+ return result;
386
+ }
387
+ function assignMergeValue(object, key, value) {
388
+ if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
389
+ baseAssignValue(object, key, value);
390
+ }
391
+ }
392
+ function assignValue(object, key, value) {
393
+ var objValue = object[key];
394
+ if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
395
+ baseAssignValue(object, key, value);
396
+ }
397
+ }
398
+ function assocIndexOf(array, key) {
399
+ var length = array.length;
400
+ while (length--) {
401
+ if (eq(array[length][0], key)) {
402
+ return length;
403
+ }
404
+ }
405
+ return -1;
406
+ }
407
+ function baseAssignValue(object, key, value) {
408
+ if (key == "__proto__" && defineProperty) {
409
+ defineProperty(object, key, {
410
+ "configurable": true,
411
+ "enumerable": true,
412
+ "value": value,
413
+ "writable": true
414
+ });
415
+ } else {
416
+ object[key] = value;
417
+ }
418
+ }
419
+ var baseFor = createBaseFor();
420
+ function baseGetTag(value) {
421
+ if (value == null) {
422
+ return value === void 0 ? undefinedTag : nullTag;
423
+ }
424
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
425
+ }
426
+ function baseIsArguments(value) {
427
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
428
+ }
429
+ function baseIsNative(value) {
430
+ if (!isObject2(value) || isMasked(value)) {
431
+ return false;
432
+ }
433
+ var pattern = isFunction2(value) ? reIsNative : reIsHostCtor;
434
+ return pattern.test(toSource(value));
435
+ }
436
+ function baseIsTypedArray(value) {
437
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
438
+ }
439
+ function baseKeysIn(object) {
440
+ if (!isObject2(object)) {
441
+ return nativeKeysIn(object);
442
+ }
443
+ var isProto = isPrototype(object), result = [];
444
+ for (var key in object) {
445
+ if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
446
+ result.push(key);
447
+ }
448
+ }
449
+ return result;
450
+ }
451
+ function baseMerge(object, source, srcIndex, customizer, stack) {
452
+ if (object === source) {
453
+ return;
454
+ }
455
+ baseFor(source, function(srcValue, key) {
456
+ stack || (stack = new Stack2());
457
+ if (isObject2(srcValue)) {
458
+ baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
459
+ } else {
460
+ var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
461
+ if (newValue === void 0) {
462
+ newValue = srcValue;
463
+ }
464
+ assignMergeValue(object, key, newValue);
465
+ }
466
+ }, keysIn);
467
+ }
468
+ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
469
+ var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
470
+ if (stacked) {
471
+ assignMergeValue(object, key, stacked);
472
+ return;
473
+ }
474
+ var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
475
+ var isCommon = newValue === void 0;
476
+ if (isCommon) {
477
+ var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
478
+ newValue = srcValue;
479
+ if (isArr || isBuff || isTyped) {
480
+ if (isArray(objValue)) {
481
+ newValue = objValue;
482
+ } else if (isArrayLikeObject(objValue)) {
483
+ newValue = copyArray(objValue);
484
+ } else if (isBuff) {
485
+ isCommon = false;
486
+ newValue = cloneBuffer(srcValue, true);
487
+ } else if (isTyped) {
488
+ isCommon = false;
489
+ newValue = cloneTypedArray(srcValue, true);
490
+ } else {
491
+ newValue = [];
492
+ }
493
+ } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
494
+ newValue = objValue;
495
+ if (isArguments(objValue)) {
496
+ newValue = toPlainObject(objValue);
497
+ } else if (!isObject2(objValue) || isFunction2(objValue)) {
498
+ newValue = initCloneObject(srcValue);
499
+ }
500
+ } else {
501
+ isCommon = false;
502
+ }
503
+ }
504
+ if (isCommon) {
505
+ stack.set(srcValue, newValue);
506
+ mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
507
+ stack["delete"](srcValue);
508
+ }
509
+ assignMergeValue(object, key, newValue);
510
+ }
511
+ function baseRest(func, start) {
512
+ return setToString(overRest(func, start, identity), func + "");
513
+ }
514
+ var baseSetToString = !defineProperty ? identity : function(func, string) {
515
+ return defineProperty(func, "toString", {
516
+ "configurable": true,
517
+ "enumerable": false,
518
+ "value": constant(string),
519
+ "writable": true
520
+ });
521
+ };
522
+ function cloneBuffer(buffer, isDeep) {
523
+ if (isDeep) {
524
+ return buffer.slice();
525
+ }
526
+ var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
527
+ buffer.copy(result);
528
+ return result;
529
+ }
530
+ function cloneArrayBuffer(arrayBuffer) {
531
+ var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
532
+ new Uint8Array2(result).set(new Uint8Array2(arrayBuffer));
533
+ return result;
534
+ }
535
+ function cloneTypedArray(typedArray, isDeep) {
536
+ var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
537
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
538
+ }
539
+ function copyArray(source, array) {
540
+ var index = -1, length = source.length;
541
+ array || (array = Array(length));
542
+ while (++index < length) {
543
+ array[index] = source[index];
544
+ }
545
+ return array;
546
+ }
547
+ function copyObject(source, props, object, customizer) {
548
+ var isNew = !object;
549
+ object || (object = {});
550
+ var index = -1, length = props.length;
551
+ while (++index < length) {
552
+ var key = props[index];
553
+ var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
554
+ if (newValue === void 0) {
555
+ newValue = source[key];
556
+ }
557
+ if (isNew) {
558
+ baseAssignValue(object, key, newValue);
559
+ } else {
560
+ assignValue(object, key, newValue);
561
+ }
562
+ }
563
+ return object;
564
+ }
565
+ function createAssigner(assigner) {
566
+ return baseRest(function(object, sources) {
567
+ var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
568
+ customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
569
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
570
+ customizer = length < 3 ? void 0 : customizer;
571
+ length = 1;
572
+ }
573
+ object = Object(object);
574
+ while (++index < length) {
575
+ var source = sources[index];
576
+ if (source) {
577
+ assigner(object, source, index, customizer);
578
+ }
579
+ }
580
+ return object;
581
+ });
582
+ }
583
+ function createBaseFor(fromRight) {
584
+ return function(object, iteratee, keysFunc) {
585
+ var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
586
+ while (length--) {
587
+ var key = props[fromRight ? length : ++index];
588
+ if (iteratee(iterable[key], key, iterable) === false) {
589
+ break;
590
+ }
591
+ }
592
+ return object;
593
+ };
594
+ }
595
+ function getMapData(map, key) {
596
+ var data = map.__data__;
597
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
598
+ }
599
+ function getNative(object, key) {
600
+ var value = getValue(object, key);
601
+ return baseIsNative(value) ? value : void 0;
602
+ }
603
+ function getRawTag(value) {
604
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
605
+ try {
606
+ value[symToStringTag] = void 0;
607
+ var unmasked = true;
608
+ } catch (e) {
609
+ }
610
+ var result = nativeObjectToString.call(value);
611
+ if (unmasked) {
612
+ if (isOwn) {
613
+ value[symToStringTag] = tag;
614
+ } else {
615
+ delete value[symToStringTag];
616
+ }
617
+ }
618
+ return result;
619
+ }
620
+ function initCloneObject(object) {
621
+ return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
622
+ }
623
+ function isIndex(value, length) {
624
+ var type = typeof value;
625
+ length = length == null ? MAX_SAFE_INTEGER : length;
626
+ return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
627
+ }
628
+ function isIterateeCall(value, index, object) {
629
+ if (!isObject2(object)) {
630
+ return false;
631
+ }
632
+ var type = typeof index;
633
+ if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
634
+ return eq(object[index], value);
635
+ }
636
+ return false;
637
+ }
638
+ function isKeyable(value) {
639
+ var type = typeof value;
640
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
641
+ }
642
+ function isMasked(func) {
643
+ return !!maskSrcKey && maskSrcKey in func;
644
+ }
645
+ function isPrototype(value) {
646
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
647
+ return value === proto;
648
+ }
649
+ function nativeKeysIn(object) {
650
+ var result = [];
651
+ if (object != null) {
652
+ for (var key in Object(object)) {
653
+ result.push(key);
654
+ }
655
+ }
656
+ return result;
657
+ }
658
+ function objectToString(value) {
659
+ return nativeObjectToString.call(value);
660
+ }
661
+ function overRest(func, start, transform2) {
662
+ start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
663
+ return function() {
664
+ var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
665
+ while (++index < length) {
666
+ array[index] = args[start + index];
667
+ }
668
+ index = -1;
669
+ var otherArgs = Array(start + 1);
670
+ while (++index < start) {
671
+ otherArgs[index] = args[index];
672
+ }
673
+ otherArgs[start] = transform2(array);
674
+ return apply(func, this, otherArgs);
675
+ };
676
+ }
677
+ function safeGet(object, key) {
678
+ if (key === "constructor" && typeof object[key] === "function") {
679
+ return;
680
+ }
681
+ if (key == "__proto__") {
682
+ return;
683
+ }
684
+ return object[key];
685
+ }
686
+ var setToString = shortOut(baseSetToString);
687
+ function shortOut(func) {
688
+ var count = 0, lastCalled = 0;
689
+ return function() {
690
+ var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
691
+ lastCalled = stamp;
692
+ if (remaining > 0) {
693
+ if (++count >= HOT_COUNT) {
694
+ return arguments[0];
695
+ }
696
+ } else {
697
+ count = 0;
698
+ }
699
+ return func.apply(void 0, arguments);
700
+ };
701
+ }
702
+ function toSource(func) {
703
+ if (func != null) {
704
+ try {
705
+ return funcToString.call(func);
706
+ } catch (e) {
707
+ }
708
+ try {
709
+ return func + "";
710
+ } catch (e) {
711
+ }
712
+ }
713
+ return "";
714
+ }
715
+ function eq(value, other) {
716
+ return value === other || value !== value && other !== other;
717
+ }
718
+ var isArguments = baseIsArguments(function() {
719
+ return arguments;
720
+ }()) ? baseIsArguments : function(value) {
721
+ return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
722
+ };
723
+ var isArray = Array.isArray;
724
+ function isArrayLike(value) {
725
+ return value != null && isLength(value.length) && !isFunction2(value);
726
+ }
727
+ function isArrayLikeObject(value) {
728
+ return isObjectLike(value) && isArrayLike(value);
729
+ }
730
+ var isBuffer = nativeIsBuffer || stubFalse;
731
+ function isFunction2(value) {
732
+ if (!isObject2(value)) {
733
+ return false;
734
+ }
735
+ var tag = baseGetTag(value);
736
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
737
+ }
738
+ function isLength(value) {
739
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
740
+ }
741
+ function isObject2(value) {
742
+ var type = typeof value;
743
+ return value != null && (type == "object" || type == "function");
744
+ }
745
+ function isObjectLike(value) {
746
+ return value != null && typeof value == "object";
747
+ }
748
+ function isPlainObject(value) {
749
+ if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
750
+ return false;
751
+ }
752
+ var proto = getPrototype(value);
753
+ if (proto === null) {
754
+ return true;
755
+ }
756
+ var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
757
+ return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
758
+ }
759
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
760
+ function toPlainObject(value) {
761
+ return copyObject(value, keysIn(value));
762
+ }
763
+ function keysIn(object) {
764
+ return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
765
+ }
766
+ var mergeWith6 = createAssigner(function(object, source, srcIndex, customizer) {
767
+ baseMerge(object, source, srcIndex, customizer);
768
+ });
769
+ function constant(value) {
770
+ return function() {
771
+ return value;
772
+ };
773
+ }
774
+ function identity(value) {
775
+ return value;
776
+ }
777
+ function stubFalse() {
778
+ return false;
779
+ }
780
+ module.exports = mergeWith6;
781
+ }
782
+ });
783
+
784
+ // ../../node_modules/react-fast-compare/index.js
785
+ var require_react_fast_compare = __commonJS({
786
+ "../../node_modules/react-fast-compare/index.js"(exports, module) {
787
+ var hasElementType = typeof Element !== "undefined";
788
+ var hasMap = typeof Map === "function";
789
+ var hasSet = typeof Set === "function";
790
+ var hasArrayBuffer = typeof ArrayBuffer === "function" && !!ArrayBuffer.isView;
791
+ function equal(a, b) {
792
+ if (a === b)
793
+ return true;
794
+ if (a && b && typeof a == "object" && typeof b == "object") {
795
+ if (a.constructor !== b.constructor)
796
+ return false;
797
+ var length, i, keys;
798
+ if (Array.isArray(a)) {
799
+ length = a.length;
800
+ if (length != b.length)
801
+ return false;
802
+ for (i = length; i-- !== 0; )
803
+ if (!equal(a[i], b[i]))
804
+ return false;
805
+ return true;
806
+ }
807
+ var it;
808
+ if (hasMap && a instanceof Map && b instanceof Map) {
809
+ if (a.size !== b.size)
810
+ return false;
811
+ it = a.entries();
812
+ while (!(i = it.next()).done)
813
+ if (!b.has(i.value[0]))
814
+ return false;
815
+ it = a.entries();
816
+ while (!(i = it.next()).done)
817
+ if (!equal(i.value[1], b.get(i.value[0])))
818
+ return false;
819
+ return true;
820
+ }
821
+ if (hasSet && a instanceof Set && b instanceof Set) {
822
+ if (a.size !== b.size)
823
+ return false;
824
+ it = a.entries();
825
+ while (!(i = it.next()).done)
826
+ if (!b.has(i.value[0]))
827
+ return false;
828
+ return true;
829
+ }
830
+ if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
831
+ length = a.length;
832
+ if (length != b.length)
833
+ return false;
834
+ for (i = length; i-- !== 0; )
835
+ if (a[i] !== b[i])
836
+ return false;
837
+ return true;
838
+ }
839
+ if (a.constructor === RegExp)
840
+ return a.source === b.source && a.flags === b.flags;
841
+ if (a.valueOf !== Object.prototype.valueOf)
842
+ return a.valueOf() === b.valueOf();
843
+ if (a.toString !== Object.prototype.toString)
844
+ return a.toString() === b.toString();
845
+ keys = Object.keys(a);
846
+ length = keys.length;
847
+ if (length !== Object.keys(b).length)
848
+ return false;
849
+ for (i = length; i-- !== 0; )
850
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
851
+ return false;
852
+ if (hasElementType && a instanceof Element)
853
+ return false;
854
+ for (i = length; i-- !== 0; ) {
855
+ if ((keys[i] === "_owner" || keys[i] === "__v" || keys[i] === "__o") && a.$$typeof) {
856
+ continue;
857
+ }
858
+ if (!equal(a[keys[i]], b[keys[i]]))
859
+ return false;
860
+ }
861
+ return true;
862
+ }
863
+ return a !== a && b !== b;
864
+ }
865
+ module.exports = function isEqual2(a, b) {
866
+ try {
867
+ return equal(a, b);
868
+ } catch (error) {
869
+ if ((error.message || "").match(/stack|recursion/i)) {
870
+ console.warn("react-fast-compare cannot handle circular refs");
871
+ return false;
872
+ }
873
+ throw error;
874
+ }
875
+ };
876
+ }
877
+ });
878
+ var DisplayField = ({
879
+ name,
880
+ label,
881
+ placeholder,
882
+ ...props
883
+ }) => {
884
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.FormControl, { ...props, children: [
885
+ label ? /* @__PURE__ */ jsxRuntime.jsx(react.FormLabel, { htmlFor: name, children: label }) : null,
886
+ /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "md", children: /* @__PURE__ */ jsxRuntime.jsx(FormValue, { name }) })
887
+ ] });
888
+ };
889
+ DisplayField.displayName = "DisplayField";
890
+ var FormValue = ({ name }) => {
891
+ const { getValues } = reactHookForm.useFormContext();
892
+ return getValues(name) || null;
893
+ };
894
+ FormValue.displayName = "FormValue";
895
+ var NumberInput = react.forwardRef((props, ref) => {
896
+ const {
897
+ hideStepper,
898
+ incrementIcon = /* @__PURE__ */ jsxRuntime.jsx(core.ChevronUpIcon, {}),
899
+ decrementIcon = /* @__PURE__ */ jsxRuntime.jsx(core.ChevronDownIcon, {}),
900
+ ...rest
901
+ } = props;
902
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.NumberInput, { ...rest, ref, children: [
903
+ /* @__PURE__ */ jsxRuntime.jsx(react.NumberInputField, {}),
904
+ !hideStepper && /* @__PURE__ */ jsxRuntime.jsxs(react.NumberInputStepper, { children: [
905
+ /* @__PURE__ */ jsxRuntime.jsx(react.NumberIncrementStepper, { children: incrementIcon }),
906
+ /* @__PURE__ */ jsxRuntime.jsx(react.NumberDecrementStepper, { children: decrementIcon })
907
+ ] })
908
+ ] });
909
+ });
910
+ NumberInput.defaultProps = {
911
+ hideStepper: false
912
+ };
913
+ NumberInput.displayName = "NumberInput";
914
+ function useTheme() {
915
+ const theme = React12.useContext(
916
+ react$1.ThemeContext
917
+ );
918
+ if (!theme) {
919
+ throw Error(
920
+ "useTheme: `theme` is undefined. Seems you forgot to wrap your app in `<ChakraProvider />` or `<ThemeProvider />`"
921
+ );
922
+ }
923
+ return theme;
924
+ }
925
+ var ColorModeContext = React12.createContext({});
926
+ ColorModeContext.displayName = "ColorModeContext";
927
+ function useColorMode() {
928
+ const context = React12.useContext(ColorModeContext);
929
+ if (context === void 0) {
930
+ throw new Error("useColorMode must be used within a ColorModeProvider");
931
+ }
932
+ return context;
933
+ }
934
+
935
+ // ../../node_modules/@chakra-ui/system/dist/chunk-7V3ZYTH7.mjs
936
+ function useChakra() {
937
+ const colorModeResult = useColorMode();
938
+ const theme = useTheme();
939
+ return { ...colorModeResult, theme };
940
+ }
941
+
942
+ // ../../node_modules/@chakra-ui/shared-utils/dist/index.mjs
943
+ var cx = (...classNames) => classNames.filter(Boolean).join(" ");
944
+ function isObject(value) {
945
+ const type = typeof value;
946
+ return value != null && (type === "object" || type === "function") && !Array.isArray(value);
947
+ }
948
+ function runIfFn(valueOrFn, ...args) {
949
+ return isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
950
+ }
951
+ var isFunction = (value) => typeof value === "function";
952
+
953
+ // ../../node_modules/@chakra-ui/styled-system/dist/index.mjs
954
+ __toESM(require_lodash(), 1);
955
+ var import_lodash2 = __toESM(require_lodash(), 1);
956
+ var import_lodash3 = __toESM(require_lodash(), 1);
957
+ var import_lodash4 = __toESM(require_lodash(), 1);
958
+ var isImportant = (value) => /!(important)?$/.test(value);
959
+ var withoutImportant = (value) => typeof value === "string" ? value.replace(/!(important)?$/, "").trim() : value;
960
+ var tokenToCSSVar = (scale, value) => (theme) => {
961
+ const valueStr = String(value);
962
+ const important = isImportant(valueStr);
963
+ const valueWithoutImportant = withoutImportant(valueStr);
964
+ const key = scale ? `${scale}.${valueWithoutImportant}` : valueWithoutImportant;
965
+ let transformed = isObject(theme.__cssMap) && key in theme.__cssMap ? theme.__cssMap[key].varRef : value;
966
+ transformed = withoutImportant(transformed);
967
+ return important ? `${transformed} !important` : transformed;
968
+ };
969
+ function createTransform(options) {
970
+ const { scale, transform: transform2, compose } = options;
971
+ const fn = (value, theme) => {
972
+ var _a2;
973
+ const _value = tokenToCSSVar(scale, value)(theme);
974
+ let result = (_a2 = transform2 == null ? void 0 : transform2(_value, theme)) != null ? _a2 : _value;
975
+ if (compose) {
976
+ result = compose(result, theme);
977
+ }
978
+ return result;
979
+ };
980
+ return fn;
981
+ }
982
+ var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
983
+ function toConfig(scale, transform2) {
984
+ return (property) => {
985
+ const result = { property, scale };
986
+ result.transform = createTransform({
987
+ scale,
988
+ transform: transform2
989
+ });
990
+ return result;
991
+ };
992
+ }
993
+ var getRtl = ({ rtl, ltr }) => (theme) => theme.direction === "rtl" ? rtl : ltr;
994
+ function logical(options) {
995
+ const { property, scale, transform: transform2 } = options;
996
+ return {
997
+ scale,
998
+ property: getRtl(property),
999
+ transform: scale ? createTransform({
1000
+ scale,
1001
+ compose: transform2
1002
+ }) : transform2
1003
+ };
1004
+ }
1005
+ var transformTemplate = [
1006
+ "rotate(var(--chakra-rotate, 0))",
1007
+ "scaleX(var(--chakra-scale-x, 1))",
1008
+ "scaleY(var(--chakra-scale-y, 1))",
1009
+ "skewX(var(--chakra-skew-x, 0))",
1010
+ "skewY(var(--chakra-skew-y, 0))"
1011
+ ];
1012
+ function getTransformTemplate() {
1013
+ return [
1014
+ "translateX(var(--chakra-translate-x, 0))",
1015
+ "translateY(var(--chakra-translate-y, 0))",
1016
+ ...transformTemplate
1017
+ ].join(" ");
1018
+ }
1019
+ function getTransformGpuTemplate() {
1020
+ return [
1021
+ "translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",
1022
+ ...transformTemplate
1023
+ ].join(" ");
1024
+ }
1025
+ var filterTemplate = {
1026
+ "--chakra-blur": "var(--chakra-empty,/*!*/ /*!*/)",
1027
+ "--chakra-brightness": "var(--chakra-empty,/*!*/ /*!*/)",
1028
+ "--chakra-contrast": "var(--chakra-empty,/*!*/ /*!*/)",
1029
+ "--chakra-grayscale": "var(--chakra-empty,/*!*/ /*!*/)",
1030
+ "--chakra-hue-rotate": "var(--chakra-empty,/*!*/ /*!*/)",
1031
+ "--chakra-invert": "var(--chakra-empty,/*!*/ /*!*/)",
1032
+ "--chakra-saturate": "var(--chakra-empty,/*!*/ /*!*/)",
1033
+ "--chakra-sepia": "var(--chakra-empty,/*!*/ /*!*/)",
1034
+ "--chakra-drop-shadow": "var(--chakra-empty,/*!*/ /*!*/)",
1035
+ filter: [
1036
+ "var(--chakra-blur)",
1037
+ "var(--chakra-brightness)",
1038
+ "var(--chakra-contrast)",
1039
+ "var(--chakra-grayscale)",
1040
+ "var(--chakra-hue-rotate)",
1041
+ "var(--chakra-invert)",
1042
+ "var(--chakra-saturate)",
1043
+ "var(--chakra-sepia)",
1044
+ "var(--chakra-drop-shadow)"
1045
+ ].join(" ")
1046
+ };
1047
+ var backdropFilterTemplate = {
1048
+ backdropFilter: [
1049
+ "var(--chakra-backdrop-blur)",
1050
+ "var(--chakra-backdrop-brightness)",
1051
+ "var(--chakra-backdrop-contrast)",
1052
+ "var(--chakra-backdrop-grayscale)",
1053
+ "var(--chakra-backdrop-hue-rotate)",
1054
+ "var(--chakra-backdrop-invert)",
1055
+ "var(--chakra-backdrop-opacity)",
1056
+ "var(--chakra-backdrop-saturate)",
1057
+ "var(--chakra-backdrop-sepia)"
1058
+ ].join(" "),
1059
+ "--chakra-backdrop-blur": "var(--chakra-empty,/*!*/ /*!*/)",
1060
+ "--chakra-backdrop-brightness": "var(--chakra-empty,/*!*/ /*!*/)",
1061
+ "--chakra-backdrop-contrast": "var(--chakra-empty,/*!*/ /*!*/)",
1062
+ "--chakra-backdrop-grayscale": "var(--chakra-empty,/*!*/ /*!*/)",
1063
+ "--chakra-backdrop-hue-rotate": "var(--chakra-empty,/*!*/ /*!*/)",
1064
+ "--chakra-backdrop-invert": "var(--chakra-empty,/*!*/ /*!*/)",
1065
+ "--chakra-backdrop-opacity": "var(--chakra-empty,/*!*/ /*!*/)",
1066
+ "--chakra-backdrop-saturate": "var(--chakra-empty,/*!*/ /*!*/)",
1067
+ "--chakra-backdrop-sepia": "var(--chakra-empty,/*!*/ /*!*/)"
1068
+ };
1069
+ function getRingTemplate(value) {
1070
+ return {
1071
+ "--chakra-ring-offset-shadow": `var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)`,
1072
+ "--chakra-ring-shadow": `var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)`,
1073
+ "--chakra-ring-width": value,
1074
+ boxShadow: [
1075
+ `var(--chakra-ring-offset-shadow)`,
1076
+ `var(--chakra-ring-shadow)`,
1077
+ `var(--chakra-shadow, 0 0 #0000)`
1078
+ ].join(", ")
1079
+ };
1080
+ }
1081
+ var flexDirectionTemplate = {
1082
+ "row-reverse": {
1083
+ space: "--chakra-space-x-reverse",
1084
+ divide: "--chakra-divide-x-reverse"
1085
+ },
1086
+ "column-reverse": {
1087
+ space: "--chakra-space-y-reverse",
1088
+ divide: "--chakra-divide-y-reverse"
1089
+ }
1090
+ };
1091
+ var directionMap = {
1092
+ "to-t": "to top",
1093
+ "to-tr": "to top right",
1094
+ "to-r": "to right",
1095
+ "to-br": "to bottom right",
1096
+ "to-b": "to bottom",
1097
+ "to-bl": "to bottom left",
1098
+ "to-l": "to left",
1099
+ "to-tl": "to top left"
1100
+ };
1101
+ var valueSet = new Set(Object.values(directionMap));
1102
+ var globalSet = /* @__PURE__ */ new Set([
1103
+ "none",
1104
+ "-moz-initial",
1105
+ "inherit",
1106
+ "initial",
1107
+ "revert",
1108
+ "unset"
1109
+ ]);
1110
+ var trimSpace = (str) => str.trim();
1111
+ function parseGradient(value, theme) {
1112
+ if (value == null || globalSet.has(value))
1113
+ return value;
1114
+ const regex = /(^[a-z-A-Z]+)\((.*)\)/g;
1115
+ const results = regex.exec(value);
1116
+ const type = results == null ? void 0 : results[1];
1117
+ const values = results == null ? void 0 : results[2];
1118
+ if (!type || !values)
1119
+ return value;
1120
+ const _type = type.includes("-gradient") ? type : `${type}-gradient`;
1121
+ const [maybeDirection, ...stops] = values.split(",").map(trimSpace).filter(Boolean);
1122
+ if ((stops == null ? void 0 : stops.length) === 0)
1123
+ return value;
1124
+ const direction = maybeDirection in directionMap ? directionMap[maybeDirection] : maybeDirection;
1125
+ stops.unshift(direction);
1126
+ const _values = stops.map((stop) => {
1127
+ if (valueSet.has(stop))
1128
+ return stop;
1129
+ const firstStop = stop.indexOf(" ");
1130
+ const [_color, _stop] = firstStop !== -1 ? [stop.substr(0, firstStop), stop.substr(firstStop + 1)] : [stop];
1131
+ const _stopOrFunc = isCSSFunction(_stop) ? _stop : _stop && _stop.split(" ");
1132
+ const key = `colors.${_color}`;
1133
+ const color2 = key in theme.__cssMap ? theme.__cssMap[key].varRef : _color;
1134
+ return _stopOrFunc ? [
1135
+ color2,
1136
+ ...Array.isArray(_stopOrFunc) ? _stopOrFunc : [_stopOrFunc]
1137
+ ].join(" ") : color2;
1138
+ });
1139
+ return `${_type}(${_values.join(", ")})`;
1140
+ }
1141
+ var isCSSFunction = (value) => {
1142
+ return typeof value === "string" && value.includes("(") && value.includes(")");
1143
+ };
1144
+ var gradientTransform = (value, theme) => parseGradient(value, theme != null ? theme : {});
1145
+ function isCssVar(value) {
1146
+ return /^var\(--.+\)$/.test(value);
1147
+ }
1148
+ var analyzeCSSValue = (value) => {
1149
+ const num = parseFloat(value.toString());
1150
+ const unit = value.toString().replace(String(num), "");
1151
+ return { unitless: !unit, value: num, unit };
1152
+ };
1153
+ var wrap = (str) => (value) => `${str}(${value})`;
1154
+ var transformFunctions = {
1155
+ filter(value) {
1156
+ return value !== "auto" ? value : filterTemplate;
1157
+ },
1158
+ backdropFilter(value) {
1159
+ return value !== "auto" ? value : backdropFilterTemplate;
1160
+ },
1161
+ ring(value) {
1162
+ return getRingTemplate(transformFunctions.px(value));
1163
+ },
1164
+ bgClip(value) {
1165
+ return value === "text" ? { color: "transparent", backgroundClip: "text" } : { backgroundClip: value };
1166
+ },
1167
+ transform(value) {
1168
+ if (value === "auto")
1169
+ return getTransformTemplate();
1170
+ if (value === "auto-gpu")
1171
+ return getTransformGpuTemplate();
1172
+ return value;
1173
+ },
1174
+ vh(value) {
1175
+ return value === "$100vh" ? "var(--chakra-vh)" : value;
1176
+ },
1177
+ px(value) {
1178
+ if (value == null)
1179
+ return value;
1180
+ const { unitless } = analyzeCSSValue(value);
1181
+ return unitless || typeof value === "number" ? `${value}px` : value;
1182
+ },
1183
+ fraction(value) {
1184
+ return !(typeof value === "number") || value > 1 ? value : `${value * 100}%`;
1185
+ },
1186
+ float(value, theme) {
1187
+ const map = { left: "right", right: "left" };
1188
+ return theme.direction === "rtl" ? map[value] : value;
1189
+ },
1190
+ degree(value) {
1191
+ if (isCssVar(value) || value == null)
1192
+ return value;
1193
+ const unitless = typeof value === "string" && !value.endsWith("deg");
1194
+ return typeof value === "number" || unitless ? `${value}deg` : value;
1195
+ },
1196
+ gradient: gradientTransform,
1197
+ blur: wrap("blur"),
1198
+ opacity: wrap("opacity"),
1199
+ brightness: wrap("brightness"),
1200
+ contrast: wrap("contrast"),
1201
+ dropShadow: wrap("drop-shadow"),
1202
+ grayscale: wrap("grayscale"),
1203
+ hueRotate: wrap("hue-rotate"),
1204
+ invert: wrap("invert"),
1205
+ saturate: wrap("saturate"),
1206
+ sepia: wrap("sepia"),
1207
+ bgImage(value) {
1208
+ if (value == null)
1209
+ return value;
1210
+ const prevent = isCSSFunction(value) || globalSet.has(value);
1211
+ return !prevent ? `url(${value})` : value;
1212
+ },
1213
+ outline(value) {
1214
+ const isNoneOrZero = String(value) === "0" || String(value) === "none";
1215
+ return value !== null && isNoneOrZero ? { outline: "2px solid transparent", outlineOffset: "2px" } : { outline: value };
1216
+ },
1217
+ flexDirection(value) {
1218
+ var _a2;
1219
+ const { space: space2, divide: divide2 } = (_a2 = flexDirectionTemplate[value]) != null ? _a2 : {};
1220
+ const result = { flexDirection: value };
1221
+ if (space2)
1222
+ result[space2] = 1;
1223
+ if (divide2)
1224
+ result[divide2] = 1;
1225
+ return result;
1226
+ }
1227
+ };
1228
+ var t = {
1229
+ borderWidths: toConfig("borderWidths"),
1230
+ borderStyles: toConfig("borderStyles"),
1231
+ colors: toConfig("colors"),
1232
+ borders: toConfig("borders"),
1233
+ radii: toConfig("radii", transformFunctions.px),
1234
+ space: toConfig("space", pipe(transformFunctions.vh, transformFunctions.px)),
1235
+ spaceT: toConfig("space", pipe(transformFunctions.vh, transformFunctions.px)),
1236
+ degreeT(property) {
1237
+ return { property, transform: transformFunctions.degree };
1238
+ },
1239
+ prop(property, scale, transform2) {
1240
+ return {
1241
+ property,
1242
+ scale,
1243
+ ...scale && {
1244
+ transform: createTransform({ scale, transform: transform2 })
1245
+ }
1246
+ };
1247
+ },
1248
+ propT(property, transform2) {
1249
+ return { property, transform: transform2 };
1250
+ },
1251
+ sizes: toConfig("sizes", pipe(transformFunctions.vh, transformFunctions.px)),
1252
+ sizesT: toConfig("sizes", pipe(transformFunctions.vh, transformFunctions.fraction)),
1253
+ shadows: toConfig("shadows"),
1254
+ logical,
1255
+ blur: toConfig("blur", transformFunctions.blur)
1256
+ };
1257
+ var background = {
1258
+ background: t.colors("background"),
1259
+ backgroundColor: t.colors("backgroundColor"),
1260
+ backgroundImage: t.propT("backgroundImage", transformFunctions.bgImage),
1261
+ backgroundSize: true,
1262
+ backgroundPosition: true,
1263
+ backgroundRepeat: true,
1264
+ backgroundAttachment: true,
1265
+ backgroundClip: { transform: transformFunctions.bgClip },
1266
+ bgSize: t.prop("backgroundSize"),
1267
+ bgPosition: t.prop("backgroundPosition"),
1268
+ bg: t.colors("background"),
1269
+ bgColor: t.colors("backgroundColor"),
1270
+ bgPos: t.prop("backgroundPosition"),
1271
+ bgRepeat: t.prop("backgroundRepeat"),
1272
+ bgAttachment: t.prop("backgroundAttachment"),
1273
+ bgGradient: t.propT("backgroundImage", transformFunctions.gradient),
1274
+ bgClip: { transform: transformFunctions.bgClip }
1275
+ };
1276
+ Object.assign(background, {
1277
+ bgImage: background.backgroundImage,
1278
+ bgImg: background.backgroundImage
1279
+ });
1280
+ var border = {
1281
+ border: t.borders("border"),
1282
+ borderWidth: t.borderWidths("borderWidth"),
1283
+ borderStyle: t.borderStyles("borderStyle"),
1284
+ borderColor: t.colors("borderColor"),
1285
+ borderRadius: t.radii("borderRadius"),
1286
+ borderTop: t.borders("borderTop"),
1287
+ borderBlockStart: t.borders("borderBlockStart"),
1288
+ borderTopLeftRadius: t.radii("borderTopLeftRadius"),
1289
+ borderStartStartRadius: t.logical({
1290
+ scale: "radii",
1291
+ property: {
1292
+ ltr: "borderTopLeftRadius",
1293
+ rtl: "borderTopRightRadius"
1294
+ }
1295
+ }),
1296
+ borderEndStartRadius: t.logical({
1297
+ scale: "radii",
1298
+ property: {
1299
+ ltr: "borderBottomLeftRadius",
1300
+ rtl: "borderBottomRightRadius"
1301
+ }
1302
+ }),
1303
+ borderTopRightRadius: t.radii("borderTopRightRadius"),
1304
+ borderStartEndRadius: t.logical({
1305
+ scale: "radii",
1306
+ property: {
1307
+ ltr: "borderTopRightRadius",
1308
+ rtl: "borderTopLeftRadius"
1309
+ }
1310
+ }),
1311
+ borderEndEndRadius: t.logical({
1312
+ scale: "radii",
1313
+ property: {
1314
+ ltr: "borderBottomRightRadius",
1315
+ rtl: "borderBottomLeftRadius"
1316
+ }
1317
+ }),
1318
+ borderRight: t.borders("borderRight"),
1319
+ borderInlineEnd: t.borders("borderInlineEnd"),
1320
+ borderBottom: t.borders("borderBottom"),
1321
+ borderBlockEnd: t.borders("borderBlockEnd"),
1322
+ borderBottomLeftRadius: t.radii("borderBottomLeftRadius"),
1323
+ borderBottomRightRadius: t.radii("borderBottomRightRadius"),
1324
+ borderLeft: t.borders("borderLeft"),
1325
+ borderInlineStart: {
1326
+ property: "borderInlineStart",
1327
+ scale: "borders"
1328
+ },
1329
+ borderInlineStartRadius: t.logical({
1330
+ scale: "radii",
1331
+ property: {
1332
+ ltr: ["borderTopLeftRadius", "borderBottomLeftRadius"],
1333
+ rtl: ["borderTopRightRadius", "borderBottomRightRadius"]
1334
+ }
1335
+ }),
1336
+ borderInlineEndRadius: t.logical({
1337
+ scale: "radii",
1338
+ property: {
1339
+ ltr: ["borderTopRightRadius", "borderBottomRightRadius"],
1340
+ rtl: ["borderTopLeftRadius", "borderBottomLeftRadius"]
1341
+ }
1342
+ }),
1343
+ borderX: t.borders(["borderLeft", "borderRight"]),
1344
+ borderInline: t.borders("borderInline"),
1345
+ borderY: t.borders(["borderTop", "borderBottom"]),
1346
+ borderBlock: t.borders("borderBlock"),
1347
+ borderTopWidth: t.borderWidths("borderTopWidth"),
1348
+ borderBlockStartWidth: t.borderWidths("borderBlockStartWidth"),
1349
+ borderTopColor: t.colors("borderTopColor"),
1350
+ borderBlockStartColor: t.colors("borderBlockStartColor"),
1351
+ borderTopStyle: t.borderStyles("borderTopStyle"),
1352
+ borderBlockStartStyle: t.borderStyles("borderBlockStartStyle"),
1353
+ borderBottomWidth: t.borderWidths("borderBottomWidth"),
1354
+ borderBlockEndWidth: t.borderWidths("borderBlockEndWidth"),
1355
+ borderBottomColor: t.colors("borderBottomColor"),
1356
+ borderBlockEndColor: t.colors("borderBlockEndColor"),
1357
+ borderBottomStyle: t.borderStyles("borderBottomStyle"),
1358
+ borderBlockEndStyle: t.borderStyles("borderBlockEndStyle"),
1359
+ borderLeftWidth: t.borderWidths("borderLeftWidth"),
1360
+ borderInlineStartWidth: t.borderWidths("borderInlineStartWidth"),
1361
+ borderLeftColor: t.colors("borderLeftColor"),
1362
+ borderInlineStartColor: t.colors("borderInlineStartColor"),
1363
+ borderLeftStyle: t.borderStyles("borderLeftStyle"),
1364
+ borderInlineStartStyle: t.borderStyles("borderInlineStartStyle"),
1365
+ borderRightWidth: t.borderWidths("borderRightWidth"),
1366
+ borderInlineEndWidth: t.borderWidths("borderInlineEndWidth"),
1367
+ borderRightColor: t.colors("borderRightColor"),
1368
+ borderInlineEndColor: t.colors("borderInlineEndColor"),
1369
+ borderRightStyle: t.borderStyles("borderRightStyle"),
1370
+ borderInlineEndStyle: t.borderStyles("borderInlineEndStyle"),
1371
+ borderTopRadius: t.radii(["borderTopLeftRadius", "borderTopRightRadius"]),
1372
+ borderBottomRadius: t.radii([
1373
+ "borderBottomLeftRadius",
1374
+ "borderBottomRightRadius"
1375
+ ]),
1376
+ borderLeftRadius: t.radii(["borderTopLeftRadius", "borderBottomLeftRadius"]),
1377
+ borderRightRadius: t.radii([
1378
+ "borderTopRightRadius",
1379
+ "borderBottomRightRadius"
1380
+ ])
1381
+ };
1382
+ Object.assign(border, {
1383
+ rounded: border.borderRadius,
1384
+ roundedTop: border.borderTopRadius,
1385
+ roundedTopLeft: border.borderTopLeftRadius,
1386
+ roundedTopRight: border.borderTopRightRadius,
1387
+ roundedTopStart: border.borderStartStartRadius,
1388
+ roundedTopEnd: border.borderStartEndRadius,
1389
+ roundedBottom: border.borderBottomRadius,
1390
+ roundedBottomLeft: border.borderBottomLeftRadius,
1391
+ roundedBottomRight: border.borderBottomRightRadius,
1392
+ roundedBottomStart: border.borderEndStartRadius,
1393
+ roundedBottomEnd: border.borderEndEndRadius,
1394
+ roundedLeft: border.borderLeftRadius,
1395
+ roundedRight: border.borderRightRadius,
1396
+ roundedStart: border.borderInlineStartRadius,
1397
+ roundedEnd: border.borderInlineEndRadius,
1398
+ borderStart: border.borderInlineStart,
1399
+ borderEnd: border.borderInlineEnd,
1400
+ borderTopStartRadius: border.borderStartStartRadius,
1401
+ borderTopEndRadius: border.borderStartEndRadius,
1402
+ borderBottomStartRadius: border.borderEndStartRadius,
1403
+ borderBottomEndRadius: border.borderEndEndRadius,
1404
+ borderStartRadius: border.borderInlineStartRadius,
1405
+ borderEndRadius: border.borderInlineEndRadius,
1406
+ borderStartWidth: border.borderInlineStartWidth,
1407
+ borderEndWidth: border.borderInlineEndWidth,
1408
+ borderStartColor: border.borderInlineStartColor,
1409
+ borderEndColor: border.borderInlineEndColor,
1410
+ borderStartStyle: border.borderInlineStartStyle,
1411
+ borderEndStyle: border.borderInlineEndStyle
1412
+ });
1413
+ var color = {
1414
+ color: t.colors("color"),
1415
+ textColor: t.colors("color"),
1416
+ fill: t.colors("fill"),
1417
+ stroke: t.colors("stroke")
1418
+ };
1419
+ var effect = {
1420
+ boxShadow: t.shadows("boxShadow"),
1421
+ mixBlendMode: true,
1422
+ blendMode: t.prop("mixBlendMode"),
1423
+ backgroundBlendMode: true,
1424
+ bgBlendMode: t.prop("backgroundBlendMode"),
1425
+ opacity: true
1426
+ };
1427
+ Object.assign(effect, {
1428
+ shadow: effect.boxShadow
1429
+ });
1430
+ var filter = {
1431
+ filter: { transform: transformFunctions.filter },
1432
+ blur: t.blur("--chakra-blur"),
1433
+ brightness: t.propT("--chakra-brightness", transformFunctions.brightness),
1434
+ contrast: t.propT("--chakra-contrast", transformFunctions.contrast),
1435
+ hueRotate: t.degreeT("--chakra-hue-rotate"),
1436
+ invert: t.propT("--chakra-invert", transformFunctions.invert),
1437
+ saturate: t.propT("--chakra-saturate", transformFunctions.saturate),
1438
+ dropShadow: t.propT("--chakra-drop-shadow", transformFunctions.dropShadow),
1439
+ backdropFilter: { transform: transformFunctions.backdropFilter },
1440
+ backdropBlur: t.blur("--chakra-backdrop-blur"),
1441
+ backdropBrightness: t.propT(
1442
+ "--chakra-backdrop-brightness",
1443
+ transformFunctions.brightness
1444
+ ),
1445
+ backdropContrast: t.propT("--chakra-backdrop-contrast", transformFunctions.contrast),
1446
+ backdropHueRotate: t.degreeT("--chakra-backdrop-hue-rotate"),
1447
+ backdropInvert: t.propT("--chakra-backdrop-invert", transformFunctions.invert),
1448
+ backdropSaturate: t.propT("--chakra-backdrop-saturate", transformFunctions.saturate)
1449
+ };
1450
+ var flexbox = {
1451
+ alignItems: true,
1452
+ alignContent: true,
1453
+ justifyItems: true,
1454
+ justifyContent: true,
1455
+ flexWrap: true,
1456
+ flexDirection: { transform: transformFunctions.flexDirection },
1457
+ flex: true,
1458
+ flexFlow: true,
1459
+ flexGrow: true,
1460
+ flexShrink: true,
1461
+ flexBasis: t.sizes("flexBasis"),
1462
+ justifySelf: true,
1463
+ alignSelf: true,
1464
+ order: true,
1465
+ placeItems: true,
1466
+ placeContent: true,
1467
+ placeSelf: true,
1468
+ gap: t.space("gap"),
1469
+ rowGap: t.space("rowGap"),
1470
+ columnGap: t.space("columnGap")
1471
+ };
1472
+ Object.assign(flexbox, {
1473
+ flexDir: flexbox.flexDirection
1474
+ });
1475
+ var grid = {
1476
+ gridGap: t.space("gridGap"),
1477
+ gridColumnGap: t.space("gridColumnGap"),
1478
+ gridRowGap: t.space("gridRowGap"),
1479
+ gridColumn: true,
1480
+ gridRow: true,
1481
+ gridAutoFlow: true,
1482
+ gridAutoColumns: true,
1483
+ gridColumnStart: true,
1484
+ gridColumnEnd: true,
1485
+ gridRowStart: true,
1486
+ gridRowEnd: true,
1487
+ gridAutoRows: true,
1488
+ gridTemplate: true,
1489
+ gridTemplateColumns: true,
1490
+ gridTemplateRows: true,
1491
+ gridTemplateAreas: true,
1492
+ gridArea: true
1493
+ };
1494
+ var interactivity = {
1495
+ appearance: true,
1496
+ cursor: true,
1497
+ resize: true,
1498
+ userSelect: true,
1499
+ pointerEvents: true,
1500
+ outline: { transform: transformFunctions.outline },
1501
+ outlineOffset: true,
1502
+ outlineColor: t.colors("outlineColor")
1503
+ };
1504
+ var layout = {
1505
+ width: t.sizesT("width"),
1506
+ inlineSize: t.sizesT("inlineSize"),
1507
+ height: t.sizes("height"),
1508
+ blockSize: t.sizes("blockSize"),
1509
+ boxSize: t.sizes(["width", "height"]),
1510
+ minWidth: t.sizes("minWidth"),
1511
+ minInlineSize: t.sizes("minInlineSize"),
1512
+ minHeight: t.sizes("minHeight"),
1513
+ minBlockSize: t.sizes("minBlockSize"),
1514
+ maxWidth: t.sizes("maxWidth"),
1515
+ maxInlineSize: t.sizes("maxInlineSize"),
1516
+ maxHeight: t.sizes("maxHeight"),
1517
+ maxBlockSize: t.sizes("maxBlockSize"),
1518
+ overflow: true,
1519
+ overflowX: true,
1520
+ overflowY: true,
1521
+ overscrollBehavior: true,
1522
+ overscrollBehaviorX: true,
1523
+ overscrollBehaviorY: true,
1524
+ display: true,
1525
+ hideFrom: {
1526
+ scale: "breakpoints",
1527
+ transform: (value, theme) => {
1528
+ var _a2, _b, _c;
1529
+ const mq = (_c = (_b = (_a2 = theme.__breakpoints) == null ? void 0 : _a2.get(value)) == null ? void 0 : _b.minWQuery) != null ? _c : `@media screen and (min-width: ${value})`;
1530
+ return { [mq]: { display: "none" } };
1531
+ }
1532
+ },
1533
+ hideBelow: {
1534
+ scale: "breakpoints",
1535
+ transform: (value, theme) => {
1536
+ var _a2, _b, _c;
1537
+ const mq = (_c = (_b = (_a2 = theme.__breakpoints) == null ? void 0 : _a2.get(value)) == null ? void 0 : _b.maxWQuery) != null ? _c : `@media screen and (max-width: ${value})`;
1538
+ return { [mq]: { display: "none" } };
1539
+ }
1540
+ },
1541
+ verticalAlign: true,
1542
+ boxSizing: true,
1543
+ boxDecorationBreak: true,
1544
+ float: t.propT("float", transformFunctions.float),
1545
+ objectFit: true,
1546
+ objectPosition: true,
1547
+ visibility: true,
1548
+ isolation: true
1549
+ };
1550
+ Object.assign(layout, {
1551
+ w: layout.width,
1552
+ h: layout.height,
1553
+ minW: layout.minWidth,
1554
+ maxW: layout.maxWidth,
1555
+ minH: layout.minHeight,
1556
+ maxH: layout.maxHeight,
1557
+ overscroll: layout.overscrollBehavior,
1558
+ overscrollX: layout.overscrollBehaviorX,
1559
+ overscrollY: layout.overscrollBehaviorY
1560
+ });
1561
+ var list = {
1562
+ listStyleType: true,
1563
+ listStylePosition: true,
1564
+ listStylePos: t.prop("listStylePosition"),
1565
+ listStyleImage: true,
1566
+ listStyleImg: t.prop("listStyleImage")
1567
+ };
1568
+ function get(obj, path, fallback, index) {
1569
+ const key = typeof path === "string" ? path.split(".") : [path];
1570
+ for (index = 0; index < key.length; index += 1) {
1571
+ if (!obj)
1572
+ break;
1573
+ obj = obj[key[index]];
1574
+ }
1575
+ return obj === void 0 ? fallback : obj;
1576
+ }
1577
+ var memoize = (fn) => {
1578
+ const cache = /* @__PURE__ */ new WeakMap();
1579
+ const memoizedFn = (obj, path, fallback, index) => {
1580
+ if (typeof obj === "undefined") {
1581
+ return fn(obj, path, fallback);
1582
+ }
1583
+ if (!cache.has(obj)) {
1584
+ cache.set(obj, /* @__PURE__ */ new Map());
1585
+ }
1586
+ const map = cache.get(obj);
1587
+ if (map.has(path)) {
1588
+ return map.get(path);
1589
+ }
1590
+ const value = fn(obj, path, fallback, index);
1591
+ map.set(path, value);
1592
+ return value;
1593
+ };
1594
+ return memoizedFn;
1595
+ };
1596
+ var memoizedGet = memoize(get);
1597
+ var srOnly = {
1598
+ border: "0px",
1599
+ clip: "rect(0, 0, 0, 0)",
1600
+ width: "1px",
1601
+ height: "1px",
1602
+ margin: "-1px",
1603
+ padding: "0px",
1604
+ overflow: "hidden",
1605
+ whiteSpace: "nowrap",
1606
+ position: "absolute"
1607
+ };
1608
+ var srFocusable = {
1609
+ position: "static",
1610
+ width: "auto",
1611
+ height: "auto",
1612
+ clip: "auto",
1613
+ padding: "0",
1614
+ margin: "0",
1615
+ overflow: "visible",
1616
+ whiteSpace: "normal"
1617
+ };
1618
+ var getWithPriority = (theme, key, styles) => {
1619
+ const result = {};
1620
+ const obj = memoizedGet(theme, key, {});
1621
+ for (const prop in obj) {
1622
+ const isInStyles = prop in styles && styles[prop] != null;
1623
+ if (!isInStyles)
1624
+ result[prop] = obj[prop];
1625
+ }
1626
+ return result;
1627
+ };
1628
+ var others = {
1629
+ srOnly: {
1630
+ transform(value) {
1631
+ if (value === true)
1632
+ return srOnly;
1633
+ if (value === "focusable")
1634
+ return srFocusable;
1635
+ return {};
1636
+ }
1637
+ },
1638
+ layerStyle: {
1639
+ processResult: true,
1640
+ transform: (value, theme, styles) => getWithPriority(theme, `layerStyles.${value}`, styles)
1641
+ },
1642
+ textStyle: {
1643
+ processResult: true,
1644
+ transform: (value, theme, styles) => getWithPriority(theme, `textStyles.${value}`, styles)
1645
+ },
1646
+ apply: {
1647
+ processResult: true,
1648
+ transform: (value, theme, styles) => getWithPriority(theme, value, styles)
1649
+ }
1650
+ };
1651
+ var position = {
1652
+ position: true,
1653
+ pos: t.prop("position"),
1654
+ zIndex: t.prop("zIndex", "zIndices"),
1655
+ inset: t.spaceT("inset"),
1656
+ insetX: t.spaceT(["left", "right"]),
1657
+ insetInline: t.spaceT("insetInline"),
1658
+ insetY: t.spaceT(["top", "bottom"]),
1659
+ insetBlock: t.spaceT("insetBlock"),
1660
+ top: t.spaceT("top"),
1661
+ insetBlockStart: t.spaceT("insetBlockStart"),
1662
+ bottom: t.spaceT("bottom"),
1663
+ insetBlockEnd: t.spaceT("insetBlockEnd"),
1664
+ left: t.spaceT("left"),
1665
+ insetInlineStart: t.logical({
1666
+ scale: "space",
1667
+ property: { ltr: "left", rtl: "right" }
1668
+ }),
1669
+ right: t.spaceT("right"),
1670
+ insetInlineEnd: t.logical({
1671
+ scale: "space",
1672
+ property: { ltr: "right", rtl: "left" }
1673
+ })
1674
+ };
1675
+ Object.assign(position, {
1676
+ insetStart: position.insetInlineStart,
1677
+ insetEnd: position.insetInlineEnd
1678
+ });
1679
+ var ring = {
1680
+ ring: { transform: transformFunctions.ring },
1681
+ ringColor: t.colors("--chakra-ring-color"),
1682
+ ringOffset: t.prop("--chakra-ring-offset-width"),
1683
+ ringOffsetColor: t.colors("--chakra-ring-offset-color"),
1684
+ ringInset: t.prop("--chakra-ring-inset")
1685
+ };
1686
+ var space = {
1687
+ margin: t.spaceT("margin"),
1688
+ marginTop: t.spaceT("marginTop"),
1689
+ marginBlockStart: t.spaceT("marginBlockStart"),
1690
+ marginRight: t.spaceT("marginRight"),
1691
+ marginInlineEnd: t.spaceT("marginInlineEnd"),
1692
+ marginBottom: t.spaceT("marginBottom"),
1693
+ marginBlockEnd: t.spaceT("marginBlockEnd"),
1694
+ marginLeft: t.spaceT("marginLeft"),
1695
+ marginInlineStart: t.spaceT("marginInlineStart"),
1696
+ marginX: t.spaceT(["marginInlineStart", "marginInlineEnd"]),
1697
+ marginInline: t.spaceT("marginInline"),
1698
+ marginY: t.spaceT(["marginTop", "marginBottom"]),
1699
+ marginBlock: t.spaceT("marginBlock"),
1700
+ padding: t.space("padding"),
1701
+ paddingTop: t.space("paddingTop"),
1702
+ paddingBlockStart: t.space("paddingBlockStart"),
1703
+ paddingRight: t.space("paddingRight"),
1704
+ paddingBottom: t.space("paddingBottom"),
1705
+ paddingBlockEnd: t.space("paddingBlockEnd"),
1706
+ paddingLeft: t.space("paddingLeft"),
1707
+ paddingInlineStart: t.space("paddingInlineStart"),
1708
+ paddingInlineEnd: t.space("paddingInlineEnd"),
1709
+ paddingX: t.space(["paddingInlineStart", "paddingInlineEnd"]),
1710
+ paddingInline: t.space("paddingInline"),
1711
+ paddingY: t.space(["paddingTop", "paddingBottom"]),
1712
+ paddingBlock: t.space("paddingBlock")
1713
+ };
1714
+ Object.assign(space, {
1715
+ m: space.margin,
1716
+ mt: space.marginTop,
1717
+ mr: space.marginRight,
1718
+ me: space.marginInlineEnd,
1719
+ marginEnd: space.marginInlineEnd,
1720
+ mb: space.marginBottom,
1721
+ ml: space.marginLeft,
1722
+ ms: space.marginInlineStart,
1723
+ marginStart: space.marginInlineStart,
1724
+ mx: space.marginX,
1725
+ my: space.marginY,
1726
+ p: space.padding,
1727
+ pt: space.paddingTop,
1728
+ py: space.paddingY,
1729
+ px: space.paddingX,
1730
+ pb: space.paddingBottom,
1731
+ pl: space.paddingLeft,
1732
+ ps: space.paddingInlineStart,
1733
+ paddingStart: space.paddingInlineStart,
1734
+ pr: space.paddingRight,
1735
+ pe: space.paddingInlineEnd,
1736
+ paddingEnd: space.paddingInlineEnd
1737
+ });
1738
+ var textDecoration = {
1739
+ textDecorationColor: t.colors("textDecorationColor"),
1740
+ textDecoration: true,
1741
+ textDecor: { property: "textDecoration" },
1742
+ textDecorationLine: true,
1743
+ textDecorationStyle: true,
1744
+ textDecorationThickness: true,
1745
+ textUnderlineOffset: true,
1746
+ textShadow: t.shadows("textShadow")
1747
+ };
1748
+ var transform = {
1749
+ clipPath: true,
1750
+ transform: t.propT("transform", transformFunctions.transform),
1751
+ transformOrigin: true,
1752
+ translateX: t.spaceT("--chakra-translate-x"),
1753
+ translateY: t.spaceT("--chakra-translate-y"),
1754
+ skewX: t.degreeT("--chakra-skew-x"),
1755
+ skewY: t.degreeT("--chakra-skew-y"),
1756
+ scaleX: t.prop("--chakra-scale-x"),
1757
+ scaleY: t.prop("--chakra-scale-y"),
1758
+ scale: t.prop(["--chakra-scale-x", "--chakra-scale-y"]),
1759
+ rotate: t.degreeT("--chakra-rotate")
1760
+ };
1761
+ var transition = {
1762
+ transition: true,
1763
+ transitionDelay: true,
1764
+ animation: true,
1765
+ willChange: true,
1766
+ transitionDuration: t.prop("transitionDuration", "transition.duration"),
1767
+ transitionProperty: t.prop("transitionProperty", "transition.property"),
1768
+ transitionTimingFunction: t.prop(
1769
+ "transitionTimingFunction",
1770
+ "transition.easing"
1771
+ )
1772
+ };
1773
+ var typography = {
1774
+ fontFamily: t.prop("fontFamily", "fonts"),
1775
+ fontSize: t.prop("fontSize", "fontSizes", transformFunctions.px),
1776
+ fontWeight: t.prop("fontWeight", "fontWeights"),
1777
+ lineHeight: t.prop("lineHeight", "lineHeights"),
1778
+ letterSpacing: t.prop("letterSpacing", "letterSpacings"),
1779
+ textAlign: true,
1780
+ fontStyle: true,
1781
+ textIndent: true,
1782
+ wordBreak: true,
1783
+ overflowWrap: true,
1784
+ textOverflow: true,
1785
+ textTransform: true,
1786
+ whiteSpace: true,
1787
+ isTruncated: {
1788
+ transform(value) {
1789
+ if (value === true) {
1790
+ return {
1791
+ overflow: "hidden",
1792
+ textOverflow: "ellipsis",
1793
+ whiteSpace: "nowrap"
1794
+ };
1795
+ }
1796
+ }
1797
+ },
1798
+ noOfLines: {
1799
+ static: {
1800
+ overflow: "hidden",
1801
+ textOverflow: "ellipsis",
1802
+ display: "-webkit-box",
1803
+ WebkitBoxOrient: "vertical",
1804
+ WebkitLineClamp: "var(--chakra-line-clamp)"
1805
+ },
1806
+ property: "--chakra-line-clamp"
1807
+ }
1808
+ };
1809
+ var scroll = {
1810
+ scrollBehavior: true,
1811
+ scrollSnapAlign: true,
1812
+ scrollSnapStop: true,
1813
+ scrollSnapType: true,
1814
+ scrollMargin: t.spaceT("scrollMargin"),
1815
+ scrollMarginTop: t.spaceT("scrollMarginTop"),
1816
+ scrollMarginBottom: t.spaceT("scrollMarginBottom"),
1817
+ scrollMarginLeft: t.spaceT("scrollMarginLeft"),
1818
+ scrollMarginRight: t.spaceT("scrollMarginRight"),
1819
+ scrollMarginX: t.spaceT(["scrollMarginLeft", "scrollMarginRight"]),
1820
+ scrollMarginY: t.spaceT(["scrollMarginTop", "scrollMarginBottom"]),
1821
+ scrollPadding: t.spaceT("scrollPadding"),
1822
+ scrollPaddingTop: t.spaceT("scrollPaddingTop"),
1823
+ scrollPaddingBottom: t.spaceT("scrollPaddingBottom"),
1824
+ scrollPaddingLeft: t.spaceT("scrollPaddingLeft"),
1825
+ scrollPaddingRight: t.spaceT("scrollPaddingRight"),
1826
+ scrollPaddingX: t.spaceT(["scrollPaddingLeft", "scrollPaddingRight"]),
1827
+ scrollPaddingY: t.spaceT(["scrollPaddingTop", "scrollPaddingBottom"])
1828
+ };
1829
+ function resolveReference(operand) {
1830
+ if (isObject(operand) && operand.reference) {
1831
+ return operand.reference;
1832
+ }
1833
+ return String(operand);
1834
+ }
1835
+ var toExpression = (operator, ...operands) => operands.map(resolveReference).join(` ${operator} `).replace(/calc/g, "");
1836
+ var add = (...operands) => `calc(${toExpression("+", ...operands)})`;
1837
+ var subtract = (...operands) => `calc(${toExpression("-", ...operands)})`;
1838
+ var multiply = (...operands) => `calc(${toExpression("*", ...operands)})`;
1839
+ var divide = (...operands) => `calc(${toExpression("/", ...operands)})`;
1840
+ var negate = (x) => {
1841
+ const value = resolveReference(x);
1842
+ if (value != null && !Number.isNaN(parseFloat(value))) {
1843
+ return String(value).startsWith("-") ? String(value).slice(1) : `-${value}`;
1844
+ }
1845
+ return multiply(value, -1);
1846
+ };
1847
+ var calc = Object.assign(
1848
+ (x) => ({
1849
+ add: (...operands) => calc(add(x, ...operands)),
1850
+ subtract: (...operands) => calc(subtract(x, ...operands)),
1851
+ multiply: (...operands) => calc(multiply(x, ...operands)),
1852
+ divide: (...operands) => calc(divide(x, ...operands)),
1853
+ negate: () => calc(negate(x)),
1854
+ toString: () => x.toString()
1855
+ }),
1856
+ {
1857
+ add,
1858
+ subtract,
1859
+ multiply,
1860
+ divide,
1861
+ negate
1862
+ }
1863
+ );
1864
+ function analyzeCSSValue2(value) {
1865
+ const num = parseFloat(value.toString());
1866
+ const unit = value.toString().replace(String(num), "");
1867
+ return { unitless: !unit, value: num, unit };
1868
+ }
1869
+ function px(value) {
1870
+ if (value == null)
1871
+ return value;
1872
+ const { unitless } = analyzeCSSValue2(value);
1873
+ return unitless || typeof value === "number" ? `${value}px` : value;
1874
+ }
1875
+ function toMediaQueryString(min, max) {
1876
+ const query = ["@media screen"];
1877
+ if (min)
1878
+ query.push("and", `(min-width: ${px(min)})`);
1879
+ if (max)
1880
+ query.push("and", `(max-width: ${px(max)})`);
1881
+ return query.join(" ");
1882
+ }
1883
+ var state = {
1884
+ hover: (str, post) => `${str}:hover ${post}, ${str}[data-hover] ${post}`,
1885
+ focus: (str, post) => `${str}:focus ${post}, ${str}[data-focus] ${post}`,
1886
+ focusVisible: (str, post) => `${str}:focus-visible ${post}`,
1887
+ focusWithin: (str, post) => `${str}:focus-within ${post}`,
1888
+ active: (str, post) => `${str}:active ${post}, ${str}[data-active] ${post}`,
1889
+ disabled: (str, post) => `${str}:disabled ${post}, ${str}[data-disabled] ${post}`,
1890
+ invalid: (str, post) => `${str}:invalid ${post}, ${str}[data-invalid] ${post}`,
1891
+ checked: (str, post) => `${str}:checked ${post}, ${str}[data-checked] ${post}`,
1892
+ indeterminate: (str, post) => `${str}:indeterminate ${post}, ${str}[aria-checked=mixed] ${post}, ${str}[data-indeterminate] ${post}`,
1893
+ readOnly: (str, post) => `${str}:read-only ${post}, ${str}[readonly] ${post}, ${str}[data-read-only] ${post}`,
1894
+ expanded: (str, post) => `${str}:read-only ${post}, ${str}[aria-expanded=true] ${post}, ${str}[data-expanded] ${post}`,
1895
+ placeholderShown: (str, post) => `${str}:placeholder-shown ${post}`
1896
+ };
1897
+ var toGroup = (fn) => merge((v) => fn(v, "&"), "[role=group]", "[data-group]", ".group");
1898
+ var toPeer = (fn) => merge((v) => fn(v, "~ &"), "[data-peer]", ".peer");
1899
+ var merge = (fn, ...selectors) => selectors.map(fn).join(", ");
1900
+ var pseudoSelectors = {
1901
+ _hover: "&:hover, &[data-hover]",
1902
+ _active: "&:active, &[data-active]",
1903
+ _focus: "&:focus, &[data-focus]",
1904
+ _highlighted: "&[data-highlighted]",
1905
+ _focusWithin: "&:focus-within",
1906
+ _focusVisible: "&:focus-visible, &[data-focus-visible]",
1907
+ _disabled: "&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",
1908
+ _readOnly: "&[aria-readonly=true], &[readonly], &[data-readonly]",
1909
+ _before: "&::before",
1910
+ _after: "&::after",
1911
+ _empty: "&:empty",
1912
+ _expanded: "&[aria-expanded=true], &[data-expanded]",
1913
+ _checked: "&[aria-checked=true], &[data-checked]",
1914
+ _grabbed: "&[aria-grabbed=true], &[data-grabbed]",
1915
+ _pressed: "&[aria-pressed=true], &[data-pressed]",
1916
+ _invalid: "&[aria-invalid=true], &[data-invalid]",
1917
+ _valid: "&[data-valid], &[data-state=valid]",
1918
+ _loading: "&[data-loading], &[aria-busy=true]",
1919
+ _selected: "&[aria-selected=true], &[data-selected]",
1920
+ _hidden: "&[hidden], &[data-hidden]",
1921
+ _autofill: "&:-webkit-autofill",
1922
+ _even: "&:nth-of-type(even)",
1923
+ _odd: "&:nth-of-type(odd)",
1924
+ _first: "&:first-of-type",
1925
+ _firstLetter: "&::first-letter",
1926
+ _last: "&:last-of-type",
1927
+ _notFirst: "&:not(:first-of-type)",
1928
+ _notLast: "&:not(:last-of-type)",
1929
+ _visited: "&:visited",
1930
+ _activeLink: "&[aria-current=page]",
1931
+ _activeStep: "&[aria-current=step]",
1932
+ _indeterminate: "&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",
1933
+ _groupHover: toGroup(state.hover),
1934
+ _peerHover: toPeer(state.hover),
1935
+ _groupFocus: toGroup(state.focus),
1936
+ _peerFocus: toPeer(state.focus),
1937
+ _groupFocusVisible: toGroup(state.focusVisible),
1938
+ _peerFocusVisible: toPeer(state.focusVisible),
1939
+ _groupActive: toGroup(state.active),
1940
+ _peerActive: toPeer(state.active),
1941
+ _groupDisabled: toGroup(state.disabled),
1942
+ _peerDisabled: toPeer(state.disabled),
1943
+ _groupInvalid: toGroup(state.invalid),
1944
+ _peerInvalid: toPeer(state.invalid),
1945
+ _groupChecked: toGroup(state.checked),
1946
+ _peerChecked: toPeer(state.checked),
1947
+ _groupFocusWithin: toGroup(state.focusWithin),
1948
+ _peerFocusWithin: toPeer(state.focusWithin),
1949
+ _peerPlaceholderShown: toPeer(state.placeholderShown),
1950
+ _placeholder: "&::placeholder",
1951
+ _placeholderShown: "&:placeholder-shown",
1952
+ _fullScreen: "&:fullscreen",
1953
+ _selection: "&::selection",
1954
+ _rtl: "[dir=rtl] &, &[dir=rtl]",
1955
+ _ltr: "[dir=ltr] &, &[dir=ltr]",
1956
+ _mediaDark: "@media (prefers-color-scheme: dark)",
1957
+ _mediaReduceMotion: "@media (prefers-reduced-motion: reduce)",
1958
+ _dark: ".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",
1959
+ _light: ".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]"
1960
+ };
1961
+ var pseudoPropNames = Object.keys(
1962
+ pseudoSelectors
1963
+ );
1964
+ var systemProps = (0, import_lodash3.default)(
1965
+ {},
1966
+ background,
1967
+ border,
1968
+ color,
1969
+ flexbox,
1970
+ layout,
1971
+ filter,
1972
+ ring,
1973
+ interactivity,
1974
+ grid,
1975
+ others,
1976
+ position,
1977
+ effect,
1978
+ space,
1979
+ scroll,
1980
+ typography,
1981
+ textDecoration,
1982
+ transform,
1983
+ list,
1984
+ transition
1985
+ );
1986
+ Object.assign({}, space, layout, flexbox, grid, position);
1987
+ var propNames = [...Object.keys(systemProps), ...pseudoPropNames];
1988
+ var styleProps = { ...systemProps, ...pseudoSelectors };
1989
+ var isStyleProp = (prop) => prop in styleProps;
1990
+ var expandResponsive = (styles) => (theme) => {
1991
+ if (!theme.__breakpoints)
1992
+ return styles;
1993
+ const { isResponsive, toArrayValue, media: medias } = theme.__breakpoints;
1994
+ const computedStyles = {};
1995
+ for (const key in styles) {
1996
+ let value = runIfFn(styles[key], theme);
1997
+ if (value == null)
1998
+ continue;
1999
+ value = isObject(value) && isResponsive(value) ? toArrayValue(value) : value;
2000
+ if (!Array.isArray(value)) {
2001
+ computedStyles[key] = value;
2002
+ continue;
2003
+ }
2004
+ const queries = value.slice(0, medias.length).length;
2005
+ for (let index = 0; index < queries; index += 1) {
2006
+ const media = medias == null ? void 0 : medias[index];
2007
+ if (!media) {
2008
+ computedStyles[key] = value[index];
2009
+ continue;
2010
+ }
2011
+ computedStyles[media] = computedStyles[media] || {};
2012
+ if (value[index] == null) {
2013
+ continue;
2014
+ }
2015
+ computedStyles[media][key] = value[index];
2016
+ }
2017
+ }
2018
+ return computedStyles;
2019
+ };
2020
+ function splitByComma(value) {
2021
+ const chunks = [];
2022
+ let chunk = "";
2023
+ let inParens = false;
2024
+ for (let i = 0; i < value.length; i++) {
2025
+ const char = value[i];
2026
+ if (char === "(") {
2027
+ inParens = true;
2028
+ chunk += char;
2029
+ } else if (char === ")") {
2030
+ inParens = false;
2031
+ chunk += char;
2032
+ } else if (char === "," && !inParens) {
2033
+ chunks.push(chunk);
2034
+ chunk = "";
2035
+ } else {
2036
+ chunk += char;
2037
+ }
2038
+ }
2039
+ chunk = chunk.trim();
2040
+ if (chunk) {
2041
+ chunks.push(chunk);
2042
+ }
2043
+ return chunks;
2044
+ }
2045
+ function isCssVar2(value) {
2046
+ return /^var\(--.+\)$/.test(value);
2047
+ }
2048
+ var isCSSVariableTokenValue = (key, value) => key.startsWith("--") && typeof value === "string" && !isCssVar2(value);
2049
+ var resolveTokenValue = (theme, value) => {
2050
+ var _a2, _b;
2051
+ if (value == null)
2052
+ return value;
2053
+ const getVar = (val) => {
2054
+ var _a22, _b2;
2055
+ return (_b2 = (_a22 = theme.__cssMap) == null ? void 0 : _a22[val]) == null ? void 0 : _b2.varRef;
2056
+ };
2057
+ const getValue = (val) => {
2058
+ var _a22;
2059
+ return (_a22 = getVar(val)) != null ? _a22 : val;
2060
+ };
2061
+ const [tokenValue, fallbackValue] = splitByComma(value);
2062
+ value = (_b = (_a2 = getVar(tokenValue)) != null ? _a2 : getValue(fallbackValue)) != null ? _b : getValue(value);
2063
+ return value;
2064
+ };
2065
+ function getCss(options) {
2066
+ const { configs = {}, pseudos = {}, theme } = options;
2067
+ const css2 = (stylesOrFn, nested = false) => {
2068
+ var _a2, _b, _c;
2069
+ const _styles = runIfFn(stylesOrFn, theme);
2070
+ const styles = expandResponsive(_styles)(theme);
2071
+ let computedStyles = {};
2072
+ for (let key in styles) {
2073
+ const valueOrFn = styles[key];
2074
+ let value = runIfFn(valueOrFn, theme);
2075
+ if (key in pseudos) {
2076
+ key = pseudos[key];
2077
+ }
2078
+ if (isCSSVariableTokenValue(key, value)) {
2079
+ value = resolveTokenValue(theme, value);
2080
+ }
2081
+ let config = configs[key];
2082
+ if (config === true) {
2083
+ config = { property: key };
2084
+ }
2085
+ if (isObject(value)) {
2086
+ computedStyles[key] = (_a2 = computedStyles[key]) != null ? _a2 : {};
2087
+ computedStyles[key] = (0, import_lodash2.default)(
2088
+ {},
2089
+ computedStyles[key],
2090
+ css2(value, true)
2091
+ );
2092
+ continue;
2093
+ }
2094
+ let rawValue = (_c = (_b = config == null ? void 0 : config.transform) == null ? void 0 : _b.call(config, value, theme, _styles)) != null ? _c : value;
2095
+ rawValue = (config == null ? void 0 : config.processResult) ? css2(rawValue, true) : rawValue;
2096
+ const configProperty = runIfFn(config == null ? void 0 : config.property, theme);
2097
+ if (!nested && (config == null ? void 0 : config.static)) {
2098
+ const staticStyles = runIfFn(config.static, theme);
2099
+ computedStyles = (0, import_lodash2.default)({}, computedStyles, staticStyles);
2100
+ }
2101
+ if (configProperty && Array.isArray(configProperty)) {
2102
+ for (const property of configProperty) {
2103
+ computedStyles[property] = rawValue;
2104
+ }
2105
+ continue;
2106
+ }
2107
+ if (configProperty) {
2108
+ if (configProperty === "&" && isObject(rawValue)) {
2109
+ computedStyles = (0, import_lodash2.default)({}, computedStyles, rawValue);
2110
+ } else {
2111
+ computedStyles[configProperty] = rawValue;
2112
+ }
2113
+ continue;
2114
+ }
2115
+ if (isObject(rawValue)) {
2116
+ computedStyles = (0, import_lodash2.default)({}, computedStyles, rawValue);
2117
+ continue;
2118
+ }
2119
+ computedStyles[key] = rawValue;
2120
+ }
2121
+ return computedStyles;
2122
+ };
2123
+ return css2;
2124
+ }
2125
+ var css = (styles) => (theme) => {
2126
+ const cssFn = getCss({
2127
+ theme,
2128
+ pseudos: pseudoSelectors,
2129
+ configs: systemProps
2130
+ });
2131
+ return cssFn(styles);
2132
+ };
2133
+ function normalize2(value, toArray) {
2134
+ if (Array.isArray(value))
2135
+ return value;
2136
+ if (isObject(value))
2137
+ return toArray(value);
2138
+ if (value != null)
2139
+ return [value];
2140
+ }
2141
+ function getNextIndex(values, i) {
2142
+ for (let j = i + 1; j < values.length; j++) {
2143
+ if (values[j] != null)
2144
+ return j;
2145
+ }
2146
+ return -1;
2147
+ }
2148
+ function createResolver(theme) {
2149
+ const breakpointUtil = theme.__breakpoints;
2150
+ return function resolver(config, prop, value, props) {
2151
+ var _a2, _b;
2152
+ if (!breakpointUtil)
2153
+ return;
2154
+ const result = {};
2155
+ const normalized = normalize2(value, breakpointUtil.toArrayValue);
2156
+ if (!normalized)
2157
+ return result;
2158
+ const len = normalized.length;
2159
+ const isSingle = len === 1;
2160
+ const isMultipart = !!config.parts;
2161
+ for (let i = 0; i < len; i++) {
2162
+ const key = breakpointUtil.details[i];
2163
+ const nextKey = breakpointUtil.details[getNextIndex(normalized, i)];
2164
+ const query = toMediaQueryString(key.minW, nextKey == null ? void 0 : nextKey._minW);
2165
+ const styles = runIfFn((_a2 = config[prop]) == null ? void 0 : _a2[normalized[i]], props);
2166
+ if (!styles)
2167
+ continue;
2168
+ if (isMultipart) {
2169
+ (_b = config.parts) == null ? void 0 : _b.forEach((part) => {
2170
+ (0, import_lodash4.default)(result, {
2171
+ [part]: isSingle ? styles[part] : { [query]: styles[part] }
2172
+ });
2173
+ });
2174
+ continue;
2175
+ }
2176
+ if (!isMultipart) {
2177
+ if (isSingle)
2178
+ (0, import_lodash4.default)(result, styles);
2179
+ else
2180
+ result[query] = styles;
2181
+ continue;
2182
+ }
2183
+ result[query] = styles;
2184
+ }
2185
+ return result;
2186
+ };
2187
+ }
2188
+ function resolveStyleConfig(config) {
2189
+ return (props) => {
2190
+ var _a2;
2191
+ const { variant, size, theme } = props;
2192
+ const recipe = createResolver(theme);
2193
+ return (0, import_lodash4.default)(
2194
+ {},
2195
+ runIfFn((_a2 = config.baseStyle) != null ? _a2 : {}, props),
2196
+ recipe(config, "sizes", size, props),
2197
+ recipe(config, "variants", variant, props)
2198
+ );
2199
+ };
2200
+ }
2201
+
2202
+ // ../../node_modules/@chakra-ui/system/dist/chunk-T2VHL7RE.mjs
2203
+ var import_react_fast_compare = __toESM(require_react_fast_compare(), 1);
2204
+ function useStyleConfigImpl(themeKey, props = {}) {
2205
+ var _a2;
2206
+ const { styleConfig: styleConfigProp, ...rest } = props;
2207
+ const { theme, colorMode } = useChakra();
2208
+ const themeStyleConfig = themeKey ? utils.memoizedGet(theme, `components.${themeKey}`) : void 0;
2209
+ const styleConfig = styleConfigProp || themeStyleConfig;
2210
+ const mergedProps = utils.mergeWith(
2211
+ { theme, colorMode },
2212
+ (_a2 = styleConfig == null ? void 0 : styleConfig.defaultProps) != null ? _a2 : {},
2213
+ utils.filterUndefined(utils.omit(rest, ["children"]))
2214
+ );
2215
+ const stylesRef = React12.useRef({});
2216
+ if (styleConfig) {
2217
+ const getStyles = resolveStyleConfig(styleConfig);
2218
+ const styles = getStyles(mergedProps);
2219
+ const isStyleEqual = (0, import_react_fast_compare.default)(stylesRef.current, styles);
2220
+ if (!isStyleEqual) {
2221
+ stylesRef.current = styles;
2222
+ }
2223
+ }
2224
+ return stylesRef.current;
2225
+ }
2226
+ function useStyleConfig(themeKey, props = {}) {
2227
+ return useStyleConfigImpl(themeKey, props);
2228
+ }
2229
+
2230
+ // ../../node_modules/@chakra-ui/system/dist/chunk-NAGWYFCH.mjs
2231
+ var allPropNames = /* @__PURE__ */ new Set([
2232
+ ...propNames,
2233
+ "textStyle",
2234
+ "layerStyle",
2235
+ "apply",
2236
+ "noOfLines",
2237
+ "focusBorderColor",
2238
+ "errorBorderColor",
2239
+ "as",
2240
+ "__css",
2241
+ "css",
2242
+ "sx"
2243
+ ]);
2244
+ var validHTMLProps = /* @__PURE__ */ new Set([
2245
+ "htmlWidth",
2246
+ "htmlHeight",
2247
+ "htmlSize",
2248
+ "htmlTranslate"
2249
+ ]);
2250
+ function shouldForwardProp(prop) {
2251
+ return validHTMLProps.has(prop) || !allPropNames.has(prop);
2252
+ }
29
2253
 
30
- // src/display-field.tsx
31
- var DisplayField = ({
32
- name,
33
- label,
34
- placeholder,
35
- ...props
36
- }) => {
37
- return /* @__PURE__ */ React8__namespace.createElement(react.FormControl, {
38
- ...props
39
- }, label ? /* @__PURE__ */ React8__namespace.createElement(react.FormLabel, {
40
- htmlFor: name
41
- }, label) : null, /* @__PURE__ */ React8__namespace.createElement(react.Text, {
42
- fontSize: "md"
43
- }, /* @__PURE__ */ React8__namespace.createElement(FormValue, {
44
- name
45
- })));
46
- };
47
- if (utils.__DEV__) {
48
- DisplayField.displayName = "DisplayField";
2254
+ // ../../node_modules/@chakra-ui/object-utils/dist/index.mjs
2255
+ function assignAfter(target, ...sources) {
2256
+ if (target == null) {
2257
+ throw new TypeError("Cannot convert undefined or null to object");
2258
+ }
2259
+ const result = { ...target };
2260
+ for (const nextSource of sources) {
2261
+ if (nextSource == null)
2262
+ continue;
2263
+ for (const nextKey in nextSource) {
2264
+ if (!Object.prototype.hasOwnProperty.call(nextSource, nextKey))
2265
+ continue;
2266
+ if (nextKey in result)
2267
+ delete result[nextKey];
2268
+ result[nextKey] = nextSource[nextKey];
2269
+ }
2270
+ }
2271
+ return result;
49
2272
  }
50
- var FormValue = ({ name }) => {
51
- const { getValues } = reactHookForm.useFormContext();
52
- return getValues(name) || null;
2273
+ var _a;
2274
+ var emotion_styled = (_a = createStyled__default.default.default) != null ? _a : createStyled__default.default;
2275
+ var toCSSObject = ({ baseStyle }) => (props) => {
2276
+ const { theme, css: cssProp, __css, sx, ...rest } = props;
2277
+ const styleProps2 = utils.objectFilter(rest, (_, prop) => isStyleProp(prop));
2278
+ const finalBaseStyle = utils.runIfFn(baseStyle, props);
2279
+ const finalStyles = assignAfter(
2280
+ {},
2281
+ __css,
2282
+ finalBaseStyle,
2283
+ utils.filterUndefined(styleProps2),
2284
+ sx
2285
+ );
2286
+ const computedCSS = css(finalStyles)(props.theme);
2287
+ return cssProp ? [computedCSS, cssProp] : computedCSS;
53
2288
  };
54
- if (utils.__DEV__) {
55
- FormValue.displayName = "FormValue";
2289
+ function styled(component, options) {
2290
+ const { baseStyle, ...styledOptions } = options != null ? options : {};
2291
+ if (!styledOptions.shouldForwardProp) {
2292
+ styledOptions.shouldForwardProp = shouldForwardProp;
2293
+ }
2294
+ const styleObject = toCSSObject({ baseStyle });
2295
+ const Component = emotion_styled(
2296
+ component,
2297
+ styledOptions
2298
+ )(styleObject);
2299
+ const chakraComponent = React12__namespace.default.forwardRef(function ChakraComponent(props, ref) {
2300
+ const { colorMode, forced } = useColorMode();
2301
+ return React12__namespace.default.createElement(Component, {
2302
+ ref,
2303
+ "data-theme": forced ? colorMode : void 0,
2304
+ ...props
2305
+ });
2306
+ });
2307
+ return chakraComponent;
56
2308
  }
57
- var NumberInput = react.forwardRef((props, ref) => {
58
- const { hideStepper, incrementIcon, decrementIcon, ...rest } = props;
59
- return /* @__PURE__ */ React8__namespace.createElement(react.NumberInput, {
60
- ...rest,
61
- ref
62
- }, /* @__PURE__ */ React8__namespace.createElement(react.NumberInputField, null), !hideStepper && /* @__PURE__ */ React8__namespace.createElement(react.NumberInputStepper, null, /* @__PURE__ */ React8__namespace.createElement(react.NumberIncrementStepper, {
63
- children: incrementIcon
64
- }), /* @__PURE__ */ React8__namespace.createElement(react.NumberDecrementStepper, {
65
- children: decrementIcon
66
- })));
67
- });
68
- NumberInput.defaultProps = {
69
- hideStepper: false
2309
+
2310
+ // ../../node_modules/@chakra-ui/system/dist/chunk-3LE6AY5Q.mjs
2311
+ function factory() {
2312
+ const cache = /* @__PURE__ */ new Map();
2313
+ return new Proxy(styled, {
2314
+ apply(target, thisArg, argArray) {
2315
+ return styled(...argArray);
2316
+ },
2317
+ get(_, element) {
2318
+ if (!cache.has(element)) {
2319
+ cache.set(element, styled(element));
2320
+ }
2321
+ return cache.get(element);
2322
+ }
2323
+ });
2324
+ }
2325
+ var chakra = factory();
2326
+ function forwardRef2(component) {
2327
+ return React12.forwardRef(component);
2328
+ }
2329
+ var fallbackIcon = {
2330
+ path: /* @__PURE__ */ jsxRuntime.jsxs("g", { stroke: "currentColor", strokeWidth: "1.5", children: [
2331
+ /* @__PURE__ */ jsxRuntime.jsx(
2332
+ "path",
2333
+ {
2334
+ strokeLinecap: "round",
2335
+ fill: "none",
2336
+ d: "M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"
2337
+ }
2338
+ ),
2339
+ /* @__PURE__ */ jsxRuntime.jsx(
2340
+ "path",
2341
+ {
2342
+ fill: "currentColor",
2343
+ strokeLinecap: "round",
2344
+ d: "M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"
2345
+ }
2346
+ ),
2347
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { fill: "none", strokeMiterlimit: "10", cx: "12", cy: "12", r: "11.25" })
2348
+ ] }),
2349
+ viewBox: "0 0 24 24"
70
2350
  };
71
- if (utils.__DEV__) {
72
- NumberInput.displayName = "NumberInput";
2351
+ var Icon = forwardRef2((props, ref) => {
2352
+ const {
2353
+ as: element,
2354
+ viewBox,
2355
+ color: color2 = "currentColor",
2356
+ focusable = false,
2357
+ children,
2358
+ className,
2359
+ __css,
2360
+ ...rest
2361
+ } = props;
2362
+ const _className = cx("chakra-icon", className);
2363
+ const customStyles = useStyleConfig("Icon", props);
2364
+ const styles = {
2365
+ w: "1em",
2366
+ h: "1em",
2367
+ display: "inline-block",
2368
+ lineHeight: "1em",
2369
+ flexShrink: 0,
2370
+ color: color2,
2371
+ ...__css,
2372
+ ...customStyles
2373
+ };
2374
+ const shared = {
2375
+ ref,
2376
+ focusable,
2377
+ className: _className,
2378
+ __css: styles
2379
+ };
2380
+ const _viewBox = viewBox != null ? viewBox : fallbackIcon.viewBox;
2381
+ if (element && typeof element !== "string") {
2382
+ return /* @__PURE__ */ jsxRuntime.jsx(chakra.svg, { as: element, ...shared, ...rest });
2383
+ }
2384
+ const _path = children != null ? children : fallbackIcon.path;
2385
+ return /* @__PURE__ */ jsxRuntime.jsx(chakra.svg, { verticalAlign: "middle", viewBox: _viewBox, ...shared, ...rest, children: _path });
2386
+ });
2387
+ Icon.displayName = "Icon";
2388
+ function createIcon(options) {
2389
+ const {
2390
+ viewBox = "0 0 24 24",
2391
+ d: pathDefinition,
2392
+ displayName,
2393
+ defaultProps = {}
2394
+ } = options;
2395
+ const path = React12.Children.toArray(options.path);
2396
+ const Comp = forwardRef2((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(Icon, { ref, viewBox, ...defaultProps, ...props, children: path.length ? path : /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", d: pathDefinition }) }));
2397
+ Comp.displayName = displayName;
2398
+ return Comp;
73
2399
  }
2400
+ var ViewOffIcon = createIcon({
2401
+ displayName: "ViewOffIcon",
2402
+ path: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "currentColor", children: [
2403
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M23.2,10.549a20.954,20.954,0,0,0-4.3-3.6l4-3.995a1,1,0,1,0-1.414-1.414l-.018.018a.737.737,0,0,1-.173.291l-19.5,19.5c-.008.007-.018.009-.026.017a1,1,0,0,0,1.631,1.088l4.146-4.146a11.26,11.26,0,0,0,4.31.939h.3c4.256,0,8.489-2.984,11.051-5.8A2.171,2.171,0,0,0,23.2,10.549ZM16.313,13.27a4.581,4.581,0,0,1-3,3.028,4.3,4.3,0,0,1-3.1-.19.253.253,0,0,1-.068-.407l5.56-5.559a.252.252,0,0,1,.407.067A4.3,4.3,0,0,1,16.313,13.27Z" }),
2404
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7.615,13.4a.244.244,0,0,0,.061-.24A4.315,4.315,0,0,1,7.5,12,4.5,4.5,0,0,1,12,7.5a4.276,4.276,0,0,1,1.16.173.244.244,0,0,0,.24-.062l1.941-1.942a.254.254,0,0,0-.1-.421A10.413,10.413,0,0,0,12,4.75C7.7,4.692,3.4,7.7.813,10.549a2.15,2.15,0,0,0-.007,2.9,21.209,21.209,0,0,0,3.438,3.03.256.256,0,0,0,.326-.029Z" })
2405
+ ] })
2406
+ });
2407
+ var ViewIcon = createIcon({
2408
+ displayName: "ViewIcon",
2409
+ path: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "currentColor", children: [
2410
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M23.432,10.524C20.787,7.614,16.4,4.538,12,4.6,7.6,4.537,3.213,7.615.568,10.524a2.211,2.211,0,0,0,0,2.948C3.182,16.351,7.507,19.4,11.839,19.4h.308c4.347,0,8.671-3.049,11.288-5.929A2.21,2.21,0,0,0,23.432,10.524ZM7.4,12A4.6,4.6,0,1,1,12,16.6,4.6,4.6,0,0,1,7.4,12Z" }),
2411
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "2" })
2412
+ ] })
2413
+ });
2414
+ var MinusIcon = createIcon({
2415
+ displayName: "MinusIcon",
2416
+ path: /* @__PURE__ */ jsxRuntime.jsx("g", { fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { height: "4", width: "20", x: "2", y: "10" }) })
2417
+ });
2418
+
2419
+ // ../../node_modules/@chakra-ui/icons/dist/chunk-VJ54TX72.mjs
2420
+ var AddIcon = createIcon({
2421
+ d: "M0,12a1.5,1.5,0,0,0,1.5,1.5h8.75a.25.25,0,0,1,.25.25V22.5a1.5,1.5,0,0,0,3,0V13.75a.25.25,0,0,1,.25-.25H22.5a1.5,1.5,0,0,0,0-3H13.75a.25.25,0,0,1-.25-.25V1.5a1.5,1.5,0,0,0-3,0v8.75a.25.25,0,0,1-.25.25H1.5A1.5,1.5,0,0,0,0,12Z",
2422
+ displayName: "AddIcon"
2423
+ });
74
2424
  var InputRightButton = react.forwardRef(
75
2425
  (props, ref) => {
76
- return /* @__PURE__ */ React8__namespace.createElement(react.InputRightElement, {
77
- w: "auto",
78
- px: "1",
79
- py: "1",
80
- alignItems: "stretch"
81
- }, /* @__PURE__ */ React8__namespace.createElement(react.Button, {
82
- ref,
83
- height: "auto",
84
- ...props
85
- }));
2426
+ return /* @__PURE__ */ jsxRuntime.jsx(react.InputRightElement, { w: "auto", px: "1", py: "1", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(react.Button, { ref, height: "auto", ...props }) });
86
2427
  }
87
2428
  );
88
2429
  InputRightButton.id = "InputRightElement";
89
2430
  InputRightButton.displayName = "InputRightButton";
90
-
91
- // src/password-input/password-input.tsx
92
2431
  var PasswordInput = react.forwardRef(
93
2432
  (props, ref) => {
94
2433
  const {
@@ -99,62 +2438,89 @@ var PasswordInput = react.forwardRef(
99
2438
  width,
100
2439
  size,
101
2440
  variant,
2441
+ leftAddon,
102
2442
  ...inputProps
103
2443
  } = props;
104
- const [show, setShow] = React8.useState(false);
2444
+ const [show, setShow] = React12.useState(false);
105
2445
  const handleClick = () => setShow(!show);
106
2446
  const label = show ? "Hide password" : "Show password";
107
2447
  let icon;
108
2448
  if (show) {
109
- icon = viewIcon || /* @__PURE__ */ React8.createElement(icons.ViewIcon, null);
2449
+ icon = viewIcon || /* @__PURE__ */ jsxRuntime.jsx(ViewIcon, {});
110
2450
  } else {
111
- icon = viewOffIcon || /* @__PURE__ */ React8.createElement(icons.ViewOffIcon, null);
2451
+ icon = viewOffIcon || /* @__PURE__ */ jsxRuntime.jsx(ViewOffIcon, {});
112
2452
  }
113
2453
  const groupProps = {
114
2454
  width: w || width,
115
2455
  size,
116
2456
  variant
117
2457
  };
118
- return /* @__PURE__ */ React8.createElement(react.InputGroup, {
119
- ...groupProps
120
- }, /* @__PURE__ */ React8.createElement(react.Input, {
121
- ...inputProps,
122
- ref,
123
- type: show ? "text" : "password",
124
- autoComplete: show ? "off" : autoComplete
125
- }), /* @__PURE__ */ React8.createElement(InputRightButton, {
126
- onClick: handleClick,
127
- "aria-label": label,
128
- variant: "ghost"
129
- }, icon));
2458
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.InputGroup, { ...groupProps, children: [
2459
+ leftAddon,
2460
+ /* @__PURE__ */ jsxRuntime.jsx(
2461
+ react.Input,
2462
+ {
2463
+ ...inputProps,
2464
+ ref,
2465
+ type: show ? "text" : "password",
2466
+ autoComplete: show ? "off" : autoComplete
2467
+ }
2468
+ ),
2469
+ /* @__PURE__ */ jsxRuntime.jsx(
2470
+ InputRightButton,
2471
+ {
2472
+ onClick: handleClick,
2473
+ "aria-label": label,
2474
+ variant: "ghost",
2475
+ children: icon
2476
+ }
2477
+ )
2478
+ ] });
130
2479
  }
131
2480
  );
132
- if (utils.__DEV__) {
133
- PasswordInput.displayName = "PasswordInput";
134
- }
2481
+ PasswordInput.displayName = "PasswordInput";
2482
+ var mapNestedFields = (name, children) => {
2483
+ return React12__namespace.Children.map(children, (child) => {
2484
+ if (React12__namespace.isValidElement(child) && child.props.name) {
2485
+ return React12__namespace.cloneElement(child, {
2486
+ ...child.props,
2487
+ name: `${name}.${child.props.name}`
2488
+ });
2489
+ }
2490
+ return child;
2491
+ });
2492
+ };
2493
+ var mapOptions = (options) => {
2494
+ return options.map((option) => {
2495
+ if (typeof option === "string") {
2496
+ return {
2497
+ label: option,
2498
+ value: option
2499
+ };
2500
+ }
2501
+ return option;
2502
+ });
2503
+ };
135
2504
  var RadioInput = react.forwardRef(
136
- ({ options, spacing, direction, ...props }, ref) => {
2505
+ ({ options: optionsProp, spacing, direction, ...props }, ref) => {
137
2506
  const { onBlur, onChange, ...groupProps } = props;
138
- return /* @__PURE__ */ React8__namespace.createElement(react.RadioGroup, {
139
- onChange,
140
- ...groupProps
141
- }, /* @__PURE__ */ React8__namespace.createElement(react.Stack, {
142
- spacing,
143
- direction
144
- }, options.map(({ value, label, ...radioProps }, i) => {
145
- return /* @__PURE__ */ React8__namespace.createElement(react.Radio, {
146
- key: i,
147
- onBlur,
148
- value,
149
- ref,
150
- ...radioProps
151
- }, label || value);
152
- })));
2507
+ const options = mapOptions(optionsProp);
2508
+ return /* @__PURE__ */ jsxRuntime.jsx(react.RadioGroup, { onChange, ...groupProps, children: /* @__PURE__ */ jsxRuntime.jsx(react.Stack, { spacing, direction, children: options.map(({ value, label, ...radioProps }, i) => {
2509
+ return /* @__PURE__ */ jsxRuntime.jsx(
2510
+ react.Radio,
2511
+ {
2512
+ onBlur,
2513
+ value,
2514
+ ref,
2515
+ ...radioProps,
2516
+ children: label || value
2517
+ },
2518
+ i
2519
+ );
2520
+ }) }) });
153
2521
  }
154
2522
  );
155
- if (utils.__DEV__) {
156
- RadioInput.displayName = "RadioInput";
157
- }
2523
+ RadioInput.displayName = "RadioInput";
158
2524
  var SelectButton = react.forwardRef((props, ref) => {
159
2525
  const styles = react.useMultiStyleConfig("Input", props);
160
2526
  const focusStyles = styles.field._focusVisible;
@@ -172,20 +2538,13 @@ var SelectButton = react.forwardRef((props, ref) => {
172
2538
  ...styles.field,
173
2539
  h: "auto"
174
2540
  };
175
- return /* @__PURE__ */ React8__namespace.createElement(react.MenuButton, {
176
- as: react.Button,
177
- ...props,
178
- ref,
179
- sx: buttonStyles
180
- });
2541
+ return /* @__PURE__ */ jsxRuntime.jsx(react.MenuButton, { as: react.Button, ...props, ref, sx: buttonStyles });
181
2542
  });
182
- if (utils.__DEV__) {
183
- SelectButton.displayName = "SelectButton";
184
- }
2543
+ SelectButton.displayName = "SelectButton";
185
2544
  var Select = react.forwardRef((props, ref) => {
186
2545
  const {
187
2546
  name,
188
- options,
2547
+ options: optionsProp,
189
2548
  children,
190
2549
  onChange,
191
2550
  defaultValue,
@@ -193,7 +2552,7 @@ var Select = react.forwardRef((props, ref) => {
193
2552
  placeholder,
194
2553
  isDisabled,
195
2554
  leftIcon,
196
- rightIcon = /* @__PURE__ */ React8__namespace.createElement(icons.ChevronDownIcon, null),
2555
+ rightIcon = /* @__PURE__ */ jsxRuntime.jsx(core.ChevronDownIcon, {}),
197
2556
  multiple,
198
2557
  size,
199
2558
  variant,
@@ -202,8 +2561,12 @@ var Select = react.forwardRef((props, ref) => {
202
2561
  ...rest
203
2562
  } = props;
204
2563
  const menuProps = react.omitThemingProps(rest);
205
- const [currentValue, setCurrentValue] = React8__namespace.useState(value || defaultValue);
2564
+ const [currentValue, setCurrentValue] = React12__namespace.useState(value || defaultValue);
206
2565
  const controlProps = react.useFormControl({ name });
2566
+ const options = React12__namespace.useMemo(
2567
+ () => optionsProp && mapOptions(optionsProp),
2568
+ [optionsProp]
2569
+ );
207
2570
  const handleChange = (value2) => {
208
2571
  setCurrentValue(value2);
209
2572
  onChange == null ? void 0 : onChange(value2);
@@ -215,7 +2578,7 @@ var Select = react.forwardRef((props, ref) => {
215
2578
  size,
216
2579
  variant
217
2580
  };
218
- const getDisplayValue = React8__namespace.useCallback(
2581
+ const getDisplayValue = React12__namespace.useCallback(
219
2582
  (value2) => {
220
2583
  if (!options) {
221
2584
  return value2;
@@ -232,60 +2595,38 @@ var Select = react.forwardRef((props, ref) => {
232
2595
  const displayValue = currentValue ? (Array.isArray(currentValue) ? currentValue : [currentValue]).map(
233
2596
  getDisplayValue
234
2597
  ) : [];
235
- return /* @__PURE__ */ React8__namespace.createElement(react.Menu, {
236
- ...menuProps,
237
- closeOnSelect: !multiple
238
- }, /* @__PURE__ */ React8__namespace.createElement(react.chakra.div, {
239
- className: utils.cx("sui-select")
240
- }, /* @__PURE__ */ React8__namespace.createElement(SelectButton, {
241
- ref,
242
- ...buttonProps
243
- }, renderValue(displayValue) || placeholder), /* @__PURE__ */ React8__namespace.createElement(react.MenuList, {
244
- maxH: "60vh",
245
- overflowY: "auto",
246
- ...menuListProps
247
- }, /* @__PURE__ */ React8__namespace.createElement(react.MenuOptionGroup, {
248
- defaultValue: defaultValue || value,
249
- onChange: handleChange,
250
- type: multiple ? "checkbox" : "radio"
251
- }, options ? options.map(({ value: value2, label, ...rest2 }, i) => /* @__PURE__ */ React8__namespace.createElement(react.MenuItemOption, {
252
- key: i,
253
- value: value2,
254
- ...rest2
255
- }, label || value2)) : children)), /* @__PURE__ */ React8__namespace.createElement(react.chakra.input, {
256
- ...controlProps,
257
- name,
258
- type: "hidden",
259
- value: currentValue,
260
- className: "saas-select__input"
261
- })));
2598
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Menu, { ...menuProps, closeOnSelect: !multiple, children: /* @__PURE__ */ jsxRuntime.jsxs(react.chakra.div, { className: utils.cx("sui-select"), children: [
2599
+ /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { ref, ...buttonProps, children: renderValue(displayValue) || placeholder }),
2600
+ /* @__PURE__ */ jsxRuntime.jsx(react.MenuList, { maxH: "60vh", overflowY: "auto", ...menuListProps, children: /* @__PURE__ */ jsxRuntime.jsx(
2601
+ react.MenuOptionGroup,
2602
+ {
2603
+ defaultValue: defaultValue || value,
2604
+ onChange: handleChange,
2605
+ type: multiple ? "checkbox" : "radio",
2606
+ children: options ? options.map(({ value: value2, label, ...rest2 }, i) => /* @__PURE__ */ jsxRuntime.jsx(react.MenuItemOption, { value: value2, ...rest2, children: label || value2 }, i)) : children
2607
+ }
2608
+ ) }),
2609
+ /* @__PURE__ */ jsxRuntime.jsx(
2610
+ react.chakra.input,
2611
+ {
2612
+ ...controlProps,
2613
+ name,
2614
+ type: "hidden",
2615
+ value: currentValue,
2616
+ className: "saas-select__input"
2617
+ }
2618
+ )
2619
+ ] }) });
262
2620
  });
263
- if (utils.__DEV__) {
264
- Select.displayName = "Select";
265
- }
2621
+ Select.displayName = "Select";
266
2622
  var NativeSelect = react.forwardRef(
267
2623
  ({ options, children, ...props }, ref) => {
268
- return /* @__PURE__ */ React8__namespace.createElement(react.Select, {
269
- ref,
270
- ...props
271
- }, children || (options == null ? void 0 : options.map(({ value, label }) => {
272
- return /* @__PURE__ */ React8__namespace.createElement("option", {
273
- key: value,
274
- value
275
- }, label || value);
276
- })));
2624
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Select, { ref, ...props, children: children || (options == null ? void 0 : options.map(({ value, label }) => {
2625
+ return /* @__PURE__ */ jsxRuntime.jsx("option", { value, children: label || value }, value);
2626
+ })) });
277
2627
  }
278
2628
  );
279
- if (utils.__DEV__) {
280
- NativeSelect.displayName = "NativeSelect";
281
- }
282
-
283
- // src/field.tsx
284
- var inputTypes = {};
285
- var defaultInputType = "text";
286
- var getInput = (type) => {
287
- return inputTypes[type] || inputTypes[defaultInputType];
288
- };
2629
+ NativeSelect.displayName = "NativeSelect";
289
2630
  var getError = (name, formState) => {
290
2631
  return reactHookForm.get(formState.errors, name);
291
2632
  };
@@ -293,25 +2634,17 @@ var BaseField = (props) => {
293
2634
  const { name, label, help, hideLabel, children, ...controlProps } = props;
294
2635
  const { formState } = reactHookForm.useFormContext();
295
2636
  const error = getError(name, formState);
296
- return /* @__PURE__ */ React8__namespace.createElement(react.FormControl, {
297
- ...controlProps,
298
- isInvalid: !!error
299
- }, label && !hideLabel ? /* @__PURE__ */ React8__namespace.createElement(react.FormLabel, null, label) : null, /* @__PURE__ */ React8__namespace.createElement(react.Box, null, children, help && !(error == null ? void 0 : error.message) ? /* @__PURE__ */ React8__namespace.createElement(react.FormHelperText, null, help) : null, (error == null ? void 0 : error.message) && /* @__PURE__ */ React8__namespace.createElement(react.FormErrorMessage, null, error == null ? void 0 : error.message)));
2637
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.FormControl, { ...controlProps, isInvalid: !!error, children: [
2638
+ label && !hideLabel ? /* @__PURE__ */ jsxRuntime.jsx(react.FormLabel, { children: label }) : null,
2639
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
2640
+ children,
2641
+ help && !(error == null ? void 0 : error.message) ? /* @__PURE__ */ jsxRuntime.jsx(react.FormHelperText, { children: help }) : null,
2642
+ (error == null ? void 0 : error.message) && /* @__PURE__ */ jsxRuntime.jsx(react.FormErrorMessage, { children: error == null ? void 0 : error.message })
2643
+ ] })
2644
+ ] });
300
2645
  };
301
- if (utils.__DEV__) {
302
- BaseField.displayName = "BaseField";
303
- }
304
- var Field = React8__namespace.forwardRef(
305
- (props, ref) => {
306
- const { type = defaultInputType } = props;
307
- const InputComponent = getInput(type);
308
- return /* @__PURE__ */ React8__namespace.createElement(InputComponent, {
309
- ref,
310
- ...props
311
- });
312
- }
313
- );
314
- var createField = (InputComponent, { displayName, hideLabel, BaseField: BaseField2 }) => {
2646
+ BaseField.displayName = "BaseField";
2647
+ var _createField = (InputComponent, { displayName, hideLabel, BaseField: BaseField2 }) => {
315
2648
  const Field2 = react.forwardRef((props, ref) => {
316
2649
  const {
317
2650
  id,
@@ -329,24 +2662,31 @@ var createField = (InputComponent, { displayName, hideLabel, BaseField: BaseFiel
329
2662
  required: isRequired,
330
2663
  ...rules
331
2664
  };
332
- return /* @__PURE__ */ React8__namespace.createElement(BaseField2, {
333
- id,
334
- name,
335
- label,
336
- help,
337
- hideLabel,
338
- isDisabled,
339
- isInvalid,
340
- isReadOnly,
341
- isRequired
342
- }, /* @__PURE__ */ React8__namespace.createElement(InputComponent, {
343
- ref,
344
- id,
345
- name,
346
- label: hideLabel ? label : void 0,
347
- rules: inputRules,
348
- ...inputProps
349
- }));
2665
+ return /* @__PURE__ */ jsxRuntime.jsx(
2666
+ BaseField2,
2667
+ {
2668
+ id,
2669
+ name,
2670
+ label,
2671
+ help,
2672
+ hideLabel,
2673
+ isDisabled,
2674
+ isInvalid,
2675
+ isReadOnly,
2676
+ isRequired,
2677
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2678
+ InputComponent,
2679
+ {
2680
+ ref,
2681
+ id,
2682
+ name,
2683
+ label: hideLabel ? label : void 0,
2684
+ rules: inputRules,
2685
+ ...inputProps
2686
+ }
2687
+ )
2688
+ }
2689
+ );
350
2690
  });
351
2691
  Field2.displayName = displayName;
352
2692
  return Field2;
@@ -355,18 +2695,24 @@ var withControlledInput = (InputComponent) => {
355
2695
  return react.forwardRef(
356
2696
  ({ name, rules, ...inputProps }, ref) => {
357
2697
  const { control } = reactHookForm.useFormContext();
358
- return /* @__PURE__ */ React8__namespace.createElement(reactHookForm.Controller, {
359
- name,
360
- control,
361
- rules,
362
- render: ({ field: { ref: _ref, ...field } }) => /* @__PURE__ */ React8__namespace.createElement(InputComponent, {
363
- ...field,
364
- ...inputProps,
365
- onChange: utils.callAllHandlers(inputProps.onChange, field.onChange),
366
- onBlur: utils.callAllHandlers(inputProps.onBlur, field.onBlur),
367
- ref: react.useMergeRefs(ref, _ref)
368
- })
369
- });
2698
+ return /* @__PURE__ */ jsxRuntime.jsx(
2699
+ reactHookForm.Controller,
2700
+ {
2701
+ name,
2702
+ control,
2703
+ rules,
2704
+ render: ({ field: { ref: _ref, ...field } }) => /* @__PURE__ */ jsxRuntime.jsx(
2705
+ InputComponent,
2706
+ {
2707
+ ...field,
2708
+ ...inputProps,
2709
+ onChange: utils.callAllHandlers(inputProps.onChange, field.onChange),
2710
+ onBlur: utils.callAllHandlers(inputProps.onBlur, field.onBlur),
2711
+ ref: react.useMergeRefs(ref, _ref)
2712
+ }
2713
+ )
2714
+ }
2715
+ );
370
2716
  }
371
2717
  );
372
2718
  };
@@ -375,133 +2721,135 @@ var withUncontrolledInput = (InputComponent) => {
375
2721
  ({ name, rules, ...inputProps }, ref) => {
376
2722
  const { register } = reactHookForm.useFormContext();
377
2723
  const { ref: _ref, ...field } = register(name, rules);
378
- return /* @__PURE__ */ React8__namespace.createElement(InputComponent, {
379
- ...field,
380
- ...inputProps,
381
- onChange: utils.callAllHandlers(inputProps.onChange, field.onChange),
382
- onBlur: utils.callAllHandlers(inputProps.onBlur, field.onBlur),
383
- ref: react.useMergeRefs(ref, _ref)
384
- });
2724
+ return /* @__PURE__ */ jsxRuntime.jsx(
2725
+ InputComponent,
2726
+ {
2727
+ ...field,
2728
+ ...inputProps,
2729
+ onChange: utils.callAllHandlers(inputProps.onChange, field.onChange),
2730
+ onBlur: utils.callAllHandlers(inputProps.onBlur, field.onBlur),
2731
+ ref: react.useMergeRefs(ref, _ref)
2732
+ }
2733
+ );
385
2734
  }
386
2735
  );
387
2736
  };
388
- var registerFieldType = (type, component, options) => {
2737
+ var createField = (component, options) => {
2738
+ var _a2;
389
2739
  let InputComponent;
390
2740
  if (options == null ? void 0 : options.isControlled) {
391
2741
  InputComponent = withControlledInput(component);
392
2742
  } else {
393
2743
  InputComponent = withUncontrolledInput(component);
394
2744
  }
395
- const Field2 = createField(InputComponent, {
396
- displayName: `${type.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("")}Field`,
2745
+ const Field2 = _createField(InputComponent, {
2746
+ displayName: `${(_a2 = component.displayName) != null ? _a2 : "Custom"}Field`,
397
2747
  hideLabel: options == null ? void 0 : options.hideLabel,
398
2748
  BaseField: (options == null ? void 0 : options.BaseField) || BaseField
399
2749
  });
400
- inputTypes[type] = Field2;
401
2750
  return Field2;
402
2751
  };
403
- var InputField = registerFieldType(
404
- "text",
2752
+ var InputField = createField(
405
2753
  react.forwardRef(({ type = "text", leftAddon, rightAddon, size, ...rest }, ref) => {
406
- const input = /* @__PURE__ */ React8__namespace.createElement(react.Input, {
407
- type,
408
- size,
409
- ...rest,
410
- ref
411
- });
2754
+ const input = /* @__PURE__ */ jsxRuntime.jsx(react.Input, { type, size, ...rest, ref });
412
2755
  if (leftAddon || rightAddon) {
413
- return /* @__PURE__ */ React8__namespace.createElement(react.InputGroup, {
414
- size
415
- }, leftAddon, input, rightAddon);
2756
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.InputGroup, { size, children: [
2757
+ leftAddon,
2758
+ input,
2759
+ rightAddon
2760
+ ] });
416
2761
  }
417
2762
  return input;
418
2763
  })
419
2764
  );
420
- var NumberInputField2 = registerFieldType(
421
- "number",
2765
+ var NumberInputField2 = createField(
422
2766
  NumberInput,
423
2767
  {
424
2768
  isControlled: true
425
2769
  }
426
2770
  );
427
- var PasswordInputField = registerFieldType(
428
- "password",
429
- react.forwardRef((props, ref) => /* @__PURE__ */ React8__namespace.createElement(PasswordInput, {
430
- ref,
431
- ...props
432
- }))
2771
+ var PasswordInputField = createField(
2772
+ react.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(PasswordInput, { ref, ...props }))
433
2773
  );
434
- var TextareaField = registerFieldType(
435
- "textarea",
436
- react.Textarea
437
- );
438
- var SwitchField = registerFieldType(
439
- "switch",
2774
+ var TextareaField = createField(react.Textarea);
2775
+ var SwitchField = createField(
440
2776
  react.forwardRef(({ type, value, ...rest }, ref) => {
441
- return /* @__PURE__ */ React8__namespace.createElement(react.Switch, {
442
- isChecked: !!value,
443
- ...rest,
444
- ref
445
- });
2777
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Switch, { isChecked: !!value, ...rest, ref });
446
2778
  }),
447
2779
  {
448
2780
  isControlled: true
449
2781
  }
450
2782
  );
451
- var SelectField = registerFieldType("select", Select, {
2783
+ var SelectField = createField(Select, {
452
2784
  isControlled: true
453
2785
  });
454
- var CheckboxField = registerFieldType(
455
- "checkbox",
2786
+ var CheckboxField = createField(
456
2787
  react.forwardRef(({ label, type, ...props }, ref) => {
457
- return /* @__PURE__ */ React8__namespace.createElement(react.Checkbox, {
458
- ref,
459
- ...props
460
- }, label);
2788
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Checkbox, { ref, ...props, children: label });
461
2789
  }),
462
2790
  {
463
2791
  hideLabel: true
464
2792
  }
465
2793
  );
466
- var RadioField = registerFieldType(
467
- "radio",
468
- RadioInput,
469
- {
470
- isControlled: true
471
- }
472
- );
473
- var NativeSelectField = registerFieldType(
474
- "native-select",
475
- NativeSelect,
476
- { isControlled: true }
477
- );
478
- var PinField = registerFieldType(
479
- "pin",
2794
+ var RadioField = createField(RadioInput, {
2795
+ isControlled: true
2796
+ });
2797
+ var NativeSelectField = createField(NativeSelect, {
2798
+ isControlled: true
2799
+ });
2800
+ var PinField = createField(
480
2801
  react.forwardRef((props, ref) => {
481
2802
  const { pinLength = 4, pinType, spacing, ...inputProps } = props;
482
2803
  const inputs = [];
483
2804
  for (let i = 0; i < pinLength; i++) {
484
- inputs.push(/* @__PURE__ */ React8__namespace.createElement(react.PinInputField, {
485
- key: i,
486
- ref
487
- }));
488
- }
489
- return /* @__PURE__ */ React8__namespace.createElement(react.HStack, {
490
- spacing
491
- }, /* @__PURE__ */ React8__namespace.createElement(react.PinInput, {
492
- ...inputProps,
493
- type: pinType
494
- }, inputs));
2805
+ inputs.push(/* @__PURE__ */ jsxRuntime.jsx(react.PinInputField, { ref }, i));
2806
+ }
2807
+ return /* @__PURE__ */ jsxRuntime.jsx(react.HStack, { spacing, children: /* @__PURE__ */ jsxRuntime.jsx(react.PinInput, { ...inputProps, type: pinType, children: inputs }) });
495
2808
  }),
496
2809
  {
497
2810
  isControlled: true
498
2811
  }
499
2812
  );
2813
+ var defaultFieldTypes = {
2814
+ text: InputField,
2815
+ email: InputField,
2816
+ url: InputField,
2817
+ phone: InputField,
2818
+ number: NumberInputField2,
2819
+ password: PasswordInputField,
2820
+ textarea: TextareaField,
2821
+ switch: SwitchField,
2822
+ select: SelectField,
2823
+ checkbox: CheckboxField,
2824
+ radio: RadioField,
2825
+ pin: PinField,
2826
+ "native-select": NativeSelectField
2827
+ };
2828
+ var FieldsContext = React12__namespace.default.createContext(
2829
+ null
2830
+ );
2831
+ var FieldsProvider = (props) => {
2832
+ const fields = { ...defaultFieldTypes, ...props.value };
2833
+ return /* @__PURE__ */ jsxRuntime.jsx(FieldsContext.Provider, { value: fields, children: props.children });
2834
+ };
2835
+ var useField = (type) => {
2836
+ const context = React12__namespace.default.useContext(FieldsContext);
2837
+ return (context == null ? void 0 : context[type]) || InputField;
2838
+ };
2839
+ var defaultInputType = "text";
2840
+ var Field = React12__namespace.forwardRef(
2841
+ (props, ref) => {
2842
+ const { type = defaultInputType } = props;
2843
+ const InputComponent = useField(type);
2844
+ return /* @__PURE__ */ jsxRuntime.jsx(InputComponent, { ref, ...props });
2845
+ }
2846
+ );
500
2847
  var mapFields = (schema) => schema && Object.entries(schema).map(([name, { items, label, title, ...field }]) => {
501
2848
  return {
502
2849
  ...field,
503
2850
  name,
504
2851
  label: label || title || name
2852
+ // json schema compatibility
505
2853
  };
506
2854
  });
507
2855
  var objectFieldResolver = (schema) => {
@@ -509,11 +2857,11 @@ var objectFieldResolver = (schema) => {
509
2857
  return mapFields(schema);
510
2858
  };
511
2859
  const getNestedFields = (name) => {
512
- var _a;
2860
+ var _a2;
513
2861
  const field = utils.get(schema, name);
514
2862
  if (!field)
515
2863
  return [];
516
- if (((_a = field.items) == null ? void 0 : _a.type) === "object") {
2864
+ if (((_a2 = field.items) == null ? void 0 : _a2.type) === "object") {
517
2865
  return mapFields(field.items.properties);
518
2866
  } else if (field.type === "object") {
519
2867
  return mapFields(field.properties);
@@ -522,11 +2870,9 @@ var objectFieldResolver = (schema) => {
522
2870
  };
523
2871
  return { getFields, getNestedFields };
524
2872
  };
525
-
526
- // src/form.tsx
527
2873
  var Form = react.forwardRef(
528
2874
  (props, ref) => {
529
- var _a;
2875
+ var _a2;
530
2876
  const {
531
2877
  mode = "all",
532
2878
  resolver,
@@ -563,89 +2909,64 @@ var Form = react.forwardRef(
563
2909
  resetOptions
564
2910
  };
565
2911
  if (schema && !resolver) {
566
- form.resolver = (_a = Form.getResolver) == null ? void 0 : _a.call(Form, schema);
2912
+ form.resolver = (_a2 = Form.getResolver) == null ? void 0 : _a2.call(Form, schema);
567
2913
  }
568
2914
  const methods = reactHookForm.useForm(form);
569
2915
  const { handleSubmit } = methods;
570
- React8__namespace.useImperativeHandle(formRef, () => methods, [formRef, methods]);
571
- React8__namespace.useEffect(() => {
2916
+ React12__namespace.useImperativeHandle(formRef, () => methods, [formRef, methods]);
2917
+ React12__namespace.useEffect(() => {
572
2918
  let subscription;
573
2919
  if (onChange) {
574
2920
  subscription = methods.watch(onChange);
575
2921
  }
576
2922
  return () => subscription == null ? void 0 : subscription.unsubscribe();
577
2923
  }, [methods, onChange]);
578
- const Field2 = React8__namespace.useMemo(
579
- () => (props2) => /* @__PURE__ */ React8__namespace.createElement(Field, {
580
- ...props2
581
- }),
582
- []
583
- );
584
- return /* @__PURE__ */ React8__namespace.createElement(reactHookForm.FormProvider, {
585
- ...methods
586
- }, /* @__PURE__ */ React8__namespace.createElement(react.chakra.form, {
587
- ref,
588
- onSubmit: handleSubmit(onSubmit, onError),
589
- ...rest,
590
- className: utils.cx("sui-form", props.className)
591
- }, utils.runIfFn(children, {
592
- Field: Field2,
593
- ...methods
594
- })));
2924
+ return /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.FormProvider, { ...methods, children: /* @__PURE__ */ jsxRuntime.jsx(
2925
+ react.chakra.form,
2926
+ {
2927
+ ref,
2928
+ onSubmit: handleSubmit(onSubmit, onError),
2929
+ ...rest,
2930
+ className: utils.cx("sui-form", props.className),
2931
+ children: utils.runIfFn(children, {
2932
+ Field,
2933
+ ...methods
2934
+ })
2935
+ }
2936
+ ) });
595
2937
  }
596
2938
  );
597
2939
  Form.getFieldResolver = objectFieldResolver;
598
2940
  Form.displayName = "Form";
599
- function createForm({ resolver }) {
600
- const CreateForm = (props) => {
601
- const { schema, ...rest } = props;
602
- return /* @__PURE__ */ React8__namespace.createElement(Form, {
603
- resolver: resolver == null ? void 0 : resolver(props.schema),
604
- ...rest
605
- });
606
- };
607
- return CreateForm;
608
- }
609
2941
  var FormLayoutItem = ({ children }) => {
610
- return /* @__PURE__ */ React8__namespace.createElement(react.chakra.div, null, children);
2942
+ return /* @__PURE__ */ jsxRuntime.jsx(react.chakra.div, { children });
611
2943
  };
612
- if (utils.__DEV__) {
613
- FormLayoutItem.displayName = "FormLayoutItem";
614
- }
2944
+ FormLayoutItem.displayName = "FormLayoutItem";
615
2945
  var FormLayout = ({ children, ...props }) => {
616
- var _a, _b, _c;
2946
+ var _a2, _b, _c;
617
2947
  const theme = react.useTheme();
618
- const defaultProps = (_c = (_b = (_a = theme.components) == null ? void 0 : _a.FormLayout) == null ? void 0 : _b.defaultProps) != null ? _c : {
2948
+ const defaultProps = (_c = (_b = (_a2 = theme.components) == null ? void 0 : _a2.SuiFormLayout) == null ? void 0 : _b.defaultProps) != null ? _c : {
619
2949
  spacing: 4
620
2950
  };
621
2951
  const gridProps = {
622
2952
  ...defaultProps,
623
2953
  ...props
624
2954
  };
625
- return /* @__PURE__ */ React8__namespace.createElement(react.SimpleGrid, {
626
- ...gridProps,
627
- className: utils.cx("sui-form__layout", props.className)
628
- }, React8__namespace.Children.map(children, (child) => {
629
- if (React8__namespace.isValidElement(child)) {
630
- return /* @__PURE__ */ React8__namespace.createElement(FormLayoutItem, null, child);
631
- }
632
- return child;
633
- }));
634
- };
635
- if (utils.__DEV__) {
636
- FormLayout.displayName = "FormLayout";
637
- }
638
- var mapNestedFields = (name, children) => {
639
- return React8__namespace.Children.map(children, (child) => {
640
- if (React8__namespace.isValidElement(child) && child.props.name) {
641
- return React8__namespace.cloneElement(child, {
642
- ...child.props,
643
- name: `${name}.${child.props.name}`
644
- });
2955
+ return /* @__PURE__ */ jsxRuntime.jsx(
2956
+ react.SimpleGrid,
2957
+ {
2958
+ ...gridProps,
2959
+ className: utils.cx("sui-form__layout", props.className),
2960
+ children: React12__namespace.Children.map(children, (child) => {
2961
+ if (React12__namespace.isValidElement(child)) {
2962
+ return /* @__PURE__ */ jsxRuntime.jsx(FormLayoutItem, { children: child });
2963
+ }
2964
+ return child;
2965
+ })
645
2966
  }
646
- return child;
647
- });
2967
+ );
648
2968
  };
2969
+ FormLayout.displayName = "FormLayout";
649
2970
  var [ArrayFieldProvider, useArrayFieldContext] = reactUtils.createContext({
650
2971
  name: "ArrayFieldContext"
651
2972
  });
@@ -676,7 +2997,7 @@ var useArrayField = ({
676
2997
  var useArrayFieldRow = ({ index }) => {
677
2998
  const { clearErrors } = reactHookForm.useFormContext();
678
2999
  const { name, remove, fields } = useArrayFieldContext();
679
- React8__namespace.useEffect(() => {
3000
+ React12__namespace.useEffect(() => {
680
3001
  clearErrors(name);
681
3002
  }, []);
682
3003
  return {
@@ -684,7 +3005,7 @@ var useArrayFieldRow = ({ index }) => {
684
3005
  isFirst: index === 0,
685
3006
  isLast: index === fields.length - 1,
686
3007
  name: `${name}.${index}`,
687
- remove: React8__namespace.useCallback(() => {
3008
+ remove: React12__namespace.useCallback(() => {
688
3009
  clearErrors(name);
689
3010
  remove(index);
690
3011
  }, [index])
@@ -709,39 +3030,29 @@ var useArrayFieldAddButton = () => {
709
3030
  isDisabled
710
3031
  };
711
3032
  };
712
-
713
- // src/array-field.tsx
714
3033
  var ArrayFieldRow = ({
715
3034
  children,
716
3035
  index,
717
3036
  ...rowFieldsProps
718
3037
  }) => {
719
- return /* @__PURE__ */ React8__namespace.createElement(ArrayFieldRowContainer, {
720
- index
721
- }, /* @__PURE__ */ React8__namespace.createElement(ArrayFieldRowFields, {
722
- ...rowFieldsProps
723
- }, children), /* @__PURE__ */ React8__namespace.createElement(ArrayFieldRemoveButton, null));
724
- };
725
- if (utils.__DEV__) {
726
- ArrayFieldRow.displayName = "ArrayFieldRow";
727
- }
3038
+ return /* @__PURE__ */ jsxRuntime.jsxs(ArrayFieldRowContainer, { index, children: [
3039
+ /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldRowFields, { ...rowFieldsProps, children }),
3040
+ /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldRemoveButton, {})
3041
+ ] });
3042
+ };
3043
+ ArrayFieldRow.displayName = "ArrayFieldRow";
728
3044
  var ArrayFieldRowFields = ({
729
3045
  children,
730
3046
  ...layoutProps
731
3047
  }) => {
732
3048
  const { name } = useArrayFieldRowContext();
733
- return /* @__PURE__ */ React8__namespace.createElement(FormLayout, {
734
- flex: "1",
735
- mr: "2",
736
- ...layoutProps
737
- }, mapNestedFields(name, children));
738
- };
739
- if (utils.__DEV__) {
740
- ArrayFieldRowFields.displayName = "ArrayFieldRowFields";
741
- }
3049
+ return /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { flex: "1", mr: "2", ...layoutProps, children: mapNestedFields(name, children) });
3050
+ };
3051
+ ArrayFieldRowFields.displayName = "ArrayFieldRowFields";
742
3052
  var ArrayFieldRowContainer = ({
743
3053
  children,
744
- index
3054
+ index,
3055
+ ...rest
745
3056
  }) => {
746
3057
  const context = useArrayFieldRow({ index });
747
3058
  const styles = {
@@ -751,61 +3062,44 @@ var ArrayFieldRowContainer = ({
751
3062
  width: "100%",
752
3063
  mb: 4
753
3064
  };
754
- return /* @__PURE__ */ React8__namespace.createElement(ArrayFieldRowProvider, {
755
- value: context
756
- }, /* @__PURE__ */ React8__namespace.createElement(react.chakra.div, {
757
- __css: styles
758
- }, children));
3065
+ return /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldRowProvider, { value: context, children: /* @__PURE__ */ jsxRuntime.jsx(react.chakra.div, { ...rest, __css: styles, children }) });
759
3066
  };
760
- if (utils.__DEV__) {
761
- ArrayFieldRowContainer.displayName = "ArrayFieldRowContainer";
762
- }
3067
+ ArrayFieldRowContainer.displayName = "ArrayFieldRowContainer";
763
3068
  var ArrayFieldRemoveButton = (props) => {
764
- return /* @__PURE__ */ React8__namespace.createElement(react.Button, {
765
- "aria-label": "Remove row",
766
- ...useArrayFieldRemoveButton(),
767
- ...props
768
- }, props.children || /* @__PURE__ */ React8__namespace.createElement(icons.MinusIcon, null));
3069
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Button, { "aria-label": "Remove row", ...useArrayFieldRemoveButton(), ...props, children: props.children || /* @__PURE__ */ jsxRuntime.jsx(MinusIcon, {}) });
769
3070
  };
770
- if (utils.__DEV__) {
771
- ArrayFieldRemoveButton.displayName = "ArrayFieldRemoveButton";
772
- }
3071
+ ArrayFieldRemoveButton.displayName = "ArrayFieldRemoveButton";
773
3072
  var ArrayFieldAddButton = (props) => {
774
- return /* @__PURE__ */ React8__namespace.createElement(react.Button, {
775
- "aria-label": "Add row",
776
- float: "right",
777
- ...useArrayFieldAddButton(),
778
- ...props
779
- }, props.children || /* @__PURE__ */ React8__namespace.createElement(icons.AddIcon, null));
3073
+ return /* @__PURE__ */ jsxRuntime.jsx(
3074
+ react.Button,
3075
+ {
3076
+ "aria-label": "Add row",
3077
+ float: "right",
3078
+ ...useArrayFieldAddButton(),
3079
+ ...props,
3080
+ children: props.children || /* @__PURE__ */ jsxRuntime.jsx(AddIcon, {})
3081
+ }
3082
+ );
780
3083
  };
781
- if (utils.__DEV__) {
782
- ArrayFieldAddButton.displayName = "ArrayFieldAddButton";
783
- }
3084
+ ArrayFieldAddButton.displayName = "ArrayFieldAddButton";
784
3085
  var ArrayField = react.forwardRef(
785
3086
  (props, ref) => {
786
3087
  const { children, ...containerProps } = props;
787
- return /* @__PURE__ */ React8__namespace.createElement(ArrayFieldContainer, {
788
- ref,
789
- ...containerProps
790
- }, /* @__PURE__ */ React8__namespace.createElement(ArrayFieldRows, null, (fields) => /* @__PURE__ */ React8__namespace.createElement(React8__namespace.Fragment, null, fields.map(({ id }, index) => /* @__PURE__ */ React8__namespace.createElement(ArrayFieldRow, {
791
- key: id,
792
- index
793
- }, children)))), /* @__PURE__ */ React8__namespace.createElement(ArrayFieldAddButton, null));
3088
+ return /* @__PURE__ */ jsxRuntime.jsxs(ArrayFieldContainer, { ref, ...containerProps, children: [
3089
+ /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldRows, { children: (fields) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fields.map(({ id }, index) => /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldRow, { index, children }, id)) }) }),
3090
+ /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldAddButton, {})
3091
+ ] });
794
3092
  }
795
3093
  );
796
- if (utils.__DEV__) {
797
- ArrayField.displayName = "ArrayField";
798
- }
3094
+ ArrayField.displayName = "ArrayField";
799
3095
  var ArrayFieldRows = ({
800
3096
  children
801
3097
  }) => {
802
3098
  const { fields } = useArrayFieldContext();
803
3099
  return children(fields);
804
3100
  };
805
- if (utils.__DEV__) {
806
- ArrayFieldRows.displayName = "ArrayFieldRows";
807
- }
808
- var ArrayFieldContainer = React8__namespace.forwardRef(
3101
+ ArrayFieldRows.displayName = "ArrayFieldRows";
3102
+ var ArrayFieldContainer = React12__namespace.forwardRef(
809
3103
  ({
810
3104
  name,
811
3105
  defaultValue,
@@ -822,74 +3116,56 @@ var ArrayFieldContainer = React8__namespace.forwardRef(
822
3116
  min,
823
3117
  max
824
3118
  });
825
- React8__namespace.useImperativeHandle(ref, () => context, [ref, context]);
826
- return /* @__PURE__ */ React8__namespace.createElement(ArrayFieldProvider, {
827
- value: context
828
- }, /* @__PURE__ */ React8__namespace.createElement(BaseField, {
829
- name,
830
- ...fieldProps
831
- }, children));
3119
+ React12__namespace.useImperativeHandle(ref, () => context, [ref, context]);
3120
+ return /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldProvider, { value: context, children: /* @__PURE__ */ jsxRuntime.jsx(BaseField, { name, ...fieldProps, children }) });
832
3121
  }
833
3122
  );
834
- if (utils.__DEV__) {
835
- ArrayFieldContainer.displayName = "ArrayFieldContainer";
836
- }
3123
+ ArrayFieldContainer.displayName = "ArrayFieldContainer";
837
3124
  var FormLegend = (props) => {
838
3125
  const styles = react.useStyleConfig("SuiFormLegend");
839
- return /* @__PURE__ */ React8__namespace.createElement(react.FormLabel, {
840
- as: "legend",
841
- sx: styles,
842
- ...props
843
- });
3126
+ return /* @__PURE__ */ jsxRuntime.jsx(react.FormLabel, { as: "legend", sx: styles, ...props });
844
3127
  };
845
3128
  var ObjectField = (props) => {
846
3129
  const { name, label, hideLabel, children, columns, spacing, ...fieldProps } = props;
847
- return /* @__PURE__ */ React8__namespace.createElement(react.FormControl, {
848
- name,
849
- as: "fieldset",
850
- ...fieldProps
851
- }, /* @__PURE__ */ React8__namespace.createElement(FormLegend, {
852
- display: hideLabel ? "none" : "block"
853
- }, label), /* @__PURE__ */ React8__namespace.createElement(FormLayout, {
854
- columns,
855
- gridGap: spacing
856
- }, mapNestedFields(name, children)));
857
- };
858
- if (utils.__DEV__) {
859
- ObjectField.displayName = "ObjectField";
860
- }
3130
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.FormControl, { name, as: "fieldset", ...fieldProps, children: [
3131
+ /* @__PURE__ */ jsxRuntime.jsx(FormLegend, { display: hideLabel ? "none" : "block", children: label }),
3132
+ /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { columns, gridGap: spacing, children: mapNestedFields(name, children) })
3133
+ ] });
3134
+ };
3135
+ ObjectField.displayName = "ObjectField";
861
3136
  var mapNestedFields2 = (resolver, name) => {
862
- var _a;
863
- return (_a = resolver.getNestedFields(name)) == null ? void 0 : _a.map(
864
- ({ name: name2, type, ...nestedFieldProps }, i) => /* @__PURE__ */ React8__namespace.createElement(Field, {
865
- key: name2 || i,
866
- name: name2,
867
- type,
868
- ...nestedFieldProps
869
- })
3137
+ var _a2;
3138
+ return (_a2 = resolver.getNestedFields(name)) == null ? void 0 : _a2.map(
3139
+ ({ name: name2, type, ...nestedFieldProps }, i) => /* @__PURE__ */ jsxRuntime.jsx(
3140
+ Field,
3141
+ {
3142
+ name: name2,
3143
+ type,
3144
+ ...nestedFieldProps
3145
+ },
3146
+ name2 || i
3147
+ )
870
3148
  );
871
3149
  };
872
- var Fields = ({
3150
+ var AutoFields = ({
873
3151
  schema,
874
3152
  fieldResolver,
875
3153
  focusFirstField,
876
3154
  ...props
877
3155
  }) => {
878
- const resolver = React8__namespace.useMemo(
3156
+ const resolver = React12__namespace.useMemo(
879
3157
  () => fieldResolver || Form.getFieldResolver(schema),
880
3158
  [schema, fieldResolver]
881
3159
  );
882
- const fields = React8__namespace.useMemo(() => resolver.getFields(), [resolver]);
3160
+ const fields = React12__namespace.useMemo(() => resolver.getFields(), [resolver]);
883
3161
  const form = reactHookForm.useFormContext();
884
- React8__namespace.useEffect(() => {
885
- var _a;
886
- if (focusFirstField && ((_a = fields[0]) == null ? void 0 : _a.name)) {
3162
+ React12__namespace.useEffect(() => {
3163
+ var _a2;
3164
+ if (focusFirstField && ((_a2 = fields[0]) == null ? void 0 : _a2.name)) {
887
3165
  form.setFocus(fields[0].name);
888
3166
  }
889
3167
  }, [schema, fieldResolver, focusFirstField]);
890
- return /* @__PURE__ */ React8__namespace.createElement(FormLayout, {
891
- ...props
892
- }, fields.map(
3168
+ return /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { ...props, children: fields.map(
893
3169
  ({
894
3170
  name,
895
3171
  type,
@@ -897,28 +3173,15 @@ var Fields = ({
897
3173
  ...fieldProps
898
3174
  }) => {
899
3175
  if (type === "array") {
900
- return /* @__PURE__ */ React8__namespace.createElement(ArrayField, {
901
- key: name,
902
- name,
903
- ...fieldProps
904
- }, mapNestedFields2(resolver, name));
3176
+ return /* @__PURE__ */ jsxRuntime.jsx(ArrayField, { name, ...fieldProps, children: mapNestedFields2(resolver, name) }, name);
905
3177
  } else if (type === "object") {
906
- return /* @__PURE__ */ React8__namespace.createElement(ObjectField, {
907
- key: name,
908
- name,
909
- ...fieldProps
910
- }, mapNestedFields2(resolver, name));
3178
+ return /* @__PURE__ */ jsxRuntime.jsx(ObjectField, { name, ...fieldProps, children: mapNestedFields2(resolver, name) }, name);
911
3179
  }
912
- return /* @__PURE__ */ React8__namespace.createElement(Field, {
913
- key: name,
914
- name,
915
- type,
916
- ...fieldProps
917
- });
3180
+ return /* @__PURE__ */ jsxRuntime.jsx(Field, { name, type, ...fieldProps }, name);
918
3181
  }
919
- ));
3182
+ ) });
920
3183
  };
921
- Fields.displayName = "Fields";
3184
+ AutoFields.displayName = "Fields";
922
3185
  var SubmitButton = react.forwardRef(
923
3186
  (props, ref) => {
924
3187
  const {
@@ -931,13 +3194,17 @@ var SubmitButton = react.forwardRef(
931
3194
  } = props;
932
3195
  const { formState } = reactHookForm.useFormContext();
933
3196
  const isDisabled = disableIfUntouched && !formState.isDirty || disableIfInvalid && !formState.isValid || isDisabledProp;
934
- return /* @__PURE__ */ React8__namespace.createElement(react.Button, {
935
- ...rest,
936
- ref,
937
- type: "submit",
938
- isLoading: formState.isSubmitting || isLoading,
939
- isDisabled
940
- }, children);
3197
+ return /* @__PURE__ */ jsxRuntime.jsx(
3198
+ react.Button,
3199
+ {
3200
+ ...rest,
3201
+ ref,
3202
+ type: "submit",
3203
+ isLoading: formState.isSubmitting || isLoading,
3204
+ isDisabled,
3205
+ children
3206
+ }
3207
+ );
941
3208
  }
942
3209
  );
943
3210
  SubmitButton.defaultProps = {
@@ -946,8 +3213,6 @@ SubmitButton.defaultProps = {
946
3213
  disableIfInvalid: false
947
3214
  };
948
3215
  SubmitButton.displayName = "SubmitButton";
949
-
950
- // src/auto-form.tsx
951
3216
  var AutoForm = react.forwardRef(
952
3217
  (props, ref) => {
953
3218
  const {
@@ -957,14 +3222,11 @@ var AutoForm = react.forwardRef(
957
3222
  children,
958
3223
  ...rest
959
3224
  } = props;
960
- return /* @__PURE__ */ React8__namespace.createElement(Form, {
961
- ...rest,
962
- schema,
963
- ref
964
- }, /* @__PURE__ */ React8__namespace.createElement(FormLayout, null, /* @__PURE__ */ React8__namespace.createElement(Fields, {
965
- schema,
966
- fieldResolver
967
- }), submitLabel && /* @__PURE__ */ React8__namespace.createElement(SubmitButton, null, submitLabel), children));
3225
+ return /* @__PURE__ */ jsxRuntime.jsx(Form, { ...rest, schema, ref, children: /* @__PURE__ */ jsxRuntime.jsxs(FormLayout, { children: [
3226
+ /* @__PURE__ */ jsxRuntime.jsx(AutoFields, { schema, fieldResolver }),
3227
+ submitLabel && /* @__PURE__ */ jsxRuntime.jsx(SubmitButton, { children: submitLabel }),
3228
+ children
3229
+ ] }) });
968
3230
  }
969
3231
  );
970
3232
  AutoForm.displayName = "AutoForm";
@@ -985,9 +3247,7 @@ var DisplayIf = ({
985
3247
  const context = reactHookForm.useFormContext();
986
3248
  return condition(value, context) ? children : null;
987
3249
  };
988
- if (utils.__DEV__) {
989
- DisplayIf.displayName = "DisplayIf";
990
- }
3250
+ DisplayIf.displayName = "DisplayIf";
991
3251
  var [StepFormProvider, useStepFormContext] = reactUtils.createContext({
992
3252
  name: "StepFormContext",
993
3253
  errorMessage: "useStepFormContext: `context` is undefined. Seems you forgot to wrap step form components in `<StepForm />`"
@@ -996,14 +3256,14 @@ function useStepForm(props) {
996
3256
  const { onChange, ...rest } = props;
997
3257
  const stepper = core.useStepper(rest);
998
3258
  const { activeStep, isLastStep, nextStep } = stepper;
999
- const [steps, updateSteps] = React8__namespace.useState({});
1000
- const onSubmitStep = React8__namespace.useCallback(
3259
+ const [steps, updateSteps] = React12__namespace.useState({});
3260
+ const onSubmitStep = React12__namespace.useCallback(
1001
3261
  async (data) => {
1002
- var _a, _b;
3262
+ var _a2, _b;
1003
3263
  try {
1004
3264
  const step = steps[activeStep];
1005
3265
  if (isLastStep) {
1006
- await ((_a = props.onSubmit) == null ? void 0 : _a.call(props, data));
3266
+ await ((_a2 = props.onSubmit) == null ? void 0 : _a2.call(props, data));
1007
3267
  updateStep({
1008
3268
  ...step,
1009
3269
  isCompleted: true
@@ -1018,7 +3278,7 @@ function useStepForm(props) {
1018
3278
  },
1019
3279
  [steps, activeStep, isLastStep]
1020
3280
  );
1021
- const getFormProps = React8__namespace.useCallback(() => {
3281
+ const getFormProps = React12__namespace.useCallback(() => {
1022
3282
  const step = steps[activeStep];
1023
3283
  return {
1024
3284
  onSubmit: onSubmitStep,
@@ -1026,7 +3286,7 @@ function useStepForm(props) {
1026
3286
  resolver: step == null ? void 0 : step.resolver
1027
3287
  };
1028
3288
  }, [steps, onSubmitStep, activeStep]);
1029
- const updateStep = React8__namespace.useCallback(
3289
+ const updateStep = React12__namespace.useCallback(
1030
3290
  (step) => {
1031
3291
  updateSteps((steps2) => {
1032
3292
  return {
@@ -1048,7 +3308,7 @@ function useFormStep(props) {
1048
3308
  const { name, schema, resolver, onSubmit } = props;
1049
3309
  const step = core.useStep({ name });
1050
3310
  const { steps, updateStep } = useStepFormContext();
1051
- React8__namespace.useEffect(() => {
3311
+ React12__namespace.useEffect(() => {
1052
3312
  updateStep({ name, schema, resolver, onSubmit });
1053
3313
  }, [name, schema]);
1054
3314
  return {
@@ -1056,92 +3316,85 @@ function useFormStep(props) {
1056
3316
  ...steps[name] || { name, schema }
1057
3317
  };
1058
3318
  }
1059
-
1060
- // src/step-form.tsx
1061
- var StepForm = React8__namespace.forwardRef(
3319
+ var StepForm = React12__namespace.forwardRef(
1062
3320
  (props, ref) => {
1063
3321
  const { children, ...rest } = props;
1064
3322
  const stepper = useStepForm(props);
1065
3323
  const { getFormProps, ...ctx } = stepper;
1066
- const context = React8__namespace.useMemo(() => ctx, [ctx]);
1067
- return /* @__PURE__ */ React8__namespace.createElement(core.StepperProvider, {
1068
- value: context
1069
- }, /* @__PURE__ */ React8__namespace.createElement(StepFormProvider, {
1070
- value: context
1071
- }, /* @__PURE__ */ React8__namespace.createElement(Form, {
1072
- ref,
1073
- ...rest,
1074
- ...getFormProps()
1075
- }, utils.runIfFn(children, stepper))));
3324
+ const context = React12__namespace.useMemo(() => ctx, [ctx]);
3325
+ return /* @__PURE__ */ jsxRuntime.jsx(core.StepperProvider, { value: context, children: /* @__PURE__ */ jsxRuntime.jsx(StepFormProvider, { value: context, children: /* @__PURE__ */ jsxRuntime.jsx(Form, { ref, ...rest, ...getFormProps(), children: utils.runIfFn(children, stepper) }) }) });
1076
3326
  }
1077
3327
  );
1078
3328
  var FormStepper = (props) => {
1079
3329
  const { activeIndex, setIndex } = core.useStepperContext();
1080
3330
  const { children, orientation, variant, colorScheme, size, ...rest } = props;
1081
- const elements = React8__namespace.Children.map(children, (child) => {
1082
- if (React8__namespace.isValidElement(child) && (child == null ? void 0 : child.type) === FormStep) {
3331
+ const elements = React12__namespace.Children.map(children, (child) => {
3332
+ if (React12__namespace.isValidElement(child) && (child == null ? void 0 : child.type) === FormStep) {
1083
3333
  const { isCompleted } = useFormStep(child.props);
1084
- return /* @__PURE__ */ React8__namespace.createElement(core.StepperStep, {
1085
- name: child.props.name,
1086
- title: child.props.title,
1087
- isCompleted,
1088
- ...rest
1089
- }, child.props.children);
3334
+ return /* @__PURE__ */ jsxRuntime.jsx(
3335
+ core.StepperStep,
3336
+ {
3337
+ name: child.props.name,
3338
+ title: child.props.title,
3339
+ isCompleted,
3340
+ ...rest,
3341
+ children: child.props.children
3342
+ }
3343
+ );
1090
3344
  }
1091
3345
  return child;
1092
3346
  });
1093
- const onChange = React8__namespace.useCallback((i) => {
3347
+ const onChange = React12__namespace.useCallback((i) => {
1094
3348
  setIndex(i);
1095
3349
  }, []);
1096
- return /* @__PURE__ */ React8__namespace.createElement(core.StepperContainer, {
1097
- orientation,
1098
- step: activeIndex,
1099
- variant,
1100
- colorScheme,
1101
- size,
1102
- onChange
1103
- }, /* @__PURE__ */ React8__namespace.createElement(core.StepperSteps, {
1104
- mb: "4",
1105
- ...props
1106
- }, elements));
3350
+ return /* @__PURE__ */ jsxRuntime.jsx(
3351
+ core.StepperContainer,
3352
+ {
3353
+ orientation,
3354
+ step: activeIndex,
3355
+ variant,
3356
+ colorScheme,
3357
+ size,
3358
+ onChange,
3359
+ children: /* @__PURE__ */ jsxRuntime.jsx(core.StepperSteps, { mb: "4", ...props, children: elements })
3360
+ }
3361
+ );
1107
3362
  };
1108
3363
  var FormStep = (props) => {
1109
3364
  const { name, schema, resolver, children, className, onSubmit, ...rest } = props;
1110
3365
  const step = useFormStep({ name, schema, resolver, onSubmit });
1111
3366
  const { isActive } = step;
1112
- return isActive ? /* @__PURE__ */ React8__namespace.createElement(react.chakra.div, {
1113
- ...rest,
1114
- className: utils.cx("sui-form__step", className)
1115
- }, children) : null;
3367
+ return isActive ? /* @__PURE__ */ jsxRuntime.jsx(react.chakra.div, { ...rest, className: utils.cx("sui-form__step", className), children }) : null;
1116
3368
  };
1117
- if (utils.__DEV__) {
1118
- FormStep.displayName = "FormStep";
1119
- }
3369
+ FormStep.displayName = "FormStep";
1120
3370
  var PrevButton = (props) => {
1121
3371
  const { isFirstStep, isCompleted, prevStep } = core.useStepperContext();
1122
- return /* @__PURE__ */ React8__namespace.createElement(react.Button, {
1123
- isDisabled: isFirstStep || isCompleted,
1124
- label: "Back",
1125
- ...props,
1126
- className: utils.cx("sui-form__prev-button", props.className),
1127
- onClick: utils.callAllHandlers(props.onClick, prevStep)
1128
- });
3372
+ return /* @__PURE__ */ jsxRuntime.jsx(
3373
+ react.Button,
3374
+ {
3375
+ isDisabled: isFirstStep || isCompleted,
3376
+ label: "Back",
3377
+ ...props,
3378
+ className: utils.cx("sui-form__prev-button", props.className),
3379
+ onClick: utils.callAllHandlers(props.onClick, prevStep)
3380
+ }
3381
+ );
1129
3382
  };
1130
- if (utils.__DEV__) {
1131
- PrevButton.displayName = "PrevButton";
1132
- }
3383
+ PrevButton.displayName = "PrevButton";
1133
3384
  var NextButton = (props) => {
1134
3385
  const { label = "Next", submitLabel = "Complete", ...rest } = props;
1135
3386
  const { isLastStep, isCompleted } = core.useStepperContext();
1136
- return /* @__PURE__ */ React8__namespace.createElement(SubmitButton, {
1137
- ...rest,
1138
- isDisabled: isCompleted,
1139
- className: utils.cx("sui-form__next-button", props.className)
1140
- }, isLastStep || isCompleted ? submitLabel : label);
1141
- };
1142
- if (utils.__DEV__) {
1143
- NextButton.displayName = "NextButton";
1144
- }
3387
+ return /* @__PURE__ */ jsxRuntime.jsx(
3388
+ SubmitButton,
3389
+ {
3390
+ ...rest,
3391
+ isDisabled: isCompleted,
3392
+ className: utils.cx("sui-form__next-button", props.className),
3393
+ children: isLastStep || isCompleted ? submitLabel : label
3394
+ }
3395
+ );
3396
+ };
3397
+ NextButton.displayName = "NextButton";
1145
3398
  var WatchField = (props) => {
1146
3399
  const { name, defaultValue, isDisabled, isExact } = props;
1147
3400
  const form = reactHookForm.useFormContext();
@@ -1153,6 +3406,16 @@ var WatchField = (props) => {
1153
3406
  });
1154
3407
  return props.children(field, form) || null;
1155
3408
  };
3409
+ function createForm({
3410
+ resolver,
3411
+ fields
3412
+ } = {}) {
3413
+ const CreateForm = (props) => {
3414
+ const { schema, ...rest } = props;
3415
+ return /* @__PURE__ */ jsxRuntime.jsx(FieldsProvider, { value: fields || {}, children: /* @__PURE__ */ jsxRuntime.jsx(Form, { resolver: resolver == null ? void 0 : resolver(props.schema), ...rest }) });
3416
+ };
3417
+ return CreateForm;
3418
+ }
1156
3419
 
1157
3420
  Object.defineProperty(exports, 'Controller', {
1158
3421
  enumerable: true,
@@ -1200,13 +3463,14 @@ exports.ArrayFieldRowContainer = ArrayFieldRowContainer;
1200
3463
  exports.ArrayFieldRowFields = ArrayFieldRowFields;
1201
3464
  exports.ArrayFieldRowProvider = ArrayFieldRowProvider;
1202
3465
  exports.ArrayFieldRows = ArrayFieldRows;
3466
+ exports.AutoFields = AutoFields;
1203
3467
  exports.AutoForm = AutoForm;
1204
3468
  exports.BaseField = BaseField;
1205
3469
  exports.CheckboxField = CheckboxField;
1206
3470
  exports.DisplayField = DisplayField;
1207
3471
  exports.DisplayIf = DisplayIf;
1208
3472
  exports.Field = Field;
1209
- exports.Fields = Fields;
3473
+ exports.FieldsProvider = FieldsProvider;
1210
3474
  exports.Form = Form;
1211
3475
  exports.FormLayout = FormLayout;
1212
3476
  exports.FormLegend = FormLegend;
@@ -1225,6 +3489,7 @@ exports.PasswordInputField = PasswordInputField;
1225
3489
  exports.PinField = PinField;
1226
3490
  exports.PrevButton = PrevButton;
1227
3491
  exports.RadioField = RadioField;
3492
+ exports.RadioInput = RadioInput;
1228
3493
  exports.Select = Select;
1229
3494
  exports.SelectField = SelectField;
1230
3495
  exports.StepForm = StepForm;
@@ -1233,19 +3498,19 @@ exports.SubmitButton = SubmitButton;
1233
3498
  exports.SwitchField = SwitchField;
1234
3499
  exports.TextareaField = TextareaField;
1235
3500
  exports.WatchField = WatchField;
3501
+ exports.createField = createField;
1236
3502
  exports.createForm = createForm;
3503
+ exports.defaultFieldTypes = defaultFieldTypes;
1237
3504
  exports.objectFieldResolver = objectFieldResolver;
1238
- exports.registerFieldType = registerFieldType;
1239
3505
  exports.useArrayField = useArrayField;
1240
3506
  exports.useArrayFieldAddButton = useArrayFieldAddButton;
1241
3507
  exports.useArrayFieldContext = useArrayFieldContext;
1242
3508
  exports.useArrayFieldRemoveButton = useArrayFieldRemoveButton;
1243
3509
  exports.useArrayFieldRow = useArrayFieldRow;
1244
3510
  exports.useArrayFieldRowContext = useArrayFieldRowContext;
3511
+ exports.useField = useField;
1245
3512
  exports.useFormStep = useFormStep;
1246
3513
  exports.useStepForm = useStepForm;
1247
3514
  exports.useStepFormContext = useStepFormContext;
1248
- exports.withControlledInput = withControlledInput;
1249
- exports.withUncontrolledInput = withUncontrolledInput;
1250
3515
  //# sourceMappingURL=out.js.map
1251
3516
  //# sourceMappingURL=index.js.map