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

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