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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/ajv/index.d.ts +358 -11
  3. package/dist/ajv/index.js +7 -9
  4. package/dist/ajv/index.js.map +1 -1
  5. package/dist/ajv/index.mjs +7 -10
  6. package/dist/ajv/index.mjs.map +1 -1
  7. package/dist/index.d.ts +296 -194
  8. package/dist/index.js +373 -2613
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.mjs +373 -2607
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/yup/index.d.ts +573 -106
  13. package/dist/yup/index.js +6 -10
  14. package/dist/yup/index.js.map +1 -1
  15. package/dist/yup/index.mjs +4 -8
  16. package/dist/yup/index.mjs.map +1 -1
  17. package/dist/zod/index.d.ts +490 -14
  18. package/dist/zod/index.js +5 -0
  19. package/dist/zod/index.js.map +1 -1
  20. package/dist/zod/index.mjs +5 -1
  21. package/dist/zod/index.mjs.map +1 -1
  22. package/package.json +15 -8
  23. package/src/array-field.tsx +34 -17
  24. package/src/base-field.tsx +4 -9
  25. package/src/create-field.tsx +2 -1
  26. package/src/create-form.tsx +33 -10
  27. package/src/default-fields.tsx +21 -4
  28. package/src/display-field.tsx +1 -2
  29. package/src/display-if.tsx +14 -8
  30. package/src/field-resolver.ts +10 -8
  31. package/src/field.tsx +6 -3
  32. package/src/fields.tsx +16 -13
  33. package/src/form-context.tsx +84 -0
  34. package/src/form.tsx +44 -17
  35. package/src/index.ts +17 -15
  36. package/src/object-field.tsx +6 -2
  37. package/src/password-input/password-input.tsx +1 -1
  38. package/src/select/select-context.tsx +130 -0
  39. package/src/select/select.stories.tsx +116 -85
  40. package/src/select/select.tsx +152 -142
  41. package/src/types.ts +59 -6
  42. package/src/use-array-field.tsx +9 -3
  43. package/src/utils.ts +8 -1
  44. package/src/watch-field.tsx +2 -6
package/dist/index.js CHANGED
@@ -1,17 +1,14 @@
1
1
  'use strict';
2
2
 
3
+ var React11 = require('react');
3
4
  var reactHookForm = require('react-hook-form');
4
- var react = require('@chakra-ui/react');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
- var React12 = require('react');
6
+ var react = require('@chakra-ui/react');
7
7
  var core = require('@saas-ui/core');
8
- var react$1 = require('@emotion/react');
8
+ var icons = require('@saas-ui/core/icons');
9
9
  var utils = require('@chakra-ui/utils');
10
- var createStyled = require('@emotion/styled');
11
10
  var reactUtils = require('@chakra-ui/react-utils');
12
11
 
13
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
-
15
12
  function _interopNamespace(e) {
16
13
  if (e && e.__esModule) return e;
17
14
  var n = Object.create(null);
@@ -30,851 +27,31 @@ function _interopNamespace(e) {
30
27
  return Object.freeze(n);
31
28
  }
32
29
 
33
- var React12__namespace = /*#__PURE__*/_interopNamespace(React12);
34
- var createStyled__default = /*#__PURE__*/_interopDefault(createStyled);
30
+ var React11__namespace = /*#__PURE__*/_interopNamespace(React11);
35
31
 
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 });
32
+ // src/form-context.tsx
33
+ var FormContext = React11.createContext(null);
34
+ var useFormContext = () => {
35
+ const context = React11.useContext(FormContext);
36
+ const hookContext = reactHookForm.useFormContext();
37
+ if (!context) {
38
+ throw new Error("FormProvider must be used within a Form component");
50
39
  }
51
- return to;
40
+ return {
41
+ ...hookContext,
42
+ ...context
43
+ };
44
+ };
45
+ var useFieldProps = (name) => {
46
+ var _a;
47
+ const parsedName = name == null ? void 0 : name.replace(/\.[0-9]/g, ".$");
48
+ const context = useFormContext();
49
+ return (_a = context == null ? void 0 : context.fields) == null ? void 0 : _a[parsedName];
50
+ };
51
+ var FormProvider = (props) => {
52
+ const { children, fieldResolver, schema, fields, ...rest } = props;
53
+ return /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.FormProvider, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(FormContext.Provider, { value: { fieldResolver, schema, fields }, children }) });
52
54
  };
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
55
  var DisplayField = ({
879
56
  name,
880
57
  label,
@@ -888,7 +65,7 @@ var DisplayField = ({
888
65
  };
889
66
  DisplayField.displayName = "DisplayField";
890
67
  var FormValue = ({ name }) => {
891
- const { getValues } = reactHookForm.useFormContext();
68
+ const { getValues } = useFormContext();
892
69
  return getValues(name) || null;
893
70
  };
894
71
  FormValue.displayName = "FormValue";
@@ -903,1524 +80,14 @@ var NumberInput = react.forwardRef((props, ref) => {
903
80
  /* @__PURE__ */ jsxRuntime.jsx(react.NumberInputField, {}),
904
81
  !hideStepper && /* @__PURE__ */ jsxRuntime.jsxs(react.NumberInputStepper, { children: [
905
82
  /* @__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
- }
2253
-
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;
2272
- }
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;
2288
- };
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;
2308
- }
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"
2350
- };
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;
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"
83
+ /* @__PURE__ */ jsxRuntime.jsx(react.NumberDecrementStepper, { children: decrementIcon })
84
+ ] })
85
+ ] });
2423
86
  });
87
+ NumberInput.defaultProps = {
88
+ hideStepper: false
89
+ };
90
+ NumberInput.displayName = "NumberInput";
2424
91
  var InputRightButton = react.forwardRef(
2425
92
  (props, ref) => {
2426
93
  return /* @__PURE__ */ jsxRuntime.jsx(react.InputRightElement, { w: "auto", px: "1", py: "1", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(react.Button, { ref, height: "auto", ...props }) });
@@ -2441,14 +108,14 @@ var PasswordInput = react.forwardRef(
2441
108
  leftAddon,
2442
109
  ...inputProps
2443
110
  } = props;
2444
- const [show, setShow] = React12.useState(false);
111
+ const [show, setShow] = React11.useState(false);
2445
112
  const handleClick = () => setShow(!show);
2446
113
  const label = show ? "Hide password" : "Show password";
2447
114
  let icon;
2448
115
  if (show) {
2449
- icon = viewIcon || /* @__PURE__ */ jsxRuntime.jsx(ViewIcon, {});
116
+ icon = viewIcon || /* @__PURE__ */ jsxRuntime.jsx(icons.ViewIcon, {});
2450
117
  } else {
2451
- icon = viewOffIcon || /* @__PURE__ */ jsxRuntime.jsx(ViewOffIcon, {});
118
+ icon = viewOffIcon || /* @__PURE__ */ jsxRuntime.jsx(icons.ViewOffIcon, {});
2452
119
  }
2453
120
  const groupProps = {
2454
121
  width: w || width,
@@ -2480,11 +147,17 @@ var PasswordInput = react.forwardRef(
2480
147
  );
2481
148
  PasswordInput.displayName = "PasswordInput";
2482
149
  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, {
150
+ return React11__namespace.Children.map(children, (child) => {
151
+ if (React11__namespace.isValidElement(child) && child.props.name) {
152
+ let childName = child.props.name;
153
+ if (childName.includes(".")) {
154
+ childName = childName.replace(/^.*\.(.*)/, "$1");
155
+ } else if (childName.includes(".$")) {
156
+ childName = childName.replace(/^.*\.\$(.*)/, "$1");
157
+ }
158
+ return React11__namespace.cloneElement(child, {
2486
159
  ...child.props,
2487
- name: `${name}.${child.props.name}`
160
+ name: `${name}.${childName}`
2488
161
  });
2489
162
  }
2490
163
  return child;
@@ -2521,104 +194,170 @@ var RadioInput = react.forwardRef(
2521
194
  }
2522
195
  );
2523
196
  RadioInput.displayName = "RadioInput";
2524
- var SelectButton = react.forwardRef((props, ref) => {
2525
- const styles = react.useMultiStyleConfig("Input", props);
2526
- const focusStyles = styles.field._focusVisible;
2527
- const height = styles.field.h || styles.field.height;
2528
- const buttonStyles = {
2529
- fontWeight: "normal",
2530
- textAlign: "left",
2531
- color: "inherit",
2532
- _active: {
2533
- bg: "transparent"
2534
- },
2535
- minH: height,
2536
- _focus: focusStyles,
2537
- _expanded: focusStyles,
2538
- ...styles.field,
2539
- h: "auto"
2540
- };
2541
- return /* @__PURE__ */ jsxRuntime.jsx(react.MenuButton, { as: react.Button, ...props, ref, sx: buttonStyles });
197
+ var [SelectProvider, useSelectContext] = reactUtils.createContext({
198
+ strict: true
2542
199
  });
2543
- SelectButton.displayName = "SelectButton";
2544
- var Select = react.forwardRef((props, ref) => {
200
+ var useSelect = (props) => {
2545
201
  const {
2546
202
  name,
2547
- options: optionsProp,
2548
- children,
2549
- onChange,
2550
- defaultValue,
2551
203
  value,
204
+ defaultValue,
205
+ onChange,
206
+ multiple,
2552
207
  placeholder,
208
+ options: optionsProp,
2553
209
  isDisabled,
2554
- leftIcon,
2555
- rightIcon = /* @__PURE__ */ jsxRuntime.jsx(core.ChevronDownIcon, {}),
2556
- multiple,
2557
- size,
2558
- variant,
2559
- menuListProps,
2560
- renderValue = (value2) => value2 == null ? void 0 : value2.join(", "),
2561
- ...rest
210
+ renderValue = (value2) => typeof value2 === "string" ? value2 : value2 == null ? void 0 : value2.join(", ")
2562
211
  } = props;
2563
- const menuProps = react.omitThemingProps(rest);
2564
- const [currentValue, setCurrentValue] = React12__namespace.useState(value || defaultValue);
212
+ const [currentValue, setCurrentValue] = react.useControllableState({
213
+ value,
214
+ defaultValue,
215
+ onChange
216
+ });
2565
217
  const controlProps = react.useFormControl({ name });
2566
- const options = React12__namespace.useMemo(
218
+ const options = React11__namespace.default.useMemo(
2567
219
  () => optionsProp && mapOptions(optionsProp),
2568
220
  [optionsProp]
2569
221
  );
2570
222
  const handleChange = (value2) => {
2571
223
  setCurrentValue(value2);
2572
- onChange == null ? void 0 : onChange(value2);
2573
- };
2574
- const buttonProps = {
2575
- isDisabled,
2576
- leftIcon,
2577
- rightIcon,
2578
- size,
2579
- variant
2580
224
  };
2581
- const getDisplayValue = React12__namespace.useCallback(
225
+ const getDisplayValue = React11__namespace.default.useCallback(
2582
226
  (value2) => {
2583
227
  if (!options) {
2584
228
  return value2;
2585
229
  }
2586
230
  for (const option of options) {
2587
- if (option.label && option.value === value2) {
2588
- return option.label;
231
+ if (option.value === value2) {
232
+ return option.label || option.value;
2589
233
  }
2590
234
  }
2591
235
  return value2;
2592
236
  },
2593
237
  [options]
2594
238
  );
2595
- const displayValue = currentValue ? (Array.isArray(currentValue) ? currentValue : [currentValue]).map(
2596
- getDisplayValue
2597
- ) : [];
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,
239
+ const displayValue = React11__namespace.default.useMemo(
240
+ () => currentValue ? (Array.isArray(currentValue) ? currentValue : [currentValue]).map(
241
+ getDisplayValue
242
+ ) : [],
243
+ [currentValue, getDisplayValue]
244
+ );
245
+ return {
246
+ defaultValue,
247
+ value: currentValue,
248
+ displayValue,
249
+ renderValue,
250
+ onChange: handleChange,
251
+ options,
252
+ multiple,
253
+ controlProps,
254
+ placeholder,
255
+ isDisabled
256
+ };
257
+ };
258
+ var SelectButton = react.forwardRef(
259
+ (props, ref) => {
260
+ var _a, _b, _c, _d, _e;
261
+ const styles = react.useMultiStyleConfig("SuiSelect", props);
262
+ const {
263
+ displayValue,
264
+ renderValue,
265
+ placeholder,
266
+ isDisabled: isSelectDisabled
267
+ } = useSelectContext();
268
+ const {
269
+ isInvalid,
270
+ isReadOnly,
271
+ isDisabled,
272
+ isFocused,
273
+ isRequired,
274
+ id,
275
+ onBlur,
276
+ onFocus
277
+ } = react.useFormControlContext();
278
+ const { rightIcon = /* @__PURE__ */ jsxRuntime.jsx(core.ChevronDownIcon, {}), ...rest } = props;
279
+ const focusStyles = (_a = styles.field) == null ? void 0 : _a._focusVisible;
280
+ const readOnlyStyles = (_b = styles.field) == null ? void 0 : _b._readOnly;
281
+ const invalid = (_c = styles.field) == null ? void 0 : _c._invalid;
282
+ const height = ((_d = styles.field) == null ? void 0 : _d.h) || ((_e = styles.field) == null ? void 0 : _e.height);
283
+ const buttonStyles = {
284
+ fontWeight: "normal",
285
+ textAlign: "left",
286
+ color: "inherit",
287
+ _active: {
288
+ bg: "transparent"
289
+ },
290
+ minH: height,
291
+ _focus: focusStyles,
292
+ _expanded: focusStyles,
293
+ _readOnly: readOnlyStyles,
294
+ _invalid: invalid,
295
+ ...styles.field,
296
+ h: "auto"
297
+ };
298
+ return /* @__PURE__ */ jsxRuntime.jsx(
299
+ react.MenuButton,
2602
300
  {
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
301
+ as: react.Button,
302
+ id,
303
+ ...rest,
304
+ onFocus,
305
+ onBlur,
306
+ isDisabled: isDisabled || isSelectDisabled,
307
+ "data-invalid": utils.dataAttr(isInvalid),
308
+ "data-read-only": utils.dataAttr(isReadOnly),
309
+ "data-focus": utils.dataAttr(isFocused),
310
+ "data-required": utils.dataAttr(isRequired),
311
+ rightIcon,
312
+ ref,
313
+ sx: buttonStyles,
314
+ children: renderValue(displayValue) || placeholder
2607
315
  }
2608
- ) }),
316
+ );
317
+ }
318
+ );
319
+ SelectButton.displayName = "SelectButton";
320
+ var Select = react.forwardRef((props, ref) => {
321
+ const { name, children, isDisabled, multiple, ...rest } = props;
322
+ const menuProps = react.omitThemingProps(rest);
323
+ const context = useSelect(props);
324
+ const { value, controlProps } = context;
325
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectProvider, { value: context, children: /* @__PURE__ */ jsxRuntime.jsx(react.Menu, { ...menuProps, closeOnSelect: !multiple, children: /* @__PURE__ */ jsxRuntime.jsxs(react.chakra.div, { className: utils.cx("sui-select"), children: [
326
+ children,
2609
327
  /* @__PURE__ */ jsxRuntime.jsx(
2610
328
  react.chakra.input,
2611
329
  {
2612
330
  ...controlProps,
331
+ ref,
2613
332
  name,
2614
333
  type: "hidden",
2615
- value: currentValue,
334
+ value: value || "",
2616
335
  className: "saas-select__input"
2617
336
  }
2618
337
  )
2619
- ] }) });
338
+ ] }) }) });
2620
339
  });
340
+ var SelectList = (props) => {
341
+ const { defaultValue, value, options, multiple, onChange } = useSelectContext();
342
+ return /* @__PURE__ */ jsxRuntime.jsx(react.MenuList, { maxH: "100vh", overflowY: "auto", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
343
+ react.MenuOptionGroup,
344
+ {
345
+ defaultValue: defaultValue || value,
346
+ value,
347
+ onChange,
348
+ type: multiple ? "checkbox" : "radio",
349
+ children: options ? options.map(({ value: value2, label, ...rest }, i) => /* @__PURE__ */ jsxRuntime.jsx(SelectOption, { value: value2, ...rest, children: label || value2 }, i)) : props.children
350
+ }
351
+ ) });
352
+ };
2621
353
  Select.displayName = "Select";
354
+ var SelectOption = react.forwardRef(
355
+ (props, ref) => {
356
+ return /* @__PURE__ */ jsxRuntime.jsx(react.MenuItemOption, { ref, ...props });
357
+ }
358
+ );
359
+ SelectOption.id = "MenuItemOption";
360
+ SelectOption.displayName = "SelectOption";
2622
361
  var NativeSelect = react.forwardRef(
2623
362
  ({ options, children, ...props }, ref) => {
2624
363
  return /* @__PURE__ */ jsxRuntime.jsx(react.Select, { ref, ...props, children: children || (options == null ? void 0 : options.map(({ value, label }) => {
@@ -2632,7 +371,7 @@ var getError = (name, formState) => {
2632
371
  };
2633
372
  var BaseField = (props) => {
2634
373
  const { name, label, help, hideLabel, children, ...controlProps } = props;
2635
- const { formState } = reactHookForm.useFormContext();
374
+ const { formState } = useFormContext();
2636
375
  const error = getError(name, formState);
2637
376
  return /* @__PURE__ */ jsxRuntime.jsxs(react.FormControl, { ...controlProps, isInvalid: !!error, children: [
2638
377
  label && !hideLabel ? /* @__PURE__ */ jsxRuntime.jsx(react.FormLabel, { children: label }) : null,
@@ -2694,7 +433,7 @@ var _createField = (InputComponent, { displayName, hideLabel, BaseField: BaseFie
2694
433
  var withControlledInput = (InputComponent) => {
2695
434
  return react.forwardRef(
2696
435
  ({ name, rules, ...inputProps }, ref) => {
2697
- const { control } = reactHookForm.useFormContext();
436
+ const { control } = useFormContext();
2698
437
  return /* @__PURE__ */ jsxRuntime.jsx(
2699
438
  reactHookForm.Controller,
2700
439
  {
@@ -2719,7 +458,7 @@ var withControlledInput = (InputComponent) => {
2719
458
  var withUncontrolledInput = (InputComponent) => {
2720
459
  return react.forwardRef(
2721
460
  ({ name, rules, ...inputProps }, ref) => {
2722
- const { register } = reactHookForm.useFormContext();
461
+ const { register } = useFormContext();
2723
462
  const { ref: _ref, ...field } = register(name, rules);
2724
463
  return /* @__PURE__ */ jsxRuntime.jsx(
2725
464
  InputComponent,
@@ -2735,7 +474,7 @@ var withUncontrolledInput = (InputComponent) => {
2735
474
  );
2736
475
  };
2737
476
  var createField = (component, options) => {
2738
- var _a2;
477
+ var _a;
2739
478
  let InputComponent;
2740
479
  if (options == null ? void 0 : options.isControlled) {
2741
480
  InputComponent = withControlledInput(component);
@@ -2743,7 +482,7 @@ var createField = (component, options) => {
2743
482
  InputComponent = withUncontrolledInput(component);
2744
483
  }
2745
484
  const Field2 = _createField(InputComponent, {
2746
- displayName: `${(_a2 = component.displayName) != null ? _a2 : "Custom"}Field`,
485
+ displayName: `${(_a = component.displayName) != null ? _a : "Custom"}Field`,
2747
486
  hideLabel: options == null ? void 0 : options.hideLabel,
2748
487
  BaseField: (options == null ? void 0 : options.BaseField) || BaseField
2749
488
  });
@@ -2780,9 +519,17 @@ var SwitchField = createField(
2780
519
  isControlled: true
2781
520
  }
2782
521
  );
2783
- var SelectField = createField(Select, {
2784
- isControlled: true
2785
- });
522
+ var SelectField = createField(
523
+ react.forwardRef((props, ref) => {
524
+ return /* @__PURE__ */ jsxRuntime.jsxs(Select, { ref, ...props, children: [
525
+ /* @__PURE__ */ jsxRuntime.jsx(SelectButton, {}),
526
+ /* @__PURE__ */ jsxRuntime.jsx(SelectList, {})
527
+ ] });
528
+ }),
529
+ {
530
+ isControlled: true
531
+ }
532
+ );
2786
533
  var CheckboxField = createField(
2787
534
  react.forwardRef(({ label, type, ...props }, ref) => {
2788
535
  return /* @__PURE__ */ jsxRuntime.jsx(react.Checkbox, { ref, ...props, children: label });
@@ -2825,7 +572,7 @@ var defaultFieldTypes = {
2825
572
  pin: PinField,
2826
573
  "native-select": NativeSelectField
2827
574
  };
2828
- var FieldsContext = React12__namespace.default.createContext(
575
+ var FieldsContext = React11__namespace.default.createContext(
2829
576
  null
2830
577
  );
2831
578
  var FieldsProvider = (props) => {
@@ -2833,119 +580,26 @@ var FieldsProvider = (props) => {
2833
580
  return /* @__PURE__ */ jsxRuntime.jsx(FieldsContext.Provider, { value: fields, children: props.children });
2834
581
  };
2835
582
  var useField = (type) => {
2836
- const context = React12__namespace.default.useContext(FieldsContext);
583
+ const context = React11__namespace.default.useContext(FieldsContext);
2837
584
  return (context == null ? void 0 : context[type]) || InputField;
2838
585
  };
2839
586
  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
- );
2847
- var mapFields = (schema) => schema && Object.entries(schema).map(([name, { items, label, title, ...field }]) => {
2848
- return {
2849
- ...field,
2850
- name,
2851
- label: label || title || name
2852
- // json schema compatibility
2853
- };
2854
- });
2855
- var objectFieldResolver = (schema) => {
2856
- const getFields = () => {
2857
- return mapFields(schema);
2858
- };
2859
- const getNestedFields = (name) => {
2860
- var _a2;
2861
- const field = utils.get(schema, name);
2862
- if (!field)
2863
- return [];
2864
- if (((_a2 = field.items) == null ? void 0 : _a2.type) === "object") {
2865
- return mapFields(field.items.properties);
2866
- } else if (field.type === "object") {
2867
- return mapFields(field.properties);
2868
- }
2869
- return [field.items];
2870
- };
2871
- return { getFields, getNestedFields };
2872
- };
2873
- var Form = react.forwardRef(
587
+ var Field = React11__namespace.forwardRef(
2874
588
  (props, ref) => {
2875
- var _a2;
2876
- const {
2877
- mode = "all",
2878
- resolver,
2879
- reValidateMode,
2880
- shouldFocusError,
2881
- shouldUnregister,
2882
- shouldUseNativeValidation,
2883
- criteriaMode,
2884
- delayError,
2885
- schema,
2886
- defaultValues,
2887
- values,
2888
- context,
2889
- resetOptions,
2890
- onChange,
2891
- onSubmit,
2892
- onError,
2893
- formRef,
2894
- children,
2895
- ...rest
2896
- } = props;
2897
- const form = {
2898
- mode,
2899
- resolver,
2900
- defaultValues,
2901
- values,
2902
- reValidateMode,
2903
- shouldFocusError,
2904
- shouldUnregister,
2905
- shouldUseNativeValidation,
2906
- criteriaMode,
2907
- delayError,
2908
- context,
2909
- resetOptions
2910
- };
2911
- if (schema && !resolver) {
2912
- form.resolver = (_a2 = Form.getResolver) == null ? void 0 : _a2.call(Form, schema);
2913
- }
2914
- const methods = reactHookForm.useForm(form);
2915
- const { handleSubmit } = methods;
2916
- React12__namespace.useImperativeHandle(formRef, () => methods, [formRef, methods]);
2917
- React12__namespace.useEffect(() => {
2918
- let subscription;
2919
- if (onChange) {
2920
- subscription = methods.watch(onChange);
2921
- }
2922
- return () => subscription == null ? void 0 : subscription.unsubscribe();
2923
- }, [methods, onChange]);
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
- ) });
589
+ const { type = defaultInputType, name } = props;
590
+ const overrides = useFieldProps(name);
591
+ const InputComponent = useField((overrides == null ? void 0 : overrides.type) || type);
592
+ return /* @__PURE__ */ jsxRuntime.jsx(InputComponent, { ref, ...props, ...overrides });
2937
593
  }
2938
594
  );
2939
- Form.getFieldResolver = objectFieldResolver;
2940
- Form.displayName = "Form";
2941
595
  var FormLayoutItem = ({ children }) => {
2942
596
  return /* @__PURE__ */ jsxRuntime.jsx(react.chakra.div, { children });
2943
597
  };
2944
598
  FormLayoutItem.displayName = "FormLayoutItem";
2945
599
  var FormLayout = ({ children, ...props }) => {
2946
- var _a2, _b, _c;
600
+ var _a, _b, _c;
2947
601
  const theme = react.useTheme();
2948
- const defaultProps = (_c = (_b = (_a2 = theme.components) == null ? void 0 : _a2.SuiFormLayout) == null ? void 0 : _b.defaultProps) != null ? _c : {
602
+ const defaultProps = (_c = (_b = (_a = theme.components) == null ? void 0 : _a.SuiFormLayout) == null ? void 0 : _b.defaultProps) != null ? _c : {
2949
603
  spacing: 4
2950
604
  };
2951
605
  const gridProps = {
@@ -2957,8 +611,8 @@ var FormLayout = ({ children, ...props }) => {
2957
611
  {
2958
612
  ...gridProps,
2959
613
  className: utils.cx("sui-form__layout", props.className),
2960
- children: React12__namespace.Children.map(children, (child) => {
2961
- if (React12__namespace.isValidElement(child)) {
614
+ children: React11__namespace.Children.map(children, (child) => {
615
+ if (React11__namespace.isValidElement(child)) {
2962
616
  return /* @__PURE__ */ jsxRuntime.jsx(FormLayoutItem, { children: child });
2963
617
  }
2964
618
  return child;
@@ -2980,7 +634,7 @@ var useArrayField = ({
2980
634
  min,
2981
635
  max
2982
636
  }) => {
2983
- const { control } = reactHookForm.useFormContext();
637
+ const { control } = useFormContext();
2984
638
  const context = reactHookForm.useFieldArray({
2985
639
  control,
2986
640
  name,
@@ -2995,9 +649,9 @@ var useArrayField = ({
2995
649
  };
2996
650
  };
2997
651
  var useArrayFieldRow = ({ index }) => {
2998
- const { clearErrors } = reactHookForm.useFormContext();
652
+ const { clearErrors } = useFormContext();
2999
653
  const { name, remove, fields } = useArrayFieldContext();
3000
- React12__namespace.useEffect(() => {
654
+ React11__namespace.useEffect(() => {
3001
655
  clearErrors(name);
3002
656
  }, []);
3003
657
  return {
@@ -3005,7 +659,7 @@ var useArrayFieldRow = ({ index }) => {
3005
659
  isFirst: index === 0,
3006
660
  isLast: index === fields.length - 1,
3007
661
  name: `${name}.${index}`,
3008
- remove: React12__namespace.useCallback(() => {
662
+ remove: React11__namespace.useCallback(() => {
3009
663
  clearErrors(name);
3010
664
  remove(index);
3011
665
  }, [index])
@@ -3066,7 +720,7 @@ var ArrayFieldRowContainer = ({
3066
720
  };
3067
721
  ArrayFieldRowContainer.displayName = "ArrayFieldRowContainer";
3068
722
  var ArrayFieldRemoveButton = (props) => {
3069
- return /* @__PURE__ */ jsxRuntime.jsx(react.Button, { "aria-label": "Remove row", ...useArrayFieldRemoveButton(), ...props, children: props.children || /* @__PURE__ */ jsxRuntime.jsx(MinusIcon, {}) });
723
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Button, { "aria-label": "Remove row", ...useArrayFieldRemoveButton(), ...props, children: props.children || /* @__PURE__ */ jsxRuntime.jsx(icons.MinusIcon, {}) });
3070
724
  };
3071
725
  ArrayFieldRemoveButton.displayName = "ArrayFieldRemoveButton";
3072
726
  var ArrayFieldAddButton = (props) => {
@@ -3077,7 +731,7 @@ var ArrayFieldAddButton = (props) => {
3077
731
  float: "right",
3078
732
  ...useArrayFieldAddButton(),
3079
733
  ...props,
3080
- children: props.children || /* @__PURE__ */ jsxRuntime.jsx(AddIcon, {})
734
+ children: props.children || /* @__PURE__ */ jsxRuntime.jsx(icons.PlusIcon, {})
3081
735
  }
3082
736
  );
3083
737
  };
@@ -3085,8 +739,9 @@ ArrayFieldAddButton.displayName = "ArrayFieldAddButton";
3085
739
  var ArrayField = react.forwardRef(
3086
740
  (props, ref) => {
3087
741
  const { children, ...containerProps } = props;
742
+ const rowFn = utils.isFunction(children) ? children : (fields) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fields.map(({ id }, index) => /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldRow, { index, children }, id)) || null });
3088
743
  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)) }) }),
744
+ /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldRows, { children: rowFn }),
3090
745
  /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldAddButton, {})
3091
746
  ] });
3092
747
  }
@@ -3099,7 +754,7 @@ var ArrayFieldRows = ({
3099
754
  return children(fields);
3100
755
  };
3101
756
  ArrayFieldRows.displayName = "ArrayFieldRows";
3102
- var ArrayFieldContainer = React12__namespace.forwardRef(
757
+ var ArrayFieldContainer = React11__namespace.forwardRef(
3103
758
  ({
3104
759
  name,
3105
760
  defaultValue,
@@ -3116,7 +771,7 @@ var ArrayFieldContainer = React12__namespace.forwardRef(
3116
771
  min,
3117
772
  max
3118
773
  });
3119
- React12__namespace.useImperativeHandle(ref, () => context, [ref, context]);
774
+ React11__namespace.useImperativeHandle(ref, () => context, [ref, context]);
3120
775
  return /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldProvider, { value: context, children: /* @__PURE__ */ jsxRuntime.jsx(BaseField, { name, ...fieldProps, children }) });
3121
776
  }
3122
777
  );
@@ -3134,8 +789,8 @@ var ObjectField = (props) => {
3134
789
  };
3135
790
  ObjectField.displayName = "ObjectField";
3136
791
  var mapNestedFields2 = (resolver, name) => {
3137
- var _a2;
3138
- return (_a2 = resolver.getNestedFields(name)) == null ? void 0 : _a2.map(
792
+ var _a;
793
+ return (_a = resolver.getNestedFields(name)) == null ? void 0 : _a.map(
3139
794
  ({ name: name2, type, ...nestedFieldProps }, i) => /* @__PURE__ */ jsxRuntime.jsx(
3140
795
  Field,
3141
796
  {
@@ -3148,24 +803,27 @@ var mapNestedFields2 = (resolver, name) => {
3148
803
  );
3149
804
  };
3150
805
  var AutoFields = ({
3151
- schema,
3152
- fieldResolver,
806
+ schema: schemaProp,
807
+ fieldResolver: fieldResolverProp,
3153
808
  focusFirstField,
3154
809
  ...props
3155
810
  }) => {
3156
- const resolver = React12__namespace.useMemo(
3157
- () => fieldResolver || Form.getFieldResolver(schema),
3158
- [schema, fieldResolver]
3159
- );
3160
- const fields = React12__namespace.useMemo(() => resolver.getFields(), [resolver]);
3161
- const form = reactHookForm.useFormContext();
3162
- React12__namespace.useEffect(() => {
3163
- var _a2;
3164
- if (focusFirstField && ((_a2 = fields[0]) == null ? void 0 : _a2.name)) {
811
+ const context = useFormContext();
812
+ const schema = schemaProp || context.schema;
813
+ const fieldResolver = fieldResolverProp || context.fieldResolver;
814
+ const resolver = React11__namespace.useMemo(() => fieldResolver, [schema, fieldResolver]);
815
+ const fields = React11__namespace.useMemo(() => resolver == null ? void 0 : resolver.getFields(), [resolver]);
816
+ const form = useFormContext();
817
+ React11__namespace.useEffect(() => {
818
+ var _a;
819
+ if (focusFirstField && ((_a = fields == null ? void 0 : fields[0]) == null ? void 0 : _a.name)) {
3165
820
  form.setFocus(fields[0].name);
3166
821
  }
3167
822
  }, [schema, fieldResolver, focusFirstField]);
3168
- return /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { ...props, children: fields.map(
823
+ if (!resolver) {
824
+ return null;
825
+ }
826
+ return /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { ...props, children: fields == null ? void 0 : fields.map(
3169
827
  ({
3170
828
  name,
3171
829
  type,
@@ -3213,23 +871,6 @@ SubmitButton.defaultProps = {
3213
871
  disableIfInvalid: false
3214
872
  };
3215
873
  SubmitButton.displayName = "SubmitButton";
3216
- var AutoForm = react.forwardRef(
3217
- (props, ref) => {
3218
- const {
3219
- schema,
3220
- submitLabel = "Submit",
3221
- fieldResolver,
3222
- children,
3223
- ...rest
3224
- } = props;
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
- ] }) });
3230
- }
3231
- );
3232
- AutoForm.displayName = "AutoForm";
3233
874
  var DisplayIf = ({
3234
875
  children,
3235
876
  name,
@@ -3244,10 +885,94 @@ var DisplayIf = ({
3244
885
  disabled: isDisabled,
3245
886
  exact: isExact
3246
887
  });
3247
- const context = reactHookForm.useFormContext();
888
+ const context = useFormContext();
3248
889
  return condition(value, context) ? children : null;
3249
890
  };
3250
891
  DisplayIf.displayName = "DisplayIf";
892
+ var Form = react.forwardRef(
893
+ (props, ref) => {
894
+ const {
895
+ mode = "all",
896
+ resolver,
897
+ fieldResolver,
898
+ fields,
899
+ reValidateMode,
900
+ shouldFocusError,
901
+ shouldUnregister,
902
+ shouldUseNativeValidation,
903
+ criteriaMode,
904
+ delayError,
905
+ schema,
906
+ defaultValues,
907
+ values,
908
+ context,
909
+ resetOptions,
910
+ onChange,
911
+ onSubmit,
912
+ onError,
913
+ formRef,
914
+ children,
915
+ ...rest
916
+ } = props;
917
+ const form = {
918
+ mode,
919
+ resolver,
920
+ defaultValues,
921
+ values,
922
+ reValidateMode,
923
+ shouldFocusError,
924
+ shouldUnregister,
925
+ shouldUseNativeValidation,
926
+ criteriaMode,
927
+ delayError,
928
+ context,
929
+ resetOptions
930
+ };
931
+ const methods = reactHookForm.useForm(form);
932
+ const { handleSubmit } = methods;
933
+ React11__namespace.useImperativeHandle(formRef, () => methods, [formRef, methods]);
934
+ React11__namespace.useEffect(() => {
935
+ let subscription;
936
+ if (onChange) {
937
+ subscription = methods.watch(onChange);
938
+ }
939
+ return () => subscription == null ? void 0 : subscription.unsubscribe();
940
+ }, [methods, onChange]);
941
+ let _children = children;
942
+ if (!_children && fieldResolver) {
943
+ _children = /* @__PURE__ */ jsxRuntime.jsxs(FormLayout, { children: [
944
+ /* @__PURE__ */ jsxRuntime.jsx(AutoFields, {}),
945
+ /* @__PURE__ */ jsxRuntime.jsx(SubmitButton, { ...fields == null ? void 0 : fields.submit })
946
+ ] });
947
+ }
948
+ return /* @__PURE__ */ jsxRuntime.jsx(
949
+ FormProvider,
950
+ {
951
+ ...methods,
952
+ schema,
953
+ fieldResolver,
954
+ fields,
955
+ children: /* @__PURE__ */ jsxRuntime.jsx(
956
+ react.chakra.form,
957
+ {
958
+ ref,
959
+ onSubmit: handleSubmit(onSubmit, onError),
960
+ ...rest,
961
+ className: utils.cx("sui-form", props.className),
962
+ children: utils.runIfFn(_children, {
963
+ Field,
964
+ DisplayIf,
965
+ ArrayField,
966
+ ObjectField,
967
+ ...methods
968
+ })
969
+ }
970
+ )
971
+ }
972
+ );
973
+ }
974
+ );
975
+ Form.displayName = "Form";
3251
976
  var [StepFormProvider, useStepFormContext] = reactUtils.createContext({
3252
977
  name: "StepFormContext",
3253
978
  errorMessage: "useStepFormContext: `context` is undefined. Seems you forgot to wrap step form components in `<StepForm />`"
@@ -3256,14 +981,14 @@ function useStepForm(props) {
3256
981
  const { onChange, ...rest } = props;
3257
982
  const stepper = core.useStepper(rest);
3258
983
  const { activeStep, isLastStep, nextStep } = stepper;
3259
- const [steps, updateSteps] = React12__namespace.useState({});
3260
- const onSubmitStep = React12__namespace.useCallback(
984
+ const [steps, updateSteps] = React11__namespace.useState({});
985
+ const onSubmitStep = React11__namespace.useCallback(
3261
986
  async (data) => {
3262
- var _a2, _b;
987
+ var _a, _b;
3263
988
  try {
3264
989
  const step = steps[activeStep];
3265
990
  if (isLastStep) {
3266
- await ((_a2 = props.onSubmit) == null ? void 0 : _a2.call(props, data));
991
+ await ((_a = props.onSubmit) == null ? void 0 : _a.call(props, data));
3267
992
  updateStep({
3268
993
  ...step,
3269
994
  isCompleted: true
@@ -3278,7 +1003,7 @@ function useStepForm(props) {
3278
1003
  },
3279
1004
  [steps, activeStep, isLastStep]
3280
1005
  );
3281
- const getFormProps = React12__namespace.useCallback(() => {
1006
+ const getFormProps = React11__namespace.useCallback(() => {
3282
1007
  const step = steps[activeStep];
3283
1008
  return {
3284
1009
  onSubmit: onSubmitStep,
@@ -3286,7 +1011,7 @@ function useStepForm(props) {
3286
1011
  resolver: step == null ? void 0 : step.resolver
3287
1012
  };
3288
1013
  }, [steps, onSubmitStep, activeStep]);
3289
- const updateStep = React12__namespace.useCallback(
1014
+ const updateStep = React11__namespace.useCallback(
3290
1015
  (step) => {
3291
1016
  updateSteps((steps2) => {
3292
1017
  return {
@@ -3308,7 +1033,7 @@ function useFormStep(props) {
3308
1033
  const { name, schema, resolver, onSubmit } = props;
3309
1034
  const step = core.useStep({ name });
3310
1035
  const { steps, updateStep } = useStepFormContext();
3311
- React12__namespace.useEffect(() => {
1036
+ React11__namespace.useEffect(() => {
3312
1037
  updateStep({ name, schema, resolver, onSubmit });
3313
1038
  }, [name, schema]);
3314
1039
  return {
@@ -3316,20 +1041,20 @@ function useFormStep(props) {
3316
1041
  ...steps[name] || { name, schema }
3317
1042
  };
3318
1043
  }
3319
- var StepForm = React12__namespace.forwardRef(
1044
+ var StepForm = React11__namespace.forwardRef(
3320
1045
  (props, ref) => {
3321
1046
  const { children, ...rest } = props;
3322
1047
  const stepper = useStepForm(props);
3323
1048
  const { getFormProps, ...ctx } = stepper;
3324
- const context = React12__namespace.useMemo(() => ctx, [ctx]);
1049
+ const context = React11__namespace.useMemo(() => ctx, [ctx]);
3325
1050
  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) }) }) });
3326
1051
  }
3327
1052
  );
3328
1053
  var FormStepper = (props) => {
3329
1054
  const { activeIndex, setIndex } = core.useStepperContext();
3330
1055
  const { children, orientation, variant, colorScheme, size, ...rest } = props;
3331
- const elements = React12__namespace.Children.map(children, (child) => {
3332
- if (React12__namespace.isValidElement(child) && (child == null ? void 0 : child.type) === FormStep) {
1056
+ const elements = React11__namespace.Children.map(children, (child) => {
1057
+ if (React11__namespace.isValidElement(child) && (child == null ? void 0 : child.type) === FormStep) {
3333
1058
  const { isCompleted } = useFormStep(child.props);
3334
1059
  return /* @__PURE__ */ jsxRuntime.jsx(
3335
1060
  core.StepperStep,
@@ -3344,7 +1069,7 @@ var FormStepper = (props) => {
3344
1069
  }
3345
1070
  return child;
3346
1071
  });
3347
- const onChange = React12__namespace.useCallback((i) => {
1072
+ const onChange = React11__namespace.useCallback((i) => {
3348
1073
  setIndex(i);
3349
1074
  }, []);
3350
1075
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -3395,9 +1120,35 @@ var NextButton = (props) => {
3395
1120
  );
3396
1121
  };
3397
1122
  NextButton.displayName = "NextButton";
1123
+ var mapFields = (schema) => schema && Object.entries(schema).map(([name, { items, label, title, ...field }]) => {
1124
+ return {
1125
+ ...field,
1126
+ name,
1127
+ label: label || title || name
1128
+ // json schema compatibility
1129
+ };
1130
+ });
1131
+ var objectFieldResolver = (schema) => {
1132
+ const getFields = () => {
1133
+ return mapFields(schema);
1134
+ };
1135
+ const getNestedFields = (name) => {
1136
+ var _a;
1137
+ const field = utils.get(schema, name);
1138
+ if (!field)
1139
+ return [];
1140
+ if (((_a = field.items) == null ? void 0 : _a.type) === "object") {
1141
+ return mapFields(field.items.properties);
1142
+ } else if (field.type === "object") {
1143
+ return mapFields(field.properties);
1144
+ }
1145
+ return [field.items];
1146
+ };
1147
+ return { getFields, getNestedFields };
1148
+ };
3398
1149
  var WatchField = (props) => {
3399
1150
  const { name, defaultValue, isDisabled, isExact } = props;
3400
- const form = reactHookForm.useFormContext();
1151
+ const form = useFormContext();
3401
1152
  const field = reactHookForm.useWatch({
3402
1153
  name,
3403
1154
  defaultValue,
@@ -3408,23 +1159,31 @@ var WatchField = (props) => {
3408
1159
  };
3409
1160
  function createForm({
3410
1161
  resolver,
1162
+ fieldResolver = objectFieldResolver,
3411
1163
  fields
3412
1164
  } = {}) {
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
- };
1165
+ const CreateForm = react.forwardRef(
1166
+ (props, ref) => {
1167
+ const { schema, ...rest } = props;
1168
+ return /* @__PURE__ */ jsxRuntime.jsx(FieldsProvider, { value: fields || {}, children: /* @__PURE__ */ jsxRuntime.jsx(
1169
+ Form,
1170
+ {
1171
+ ref,
1172
+ resolver: resolver == null ? void 0 : resolver(props.schema),
1173
+ fieldResolver: fieldResolver == null ? void 0 : fieldResolver(schema),
1174
+ ...rest
1175
+ }
1176
+ ) });
1177
+ }
1178
+ );
3417
1179
  return CreateForm;
3418
1180
  }
1181
+ var Form2 = createForm();
3419
1182
 
3420
1183
  Object.defineProperty(exports, 'Controller', {
3421
1184
  enumerable: true,
3422
1185
  get: function () { return reactHookForm.Controller; }
3423
1186
  });
3424
- Object.defineProperty(exports, 'FormProvider', {
3425
- enumerable: true,
3426
- get: function () { return reactHookForm.FormProvider; }
3427
- });
3428
1187
  Object.defineProperty(exports, 'appendErrors', {
3429
1188
  enumerable: true,
3430
1189
  get: function () { return reactHookForm.appendErrors; }
@@ -3441,10 +1200,6 @@ Object.defineProperty(exports, 'useForm', {
3441
1200
  enumerable: true,
3442
1201
  get: function () { return reactHookForm.useForm; }
3443
1202
  });
3444
- Object.defineProperty(exports, 'useFormContext', {
3445
- enumerable: true,
3446
- get: function () { return reactHookForm.useFormContext; }
3447
- });
3448
1203
  Object.defineProperty(exports, 'useFormState', {
3449
1204
  enumerable: true,
3450
1205
  get: function () { return reactHookForm.useFormState; }
@@ -3464,16 +1219,17 @@ exports.ArrayFieldRowFields = ArrayFieldRowFields;
3464
1219
  exports.ArrayFieldRowProvider = ArrayFieldRowProvider;
3465
1220
  exports.ArrayFieldRows = ArrayFieldRows;
3466
1221
  exports.AutoFields = AutoFields;
3467
- exports.AutoForm = AutoForm;
3468
1222
  exports.BaseField = BaseField;
1223
+ exports.BaseForm = Form;
3469
1224
  exports.CheckboxField = CheckboxField;
3470
1225
  exports.DisplayField = DisplayField;
3471
1226
  exports.DisplayIf = DisplayIf;
3472
1227
  exports.Field = Field;
3473
1228
  exports.FieldsProvider = FieldsProvider;
3474
- exports.Form = Form;
1229
+ exports.Form = Form2;
3475
1230
  exports.FormLayout = FormLayout;
3476
1231
  exports.FormLegend = FormLegend;
1232
+ exports.FormProvider = FormProvider;
3477
1233
  exports.FormStep = FormStep;
3478
1234
  exports.FormStepper = FormStepper;
3479
1235
  exports.FormValue = FormValue;
@@ -3491,7 +1247,10 @@ exports.PrevButton = PrevButton;
3491
1247
  exports.RadioField = RadioField;
3492
1248
  exports.RadioInput = RadioInput;
3493
1249
  exports.Select = Select;
1250
+ exports.SelectButton = SelectButton;
3494
1251
  exports.SelectField = SelectField;
1252
+ exports.SelectList = SelectList;
1253
+ exports.SelectOption = SelectOption;
3495
1254
  exports.StepForm = StepForm;
3496
1255
  exports.StepFormProvider = StepFormProvider;
3497
1256
  exports.SubmitButton = SubmitButton;
@@ -3509,6 +1268,7 @@ exports.useArrayFieldRemoveButton = useArrayFieldRemoveButton;
3509
1268
  exports.useArrayFieldRow = useArrayFieldRow;
3510
1269
  exports.useArrayFieldRowContext = useArrayFieldRowContext;
3511
1270
  exports.useField = useField;
1271
+ exports.useFormContext = useFormContext;
3512
1272
  exports.useFormStep = useFormStep;
3513
1273
  exports.useStepForm = useStepForm;
3514
1274
  exports.useStepFormContext = useStepFormContext;