@saas-ui/forms 2.0.0-next.3 → 2.0.0-next.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +30 -0
- package/README.md +53 -6
- package/dist/ajv/index.d.ts +1 -1
- package/dist/ajv/index.js.map +1 -1
- package/dist/ajv/index.mjs.map +1 -1
- package/dist/index.d.ts +265 -166
- package/dist/index.js +2821 -556
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2814 -555
- package/dist/index.mjs.map +1 -1
- package/dist/yup/index.d.ts +98 -6
- package/dist/yup/index.js.map +1 -1
- package/dist/yup/index.mjs.map +1 -1
- package/dist/zod/index.d.ts +97 -4
- package/dist/zod/index.js.map +1 -1
- package/dist/zod/index.mjs.map +1 -1
- package/package.json +5 -3
- package/src/array-field.tsx +50 -30
- package/src/auto-form.tsx +7 -3
- package/src/base-field.tsx +59 -0
- package/src/create-field.tsx +143 -0
- package/src/create-form.tsx +31 -0
- package/src/default-fields.tsx +146 -0
- package/src/display-field.tsx +8 -9
- package/src/display-if.tsx +6 -5
- package/src/field-resolver.ts +1 -1
- package/src/field.tsx +14 -444
- package/src/fields-context.tsx +23 -0
- package/src/fields.tsx +18 -8
- package/src/form.tsx +27 -37
- package/src/index.ts +38 -0
- package/src/input-right-button/input-right-button.stories.tsx +1 -1
- package/src/input-right-button/input-right-button.tsx +0 -2
- package/src/layout.tsx +16 -11
- package/src/number-input/number-input.tsx +9 -5
- package/src/object-field.tsx +8 -7
- package/src/password-input/password-input.stories.tsx +23 -2
- package/src/password-input/password-input.tsx +5 -5
- package/src/pin-input/pin-input.tsx +1 -5
- package/src/radio/radio-input.stories.tsx +1 -1
- package/src/radio/radio-input.tsx +12 -10
- package/src/select/native-select.tsx +1 -4
- package/src/select/select.test.tsx +1 -1
- package/src/select/select.tsx +18 -14
- package/src/step-form.tsx +29 -11
- package/src/submit-button.tsx +5 -1
- package/src/types.ts +91 -0
- package/src/utils.ts +15 -0
- /package/src/radio/{radio.test.tsx → radio-input.test.tsx} +0 -0
package/dist/index.mjs
CHANGED
@@ -1,75 +1,2410 @@
|
|
1
|
-
import
|
2
|
-
import React8__default, { useState } from 'react';
|
3
|
-
import { __DEV__, cx, runIfFn, callAllHandlers, get as get$1 } from '@chakra-ui/utils';
|
4
|
-
import { useForm, FormProvider, useFormContext, Controller, useFieldArray, useWatch, get } from 'react-hook-form';
|
1
|
+
import { useForm, FormProvider, useFormContext, useFieldArray, useWatch, get as get$1, Controller } from 'react-hook-form';
|
5
2
|
export { Controller, FormProvider, appendErrors, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch } from 'react-hook-form';
|
6
|
-
import { forwardRef, NumberInput as NumberInput$1, NumberInputField, NumberInputStepper, NumberIncrementStepper, NumberDecrementStepper, InputRightElement, Button, InputGroup, Input, RadioGroup, Stack, Radio, useMultiStyleConfig, MenuButton, omitThemingProps, useFormControl, Menu, chakra, MenuList, MenuOptionGroup, MenuItemOption, Select as Select$1, Switch, Checkbox, HStack, PinInput, FormControl, FormLabel, Text, Box, FormHelperText, FormErrorMessage,
|
7
|
-
import {
|
8
|
-
import
|
9
|
-
import {
|
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';
|
4
|
+
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';
|
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';
|
11
|
+
import { createContext as createContext$1 } from '@chakra-ui/react-utils';
|
10
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 });
|
27
|
+
}
|
28
|
+
return to;
|
29
|
+
};
|
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
|
+
});
|
12
855
|
var DisplayField = ({
|
13
856
|
name,
|
14
857
|
label,
|
15
858
|
placeholder,
|
16
859
|
...props
|
17
860
|
}) => {
|
18
|
-
return /* @__PURE__ */
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
};
|
28
|
-
|
29
|
-
|
861
|
+
return /* @__PURE__ */ jsxs(FormControl, { ...props, children: [
|
862
|
+
label ? /* @__PURE__ */ jsx(FormLabel, { htmlFor: name, children: label }) : null,
|
863
|
+
/* @__PURE__ */ jsx(Text, { fontSize: "md", children: /* @__PURE__ */ jsx(FormValue, { name }) })
|
864
|
+
] });
|
865
|
+
};
|
866
|
+
DisplayField.displayName = "DisplayField";
|
867
|
+
var FormValue = ({ name }) => {
|
868
|
+
const { getValues } = useFormContext();
|
869
|
+
return getValues(name) || null;
|
870
|
+
};
|
871
|
+
FormValue.displayName = "FormValue";
|
872
|
+
var NumberInput = forwardRef((props, ref) => {
|
873
|
+
const {
|
874
|
+
hideStepper,
|
875
|
+
incrementIcon = /* @__PURE__ */ jsx(ChevronUpIcon, {}),
|
876
|
+
decrementIcon = /* @__PURE__ */ jsx(ChevronDownIcon, {}),
|
877
|
+
...rest
|
878
|
+
} = 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;
|
30
2202
|
}
|
31
|
-
|
32
|
-
|
33
|
-
|
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;
|
34
2265
|
};
|
35
|
-
|
36
|
-
|
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;
|
37
2285
|
}
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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"
|
51
2327
|
};
|
52
|
-
|
53
|
-
|
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;
|
54
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"
|
2400
|
+
});
|
55
2401
|
var InputRightButton = forwardRef(
|
56
2402
|
(props, ref) => {
|
57
|
-
return /* @__PURE__ */
|
58
|
-
w: "auto",
|
59
|
-
px: "1",
|
60
|
-
py: "1",
|
61
|
-
alignItems: "stretch"
|
62
|
-
}, /* @__PURE__ */ React8.createElement(Button, {
|
63
|
-
ref,
|
64
|
-
height: "auto",
|
65
|
-
...props
|
66
|
-
}));
|
2403
|
+
return /* @__PURE__ */ jsx(InputRightElement, { w: "auto", px: "1", py: "1", alignItems: "stretch", children: /* @__PURE__ */ jsx(Button, { ref, height: "auto", ...props }) });
|
67
2404
|
}
|
68
2405
|
);
|
69
2406
|
InputRightButton.id = "InputRightElement";
|
70
2407
|
InputRightButton.displayName = "InputRightButton";
|
71
|
-
|
72
|
-
// src/password-input/password-input.tsx
|
73
2408
|
var PasswordInput = forwardRef(
|
74
2409
|
(props, ref) => {
|
75
2410
|
const {
|
@@ -80,6 +2415,7 @@ var PasswordInput = forwardRef(
|
|
80
2415
|
width,
|
81
2416
|
size,
|
82
2417
|
variant,
|
2418
|
+
leftAddon,
|
83
2419
|
...inputProps
|
84
2420
|
} = props;
|
85
2421
|
const [show, setShow] = useState(false);
|
@@ -87,55 +2423,81 @@ var PasswordInput = forwardRef(
|
|
87
2423
|
const label = show ? "Hide password" : "Show password";
|
88
2424
|
let icon;
|
89
2425
|
if (show) {
|
90
|
-
icon = viewIcon || /* @__PURE__ */
|
2426
|
+
icon = viewIcon || /* @__PURE__ */ jsx(ViewIcon, {});
|
91
2427
|
} else {
|
92
|
-
icon = viewOffIcon || /* @__PURE__ */
|
2428
|
+
icon = viewOffIcon || /* @__PURE__ */ jsx(ViewOffIcon, {});
|
93
2429
|
}
|
94
2430
|
const groupProps = {
|
95
2431
|
width: w || width,
|
96
2432
|
size,
|
97
2433
|
variant
|
98
2434
|
};
|
99
|
-
return /* @__PURE__ */
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
2435
|
+
return /* @__PURE__ */ jsxs(InputGroup, { ...groupProps, children: [
|
2436
|
+
leftAddon,
|
2437
|
+
/* @__PURE__ */ jsx(
|
2438
|
+
Input,
|
2439
|
+
{
|
2440
|
+
...inputProps,
|
2441
|
+
ref,
|
2442
|
+
type: show ? "text" : "password",
|
2443
|
+
autoComplete: show ? "off" : autoComplete
|
2444
|
+
}
|
2445
|
+
),
|
2446
|
+
/* @__PURE__ */ jsx(
|
2447
|
+
InputRightButton,
|
2448
|
+
{
|
2449
|
+
onClick: handleClick,
|
2450
|
+
"aria-label": label,
|
2451
|
+
variant: "ghost",
|
2452
|
+
children: icon
|
2453
|
+
}
|
2454
|
+
)
|
2455
|
+
] });
|
111
2456
|
}
|
112
2457
|
);
|
113
|
-
|
114
|
-
|
115
|
-
|
2458
|
+
PasswordInput.displayName = "PasswordInput";
|
2459
|
+
var mapNestedFields = (name, children) => {
|
2460
|
+
return React12.Children.map(children, (child) => {
|
2461
|
+
if (React12.isValidElement(child) && child.props.name) {
|
2462
|
+
return React12.cloneElement(child, {
|
2463
|
+
...child.props,
|
2464
|
+
name: `${name}.${child.props.name}`
|
2465
|
+
});
|
2466
|
+
}
|
2467
|
+
return child;
|
2468
|
+
});
|
2469
|
+
};
|
2470
|
+
var mapOptions = (options) => {
|
2471
|
+
return options.map((option) => {
|
2472
|
+
if (typeof option === "string") {
|
2473
|
+
return {
|
2474
|
+
label: option,
|
2475
|
+
value: option
|
2476
|
+
};
|
2477
|
+
}
|
2478
|
+
return option;
|
2479
|
+
});
|
2480
|
+
};
|
116
2481
|
var RadioInput = forwardRef(
|
117
|
-
({ options, spacing, direction, ...props }, ref) => {
|
2482
|
+
({ options: optionsProp, spacing, direction, ...props }, ref) => {
|
118
2483
|
const { onBlur, onChange, ...groupProps } = props;
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
})));
|
2484
|
+
const options = mapOptions(optionsProp);
|
2485
|
+
return /* @__PURE__ */ jsx(RadioGroup, { onChange, ...groupProps, children: /* @__PURE__ */ jsx(Stack, { spacing, direction, children: options.map(({ value, label, ...radioProps }, i) => {
|
2486
|
+
return /* @__PURE__ */ jsx(
|
2487
|
+
Radio,
|
2488
|
+
{
|
2489
|
+
onBlur,
|
2490
|
+
value,
|
2491
|
+
ref,
|
2492
|
+
...radioProps,
|
2493
|
+
children: label || value
|
2494
|
+
},
|
2495
|
+
i
|
2496
|
+
);
|
2497
|
+
}) }) });
|
134
2498
|
}
|
135
2499
|
);
|
136
|
-
|
137
|
-
RadioInput.displayName = "RadioInput";
|
138
|
-
}
|
2500
|
+
RadioInput.displayName = "RadioInput";
|
139
2501
|
var SelectButton = forwardRef((props, ref) => {
|
140
2502
|
const styles = useMultiStyleConfig("Input", props);
|
141
2503
|
const focusStyles = styles.field._focusVisible;
|
@@ -153,20 +2515,13 @@ var SelectButton = forwardRef((props, ref) => {
|
|
153
2515
|
...styles.field,
|
154
2516
|
h: "auto"
|
155
2517
|
};
|
156
|
-
return /* @__PURE__ */
|
157
|
-
as: Button,
|
158
|
-
...props,
|
159
|
-
ref,
|
160
|
-
sx: buttonStyles
|
161
|
-
});
|
2518
|
+
return /* @__PURE__ */ jsx(MenuButton, { as: Button, ...props, ref, sx: buttonStyles });
|
162
2519
|
});
|
163
|
-
|
164
|
-
SelectButton.displayName = "SelectButton";
|
165
|
-
}
|
2520
|
+
SelectButton.displayName = "SelectButton";
|
166
2521
|
var Select = forwardRef((props, ref) => {
|
167
2522
|
const {
|
168
2523
|
name,
|
169
|
-
options,
|
2524
|
+
options: optionsProp,
|
170
2525
|
children,
|
171
2526
|
onChange,
|
172
2527
|
defaultValue,
|
@@ -174,7 +2529,7 @@ var Select = forwardRef((props, ref) => {
|
|
174
2529
|
placeholder,
|
175
2530
|
isDisabled,
|
176
2531
|
leftIcon,
|
177
|
-
rightIcon = /* @__PURE__ */
|
2532
|
+
rightIcon = /* @__PURE__ */ jsx(ChevronDownIcon, {}),
|
178
2533
|
multiple,
|
179
2534
|
size,
|
180
2535
|
variant,
|
@@ -183,8 +2538,12 @@ var Select = forwardRef((props, ref) => {
|
|
183
2538
|
...rest
|
184
2539
|
} = props;
|
185
2540
|
const menuProps = omitThemingProps(rest);
|
186
|
-
const [currentValue, setCurrentValue] =
|
2541
|
+
const [currentValue, setCurrentValue] = React12.useState(value || defaultValue);
|
187
2542
|
const controlProps = useFormControl({ name });
|
2543
|
+
const options = React12.useMemo(
|
2544
|
+
() => optionsProp && mapOptions(optionsProp),
|
2545
|
+
[optionsProp]
|
2546
|
+
);
|
188
2547
|
const handleChange = (value2) => {
|
189
2548
|
setCurrentValue(value2);
|
190
2549
|
onChange == null ? void 0 : onChange(value2);
|
@@ -196,7 +2555,7 @@ var Select = forwardRef((props, ref) => {
|
|
196
2555
|
size,
|
197
2556
|
variant
|
198
2557
|
};
|
199
|
-
const getDisplayValue =
|
2558
|
+
const getDisplayValue = React12.useCallback(
|
200
2559
|
(value2) => {
|
201
2560
|
if (!options) {
|
202
2561
|
return value2;
|
@@ -213,86 +2572,56 @@ var Select = forwardRef((props, ref) => {
|
|
213
2572
|
const displayValue = currentValue ? (Array.isArray(currentValue) ? currentValue : [currentValue]).map(
|
214
2573
|
getDisplayValue
|
215
2574
|
) : [];
|
216
|
-
return /* @__PURE__ */
|
217
|
-
...
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
name,
|
239
|
-
type: "hidden",
|
240
|
-
value: currentValue,
|
241
|
-
className: "saas-select__input"
|
242
|
-
})));
|
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,
|
2579
|
+
{
|
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
|
2584
|
+
}
|
2585
|
+
) }),
|
2586
|
+
/* @__PURE__ */ jsx(
|
2587
|
+
chakra$1.input,
|
2588
|
+
{
|
2589
|
+
...controlProps,
|
2590
|
+
name,
|
2591
|
+
type: "hidden",
|
2592
|
+
value: currentValue,
|
2593
|
+
className: "saas-select__input"
|
2594
|
+
}
|
2595
|
+
)
|
2596
|
+
] }) });
|
243
2597
|
});
|
244
|
-
|
245
|
-
Select.displayName = "Select";
|
246
|
-
}
|
2598
|
+
Select.displayName = "Select";
|
247
2599
|
var NativeSelect = forwardRef(
|
248
2600
|
({ options, children, ...props }, ref) => {
|
249
|
-
return /* @__PURE__ */
|
250
|
-
|
251
|
-
|
252
|
-
}, children || (options == null ? void 0 : options.map(({ value, label }) => {
|
253
|
-
return /* @__PURE__ */ React8.createElement("option", {
|
254
|
-
key: value,
|
255
|
-
value
|
256
|
-
}, label || value);
|
257
|
-
})));
|
2601
|
+
return /* @__PURE__ */ jsx(Select$1, { ref, ...props, children: children || (options == null ? void 0 : options.map(({ value, label }) => {
|
2602
|
+
return /* @__PURE__ */ jsx("option", { value, children: label || value }, value);
|
2603
|
+
})) });
|
258
2604
|
}
|
259
2605
|
);
|
260
|
-
|
261
|
-
NativeSelect.displayName = "NativeSelect";
|
262
|
-
}
|
263
|
-
|
264
|
-
// src/field.tsx
|
265
|
-
var inputTypes = {};
|
266
|
-
var defaultInputType = "text";
|
267
|
-
var getInput = (type) => {
|
268
|
-
return inputTypes[type] || inputTypes[defaultInputType];
|
269
|
-
};
|
2606
|
+
NativeSelect.displayName = "NativeSelect";
|
270
2607
|
var getError = (name, formState) => {
|
271
|
-
return get(formState.errors, name);
|
2608
|
+
return get$1(formState.errors, name);
|
272
2609
|
};
|
273
2610
|
var BaseField = (props) => {
|
274
2611
|
const { name, label, help, hideLabel, children, ...controlProps } = props;
|
275
2612
|
const { formState } = useFormContext();
|
276
2613
|
const error = getError(name, formState);
|
277
|
-
return /* @__PURE__ */
|
278
|
-
|
279
|
-
|
280
|
-
|
2614
|
+
return /* @__PURE__ */ jsxs(FormControl, { ...controlProps, isInvalid: !!error, children: [
|
2615
|
+
label && !hideLabel ? /* @__PURE__ */ jsx(FormLabel, { children: label }) : null,
|
2616
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
2617
|
+
children,
|
2618
|
+
help && !(error == null ? void 0 : error.message) ? /* @__PURE__ */ jsx(FormHelperText, { children: help }) : null,
|
2619
|
+
(error == null ? void 0 : error.message) && /* @__PURE__ */ jsx(FormErrorMessage, { children: error == null ? void 0 : error.message })
|
2620
|
+
] })
|
2621
|
+
] });
|
281
2622
|
};
|
282
|
-
|
283
|
-
|
284
|
-
}
|
285
|
-
var Field = React8.forwardRef(
|
286
|
-
(props, ref) => {
|
287
|
-
const { type = defaultInputType } = props;
|
288
|
-
const InputComponent = getInput(type);
|
289
|
-
return /* @__PURE__ */ React8.createElement(InputComponent, {
|
290
|
-
ref,
|
291
|
-
...props
|
292
|
-
});
|
293
|
-
}
|
294
|
-
);
|
295
|
-
var createField = (InputComponent, { displayName, hideLabel, BaseField: BaseField2 }) => {
|
2623
|
+
BaseField.displayName = "BaseField";
|
2624
|
+
var _createField = (InputComponent, { displayName, hideLabel, BaseField: BaseField2 }) => {
|
296
2625
|
const Field2 = forwardRef((props, ref) => {
|
297
2626
|
const {
|
298
2627
|
id,
|
@@ -310,24 +2639,31 @@ var createField = (InputComponent, { displayName, hideLabel, BaseField: BaseFiel
|
|
310
2639
|
required: isRequired,
|
311
2640
|
...rules
|
312
2641
|
};
|
313
|
-
return /* @__PURE__ */
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
2642
|
+
return /* @__PURE__ */ jsx(
|
2643
|
+
BaseField2,
|
2644
|
+
{
|
2645
|
+
id,
|
2646
|
+
name,
|
2647
|
+
label,
|
2648
|
+
help,
|
2649
|
+
hideLabel,
|
2650
|
+
isDisabled,
|
2651
|
+
isInvalid,
|
2652
|
+
isReadOnly,
|
2653
|
+
isRequired,
|
2654
|
+
children: /* @__PURE__ */ jsx(
|
2655
|
+
InputComponent,
|
2656
|
+
{
|
2657
|
+
ref,
|
2658
|
+
id,
|
2659
|
+
name,
|
2660
|
+
label: hideLabel ? label : void 0,
|
2661
|
+
rules: inputRules,
|
2662
|
+
...inputProps
|
2663
|
+
}
|
2664
|
+
)
|
2665
|
+
}
|
2666
|
+
);
|
331
2667
|
});
|
332
2668
|
Field2.displayName = displayName;
|
333
2669
|
return Field2;
|
@@ -336,18 +2672,24 @@ var withControlledInput = (InputComponent) => {
|
|
336
2672
|
return forwardRef(
|
337
2673
|
({ name, rules, ...inputProps }, ref) => {
|
338
2674
|
const { control } = useFormContext();
|
339
|
-
return /* @__PURE__ */
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
...
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
2675
|
+
return /* @__PURE__ */ jsx(
|
2676
|
+
Controller,
|
2677
|
+
{
|
2678
|
+
name,
|
2679
|
+
control,
|
2680
|
+
rules,
|
2681
|
+
render: ({ field: { ref: _ref, ...field } }) => /* @__PURE__ */ jsx(
|
2682
|
+
InputComponent,
|
2683
|
+
{
|
2684
|
+
...field,
|
2685
|
+
...inputProps,
|
2686
|
+
onChange: callAllHandlers(inputProps.onChange, field.onChange),
|
2687
|
+
onBlur: callAllHandlers(inputProps.onBlur, field.onBlur),
|
2688
|
+
ref: useMergeRefs(ref, _ref)
|
2689
|
+
}
|
2690
|
+
)
|
2691
|
+
}
|
2692
|
+
);
|
351
2693
|
}
|
352
2694
|
);
|
353
2695
|
};
|
@@ -356,133 +2698,135 @@ var withUncontrolledInput = (InputComponent) => {
|
|
356
2698
|
({ name, rules, ...inputProps }, ref) => {
|
357
2699
|
const { register } = useFormContext();
|
358
2700
|
const { ref: _ref, ...field } = register(name, rules);
|
359
|
-
return /* @__PURE__ */
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
2701
|
+
return /* @__PURE__ */ jsx(
|
2702
|
+
InputComponent,
|
2703
|
+
{
|
2704
|
+
...field,
|
2705
|
+
...inputProps,
|
2706
|
+
onChange: callAllHandlers(inputProps.onChange, field.onChange),
|
2707
|
+
onBlur: callAllHandlers(inputProps.onBlur, field.onBlur),
|
2708
|
+
ref: useMergeRefs(ref, _ref)
|
2709
|
+
}
|
2710
|
+
);
|
366
2711
|
}
|
367
2712
|
);
|
368
2713
|
};
|
369
|
-
var
|
2714
|
+
var createField = (component, options) => {
|
2715
|
+
var _a2;
|
370
2716
|
let InputComponent;
|
371
2717
|
if (options == null ? void 0 : options.isControlled) {
|
372
2718
|
InputComponent = withControlledInput(component);
|
373
2719
|
} else {
|
374
2720
|
InputComponent = withUncontrolledInput(component);
|
375
2721
|
}
|
376
|
-
const Field2 =
|
377
|
-
displayName: `${
|
2722
|
+
const Field2 = _createField(InputComponent, {
|
2723
|
+
displayName: `${(_a2 = component.displayName) != null ? _a2 : "Custom"}Field`,
|
378
2724
|
hideLabel: options == null ? void 0 : options.hideLabel,
|
379
2725
|
BaseField: (options == null ? void 0 : options.BaseField) || BaseField
|
380
2726
|
});
|
381
|
-
inputTypes[type] = Field2;
|
382
2727
|
return Field2;
|
383
2728
|
};
|
384
|
-
var InputField =
|
385
|
-
"text",
|
2729
|
+
var InputField = createField(
|
386
2730
|
forwardRef(({ type = "text", leftAddon, rightAddon, size, ...rest }, ref) => {
|
387
|
-
const input = /* @__PURE__ */
|
388
|
-
type,
|
389
|
-
size,
|
390
|
-
...rest,
|
391
|
-
ref
|
392
|
-
});
|
2731
|
+
const input = /* @__PURE__ */ jsx(Input, { type, size, ...rest, ref });
|
393
2732
|
if (leftAddon || rightAddon) {
|
394
|
-
return /* @__PURE__ */
|
395
|
-
|
396
|
-
|
2733
|
+
return /* @__PURE__ */ jsxs(InputGroup, { size, children: [
|
2734
|
+
leftAddon,
|
2735
|
+
input,
|
2736
|
+
rightAddon
|
2737
|
+
] });
|
397
2738
|
}
|
398
2739
|
return input;
|
399
2740
|
})
|
400
2741
|
);
|
401
|
-
var NumberInputField2 =
|
402
|
-
"number",
|
2742
|
+
var NumberInputField2 = createField(
|
403
2743
|
NumberInput,
|
404
2744
|
{
|
405
2745
|
isControlled: true
|
406
2746
|
}
|
407
2747
|
);
|
408
|
-
var PasswordInputField =
|
409
|
-
|
410
|
-
forwardRef((props, ref) => /* @__PURE__ */ React8.createElement(PasswordInput, {
|
411
|
-
ref,
|
412
|
-
...props
|
413
|
-
}))
|
414
|
-
);
|
415
|
-
var TextareaField = registerFieldType(
|
416
|
-
"textarea",
|
417
|
-
Textarea
|
2748
|
+
var PasswordInputField = createField(
|
2749
|
+
forwardRef((props, ref) => /* @__PURE__ */ jsx(PasswordInput, { ref, ...props }))
|
418
2750
|
);
|
419
|
-
var
|
420
|
-
|
2751
|
+
var TextareaField = createField(Textarea);
|
2752
|
+
var SwitchField = createField(
|
421
2753
|
forwardRef(({ type, value, ...rest }, ref) => {
|
422
|
-
return /* @__PURE__ */
|
423
|
-
isChecked: !!value,
|
424
|
-
...rest,
|
425
|
-
ref
|
426
|
-
});
|
2754
|
+
return /* @__PURE__ */ jsx(Switch, { isChecked: !!value, ...rest, ref });
|
427
2755
|
}),
|
428
2756
|
{
|
429
2757
|
isControlled: true
|
430
2758
|
}
|
431
2759
|
);
|
432
|
-
var SelectField =
|
2760
|
+
var SelectField = createField(Select, {
|
433
2761
|
isControlled: true
|
434
2762
|
});
|
435
|
-
var CheckboxField =
|
436
|
-
"checkbox",
|
2763
|
+
var CheckboxField = createField(
|
437
2764
|
forwardRef(({ label, type, ...props }, ref) => {
|
438
|
-
return /* @__PURE__ */
|
439
|
-
ref,
|
440
|
-
...props
|
441
|
-
}, label);
|
2765
|
+
return /* @__PURE__ */ jsx(Checkbox, { ref, ...props, children: label });
|
442
2766
|
}),
|
443
2767
|
{
|
444
2768
|
hideLabel: true
|
445
2769
|
}
|
446
2770
|
);
|
447
|
-
var RadioField =
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
var NativeSelectField = registerFieldType(
|
455
|
-
"native-select",
|
456
|
-
NativeSelect,
|
457
|
-
{ isControlled: true }
|
458
|
-
);
|
459
|
-
var PinField = registerFieldType(
|
460
|
-
"pin",
|
2771
|
+
var RadioField = createField(RadioInput, {
|
2772
|
+
isControlled: true
|
2773
|
+
});
|
2774
|
+
var NativeSelectField = createField(NativeSelect, {
|
2775
|
+
isControlled: true
|
2776
|
+
});
|
2777
|
+
var PinField = createField(
|
461
2778
|
forwardRef((props, ref) => {
|
462
2779
|
const { pinLength = 4, pinType, spacing, ...inputProps } = props;
|
463
2780
|
const inputs = [];
|
464
2781
|
for (let i = 0; i < pinLength; i++) {
|
465
|
-
inputs.push(/* @__PURE__ */
|
466
|
-
|
467
|
-
|
468
|
-
}));
|
469
|
-
}
|
470
|
-
return /* @__PURE__ */ React8.createElement(HStack, {
|
471
|
-
spacing
|
472
|
-
}, /* @__PURE__ */ React8.createElement(PinInput, {
|
473
|
-
...inputProps,
|
474
|
-
type: pinType
|
475
|
-
}, inputs));
|
2782
|
+
inputs.push(/* @__PURE__ */ jsx(PinInputField, { ref }, i));
|
2783
|
+
}
|
2784
|
+
return /* @__PURE__ */ jsx(HStack, { spacing, children: /* @__PURE__ */ jsx(PinInput, { ...inputProps, type: pinType, children: inputs }) });
|
476
2785
|
}),
|
477
2786
|
{
|
478
2787
|
isControlled: true
|
479
2788
|
}
|
480
2789
|
);
|
2790
|
+
var defaultFieldTypes = {
|
2791
|
+
text: InputField,
|
2792
|
+
email: InputField,
|
2793
|
+
url: InputField,
|
2794
|
+
phone: InputField,
|
2795
|
+
number: NumberInputField2,
|
2796
|
+
password: PasswordInputField,
|
2797
|
+
textarea: TextareaField,
|
2798
|
+
switch: SwitchField,
|
2799
|
+
select: SelectField,
|
2800
|
+
checkbox: CheckboxField,
|
2801
|
+
radio: RadioField,
|
2802
|
+
pin: PinField,
|
2803
|
+
"native-select": NativeSelectField
|
2804
|
+
};
|
2805
|
+
var FieldsContext = React12__default.createContext(
|
2806
|
+
null
|
2807
|
+
);
|
2808
|
+
var FieldsProvider = (props) => {
|
2809
|
+
const fields = { ...defaultFieldTypes, ...props.value };
|
2810
|
+
return /* @__PURE__ */ jsx(FieldsContext.Provider, { value: fields, children: props.children });
|
2811
|
+
};
|
2812
|
+
var useField = (type) => {
|
2813
|
+
const context = React12__default.useContext(FieldsContext);
|
2814
|
+
return (context == null ? void 0 : context[type]) || InputField;
|
2815
|
+
};
|
2816
|
+
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
|
+
);
|
481
2824
|
var mapFields = (schema) => schema && Object.entries(schema).map(([name, { items, label, title, ...field }]) => {
|
482
2825
|
return {
|
483
2826
|
...field,
|
484
2827
|
name,
|
485
2828
|
label: label || title || name
|
2829
|
+
// json schema compatibility
|
486
2830
|
};
|
487
2831
|
});
|
488
2832
|
var objectFieldResolver = (schema) => {
|
@@ -490,11 +2834,11 @@ var objectFieldResolver = (schema) => {
|
|
490
2834
|
return mapFields(schema);
|
491
2835
|
};
|
492
2836
|
const getNestedFields = (name) => {
|
493
|
-
var
|
494
|
-
const field = get$
|
2837
|
+
var _a2;
|
2838
|
+
const field = get$2(schema, name);
|
495
2839
|
if (!field)
|
496
2840
|
return [];
|
497
|
-
if (((
|
2841
|
+
if (((_a2 = field.items) == null ? void 0 : _a2.type) === "object") {
|
498
2842
|
return mapFields(field.items.properties);
|
499
2843
|
} else if (field.type === "object") {
|
500
2844
|
return mapFields(field.properties);
|
@@ -503,11 +2847,9 @@ var objectFieldResolver = (schema) => {
|
|
503
2847
|
};
|
504
2848
|
return { getFields, getNestedFields };
|
505
2849
|
};
|
506
|
-
|
507
|
-
// src/form.tsx
|
508
2850
|
var Form = forwardRef(
|
509
2851
|
(props, ref) => {
|
510
|
-
var
|
2852
|
+
var _a2;
|
511
2853
|
const {
|
512
2854
|
mode = "all",
|
513
2855
|
resolver,
|
@@ -544,93 +2886,68 @@ var Form = forwardRef(
|
|
544
2886
|
resetOptions
|
545
2887
|
};
|
546
2888
|
if (schema && !resolver) {
|
547
|
-
form.resolver = (
|
2889
|
+
form.resolver = (_a2 = Form.getResolver) == null ? void 0 : _a2.call(Form, schema);
|
548
2890
|
}
|
549
2891
|
const methods = useForm(form);
|
550
2892
|
const { handleSubmit } = methods;
|
551
|
-
|
552
|
-
|
2893
|
+
React12.useImperativeHandle(formRef, () => methods, [formRef, methods]);
|
2894
|
+
React12.useEffect(() => {
|
553
2895
|
let subscription;
|
554
2896
|
if (onChange) {
|
555
2897
|
subscription = methods.watch(onChange);
|
556
2898
|
}
|
557
2899
|
return () => subscription == null ? void 0 : subscription.unsubscribe();
|
558
2900
|
}, [methods, onChange]);
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
}, runIfFn(children, {
|
573
|
-
Field: Field2,
|
574
|
-
...methods
|
575
|
-
})));
|
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
|
+
) });
|
576
2914
|
}
|
577
2915
|
);
|
578
2916
|
Form.getFieldResolver = objectFieldResolver;
|
579
2917
|
Form.displayName = "Form";
|
580
|
-
function createForm({ resolver }) {
|
581
|
-
const CreateForm = (props) => {
|
582
|
-
const { schema, ...rest } = props;
|
583
|
-
return /* @__PURE__ */ React8.createElement(Form, {
|
584
|
-
resolver: resolver == null ? void 0 : resolver(props.schema),
|
585
|
-
...rest
|
586
|
-
});
|
587
|
-
};
|
588
|
-
return CreateForm;
|
589
|
-
}
|
590
2918
|
var FormLayoutItem = ({ children }) => {
|
591
|
-
return /* @__PURE__ */
|
2919
|
+
return /* @__PURE__ */ jsx(chakra$1.div, { children });
|
592
2920
|
};
|
593
|
-
|
594
|
-
FormLayoutItem.displayName = "FormLayoutItem";
|
595
|
-
}
|
2921
|
+
FormLayoutItem.displayName = "FormLayoutItem";
|
596
2922
|
var FormLayout = ({ children, ...props }) => {
|
597
|
-
var
|
598
|
-
const theme = useTheme();
|
599
|
-
const defaultProps = (_c = (_b = (
|
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 : {
|
600
2926
|
spacing: 4
|
601
2927
|
};
|
602
2928
|
const gridProps = {
|
603
2929
|
...defaultProps,
|
604
2930
|
...props
|
605
2931
|
};
|
606
|
-
return /* @__PURE__ */
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
FormLayout.displayName = "FormLayout";
|
618
|
-
}
|
619
|
-
var mapNestedFields = (name, children) => {
|
620
|
-
return React8.Children.map(children, (child) => {
|
621
|
-
if (React8.isValidElement(child) && child.props.name) {
|
622
|
-
return React8.cloneElement(child, {
|
623
|
-
...child.props,
|
624
|
-
name: `${name}.${child.props.name}`
|
625
|
-
});
|
2932
|
+
return /* @__PURE__ */ jsx(
|
2933
|
+
SimpleGrid,
|
2934
|
+
{
|
2935
|
+
...gridProps,
|
2936
|
+
className: cx$1("sui-form__layout", props.className),
|
2937
|
+
children: React12.Children.map(children, (child) => {
|
2938
|
+
if (React12.isValidElement(child)) {
|
2939
|
+
return /* @__PURE__ */ jsx(FormLayoutItem, { children: child });
|
2940
|
+
}
|
2941
|
+
return child;
|
2942
|
+
})
|
626
2943
|
}
|
627
|
-
|
628
|
-
});
|
2944
|
+
);
|
629
2945
|
};
|
630
|
-
|
2946
|
+
FormLayout.displayName = "FormLayout";
|
2947
|
+
var [ArrayFieldProvider, useArrayFieldContext] = createContext$1({
|
631
2948
|
name: "ArrayFieldContext"
|
632
2949
|
});
|
633
|
-
var [ArrayFieldRowProvider, useArrayFieldRowContext] = createContext({
|
2950
|
+
var [ArrayFieldRowProvider, useArrayFieldRowContext] = createContext$1({
|
634
2951
|
name: "ArrayFieldRowContext"
|
635
2952
|
});
|
636
2953
|
var useArrayField = ({
|
@@ -657,7 +2974,7 @@ var useArrayField = ({
|
|
657
2974
|
var useArrayFieldRow = ({ index }) => {
|
658
2975
|
const { clearErrors } = useFormContext();
|
659
2976
|
const { name, remove, fields } = useArrayFieldContext();
|
660
|
-
|
2977
|
+
React12.useEffect(() => {
|
661
2978
|
clearErrors(name);
|
662
2979
|
}, []);
|
663
2980
|
return {
|
@@ -665,7 +2982,7 @@ var useArrayFieldRow = ({ index }) => {
|
|
665
2982
|
isFirst: index === 0,
|
666
2983
|
isLast: index === fields.length - 1,
|
667
2984
|
name: `${name}.${index}`,
|
668
|
-
remove:
|
2985
|
+
remove: React12.useCallback(() => {
|
669
2986
|
clearErrors(name);
|
670
2987
|
remove(index);
|
671
2988
|
}, [index])
|
@@ -690,39 +3007,29 @@ var useArrayFieldAddButton = () => {
|
|
690
3007
|
isDisabled
|
691
3008
|
};
|
692
3009
|
};
|
693
|
-
|
694
|
-
// src/array-field.tsx
|
695
3010
|
var ArrayFieldRow = ({
|
696
3011
|
children,
|
697
3012
|
index,
|
698
3013
|
...rowFieldsProps
|
699
3014
|
}) => {
|
700
|
-
return /* @__PURE__ */
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
if (__DEV__) {
|
707
|
-
ArrayFieldRow.displayName = "ArrayFieldRow";
|
708
|
-
}
|
3015
|
+
return /* @__PURE__ */ jsxs(ArrayFieldRowContainer, { index, children: [
|
3016
|
+
/* @__PURE__ */ jsx(ArrayFieldRowFields, { ...rowFieldsProps, children }),
|
3017
|
+
/* @__PURE__ */ jsx(ArrayFieldRemoveButton, {})
|
3018
|
+
] });
|
3019
|
+
};
|
3020
|
+
ArrayFieldRow.displayName = "ArrayFieldRow";
|
709
3021
|
var ArrayFieldRowFields = ({
|
710
3022
|
children,
|
711
3023
|
...layoutProps
|
712
3024
|
}) => {
|
713
3025
|
const { name } = useArrayFieldRowContext();
|
714
|
-
return /* @__PURE__ */
|
715
|
-
|
716
|
-
|
717
|
-
...layoutProps
|
718
|
-
}, mapNestedFields(name, children));
|
719
|
-
};
|
720
|
-
if (__DEV__) {
|
721
|
-
ArrayFieldRowFields.displayName = "ArrayFieldRowFields";
|
722
|
-
}
|
3026
|
+
return /* @__PURE__ */ jsx(FormLayout, { flex: "1", mr: "2", ...layoutProps, children: mapNestedFields(name, children) });
|
3027
|
+
};
|
3028
|
+
ArrayFieldRowFields.displayName = "ArrayFieldRowFields";
|
723
3029
|
var ArrayFieldRowContainer = ({
|
724
3030
|
children,
|
725
|
-
index
|
3031
|
+
index,
|
3032
|
+
...rest
|
726
3033
|
}) => {
|
727
3034
|
const context = useArrayFieldRow({ index });
|
728
3035
|
const styles = {
|
@@ -732,61 +3039,44 @@ var ArrayFieldRowContainer = ({
|
|
732
3039
|
width: "100%",
|
733
3040
|
mb: 4
|
734
3041
|
};
|
735
|
-
return /* @__PURE__ */
|
736
|
-
value: context
|
737
|
-
}, /* @__PURE__ */ React8.createElement(chakra.div, {
|
738
|
-
__css: styles
|
739
|
-
}, children));
|
3042
|
+
return /* @__PURE__ */ jsx(ArrayFieldRowProvider, { value: context, children: /* @__PURE__ */ jsx(chakra$1.div, { ...rest, __css: styles, children }) });
|
740
3043
|
};
|
741
|
-
|
742
|
-
ArrayFieldRowContainer.displayName = "ArrayFieldRowContainer";
|
743
|
-
}
|
3044
|
+
ArrayFieldRowContainer.displayName = "ArrayFieldRowContainer";
|
744
3045
|
var ArrayFieldRemoveButton = (props) => {
|
745
|
-
return /* @__PURE__ */
|
746
|
-
"aria-label": "Remove row",
|
747
|
-
...useArrayFieldRemoveButton(),
|
748
|
-
...props
|
749
|
-
}, props.children || /* @__PURE__ */ React8.createElement(MinusIcon, null));
|
3046
|
+
return /* @__PURE__ */ jsx(Button, { "aria-label": "Remove row", ...useArrayFieldRemoveButton(), ...props, children: props.children || /* @__PURE__ */ jsx(MinusIcon, {}) });
|
750
3047
|
};
|
751
|
-
|
752
|
-
ArrayFieldRemoveButton.displayName = "ArrayFieldRemoveButton";
|
753
|
-
}
|
3048
|
+
ArrayFieldRemoveButton.displayName = "ArrayFieldRemoveButton";
|
754
3049
|
var ArrayFieldAddButton = (props) => {
|
755
|
-
return /* @__PURE__ */
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
3050
|
+
return /* @__PURE__ */ jsx(
|
3051
|
+
Button,
|
3052
|
+
{
|
3053
|
+
"aria-label": "Add row",
|
3054
|
+
float: "right",
|
3055
|
+
...useArrayFieldAddButton(),
|
3056
|
+
...props,
|
3057
|
+
children: props.children || /* @__PURE__ */ jsx(AddIcon, {})
|
3058
|
+
}
|
3059
|
+
);
|
761
3060
|
};
|
762
|
-
|
763
|
-
ArrayFieldAddButton.displayName = "ArrayFieldAddButton";
|
764
|
-
}
|
3061
|
+
ArrayFieldAddButton.displayName = "ArrayFieldAddButton";
|
765
3062
|
var ArrayField = forwardRef(
|
766
3063
|
(props, ref) => {
|
767
3064
|
const { children, ...containerProps } = props;
|
768
|
-
return /* @__PURE__ */
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
key: id,
|
773
|
-
index
|
774
|
-
}, children)))), /* @__PURE__ */ React8.createElement(ArrayFieldAddButton, null));
|
3065
|
+
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)) }) }),
|
3067
|
+
/* @__PURE__ */ jsx(ArrayFieldAddButton, {})
|
3068
|
+
] });
|
775
3069
|
}
|
776
3070
|
);
|
777
|
-
|
778
|
-
ArrayField.displayName = "ArrayField";
|
779
|
-
}
|
3071
|
+
ArrayField.displayName = "ArrayField";
|
780
3072
|
var ArrayFieldRows = ({
|
781
3073
|
children
|
782
3074
|
}) => {
|
783
3075
|
const { fields } = useArrayFieldContext();
|
784
3076
|
return children(fields);
|
785
3077
|
};
|
786
|
-
|
787
|
-
|
788
|
-
}
|
789
|
-
var ArrayFieldContainer = React8.forwardRef(
|
3078
|
+
ArrayFieldRows.displayName = "ArrayFieldRows";
|
3079
|
+
var ArrayFieldContainer = React12.forwardRef(
|
790
3080
|
({
|
791
3081
|
name,
|
792
3082
|
defaultValue,
|
@@ -803,74 +3093,56 @@ var ArrayFieldContainer = React8.forwardRef(
|
|
803
3093
|
min,
|
804
3094
|
max
|
805
3095
|
});
|
806
|
-
|
807
|
-
return /* @__PURE__ */
|
808
|
-
value: context
|
809
|
-
}, /* @__PURE__ */ React8.createElement(BaseField, {
|
810
|
-
name,
|
811
|
-
...fieldProps
|
812
|
-
}, children));
|
3096
|
+
React12.useImperativeHandle(ref, () => context, [ref, context]);
|
3097
|
+
return /* @__PURE__ */ jsx(ArrayFieldProvider, { value: context, children: /* @__PURE__ */ jsx(BaseField, { name, ...fieldProps, children }) });
|
813
3098
|
}
|
814
3099
|
);
|
815
|
-
|
816
|
-
ArrayFieldContainer.displayName = "ArrayFieldContainer";
|
817
|
-
}
|
3100
|
+
ArrayFieldContainer.displayName = "ArrayFieldContainer";
|
818
3101
|
var FormLegend = (props) => {
|
819
|
-
const styles = useStyleConfig("SuiFormLegend");
|
820
|
-
return /* @__PURE__ */
|
821
|
-
as: "legend",
|
822
|
-
sx: styles,
|
823
|
-
...props
|
824
|
-
});
|
3102
|
+
const styles = useStyleConfig$1("SuiFormLegend");
|
3103
|
+
return /* @__PURE__ */ jsx(FormLabel, { as: "legend", sx: styles, ...props });
|
825
3104
|
};
|
826
3105
|
var ObjectField = (props) => {
|
827
3106
|
const { name, label, hideLabel, children, columns, spacing, ...fieldProps } = props;
|
828
|
-
return /* @__PURE__ */
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
}, label), /* @__PURE__ */ React8.createElement(FormLayout, {
|
835
|
-
columns,
|
836
|
-
gridGap: spacing
|
837
|
-
}, mapNestedFields(name, children)));
|
838
|
-
};
|
839
|
-
if (__DEV__) {
|
840
|
-
ObjectField.displayName = "ObjectField";
|
841
|
-
}
|
3107
|
+
return /* @__PURE__ */ jsxs(FormControl, { name, as: "fieldset", ...fieldProps, children: [
|
3108
|
+
/* @__PURE__ */ jsx(FormLegend, { display: hideLabel ? "none" : "block", children: label }),
|
3109
|
+
/* @__PURE__ */ jsx(FormLayout, { columns, gridGap: spacing, children: mapNestedFields(name, children) })
|
3110
|
+
] });
|
3111
|
+
};
|
3112
|
+
ObjectField.displayName = "ObjectField";
|
842
3113
|
var mapNestedFields2 = (resolver, name) => {
|
843
|
-
var
|
844
|
-
return (
|
845
|
-
({ name: name2, type, ...nestedFieldProps }, i) => /* @__PURE__ */
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
3114
|
+
var _a2;
|
3115
|
+
return (_a2 = resolver.getNestedFields(name)) == null ? void 0 : _a2.map(
|
3116
|
+
({ name: name2, type, ...nestedFieldProps }, i) => /* @__PURE__ */ jsx(
|
3117
|
+
Field,
|
3118
|
+
{
|
3119
|
+
name: name2,
|
3120
|
+
type,
|
3121
|
+
...nestedFieldProps
|
3122
|
+
},
|
3123
|
+
name2 || i
|
3124
|
+
)
|
851
3125
|
);
|
852
3126
|
};
|
853
|
-
var
|
3127
|
+
var AutoFields = ({
|
854
3128
|
schema,
|
855
3129
|
fieldResolver,
|
856
3130
|
focusFirstField,
|
857
3131
|
...props
|
858
3132
|
}) => {
|
859
|
-
const resolver =
|
3133
|
+
const resolver = React12.useMemo(
|
860
3134
|
() => fieldResolver || Form.getFieldResolver(schema),
|
861
3135
|
[schema, fieldResolver]
|
862
3136
|
);
|
863
|
-
const fields =
|
3137
|
+
const fields = React12.useMemo(() => resolver.getFields(), [resolver]);
|
864
3138
|
const form = useFormContext();
|
865
|
-
|
866
|
-
var
|
867
|
-
if (focusFirstField && ((
|
3139
|
+
React12.useEffect(() => {
|
3140
|
+
var _a2;
|
3141
|
+
if (focusFirstField && ((_a2 = fields[0]) == null ? void 0 : _a2.name)) {
|
868
3142
|
form.setFocus(fields[0].name);
|
869
3143
|
}
|
870
3144
|
}, [schema, fieldResolver, focusFirstField]);
|
871
|
-
return /* @__PURE__ */
|
872
|
-
...props
|
873
|
-
}, fields.map(
|
3145
|
+
return /* @__PURE__ */ jsx(FormLayout, { ...props, children: fields.map(
|
874
3146
|
({
|
875
3147
|
name,
|
876
3148
|
type,
|
@@ -878,28 +3150,15 @@ var Fields = ({
|
|
878
3150
|
...fieldProps
|
879
3151
|
}) => {
|
880
3152
|
if (type === "array") {
|
881
|
-
return /* @__PURE__ */
|
882
|
-
key: name,
|
883
|
-
name,
|
884
|
-
...fieldProps
|
885
|
-
}, mapNestedFields2(resolver, name));
|
3153
|
+
return /* @__PURE__ */ jsx(ArrayField, { name, ...fieldProps, children: mapNestedFields2(resolver, name) }, name);
|
886
3154
|
} else if (type === "object") {
|
887
|
-
return /* @__PURE__ */
|
888
|
-
key: name,
|
889
|
-
name,
|
890
|
-
...fieldProps
|
891
|
-
}, mapNestedFields2(resolver, name));
|
3155
|
+
return /* @__PURE__ */ jsx(ObjectField, { name, ...fieldProps, children: mapNestedFields2(resolver, name) }, name);
|
892
3156
|
}
|
893
|
-
return /* @__PURE__ */
|
894
|
-
key: name,
|
895
|
-
name,
|
896
|
-
type,
|
897
|
-
...fieldProps
|
898
|
-
});
|
3157
|
+
return /* @__PURE__ */ jsx(Field, { name, type, ...fieldProps }, name);
|
899
3158
|
}
|
900
|
-
));
|
3159
|
+
) });
|
901
3160
|
};
|
902
|
-
|
3161
|
+
AutoFields.displayName = "Fields";
|
903
3162
|
var SubmitButton = forwardRef(
|
904
3163
|
(props, ref) => {
|
905
3164
|
const {
|
@@ -912,13 +3171,17 @@ var SubmitButton = forwardRef(
|
|
912
3171
|
} = props;
|
913
3172
|
const { formState } = useFormContext();
|
914
3173
|
const isDisabled = disableIfUntouched && !formState.isDirty || disableIfInvalid && !formState.isValid || isDisabledProp;
|
915
|
-
return /* @__PURE__ */
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
3174
|
+
return /* @__PURE__ */ jsx(
|
3175
|
+
Button,
|
3176
|
+
{
|
3177
|
+
...rest,
|
3178
|
+
ref,
|
3179
|
+
type: "submit",
|
3180
|
+
isLoading: formState.isSubmitting || isLoading,
|
3181
|
+
isDisabled,
|
3182
|
+
children
|
3183
|
+
}
|
3184
|
+
);
|
922
3185
|
}
|
923
3186
|
);
|
924
3187
|
SubmitButton.defaultProps = {
|
@@ -927,8 +3190,6 @@ SubmitButton.defaultProps = {
|
|
927
3190
|
disableIfInvalid: false
|
928
3191
|
};
|
929
3192
|
SubmitButton.displayName = "SubmitButton";
|
930
|
-
|
931
|
-
// src/auto-form.tsx
|
932
3193
|
var AutoForm = forwardRef(
|
933
3194
|
(props, ref) => {
|
934
3195
|
const {
|
@@ -938,14 +3199,11 @@ var AutoForm = forwardRef(
|
|
938
3199
|
children,
|
939
3200
|
...rest
|
940
3201
|
} = props;
|
941
|
-
return /* @__PURE__ */
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
}
|
946
|
-
schema,
|
947
|
-
fieldResolver
|
948
|
-
}), submitLabel && /* @__PURE__ */ React8.createElement(SubmitButton, null, submitLabel), children));
|
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
|
+
] }) });
|
949
3207
|
}
|
950
3208
|
);
|
951
3209
|
AutoForm.displayName = "AutoForm";
|
@@ -966,10 +3224,8 @@ var DisplayIf = ({
|
|
966
3224
|
const context = useFormContext();
|
967
3225
|
return condition(value, context) ? children : null;
|
968
3226
|
};
|
969
|
-
|
970
|
-
|
971
|
-
}
|
972
|
-
var [StepFormProvider, useStepFormContext] = createContext({
|
3227
|
+
DisplayIf.displayName = "DisplayIf";
|
3228
|
+
var [StepFormProvider, useStepFormContext] = createContext$1({
|
973
3229
|
name: "StepFormContext",
|
974
3230
|
errorMessage: "useStepFormContext: `context` is undefined. Seems you forgot to wrap step form components in `<StepForm />`"
|
975
3231
|
});
|
@@ -977,14 +3233,14 @@ function useStepForm(props) {
|
|
977
3233
|
const { onChange, ...rest } = props;
|
978
3234
|
const stepper = useStepper(rest);
|
979
3235
|
const { activeStep, isLastStep, nextStep } = stepper;
|
980
|
-
const [steps, updateSteps] =
|
981
|
-
const onSubmitStep =
|
3236
|
+
const [steps, updateSteps] = React12.useState({});
|
3237
|
+
const onSubmitStep = React12.useCallback(
|
982
3238
|
async (data) => {
|
983
|
-
var
|
3239
|
+
var _a2, _b;
|
984
3240
|
try {
|
985
3241
|
const step = steps[activeStep];
|
986
3242
|
if (isLastStep) {
|
987
|
-
await ((
|
3243
|
+
await ((_a2 = props.onSubmit) == null ? void 0 : _a2.call(props, data));
|
988
3244
|
updateStep({
|
989
3245
|
...step,
|
990
3246
|
isCompleted: true
|
@@ -999,7 +3255,7 @@ function useStepForm(props) {
|
|
999
3255
|
},
|
1000
3256
|
[steps, activeStep, isLastStep]
|
1001
3257
|
);
|
1002
|
-
const getFormProps =
|
3258
|
+
const getFormProps = React12.useCallback(() => {
|
1003
3259
|
const step = steps[activeStep];
|
1004
3260
|
return {
|
1005
3261
|
onSubmit: onSubmitStep,
|
@@ -1007,7 +3263,7 @@ function useStepForm(props) {
|
|
1007
3263
|
resolver: step == null ? void 0 : step.resolver
|
1008
3264
|
};
|
1009
3265
|
}, [steps, onSubmitStep, activeStep]);
|
1010
|
-
const updateStep =
|
3266
|
+
const updateStep = React12.useCallback(
|
1011
3267
|
(step) => {
|
1012
3268
|
updateSteps((steps2) => {
|
1013
3269
|
return {
|
@@ -1029,7 +3285,7 @@ function useFormStep(props) {
|
|
1029
3285
|
const { name, schema, resolver, onSubmit } = props;
|
1030
3286
|
const step = useStep({ name });
|
1031
3287
|
const { steps, updateStep } = useStepFormContext();
|
1032
|
-
|
3288
|
+
React12.useEffect(() => {
|
1033
3289
|
updateStep({ name, schema, resolver, onSubmit });
|
1034
3290
|
}, [name, schema]);
|
1035
3291
|
return {
|
@@ -1037,92 +3293,85 @@ function useFormStep(props) {
|
|
1037
3293
|
...steps[name] || { name, schema }
|
1038
3294
|
};
|
1039
3295
|
}
|
1040
|
-
|
1041
|
-
// src/step-form.tsx
|
1042
|
-
var StepForm = React8.forwardRef(
|
3296
|
+
var StepForm = React12.forwardRef(
|
1043
3297
|
(props, ref) => {
|
1044
3298
|
const { children, ...rest } = props;
|
1045
3299
|
const stepper = useStepForm(props);
|
1046
3300
|
const { getFormProps, ...ctx } = stepper;
|
1047
|
-
const context =
|
1048
|
-
return /* @__PURE__ */
|
1049
|
-
value: context
|
1050
|
-
}, /* @__PURE__ */ React8.createElement(StepFormProvider, {
|
1051
|
-
value: context
|
1052
|
-
}, /* @__PURE__ */ React8.createElement(Form, {
|
1053
|
-
ref,
|
1054
|
-
...rest,
|
1055
|
-
...getFormProps()
|
1056
|
-
}, runIfFn(children, 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) }) }) });
|
1057
3303
|
}
|
1058
3304
|
);
|
1059
3305
|
var FormStepper = (props) => {
|
1060
3306
|
const { activeIndex, setIndex } = useStepperContext();
|
1061
3307
|
const { children, orientation, variant, colorScheme, size, ...rest } = props;
|
1062
|
-
const elements =
|
1063
|
-
if (
|
3308
|
+
const elements = React12.Children.map(children, (child) => {
|
3309
|
+
if (React12.isValidElement(child) && (child == null ? void 0 : child.type) === FormStep) {
|
1064
3310
|
const { isCompleted } = useFormStep(child.props);
|
1065
|
-
return /* @__PURE__ */
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
3311
|
+
return /* @__PURE__ */ jsx(
|
3312
|
+
StepperStep,
|
3313
|
+
{
|
3314
|
+
name: child.props.name,
|
3315
|
+
title: child.props.title,
|
3316
|
+
isCompleted,
|
3317
|
+
...rest,
|
3318
|
+
children: child.props.children
|
3319
|
+
}
|
3320
|
+
);
|
1071
3321
|
}
|
1072
3322
|
return child;
|
1073
3323
|
});
|
1074
|
-
const onChange =
|
3324
|
+
const onChange = React12.useCallback((i) => {
|
1075
3325
|
setIndex(i);
|
1076
3326
|
}, []);
|
1077
|
-
return /* @__PURE__ */
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
3327
|
+
return /* @__PURE__ */ jsx(
|
3328
|
+
StepperContainer,
|
3329
|
+
{
|
3330
|
+
orientation,
|
3331
|
+
step: activeIndex,
|
3332
|
+
variant,
|
3333
|
+
colorScheme,
|
3334
|
+
size,
|
3335
|
+
onChange,
|
3336
|
+
children: /* @__PURE__ */ jsx(StepperSteps, { mb: "4", ...props, children: elements })
|
3337
|
+
}
|
3338
|
+
);
|
1088
3339
|
};
|
1089
3340
|
var FormStep = (props) => {
|
1090
3341
|
const { name, schema, resolver, children, className, onSubmit, ...rest } = props;
|
1091
3342
|
const step = useFormStep({ name, schema, resolver, onSubmit });
|
1092
3343
|
const { isActive } = step;
|
1093
|
-
return isActive ? /* @__PURE__ */
|
1094
|
-
...rest,
|
1095
|
-
className: cx("sui-form__step", className)
|
1096
|
-
}, children) : null;
|
3344
|
+
return isActive ? /* @__PURE__ */ jsx(chakra$1.div, { ...rest, className: cx$1("sui-form__step", className), children }) : null;
|
1097
3345
|
};
|
1098
|
-
|
1099
|
-
FormStep.displayName = "FormStep";
|
1100
|
-
}
|
3346
|
+
FormStep.displayName = "FormStep";
|
1101
3347
|
var PrevButton = (props) => {
|
1102
3348
|
const { isFirstStep, isCompleted, prevStep } = useStepperContext();
|
1103
|
-
return /* @__PURE__ */
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
3349
|
+
return /* @__PURE__ */ jsx(
|
3350
|
+
Button,
|
3351
|
+
{
|
3352
|
+
isDisabled: isFirstStep || isCompleted,
|
3353
|
+
label: "Back",
|
3354
|
+
...props,
|
3355
|
+
className: cx$1("sui-form__prev-button", props.className),
|
3356
|
+
onClick: callAllHandlers(props.onClick, prevStep)
|
3357
|
+
}
|
3358
|
+
);
|
1110
3359
|
};
|
1111
|
-
|
1112
|
-
PrevButton.displayName = "PrevButton";
|
1113
|
-
}
|
3360
|
+
PrevButton.displayName = "PrevButton";
|
1114
3361
|
var NextButton = (props) => {
|
1115
3362
|
const { label = "Next", submitLabel = "Complete", ...rest } = props;
|
1116
3363
|
const { isLastStep, isCompleted } = useStepperContext();
|
1117
|
-
return /* @__PURE__ */
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
3364
|
+
return /* @__PURE__ */ jsx(
|
3365
|
+
SubmitButton,
|
3366
|
+
{
|
3367
|
+
...rest,
|
3368
|
+
isDisabled: isCompleted,
|
3369
|
+
className: cx$1("sui-form__next-button", props.className),
|
3370
|
+
children: isLastStep || isCompleted ? submitLabel : label
|
3371
|
+
}
|
3372
|
+
);
|
3373
|
+
};
|
3374
|
+
NextButton.displayName = "NextButton";
|
1126
3375
|
var WatchField = (props) => {
|
1127
3376
|
const { name, defaultValue, isDisabled, isExact } = props;
|
1128
3377
|
const form = useFormContext();
|
@@ -1134,7 +3383,17 @@ var WatchField = (props) => {
|
|
1134
3383
|
});
|
1135
3384
|
return props.children(field, form) || null;
|
1136
3385
|
};
|
3386
|
+
function createForm({
|
3387
|
+
resolver,
|
3388
|
+
fields
|
3389
|
+
} = {}) {
|
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
|
+
};
|
3394
|
+
return CreateForm;
|
3395
|
+
}
|
1137
3396
|
|
1138
|
-
export { ArrayField, ArrayFieldAddButton, ArrayFieldContainer, ArrayFieldProvider, ArrayFieldRemoveButton, ArrayFieldRow, ArrayFieldRowContainer, ArrayFieldRowFields, ArrayFieldRowProvider, ArrayFieldRows, AutoForm, BaseField, CheckboxField, DisplayField, DisplayIf, Field,
|
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 };
|
1139
3398
|
//# sourceMappingURL=out.js.map
|
1140
3399
|
//# sourceMappingURL=index.mjs.map
|