@rjsf/chakra-ui 5.0.0-beta.8 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/chakra-ui.cjs.development.js +492 -526
- package/dist/chakra-ui.cjs.development.js.map +1 -1
- package/dist/chakra-ui.cjs.production.min.js +1 -1
- package/dist/chakra-ui.cjs.production.min.js.map +1 -1
- package/dist/chakra-ui.esm.js +491 -529
- package/dist/chakra-ui.esm.js.map +1 -1
- package/dist/chakra-ui.umd.development.js +492 -526
- package/dist/chakra-ui.umd.development.js.map +1 -1
- package/dist/chakra-ui.umd.production.min.js +1 -1
- package/dist/chakra-ui.umd.production.min.js.map +1 -1
- package/dist/index.d.ts +12 -77
- package/package.json +17 -16
|
@@ -41,56 +41,54 @@ function _extends() {
|
|
|
41
41
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
42
42
|
for (var i = 1; i < arguments.length; i++) {
|
|
43
43
|
var source = arguments[i];
|
|
44
|
-
|
|
45
44
|
for (var key in source) {
|
|
46
45
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
47
46
|
target[key] = source[key];
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
|
-
|
|
52
50
|
return target;
|
|
53
51
|
};
|
|
54
52
|
return _extends.apply(this, arguments);
|
|
55
53
|
}
|
|
56
|
-
|
|
57
54
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
58
55
|
if (source == null) return {};
|
|
59
56
|
var target = {};
|
|
60
57
|
var sourceKeys = Object.keys(source);
|
|
61
58
|
var key, i;
|
|
62
|
-
|
|
63
59
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
64
60
|
key = sourceKeys[i];
|
|
65
61
|
if (excluded.indexOf(key) >= 0) continue;
|
|
66
62
|
target[key] = source[key];
|
|
67
63
|
}
|
|
68
|
-
|
|
69
64
|
return target;
|
|
70
65
|
}
|
|
71
66
|
|
|
72
|
-
var
|
|
67
|
+
var _excluded$2 = ["uiSchema", "registry"];
|
|
68
|
+
function AddButton(_ref) {
|
|
69
|
+
var props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
73
70
|
return React__default["default"].createElement(react.Button, _extends({
|
|
74
71
|
leftIcon: React__default["default"].createElement(icons.AddIcon, null)
|
|
75
72
|
}, props), "Add Item");
|
|
76
|
-
}
|
|
73
|
+
}
|
|
77
74
|
|
|
78
|
-
|
|
75
|
+
function ArrayFieldItemTemplate(props) {
|
|
79
76
|
var children = props.children,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
disabled = props.disabled,
|
|
78
|
+
hasToolbar = props.hasToolbar,
|
|
79
|
+
hasMoveDown = props.hasMoveDown,
|
|
80
|
+
hasMoveUp = props.hasMoveUp,
|
|
81
|
+
hasRemove = props.hasRemove,
|
|
82
|
+
index = props.index,
|
|
83
|
+
onDropIndexClick = props.onDropIndexClick,
|
|
84
|
+
onReorderClick = props.onReorderClick,
|
|
85
|
+
readonly = props.readonly,
|
|
86
|
+
uiSchema = props.uiSchema,
|
|
87
|
+
registry = props.registry;
|
|
90
88
|
var _registry$templates$B = registry.templates.ButtonTemplates,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
90
|
+
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
91
|
+
RemoveButton = _registry$templates$B.RemoveButton;
|
|
94
92
|
var onRemoveClick = React.useMemo(function () {
|
|
95
93
|
return onDropIndexClick(index);
|
|
96
94
|
}, [index, onDropIndexClick]);
|
|
@@ -110,53 +108,59 @@ var ArrayFieldItemTemplate = function ArrayFieldItemTemplate(props) {
|
|
|
110
108
|
mb: 1
|
|
111
109
|
}, (hasMoveUp || hasMoveDown) && React__default["default"].createElement(MoveUpButton, {
|
|
112
110
|
disabled: disabled || readonly || !hasMoveUp,
|
|
113
|
-
onClick: onArrowUpClick
|
|
111
|
+
onClick: onArrowUpClick,
|
|
112
|
+
uiSchema: uiSchema,
|
|
113
|
+
registry: registry
|
|
114
114
|
}), (hasMoveUp || hasMoveDown) && React__default["default"].createElement(MoveDownButton, {
|
|
115
115
|
disabled: disabled || readonly || !hasMoveDown,
|
|
116
|
-
onClick: onArrowDownClick
|
|
116
|
+
onClick: onArrowDownClick,
|
|
117
|
+
uiSchema: uiSchema,
|
|
118
|
+
registry: registry
|
|
117
119
|
}), hasRemove && React__default["default"].createElement(RemoveButton, {
|
|
118
120
|
disabled: disabled || readonly,
|
|
119
|
-
onClick: onRemoveClick
|
|
121
|
+
onClick: onRemoveClick,
|
|
122
|
+
uiSchema: uiSchema,
|
|
123
|
+
registry: registry
|
|
120
124
|
}))));
|
|
121
|
-
}
|
|
125
|
+
}
|
|
122
126
|
|
|
123
127
|
var _excluded$1 = ["key"];
|
|
124
|
-
|
|
125
|
-
var ArrayFieldTemplate = function ArrayFieldTemplate(props) {
|
|
128
|
+
function ArrayFieldTemplate(props) {
|
|
126
129
|
var canAdd = props.canAdd,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
disabled = props.disabled,
|
|
131
|
+
idSchema = props.idSchema,
|
|
132
|
+
uiSchema = props.uiSchema,
|
|
133
|
+
items = props.items,
|
|
134
|
+
onAddClick = props.onAddClick,
|
|
135
|
+
readonly = props.readonly,
|
|
136
|
+
registry = props.registry,
|
|
137
|
+
required = props.required,
|
|
138
|
+
schema = props.schema,
|
|
139
|
+
title = props.title;
|
|
137
140
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
138
141
|
var ArrayFieldDescriptionTemplate = utils.getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
|
|
139
142
|
var ArrayFieldItemTemplate = utils.getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
|
|
140
|
-
var ArrayFieldTitleTemplate = utils.getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
|
|
141
|
-
|
|
143
|
+
var ArrayFieldTitleTemplate = utils.getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
|
|
144
|
+
// Button templates are not overridden in the uiSchema
|
|
142
145
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
143
146
|
return React__default["default"].createElement(react.Box, null, React__default["default"].createElement(ArrayFieldTitleTemplate, {
|
|
144
147
|
idSchema: idSchema,
|
|
145
148
|
title: uiOptions.title || title,
|
|
149
|
+
schema: schema,
|
|
146
150
|
uiSchema: uiSchema,
|
|
147
151
|
required: required,
|
|
148
152
|
registry: registry
|
|
149
|
-
}),
|
|
153
|
+
}), React__default["default"].createElement(ArrayFieldDescriptionTemplate, {
|
|
150
154
|
idSchema: idSchema,
|
|
151
155
|
description: uiOptions.description || schema.description,
|
|
156
|
+
schema: schema,
|
|
152
157
|
uiSchema: uiSchema,
|
|
153
158
|
registry: registry
|
|
154
159
|
}), React__default["default"].createElement(react.Grid, {
|
|
155
160
|
key: "array-item-list-" + idSchema.$id
|
|
156
161
|
}, React__default["default"].createElement(react.GridItem, null, items.length > 0 && items.map(function (_ref) {
|
|
157
162
|
var key = _ref.key,
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
160
164
|
return React__default["default"].createElement(ArrayFieldItemTemplate, _extends({
|
|
161
165
|
key: key
|
|
162
166
|
}, itemProps));
|
|
@@ -167,13 +171,15 @@ var ArrayFieldTemplate = function ArrayFieldTemplate(props) {
|
|
|
167
171
|
}, React__default["default"].createElement(AddButton, {
|
|
168
172
|
className: "array-item-add",
|
|
169
173
|
onClick: onAddClick,
|
|
170
|
-
disabled: disabled || readonly
|
|
174
|
+
disabled: disabled || readonly,
|
|
175
|
+
uiSchema: uiSchema,
|
|
176
|
+
registry: registry
|
|
171
177
|
})))));
|
|
172
|
-
}
|
|
178
|
+
}
|
|
173
179
|
|
|
174
180
|
function getChakra(_ref) {
|
|
175
181
|
var _ref$uiSchema = _ref.uiSchema,
|
|
176
|
-
|
|
182
|
+
uiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema;
|
|
177
183
|
var chakraProps = uiSchema["ui:options"] && uiSchema["ui:options"].chakra || {};
|
|
178
184
|
Object.keys(chakraProps).forEach(function (key) {
|
|
179
185
|
/**
|
|
@@ -190,45 +196,41 @@ function getChakra(_ref) {
|
|
|
190
196
|
return chakraProps;
|
|
191
197
|
}
|
|
192
198
|
|
|
193
|
-
|
|
199
|
+
function BaseInputTemplate(props) {
|
|
194
200
|
var id = props.id,
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
201
|
+
type = props.type,
|
|
202
|
+
value = props.value,
|
|
203
|
+
label = props.label,
|
|
204
|
+
schema = props.schema,
|
|
205
|
+
uiSchema = props.uiSchema,
|
|
206
|
+
onChange = props.onChange,
|
|
207
|
+
onBlur = props.onBlur,
|
|
208
|
+
onFocus = props.onFocus,
|
|
209
|
+
options = props.options,
|
|
210
|
+
required = props.required,
|
|
211
|
+
readonly = props.readonly,
|
|
212
|
+
rawErrors = props.rawErrors,
|
|
213
|
+
autofocus = props.autofocus,
|
|
214
|
+
placeholder = props.placeholder,
|
|
215
|
+
disabled = props.disabled,
|
|
216
|
+
registry = props.registry;
|
|
211
217
|
var inputProps = utils.getInputProps(schema, type, options);
|
|
212
218
|
var chakraProps = getChakra({
|
|
213
219
|
uiSchema: uiSchema
|
|
214
220
|
});
|
|
215
221
|
var schemaUtils = registry.schemaUtils;
|
|
216
|
-
|
|
217
222
|
var _onChange = function _onChange(_ref) {
|
|
218
223
|
var value = _ref.target.value;
|
|
219
224
|
return onChange(value === "" ? options.emptyValue : value);
|
|
220
225
|
};
|
|
221
|
-
|
|
222
226
|
var _onBlur = function _onBlur(_ref2) {
|
|
223
227
|
var value = _ref2.target.value;
|
|
224
228
|
return onBlur(id, value);
|
|
225
229
|
};
|
|
226
|
-
|
|
227
230
|
var _onFocus = function _onFocus(_ref3) {
|
|
228
231
|
var value = _ref3.target.value;
|
|
229
232
|
return onFocus(id, value);
|
|
230
233
|
};
|
|
231
|
-
|
|
232
234
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
233
235
|
return React__namespace.createElement(react.FormControl, _extends({
|
|
234
236
|
mb: 1
|
|
@@ -250,25 +252,24 @@ var BaseInputTemplate = function BaseInputTemplate(props) {
|
|
|
250
252
|
autoFocus: autofocus,
|
|
251
253
|
placeholder: placeholder
|
|
252
254
|
}, inputProps, {
|
|
253
|
-
list: schema.examples ?
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
list: schema.examples ? utils.examplesId(id) : undefined,
|
|
256
|
+
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
257
|
+
})), Array.isArray(schema.examples) ? React__namespace.createElement("datalist", {
|
|
258
|
+
id: utils.examplesId(id)
|
|
259
|
+
}, schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
257
260
|
return React__namespace.createElement("option", {
|
|
258
261
|
key: example,
|
|
259
262
|
value: example
|
|
260
263
|
});
|
|
261
264
|
})) : null);
|
|
262
|
-
}
|
|
265
|
+
}
|
|
263
266
|
|
|
264
|
-
|
|
267
|
+
function DescriptionField(_ref) {
|
|
265
268
|
var description = _ref.description,
|
|
266
|
-
|
|
267
|
-
|
|
269
|
+
id = _ref.id;
|
|
268
270
|
if (!description) {
|
|
269
271
|
return null;
|
|
270
272
|
}
|
|
271
|
-
|
|
272
273
|
if (typeof description === "string") {
|
|
273
274
|
return React__default["default"].createElement(react.Text, {
|
|
274
275
|
id: id,
|
|
@@ -276,11 +277,10 @@ var DescriptionField = function DescriptionField(_ref) {
|
|
|
276
277
|
mb: 4
|
|
277
278
|
}, description);
|
|
278
279
|
}
|
|
279
|
-
|
|
280
280
|
return React__default["default"].createElement(React__default["default"].Fragment, null, description);
|
|
281
|
-
}
|
|
281
|
+
}
|
|
282
282
|
|
|
283
|
-
|
|
283
|
+
function ErrorList(_ref) {
|
|
284
284
|
var errors = _ref.errors;
|
|
285
285
|
return React__default["default"].createElement(react.Alert, {
|
|
286
286
|
flexDirection: "column",
|
|
@@ -295,41 +295,37 @@ var ErrorList = function ErrorList(_ref) {
|
|
|
295
295
|
color: "red.500"
|
|
296
296
|
}), error.stack);
|
|
297
297
|
})));
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
var _excluded = ["icon", "iconType"];
|
|
301
|
-
/**
|
|
302
|
-
* props used in Template:
|
|
303
|
-
* icon, tabIndex, disabled, onClick
|
|
304
|
-
*/
|
|
298
|
+
}
|
|
305
299
|
|
|
306
|
-
var
|
|
300
|
+
var _excluded = ["icon", "iconType", "uiSchema", "registry"];
|
|
301
|
+
function ChakraIconButton(props) {
|
|
307
302
|
var icon = props.icon,
|
|
308
|
-
|
|
309
|
-
|
|
303
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
310
304
|
return React__default["default"].createElement(react.IconButton, _extends({
|
|
311
305
|
"aria-label": props.title
|
|
312
306
|
}, otherProps, {
|
|
313
307
|
icon: icon
|
|
314
308
|
}));
|
|
315
|
-
}
|
|
309
|
+
}
|
|
316
310
|
ChakraIconButton.displayName = "ChakraIconButton";
|
|
311
|
+
var ChakraIconButton$1 = /*#__PURE__*/React__default["default"].memo(ChakraIconButton);
|
|
312
|
+
|
|
317
313
|
function MoveDownButton(props) {
|
|
318
|
-
return React__default["default"].createElement(ChakraIconButton, _extends({
|
|
314
|
+
return React__default["default"].createElement(ChakraIconButton$1, _extends({
|
|
319
315
|
title: "Move down"
|
|
320
316
|
}, props, {
|
|
321
317
|
icon: React__default["default"].createElement(icons.ArrowDownIcon, null)
|
|
322
318
|
}));
|
|
323
319
|
}
|
|
324
320
|
function MoveUpButton(props) {
|
|
325
|
-
return React__default["default"].createElement(ChakraIconButton, _extends({
|
|
321
|
+
return React__default["default"].createElement(ChakraIconButton$1, _extends({
|
|
326
322
|
title: "Move up"
|
|
327
323
|
}, props, {
|
|
328
324
|
icon: React__default["default"].createElement(icons.ArrowUpIcon, null)
|
|
329
325
|
}));
|
|
330
326
|
}
|
|
331
327
|
function RemoveButton(props) {
|
|
332
|
-
return React__default["default"].createElement(ChakraIconButton, _extends({
|
|
328
|
+
return React__default["default"].createElement(ChakraIconButton$1, _extends({
|
|
333
329
|
title: "Remove"
|
|
334
330
|
}, props, {
|
|
335
331
|
icon: React__default["default"].createElement(icons.DeleteIcon, null)
|
|
@@ -340,17 +336,14 @@ function RemoveButton(props) {
|
|
|
340
336
|
*
|
|
341
337
|
* @param props - The `FieldErrorProps` for the errors being rendered
|
|
342
338
|
*/
|
|
343
|
-
|
|
344
339
|
function FieldErrorTemplate(props) {
|
|
345
340
|
var _props$errors = props.errors,
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
341
|
+
errors = _props$errors === void 0 ? [] : _props$errors,
|
|
342
|
+
idSchema = props.idSchema;
|
|
349
343
|
if (errors.length === 0) {
|
|
350
344
|
return null;
|
|
351
345
|
}
|
|
352
|
-
|
|
353
|
-
var id = idSchema.$id + "__error";
|
|
346
|
+
var id = utils.errorId(idSchema);
|
|
354
347
|
return React__default["default"].createElement(react.List, null, errors.map(function (error, i) {
|
|
355
348
|
return React__default["default"].createElement(react.ListItem, {
|
|
356
349
|
key: i
|
|
@@ -364,93 +357,41 @@ function FieldErrorTemplate(props) {
|
|
|
364
357
|
*
|
|
365
358
|
* @param props - The `FieldHelpProps` to be rendered
|
|
366
359
|
*/
|
|
367
|
-
|
|
368
360
|
function FieldHelpTemplate(props) {
|
|
369
361
|
var idSchema = props.idSchema,
|
|
370
|
-
|
|
371
|
-
|
|
362
|
+
help = props.help;
|
|
372
363
|
if (!help) {
|
|
373
364
|
return null;
|
|
374
365
|
}
|
|
375
|
-
|
|
376
|
-
var id = idSchema.$id + "__help";
|
|
366
|
+
var id = utils.helpId(idSchema);
|
|
377
367
|
return React__default["default"].createElement(react.FormHelperText, {
|
|
378
368
|
id: id
|
|
379
369
|
}, help);
|
|
380
370
|
}
|
|
381
371
|
|
|
382
|
-
|
|
383
|
-
var children = props.children,
|
|
384
|
-
classNames = props.classNames,
|
|
385
|
-
disabled = props.disabled,
|
|
386
|
-
id = props.id,
|
|
387
|
-
label = props.label,
|
|
388
|
-
onDropPropertyClick = props.onDropPropertyClick,
|
|
389
|
-
onKeyChange = props.onKeyChange,
|
|
390
|
-
readonly = props.readonly,
|
|
391
|
-
registry = props.registry,
|
|
392
|
-
required = props.required,
|
|
393
|
-
schema = props.schema;
|
|
394
|
-
var RemoveButton = registry.templates.ButtonTemplates.RemoveButton;
|
|
395
|
-
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
396
|
-
|
|
397
|
-
if (!additional) {
|
|
398
|
-
return React__default["default"].createElement("div", {
|
|
399
|
-
className: classNames
|
|
400
|
-
}, children);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
var keyLabel = label + " Key";
|
|
404
|
-
|
|
405
|
-
var handleBlur = function handleBlur(_ref) {
|
|
406
|
-
var target = _ref.target;
|
|
407
|
-
return onKeyChange(target.value);
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
return React__default["default"].createElement(react.Grid, {
|
|
411
|
-
key: id + "-key",
|
|
412
|
-
className: classNames,
|
|
413
|
-
alignItems: "center",
|
|
414
|
-
gap: 2
|
|
415
|
-
}, React__default["default"].createElement(react.GridItem, null, React__default["default"].createElement(react.FormControl, {
|
|
416
|
-
isRequired: required
|
|
417
|
-
}, React__default["default"].createElement(react.FormLabel, {
|
|
418
|
-
htmlFor: id + "-key",
|
|
419
|
-
id: id + "-key-label"
|
|
420
|
-
}, keyLabel), React__default["default"].createElement(react.Input, {
|
|
421
|
-
defaultValue: label,
|
|
422
|
-
disabled: disabled || readonly,
|
|
423
|
-
id: id + "-key",
|
|
424
|
-
name: id + "-key",
|
|
425
|
-
onBlur: !readonly ? handleBlur : undefined,
|
|
426
|
-
type: "text",
|
|
427
|
-
mb: 1
|
|
428
|
-
}))), React__default["default"].createElement(react.GridItem, null, children), React__default["default"].createElement(react.GridItem, null, React__default["default"].createElement(RemoveButton, {
|
|
429
|
-
disabled: disabled || readonly,
|
|
430
|
-
onClick: onDropPropertyClick(label)
|
|
431
|
-
})));
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
var FieldTemplate = function FieldTemplate(props) {
|
|
372
|
+
function FieldTemplate(props) {
|
|
435
373
|
var id = props.id,
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
374
|
+
children = props.children,
|
|
375
|
+
classNames = props.classNames,
|
|
376
|
+
style = props.style,
|
|
377
|
+
disabled = props.disabled,
|
|
378
|
+
displayLabel = props.displayLabel,
|
|
379
|
+
hidden = props.hidden,
|
|
380
|
+
label = props.label,
|
|
381
|
+
onDropPropertyClick = props.onDropPropertyClick,
|
|
382
|
+
onKeyChange = props.onKeyChange,
|
|
383
|
+
readonly = props.readonly,
|
|
384
|
+
registry = props.registry,
|
|
385
|
+
required = props.required,
|
|
386
|
+
_props$rawErrors = props.rawErrors,
|
|
387
|
+
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
388
|
+
errors = props.errors,
|
|
389
|
+
help = props.help,
|
|
390
|
+
rawDescription = props.rawDescription,
|
|
391
|
+
schema = props.schema,
|
|
392
|
+
uiSchema = props.uiSchema;
|
|
393
|
+
var uiOptions = utils.getUiOptions(uiSchema);
|
|
394
|
+
var WrapIfAdditionalTemplate = utils.getTemplate("WrapIfAdditionalTemplate", registry, uiOptions);
|
|
454
395
|
if (hidden) {
|
|
455
396
|
return React__default["default"].createElement("div", {
|
|
456
397
|
style: {
|
|
@@ -458,9 +399,9 @@ var FieldTemplate = function FieldTemplate(props) {
|
|
|
458
399
|
}
|
|
459
400
|
}, children);
|
|
460
401
|
}
|
|
461
|
-
|
|
462
|
-
return React__default["default"].createElement(WrapIfAdditional, {
|
|
402
|
+
return React__default["default"].createElement(WrapIfAdditionalTemplate, {
|
|
463
403
|
classNames: classNames,
|
|
404
|
+
style: style,
|
|
464
405
|
disabled: disabled,
|
|
465
406
|
id: id,
|
|
466
407
|
label: label,
|
|
@@ -469,6 +410,7 @@ var FieldTemplate = function FieldTemplate(props) {
|
|
|
469
410
|
readonly: readonly,
|
|
470
411
|
required: required,
|
|
471
412
|
schema: schema,
|
|
413
|
+
uiSchema: uiSchema,
|
|
472
414
|
registry: registry
|
|
473
415
|
}, React__default["default"].createElement(react.FormControl, {
|
|
474
416
|
isRequired: required,
|
|
@@ -476,35 +418,38 @@ var FieldTemplate = function FieldTemplate(props) {
|
|
|
476
418
|
}, children, displayLabel && rawDescription ? React__default["default"].createElement(react.Text, {
|
|
477
419
|
mt: 2
|
|
478
420
|
}, rawDescription) : null, errors, help));
|
|
479
|
-
}
|
|
421
|
+
}
|
|
480
422
|
|
|
481
|
-
|
|
423
|
+
function ObjectFieldTemplate(props) {
|
|
482
424
|
var description = props.description,
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
425
|
+
title = props.title,
|
|
426
|
+
properties = props.properties,
|
|
427
|
+
required = props.required,
|
|
428
|
+
disabled = props.disabled,
|
|
429
|
+
readonly = props.readonly,
|
|
430
|
+
uiSchema = props.uiSchema,
|
|
431
|
+
idSchema = props.idSchema,
|
|
432
|
+
schema = props.schema,
|
|
433
|
+
formData = props.formData,
|
|
434
|
+
onAddClick = props.onAddClick,
|
|
435
|
+
registry = props.registry;
|
|
494
436
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
495
437
|
var TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, uiOptions);
|
|
496
|
-
var DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions);
|
|
497
|
-
|
|
438
|
+
var DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions);
|
|
439
|
+
// Button templates are not overridden in the uiSchema
|
|
498
440
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
499
441
|
return React__default["default"].createElement(React__default["default"].Fragment, null, (uiOptions.title || title) && React__default["default"].createElement(TitleFieldTemplate, {
|
|
500
|
-
id: idSchema
|
|
442
|
+
id: utils.titleId(idSchema),
|
|
501
443
|
title: uiOptions.title || title,
|
|
502
444
|
required: required,
|
|
445
|
+
schema: schema,
|
|
503
446
|
uiSchema: uiSchema,
|
|
504
447
|
registry: registry
|
|
505
448
|
}), (uiOptions.description || description) && React__default["default"].createElement(DescriptionFieldTemplate, {
|
|
506
|
-
id: idSchema
|
|
449
|
+
id: utils.descriptionId(idSchema),
|
|
507
450
|
description: uiOptions.description || description,
|
|
451
|
+
schema: schema,
|
|
452
|
+
uiSchema: uiSchema,
|
|
508
453
|
registry: registry
|
|
509
454
|
}), React__default["default"].createElement(react.Grid, {
|
|
510
455
|
gap: description ? 2 : 6,
|
|
@@ -518,33 +463,32 @@ var ObjectFieldTemplate = function ObjectFieldTemplate(props) {
|
|
|
518
463
|
}, React__default["default"].createElement(AddButton, {
|
|
519
464
|
className: "object-property-expand",
|
|
520
465
|
onClick: onAddClick(schema),
|
|
521
|
-
disabled: disabled || readonly
|
|
466
|
+
disabled: disabled || readonly,
|
|
467
|
+
uiSchema: uiSchema,
|
|
468
|
+
registry: registry
|
|
522
469
|
}))));
|
|
523
|
-
}
|
|
470
|
+
}
|
|
524
471
|
|
|
525
|
-
|
|
472
|
+
function SubmitButton(_ref) {
|
|
526
473
|
var uiSchema = _ref.uiSchema;
|
|
527
|
-
|
|
528
474
|
var _getSubmitButtonOptio = utils.getSubmitButtonOptions(uiSchema),
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
475
|
+
submitText = _getSubmitButtonOptio.submitText,
|
|
476
|
+
norender = _getSubmitButtonOptio.norender,
|
|
477
|
+
submitButtonProps = _getSubmitButtonOptio.props;
|
|
533
478
|
if (norender) {
|
|
534
479
|
return null;
|
|
535
480
|
}
|
|
536
|
-
|
|
537
481
|
return React__default["default"].createElement(react.Box, {
|
|
538
482
|
marginTop: 3
|
|
539
483
|
}, React__default["default"].createElement(react.Button, _extends({
|
|
540
484
|
type: "submit",
|
|
541
485
|
variant: "solid"
|
|
542
486
|
}, submitButtonProps), submitText));
|
|
543
|
-
}
|
|
487
|
+
}
|
|
544
488
|
|
|
545
|
-
|
|
489
|
+
function TitleField(_ref) {
|
|
546
490
|
var id = _ref.id,
|
|
547
|
-
|
|
491
|
+
title = _ref.title;
|
|
548
492
|
return React__default["default"].createElement(react.Box, {
|
|
549
493
|
id: id,
|
|
550
494
|
mt: 1,
|
|
@@ -552,109 +496,171 @@ var TitleField = function TitleField(_ref) {
|
|
|
552
496
|
}, React__default["default"].createElement(react.Heading, {
|
|
553
497
|
as: "h5"
|
|
554
498
|
}, title), React__default["default"].createElement(react.Divider, null));
|
|
555
|
-
}
|
|
499
|
+
}
|
|
556
500
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
501
|
+
function WrapIfAdditionalTemplate(props) {
|
|
502
|
+
var children = props.children,
|
|
503
|
+
classNames = props.classNames,
|
|
504
|
+
style = props.style,
|
|
505
|
+
disabled = props.disabled,
|
|
506
|
+
id = props.id,
|
|
507
|
+
label = props.label,
|
|
508
|
+
onDropPropertyClick = props.onDropPropertyClick,
|
|
509
|
+
onKeyChange = props.onKeyChange,
|
|
510
|
+
readonly = props.readonly,
|
|
511
|
+
registry = props.registry,
|
|
512
|
+
required = props.required,
|
|
513
|
+
schema = props.schema,
|
|
514
|
+
uiSchema = props.uiSchema;
|
|
515
|
+
// Button templates are not overridden in the uiSchema
|
|
516
|
+
var RemoveButton = registry.templates.ButtonTemplates.RemoveButton;
|
|
517
|
+
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
518
|
+
if (!additional) {
|
|
519
|
+
return React__default["default"].createElement("div", {
|
|
520
|
+
className: classNames,
|
|
521
|
+
style: style
|
|
522
|
+
}, children);
|
|
523
|
+
}
|
|
524
|
+
var keyLabel = label + " Key";
|
|
525
|
+
var handleBlur = function handleBlur(_ref) {
|
|
526
|
+
var target = _ref.target;
|
|
527
|
+
return onKeyChange(target.value);
|
|
528
|
+
};
|
|
529
|
+
return React__default["default"].createElement(react.Grid, {
|
|
530
|
+
key: id + "-key",
|
|
531
|
+
className: classNames,
|
|
532
|
+
style: style,
|
|
533
|
+
alignItems: "center",
|
|
534
|
+
gap: 2
|
|
535
|
+
}, React__default["default"].createElement(react.GridItem, null, React__default["default"].createElement(react.FormControl, {
|
|
536
|
+
isRequired: required
|
|
537
|
+
}, React__default["default"].createElement(react.FormLabel, {
|
|
538
|
+
htmlFor: id + "-key",
|
|
539
|
+
id: id + "-key-label"
|
|
540
|
+
}, keyLabel), React__default["default"].createElement(react.Input, {
|
|
541
|
+
defaultValue: label,
|
|
542
|
+
disabled: disabled || readonly,
|
|
543
|
+
id: id + "-key",
|
|
544
|
+
name: id + "-key",
|
|
545
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
546
|
+
type: "text",
|
|
547
|
+
mb: 1
|
|
548
|
+
}))), React__default["default"].createElement(react.GridItem, null, children), React__default["default"].createElement(react.GridItem, null, React__default["default"].createElement(RemoveButton, {
|
|
549
|
+
disabled: disabled || readonly,
|
|
550
|
+
onClick: onDropPropertyClick(label),
|
|
551
|
+
uiSchema: uiSchema,
|
|
552
|
+
registry: registry
|
|
553
|
+
})));
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function generateTemplates() {
|
|
557
|
+
return {
|
|
558
|
+
ArrayFieldItemTemplate: ArrayFieldItemTemplate,
|
|
559
|
+
ArrayFieldTemplate: ArrayFieldTemplate,
|
|
560
|
+
BaseInputTemplate: BaseInputTemplate,
|
|
561
|
+
ButtonTemplates: {
|
|
562
|
+
AddButton: AddButton,
|
|
563
|
+
MoveDownButton: MoveDownButton,
|
|
564
|
+
MoveUpButton: MoveUpButton,
|
|
565
|
+
RemoveButton: RemoveButton,
|
|
566
|
+
SubmitButton: SubmitButton
|
|
567
|
+
},
|
|
568
|
+
DescriptionFieldTemplate: DescriptionField,
|
|
569
|
+
ErrorListTemplate: ErrorList,
|
|
570
|
+
FieldErrorTemplate: FieldErrorTemplate,
|
|
571
|
+
FieldHelpTemplate: FieldHelpTemplate,
|
|
572
|
+
FieldTemplate: FieldTemplate,
|
|
573
|
+
ObjectFieldTemplate: ObjectFieldTemplate,
|
|
574
|
+
TitleFieldTemplate: TitleField,
|
|
575
|
+
WrapIfAdditionalTemplate: WrapIfAdditionalTemplate
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
var Templates = /*#__PURE__*/generateTemplates();
|
|
576
579
|
|
|
577
580
|
var rangeOptions = function rangeOptions(start, stop) {
|
|
578
581
|
var options = [];
|
|
579
|
-
|
|
580
582
|
for (var i = start; i <= stop; i++) {
|
|
581
583
|
options.push({
|
|
582
584
|
value: i,
|
|
583
585
|
label: utils.pad(i, 2)
|
|
584
586
|
});
|
|
585
587
|
}
|
|
586
|
-
|
|
587
588
|
return options;
|
|
588
589
|
};
|
|
589
|
-
|
|
590
|
+
function DateElement(props) {
|
|
591
|
+
var SelectWidget = props.registry.widgets.SelectWidget;
|
|
592
|
+
var value = props.value ? props.value : undefined;
|
|
593
|
+
return React__default["default"].createElement(SelectWidget, _extends({}, props, {
|
|
594
|
+
label: "",
|
|
595
|
+
className: "form-control",
|
|
596
|
+
onChange: function onChange(elemValue) {
|
|
597
|
+
return props.select(props.type, elemValue);
|
|
598
|
+
},
|
|
599
|
+
options: {
|
|
600
|
+
enumOptions: rangeOptions(props.range[0], props.range[1])
|
|
601
|
+
},
|
|
602
|
+
placeholder: props.type,
|
|
603
|
+
schema: {
|
|
604
|
+
type: "integer"
|
|
605
|
+
},
|
|
606
|
+
value: value,
|
|
607
|
+
"aria-describedby": utils.ariaDescribedByIds(props.name)
|
|
608
|
+
}));
|
|
609
|
+
}
|
|
590
610
|
var readyForChange = function readyForChange(state) {
|
|
591
611
|
return Object.keys(state).every(function (key) {
|
|
592
612
|
return typeof state[key] !== "undefined" && state[key] !== -1;
|
|
593
613
|
});
|
|
594
614
|
};
|
|
595
|
-
|
|
596
|
-
var AltDateWidget = function AltDateWidget(props) {
|
|
615
|
+
function AltDateWidget(props) {
|
|
597
616
|
var autofocus = props.autofocus,
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
var SelectWidget = registry.widgets.SelectWidget;
|
|
609
|
-
|
|
617
|
+
disabled = props.disabled,
|
|
618
|
+
id = props.id,
|
|
619
|
+
onBlur = props.onBlur,
|
|
620
|
+
onChange = props.onChange,
|
|
621
|
+
onFocus = props.onFocus,
|
|
622
|
+
options = props.options,
|
|
623
|
+
readonly = props.readonly,
|
|
624
|
+
registry = props.registry,
|
|
625
|
+
showTime = props.showTime,
|
|
626
|
+
value = props.value;
|
|
610
627
|
var _useState = React.useState(utils.parseDateString(value, showTime)),
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
628
|
+
state = _useState[0],
|
|
629
|
+
setState = _useState[1];
|
|
614
630
|
React.useEffect(function () {
|
|
615
631
|
setState(utils.parseDateString(value, showTime));
|
|
616
632
|
}, [showTime, value]);
|
|
617
|
-
|
|
618
633
|
var handleChange = function handleChange(property, nextValue) {
|
|
619
634
|
var _extends2;
|
|
620
|
-
|
|
621
635
|
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === "undefined" ? -1 : nextValue, _extends2));
|
|
622
|
-
|
|
623
636
|
if (readyForChange(nextState)) {
|
|
624
637
|
onChange(utils.toDateString(nextState, showTime));
|
|
625
638
|
} else {
|
|
626
639
|
setState(nextState);
|
|
627
640
|
}
|
|
628
641
|
};
|
|
629
|
-
|
|
630
642
|
var handleNow = function handleNow(event) {
|
|
631
643
|
event.preventDefault();
|
|
632
|
-
|
|
633
644
|
if (disabled || readonly) {
|
|
634
645
|
return;
|
|
635
646
|
}
|
|
636
|
-
|
|
637
647
|
var nextState = utils.parseDateString(new Date().toJSON(), showTime);
|
|
638
648
|
onChange(utils.toDateString(nextState, showTime));
|
|
639
649
|
};
|
|
640
|
-
|
|
641
650
|
var handleClear = function handleClear(event) {
|
|
642
651
|
event.preventDefault();
|
|
643
|
-
|
|
644
652
|
if (disabled || readonly) {
|
|
645
653
|
return;
|
|
646
654
|
}
|
|
647
|
-
|
|
648
655
|
onChange(undefined);
|
|
649
656
|
};
|
|
650
|
-
|
|
651
657
|
var dateElementProps = function dateElementProps() {
|
|
652
658
|
var year = state.year,
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
659
|
+
month = state.month,
|
|
660
|
+
day = state.day,
|
|
661
|
+
hour = state.hour,
|
|
662
|
+
minute = state.minute,
|
|
663
|
+
second = state.second;
|
|
658
664
|
var data = [{
|
|
659
665
|
type: "year",
|
|
660
666
|
range: options.yearsRange,
|
|
@@ -668,7 +674,6 @@ var AltDateWidget = function AltDateWidget(props) {
|
|
|
668
674
|
range: [1, 31],
|
|
669
675
|
value: day
|
|
670
676
|
}];
|
|
671
|
-
|
|
672
677
|
if (showTime) {
|
|
673
678
|
data.push({
|
|
674
679
|
type: "hour",
|
|
@@ -684,29 +689,8 @@ var AltDateWidget = function AltDateWidget(props) {
|
|
|
684
689
|
value: second
|
|
685
690
|
});
|
|
686
691
|
}
|
|
687
|
-
|
|
688
692
|
return data;
|
|
689
693
|
};
|
|
690
|
-
|
|
691
|
-
var renderDateElement = function renderDateElement(elemProps) {
|
|
692
|
-
var value = elemProps.value ? elemProps.value : undefined;
|
|
693
|
-
return React__default["default"].createElement(SelectWidget, _extends({}, elemProps, {
|
|
694
|
-
label: undefined,
|
|
695
|
-
className: "form-control",
|
|
696
|
-
onChange: function onChange(elemValue) {
|
|
697
|
-
return elemProps.select(elemProps.type, elemValue);
|
|
698
|
-
},
|
|
699
|
-
options: {
|
|
700
|
-
enumOptions: rangeOptions(elemProps.range[0], elemProps.range[1])
|
|
701
|
-
},
|
|
702
|
-
placeholder: elemProps.type,
|
|
703
|
-
schema: {
|
|
704
|
-
type: "integer"
|
|
705
|
-
},
|
|
706
|
-
value: value
|
|
707
|
-
}));
|
|
708
|
-
};
|
|
709
|
-
|
|
710
694
|
return React__default["default"].createElement(react.Box, null, React__default["default"].createElement(react.Box, {
|
|
711
695
|
display: "flex",
|
|
712
696
|
flexWrap: "wrap",
|
|
@@ -718,10 +702,11 @@ var AltDateWidget = function AltDateWidget(props) {
|
|
|
718
702
|
key: elemId,
|
|
719
703
|
mr: "2",
|
|
720
704
|
mb: "2"
|
|
721
|
-
},
|
|
705
|
+
}, React__default["default"].createElement(DateElement, _extends({}, props, elemProps, {
|
|
722
706
|
autofocus: autofocus && i === 0,
|
|
723
707
|
disabled: disabled,
|
|
724
708
|
id: elemId,
|
|
709
|
+
name: id,
|
|
725
710
|
onBlur: onBlur,
|
|
726
711
|
onFocus: onFocus,
|
|
727
712
|
readonly: readonly,
|
|
@@ -741,8 +726,7 @@ var AltDateWidget = function AltDateWidget(props) {
|
|
|
741
726
|
return handleClear(e);
|
|
742
727
|
}
|
|
743
728
|
}, "Clear")));
|
|
744
|
-
}
|
|
745
|
-
|
|
729
|
+
}
|
|
746
730
|
AltDateWidget.defaultProps = {
|
|
747
731
|
autofocus: false,
|
|
748
732
|
disabled: false,
|
|
@@ -753,47 +737,46 @@ AltDateWidget.defaultProps = {
|
|
|
753
737
|
}
|
|
754
738
|
};
|
|
755
739
|
|
|
756
|
-
|
|
740
|
+
function AltDateTimeWidget(props) {
|
|
757
741
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
758
742
|
return React__default["default"].createElement(AltDateWidget, _extends({}, props, {
|
|
759
743
|
showTime: true
|
|
760
744
|
}));
|
|
761
|
-
}
|
|
762
|
-
|
|
745
|
+
}
|
|
763
746
|
AltDateTimeWidget.defaultProps = /*#__PURE__*/_extends({}, AltDateWidget.defaultProps, {
|
|
764
747
|
showTime: true
|
|
765
748
|
});
|
|
766
749
|
|
|
767
|
-
|
|
750
|
+
function CheckboxWidget(props) {
|
|
768
751
|
var id = props.id,
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
752
|
+
value = props.value,
|
|
753
|
+
disabled = props.disabled,
|
|
754
|
+
readonly = props.readonly,
|
|
755
|
+
onChange = props.onChange,
|
|
756
|
+
onBlur = props.onBlur,
|
|
757
|
+
onFocus = props.onFocus,
|
|
758
|
+
label = props.label,
|
|
759
|
+
uiSchema = props.uiSchema,
|
|
760
|
+
schema = props.schema;
|
|
778
761
|
var chakraProps = getChakra({
|
|
779
762
|
uiSchema: uiSchema
|
|
780
763
|
});
|
|
781
|
-
|
|
764
|
+
// Because an unchecked checkbox will cause html5 validation to fail, only add
|
|
765
|
+
// the "required" attribute if the field value must be "true", due to the
|
|
766
|
+
// "const" or "enum" keywords
|
|
767
|
+
var required = utils.schemaRequiresTrueValue(schema);
|
|
782
768
|
var _onChange = function _onChange(_ref) {
|
|
783
769
|
var checked = _ref.target.checked;
|
|
784
770
|
return onChange(checked);
|
|
785
771
|
};
|
|
786
|
-
|
|
787
772
|
var _onBlur = function _onBlur(_ref2) {
|
|
788
773
|
var value = _ref2.target.value;
|
|
789
774
|
return onBlur(id, value);
|
|
790
775
|
};
|
|
791
|
-
|
|
792
776
|
var _onFocus = function _onFocus(_ref3) {
|
|
793
777
|
var value = _ref3.target.value;
|
|
794
778
|
return onFocus(id, value);
|
|
795
779
|
};
|
|
796
|
-
|
|
797
780
|
return React__default["default"].createElement(react.FormControl, _extends({
|
|
798
781
|
mb: 1
|
|
799
782
|
}, chakraProps, {
|
|
@@ -805,59 +788,43 @@ var CheckboxWidget = function CheckboxWidget(props) {
|
|
|
805
788
|
isDisabled: disabled || readonly,
|
|
806
789
|
onChange: _onChange,
|
|
807
790
|
onBlur: _onBlur,
|
|
808
|
-
onFocus: _onFocus
|
|
791
|
+
onFocus: _onFocus,
|
|
792
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
809
793
|
}, label && React__default["default"].createElement(react.Text, null, label)));
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
// const at = all.indexOf(value);
|
|
813
|
-
// const updated = selected.slice(0, at).concat(value, selected.slice(at));
|
|
814
|
-
// // As inserting values at predefined index positions doesn't work with empty
|
|
815
|
-
// // arrays, we need to reorder the updated selection to match the initial order
|
|
816
|
-
// return updated.sort((a, b) => all.indexOf(a) > all.indexOf(b));
|
|
817
|
-
// };
|
|
818
|
-
// const deselectValue = (value, selected) => {
|
|
819
|
-
// return selected.filter((v) => v !== value);
|
|
820
|
-
// };
|
|
794
|
+
}
|
|
821
795
|
|
|
822
|
-
|
|
796
|
+
function CheckboxesWidget(props) {
|
|
823
797
|
var id = props.id,
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
798
|
+
disabled = props.disabled,
|
|
799
|
+
options = props.options,
|
|
800
|
+
value = props.value,
|
|
801
|
+
readonly = props.readonly,
|
|
802
|
+
_onChange = props.onChange,
|
|
803
|
+
onBlur = props.onBlur,
|
|
804
|
+
onFocus = props.onFocus,
|
|
805
|
+
required = props.required,
|
|
806
|
+
label = props.label,
|
|
807
|
+
uiSchema = props.uiSchema,
|
|
808
|
+
_props$rawErrors = props.rawErrors,
|
|
809
|
+
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
810
|
+
schema = props.schema;
|
|
837
811
|
var enumOptions = options.enumOptions,
|
|
838
|
-
|
|
812
|
+
enumDisabled = options.enumDisabled,
|
|
813
|
+
emptyValue = options.emptyValue;
|
|
839
814
|
var chakraProps = getChakra({
|
|
840
815
|
uiSchema: uiSchema
|
|
841
|
-
});
|
|
842
|
-
|
|
843
|
-
// if (checked) {
|
|
844
|
-
// onChange(selectValue(option.value, value, all))
|
|
845
|
-
// } else {
|
|
846
|
-
// onChange(deselectValue(option.value, value))
|
|
847
|
-
// }
|
|
848
|
-
// }
|
|
849
|
-
|
|
816
|
+
});
|
|
817
|
+
var checkboxesValues = Array.isArray(value) ? value : [value];
|
|
850
818
|
var _onBlur = function _onBlur(_ref) {
|
|
851
819
|
var value = _ref.target.value;
|
|
852
|
-
return onBlur(id, value);
|
|
820
|
+
return onBlur(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
853
821
|
};
|
|
854
|
-
|
|
855
822
|
var _onFocus = function _onFocus(_ref2) {
|
|
856
823
|
var value = _ref2.target.value;
|
|
857
|
-
return onFocus(id, value);
|
|
824
|
+
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
858
825
|
};
|
|
859
|
-
|
|
860
826
|
var row = options ? options.inline : false;
|
|
827
|
+
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
|
|
861
828
|
return React__default["default"].createElement(react.FormControl, _extends({
|
|
862
829
|
mb: 1
|
|
863
830
|
}, chakraProps, {
|
|
@@ -870,56 +837,60 @@ var CheckboxesWidget = function CheckboxesWidget(props) {
|
|
|
870
837
|
id: id + "-label"
|
|
871
838
|
}, label || schema.title), React__default["default"].createElement(react.CheckboxGroup, {
|
|
872
839
|
onChange: function onChange(option) {
|
|
873
|
-
return _onChange(option);
|
|
840
|
+
return _onChange(utils.enumOptionsValueForIndex(option, enumOptions, emptyValue));
|
|
874
841
|
},
|
|
875
|
-
defaultValue:
|
|
842
|
+
defaultValue: selectedIndexes,
|
|
843
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
876
844
|
}, React__default["default"].createElement(react.Stack, {
|
|
877
845
|
direction: row ? "row" : "column"
|
|
878
|
-
}, enumOptions.map(function (option, index) {
|
|
879
|
-
var checked =
|
|
880
|
-
var itemDisabled = enumDisabled && enumDisabled.indexOf(option.value) !== -1;
|
|
846
|
+
}, Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
847
|
+
var checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
848
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
881
849
|
return React__default["default"].createElement(react.Checkbox, {
|
|
882
|
-
key:
|
|
883
|
-
id: id
|
|
884
|
-
|
|
850
|
+
key: index,
|
|
851
|
+
id: utils.optionId(id, index),
|
|
852
|
+
name: id,
|
|
853
|
+
value: String(index),
|
|
885
854
|
isChecked: checked,
|
|
886
855
|
isDisabled: disabled || itemDisabled || readonly,
|
|
887
856
|
onBlur: _onBlur,
|
|
888
857
|
onFocus: _onFocus
|
|
889
858
|
}, option.label && React__default["default"].createElement(react.Text, null, option.label));
|
|
890
859
|
}))));
|
|
891
|
-
}
|
|
860
|
+
}
|
|
892
861
|
|
|
893
|
-
|
|
862
|
+
function RadioWidget(_ref) {
|
|
894
863
|
var id = _ref.id,
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
864
|
+
schema = _ref.schema,
|
|
865
|
+
options = _ref.options,
|
|
866
|
+
value = _ref.value,
|
|
867
|
+
required = _ref.required,
|
|
868
|
+
disabled = _ref.disabled,
|
|
869
|
+
readonly = _ref.readonly,
|
|
870
|
+
label = _ref.label,
|
|
871
|
+
onChange = _ref.onChange,
|
|
872
|
+
onBlur = _ref.onBlur,
|
|
873
|
+
onFocus = _ref.onFocus,
|
|
874
|
+
uiSchema = _ref.uiSchema;
|
|
906
875
|
var enumOptions = options.enumOptions,
|
|
907
|
-
|
|
876
|
+
enumDisabled = options.enumDisabled,
|
|
877
|
+
emptyValue = options.emptyValue;
|
|
908
878
|
var chakraProps = getChakra({
|
|
909
879
|
uiSchema: uiSchema
|
|
910
880
|
});
|
|
911
|
-
|
|
881
|
+
var _onChange = function _onChange(nextValue) {
|
|
882
|
+
return onChange(utils.enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
883
|
+
};
|
|
912
884
|
var _onBlur = function _onBlur(_ref2) {
|
|
913
885
|
var value = _ref2.target.value;
|
|
914
|
-
return onBlur(id, value);
|
|
886
|
+
return onBlur(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
915
887
|
};
|
|
916
|
-
|
|
917
888
|
var _onFocus = function _onFocus(_ref3) {
|
|
918
889
|
var value = _ref3.target.value;
|
|
919
|
-
return onFocus(id, value);
|
|
890
|
+
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
920
891
|
};
|
|
921
|
-
|
|
922
892
|
var row = options ? options.inline : false;
|
|
893
|
+
var selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
923
894
|
return React__default["default"].createElement(react.FormControl, _extends({
|
|
924
895
|
mb: 1
|
|
925
896
|
}, chakraProps, {
|
|
@@ -930,64 +901,59 @@ var RadioWidget = function RadioWidget(_ref) {
|
|
|
930
901
|
htmlFor: id,
|
|
931
902
|
id: id + "-label"
|
|
932
903
|
}, label || schema.title), React__default["default"].createElement(react.RadioGroup, {
|
|
933
|
-
onChange:
|
|
904
|
+
onChange: _onChange,
|
|
934
905
|
onBlur: _onBlur,
|
|
935
906
|
onFocus: _onFocus,
|
|
936
|
-
value:
|
|
937
|
-
name: id
|
|
907
|
+
value: selectedIndex,
|
|
908
|
+
name: id,
|
|
909
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
938
910
|
}, React__default["default"].createElement(react.Stack, {
|
|
939
911
|
direction: row ? "row" : "column"
|
|
940
|
-
}, enumOptions.map(function (option,
|
|
941
|
-
var itemDisabled =
|
|
912
|
+
}, Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
913
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
942
914
|
return React__default["default"].createElement(react.Radio, {
|
|
943
|
-
value:
|
|
944
|
-
key:
|
|
945
|
-
id: id
|
|
915
|
+
value: String(index),
|
|
916
|
+
key: index,
|
|
917
|
+
id: utils.optionId(id, index),
|
|
946
918
|
disabled: disabled || itemDisabled || readonly
|
|
947
|
-
},
|
|
919
|
+
}, option.label);
|
|
948
920
|
}))));
|
|
949
|
-
}
|
|
921
|
+
}
|
|
950
922
|
|
|
951
|
-
|
|
923
|
+
function RangeWidget(_ref) {
|
|
952
924
|
var value = _ref.value,
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
925
|
+
readonly = _ref.readonly,
|
|
926
|
+
disabled = _ref.disabled,
|
|
927
|
+
onBlur = _ref.onBlur,
|
|
928
|
+
onFocus = _ref.onFocus,
|
|
929
|
+
options = _ref.options,
|
|
930
|
+
schema = _ref.schema,
|
|
931
|
+
uiSchema = _ref.uiSchema,
|
|
932
|
+
onChange = _ref.onChange,
|
|
933
|
+
label = _ref.label,
|
|
934
|
+
id = _ref.id,
|
|
935
|
+
registry = _ref.registry;
|
|
964
936
|
var schemaUtils = registry.schemaUtils;
|
|
965
937
|
var chakraProps = getChakra({
|
|
966
938
|
uiSchema: uiSchema
|
|
967
939
|
});
|
|
968
|
-
|
|
969
940
|
var sliderWidgetProps = _extends({
|
|
970
941
|
value: value,
|
|
971
942
|
label: label,
|
|
972
943
|
id: id
|
|
973
944
|
}, utils.rangeSpec(schema));
|
|
974
|
-
|
|
975
945
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
976
|
-
|
|
977
946
|
var _onChange = function _onChange(value) {
|
|
978
947
|
return onChange(value === undefined ? options.emptyValue : value);
|
|
979
948
|
};
|
|
980
|
-
|
|
981
949
|
var _onBlur = function _onBlur(_ref2) {
|
|
982
950
|
var value = _ref2.target.value;
|
|
983
951
|
return onBlur(id, value);
|
|
984
952
|
};
|
|
985
|
-
|
|
986
953
|
var _onFocus = function _onFocus(_ref3) {
|
|
987
954
|
var value = _ref3.target.value;
|
|
988
955
|
return onFocus(id, value);
|
|
989
956
|
};
|
|
990
|
-
|
|
991
957
|
return React__default["default"].createElement(react.FormControl, _extends({
|
|
992
958
|
mb: 1
|
|
993
959
|
}, chakraProps), displayLabel ? React__default["default"].createElement(react.FormLabel, {
|
|
@@ -998,58 +964,72 @@ var RangeWidget = function RangeWidget(_ref) {
|
|
|
998
964
|
isDisabled: disabled || readonly,
|
|
999
965
|
onChange: _onChange,
|
|
1000
966
|
onBlur: _onBlur,
|
|
1001
|
-
onFocus: _onFocus
|
|
967
|
+
onFocus: _onFocus,
|
|
968
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1002
969
|
}), React__default["default"].createElement(react.SliderTrack, null, React__default["default"].createElement(react.SliderFilledTrack, null)), React__default["default"].createElement(react.SliderThumb, null)));
|
|
1003
|
-
}
|
|
970
|
+
}
|
|
1004
971
|
|
|
1005
|
-
|
|
972
|
+
function SelectWidget(props) {
|
|
1006
973
|
var schema = props.schema,
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
974
|
+
id = props.id,
|
|
975
|
+
options = props.options,
|
|
976
|
+
label = props.label,
|
|
977
|
+
placeholder = props.placeholder,
|
|
978
|
+
multiple = props.multiple,
|
|
979
|
+
required = props.required,
|
|
980
|
+
disabled = props.disabled,
|
|
981
|
+
readonly = props.readonly,
|
|
982
|
+
value = props.value,
|
|
983
|
+
autofocus = props.autofocus,
|
|
984
|
+
onChange = props.onChange,
|
|
985
|
+
onBlur = props.onBlur,
|
|
986
|
+
onFocus = props.onFocus,
|
|
987
|
+
_props$rawErrors = props.rawErrors,
|
|
988
|
+
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
|
|
989
|
+
uiSchema = props.uiSchema;
|
|
1023
990
|
var enumOptions = options.enumOptions,
|
|
1024
|
-
|
|
991
|
+
enumDisabled = options.enumDisabled,
|
|
992
|
+
emptyValue = options.emptyValue;
|
|
1025
993
|
var chakraProps = getChakra({
|
|
1026
994
|
uiSchema: uiSchema
|
|
1027
|
-
});
|
|
1028
|
-
// const emptyValue = multiple ? [] : "";
|
|
1029
|
-
|
|
1030
|
-
var emptyValue = "";
|
|
1031
|
-
|
|
995
|
+
});
|
|
1032
996
|
var _onMultiChange = function _onMultiChange(e) {
|
|
1033
|
-
return onChange(utils.
|
|
997
|
+
return onChange(utils.enumOptionsValueForIndex(e.map(function (v) {
|
|
1034
998
|
return v.value;
|
|
1035
|
-
}),
|
|
999
|
+
}), enumOptions, emptyValue));
|
|
1036
1000
|
};
|
|
1037
|
-
|
|
1038
|
-
|
|
1001
|
+
var _onChange = function _onChange(e) {
|
|
1002
|
+
return onChange(utils.enumOptionsValueForIndex(e.value, enumOptions, emptyValue));
|
|
1003
|
+
};
|
|
1004
|
+
var _onBlur = function _onBlur(_ref) {
|
|
1039
1005
|
var value = _ref.target.value;
|
|
1040
|
-
return
|
|
1006
|
+
return onBlur(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
1041
1007
|
};
|
|
1042
|
-
|
|
1043
|
-
var _onBlur = function _onBlur(_ref2) {
|
|
1008
|
+
var _onFocus = function _onFocus(_ref2) {
|
|
1044
1009
|
var value = _ref2.target.value;
|
|
1045
|
-
return
|
|
1010
|
+
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
1046
1011
|
};
|
|
1047
|
-
|
|
1048
|
-
var
|
|
1049
|
-
var value =
|
|
1050
|
-
|
|
1012
|
+
var _valueLabelMap = {};
|
|
1013
|
+
var displayEnumOptions = Array.isArray(enumOptions) ? enumOptions.map(function (option, index) {
|
|
1014
|
+
var value = option.value,
|
|
1015
|
+
label = option.label;
|
|
1016
|
+
_valueLabelMap[index] = label;
|
|
1017
|
+
return {
|
|
1018
|
+
label: label,
|
|
1019
|
+
value: String(index),
|
|
1020
|
+
isDisabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1
|
|
1021
|
+
};
|
|
1022
|
+
}) : [];
|
|
1023
|
+
var isMultiple = typeof multiple !== "undefined" && Boolean(enumOptions);
|
|
1024
|
+
var formValue = isMultiple ? (value || []).map(function (v, index) {
|
|
1025
|
+
return {
|
|
1026
|
+
label: _valueLabelMap[index] || v,
|
|
1027
|
+
value: index
|
|
1028
|
+
};
|
|
1029
|
+
}) : {
|
|
1030
|
+
label: _valueLabelMap[0] || value || "",
|
|
1031
|
+
value: 0
|
|
1051
1032
|
};
|
|
1052
|
-
|
|
1053
1033
|
return React__default["default"].createElement(react.FormControl, _extends({
|
|
1054
1034
|
mb: 1
|
|
1055
1035
|
}, chakraProps, {
|
|
@@ -1058,80 +1038,57 @@ var SelectWidget = function SelectWidget(props) {
|
|
|
1058
1038
|
isReadOnly: readonly,
|
|
1059
1039
|
isInvalid: rawErrors && rawErrors.length > 0
|
|
1060
1040
|
}), (label || schema.title) && React__default["default"].createElement(react.FormLabel, {
|
|
1061
|
-
htmlFor:
|
|
1062
|
-
}, label || schema.title),
|
|
1041
|
+
htmlFor: isMultiple ? undefined : id
|
|
1042
|
+
}, label || schema.title), React__default["default"].createElement(chakraReactSelect.Select, {
|
|
1063
1043
|
inputId: id,
|
|
1064
1044
|
name: id,
|
|
1065
|
-
isMulti:
|
|
1066
|
-
options:
|
|
1045
|
+
isMulti: isMultiple,
|
|
1046
|
+
options: displayEnumOptions,
|
|
1067
1047
|
placeholder: placeholder,
|
|
1068
|
-
closeMenuOnSelect:
|
|
1069
|
-
onChange: _onMultiChange,
|
|
1070
|
-
value: value.map(function (v) {
|
|
1071
|
-
return {
|
|
1072
|
-
label: v,
|
|
1073
|
-
value: v
|
|
1074
|
-
};
|
|
1075
|
-
})
|
|
1076
|
-
}) : React__default["default"].createElement(react.Select, {
|
|
1077
|
-
id: id,
|
|
1078
|
-
name: id,
|
|
1079
|
-
placeholder: placeholder !== "" ? placeholder : " ",
|
|
1080
|
-
value: typeof value === "undefined" ? emptyValue : value.toString(),
|
|
1081
|
-
autoFocus: autofocus,
|
|
1048
|
+
closeMenuOnSelect: !isMultiple,
|
|
1082
1049
|
onBlur: _onBlur,
|
|
1083
|
-
onChange: _onChange,
|
|
1084
|
-
onFocus: _onFocus
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
key: i,
|
|
1091
|
-
value: value,
|
|
1092
|
-
disabled: disabled
|
|
1093
|
-
}, label);
|
|
1094
|
-
})));
|
|
1095
|
-
};
|
|
1050
|
+
onChange: isMultiple ? _onMultiChange : _onChange,
|
|
1051
|
+
onFocus: _onFocus,
|
|
1052
|
+
autoFocus: autofocus,
|
|
1053
|
+
value: formValue,
|
|
1054
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1055
|
+
}));
|
|
1056
|
+
}
|
|
1096
1057
|
|
|
1097
|
-
|
|
1058
|
+
function TextareaWidget(_ref) {
|
|
1098
1059
|
var id = _ref.id,
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1060
|
+
placeholder = _ref.placeholder,
|
|
1061
|
+
value = _ref.value,
|
|
1062
|
+
label = _ref.label,
|
|
1063
|
+
disabled = _ref.disabled,
|
|
1064
|
+
autofocus = _ref.autofocus,
|
|
1065
|
+
readonly = _ref.readonly,
|
|
1066
|
+
onBlur = _ref.onBlur,
|
|
1067
|
+
onFocus = _ref.onFocus,
|
|
1068
|
+
onChange = _ref.onChange,
|
|
1069
|
+
options = _ref.options,
|
|
1070
|
+
schema = _ref.schema,
|
|
1071
|
+
uiSchema = _ref.uiSchema,
|
|
1072
|
+
required = _ref.required,
|
|
1073
|
+
rawErrors = _ref.rawErrors,
|
|
1074
|
+
registry = _ref.registry;
|
|
1114
1075
|
var chakraProps = getChakra({
|
|
1115
1076
|
uiSchema: uiSchema
|
|
1116
1077
|
});
|
|
1117
1078
|
var schemaUtils = registry.schemaUtils;
|
|
1118
1079
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1119
|
-
|
|
1120
1080
|
var _onChange = function _onChange(_ref2) {
|
|
1121
1081
|
var value = _ref2.target.value;
|
|
1122
1082
|
return onChange(value === "" ? options.emptyValue : value);
|
|
1123
1083
|
};
|
|
1124
|
-
|
|
1125
1084
|
var _onBlur = function _onBlur(_ref3) {
|
|
1126
1085
|
var value = _ref3.target.value;
|
|
1127
1086
|
return onBlur(id, value);
|
|
1128
1087
|
};
|
|
1129
|
-
|
|
1130
1088
|
var _onFocus = function _onFocus(_ref4) {
|
|
1131
1089
|
var value = _ref4.target.value;
|
|
1132
1090
|
return onFocus(id, value);
|
|
1133
1091
|
};
|
|
1134
|
-
|
|
1135
1092
|
return React__default["default"].createElement(react.FormControl, _extends({
|
|
1136
1093
|
mb: 1
|
|
1137
1094
|
}, chakraProps, {
|
|
@@ -1149,44 +1106,41 @@ var TextareaWidget = function TextareaWidget(_ref) {
|
|
|
1149
1106
|
autoFocus: autofocus,
|
|
1150
1107
|
onChange: _onChange,
|
|
1151
1108
|
onBlur: _onBlur,
|
|
1152
|
-
onFocus: _onFocus
|
|
1109
|
+
onFocus: _onFocus,
|
|
1110
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1153
1111
|
}));
|
|
1154
|
-
}
|
|
1112
|
+
}
|
|
1155
1113
|
|
|
1156
|
-
|
|
1114
|
+
function UpDownWidget(props) {
|
|
1157
1115
|
var id = props.id,
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1116
|
+
schema = props.schema,
|
|
1117
|
+
uiSchema = props.uiSchema,
|
|
1118
|
+
readonly = props.readonly,
|
|
1119
|
+
disabled = props.disabled,
|
|
1120
|
+
label = props.label,
|
|
1121
|
+
value = props.value,
|
|
1122
|
+
onChange = props.onChange,
|
|
1123
|
+
onBlur = props.onBlur,
|
|
1124
|
+
onFocus = props.onFocus,
|
|
1125
|
+
rawErrors = props.rawErrors,
|
|
1126
|
+
required = props.required,
|
|
1127
|
+
registry = props.registry;
|
|
1170
1128
|
var schemaUtils = registry.schemaUtils;
|
|
1171
1129
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1172
1130
|
var chakraProps = getChakra({
|
|
1173
1131
|
uiSchema: uiSchema
|
|
1174
1132
|
});
|
|
1175
|
-
|
|
1176
1133
|
var _onChange = function _onChange(value) {
|
|
1177
1134
|
return onChange(value);
|
|
1178
1135
|
};
|
|
1179
|
-
|
|
1180
1136
|
var _onBlur = function _onBlur(_ref) {
|
|
1181
1137
|
var value = _ref.target.value;
|
|
1182
1138
|
return onBlur(id, value);
|
|
1183
1139
|
};
|
|
1184
|
-
|
|
1185
1140
|
var _onFocus = function _onFocus(_ref2) {
|
|
1186
1141
|
var value = _ref2.target.value;
|
|
1187
1142
|
return onFocus(id, value);
|
|
1188
1143
|
};
|
|
1189
|
-
|
|
1190
1144
|
return React__default["default"].createElement(react.FormControl, _extends({
|
|
1191
1145
|
mb: 1
|
|
1192
1146
|
}, chakraProps, {
|
|
@@ -1200,31 +1154,41 @@ var UpDownWidget = function UpDownWidget(props) {
|
|
|
1200
1154
|
value: value != null ? value : "",
|
|
1201
1155
|
onChange: _onChange,
|
|
1202
1156
|
onBlur: _onBlur,
|
|
1203
|
-
onFocus: _onFocus
|
|
1157
|
+
onFocus: _onFocus,
|
|
1158
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1204
1159
|
}, React__default["default"].createElement(react.NumberInputField, {
|
|
1205
1160
|
id: id,
|
|
1206
1161
|
name: id
|
|
1207
1162
|
}), React__default["default"].createElement(react.NumberInputStepper, null, React__default["default"].createElement(react.NumberIncrementStepper, null), React__default["default"].createElement(react.NumberDecrementStepper, null))));
|
|
1208
|
-
}
|
|
1163
|
+
}
|
|
1209
1164
|
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1165
|
+
function generateWidgets() {
|
|
1166
|
+
return {
|
|
1167
|
+
AltDateTimeWidget: AltDateTimeWidget,
|
|
1168
|
+
AltDateWidget: AltDateWidget,
|
|
1169
|
+
CheckboxWidget: CheckboxWidget,
|
|
1170
|
+
CheckboxesWidget: CheckboxesWidget,
|
|
1171
|
+
RadioWidget: RadioWidget,
|
|
1172
|
+
RangeWidget: RangeWidget,
|
|
1173
|
+
SelectWidget: SelectWidget,
|
|
1174
|
+
TextareaWidget: TextareaWidget,
|
|
1175
|
+
UpDownWidget: UpDownWidget
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
var Widgets = /*#__PURE__*/generateWidgets();
|
|
1221
1179
|
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1180
|
+
function generateTheme() {
|
|
1181
|
+
return {
|
|
1182
|
+
templates: generateTemplates(),
|
|
1183
|
+
widgets: generateWidgets()
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
var Theme = /*#__PURE__*/generateTheme();
|
|
1226
1187
|
|
|
1227
|
-
|
|
1188
|
+
function generateForm() {
|
|
1189
|
+
return core.withTheme(generateTheme());
|
|
1190
|
+
}
|
|
1191
|
+
var Form = /*#__PURE__*/generateForm();
|
|
1228
1192
|
|
|
1229
1193
|
/**
|
|
1230
1194
|
*
|
|
@@ -1247,7 +1211,6 @@ var Form = /*#__PURE__*/core.withTheme(Theme);
|
|
|
1247
1211
|
|
|
1248
1212
|
It is located at the bottom of the styles string.
|
|
1249
1213
|
*/
|
|
1250
|
-
|
|
1251
1214
|
var CSSReset = function CSSReset() {
|
|
1252
1215
|
return React__namespace.createElement(react$1.Global, {
|
|
1253
1216
|
styles: "\n html {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n font-family: system-ui, sans-serif;\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n -moz-osx-font-smoothing: grayscale;\n touch-action: manipulation;\n }\n body {\n position: relative;\n min-height: 100%;\n font-feature-settings: 'kern';\n }\n *,\n *::before,\n *::after {\n border-width: 0;\n border-style: solid;\n box-sizing: border-box;\n }\n main {\n display: block;\n }\n hr {\n border-top-width: 1px;\n box-sizing: content-box;\n height: 0;\n overflow: visible;\n }\n pre,\n code,\n kbd,\n samp {\n font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n font-size: 1em;\n }\n a {\n background-color: transparent;\n color: inherit;\n text-decoration: inherit;\n }\n abbr[title] {\n border-bottom: none;\n text-decoration: underline;\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n b,\n strong {\n font-weight: bold;\n }\n small {\n font-size: 80%;\n }\n sub,\n sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n img {\n border-style: none;\n }\n button,\n input,\n optgroup,\n select,\n textarea {\n font-family: inherit;\n font-size: 100%;\n line-height: 1.15;\n margin: 0;\n }\n button,\n input {\n overflow: visible;\n }\n button,\n select {\n text-transform: none;\n }\n button::-moz-focus-inner,\n [type=\"button\"]::-moz-focus-inner,\n [type=\"reset\"]::-moz-focus-inner,\n [type=\"submit\"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n fieldset {\n padding: 0.35em 0.75em 0.625em;\n }\n legend {\n box-sizing: border-box;\n color: inherit;\n display: table;\n max-width: 100%;\n padding: 0;\n white-space: normal;\n }\n progress {\n vertical-align: baseline;\n }\n textarea {\n overflow: auto;\n }\n [type=\"checkbox\"],\n [type=\"radio\"] {\n box-sizing: border-box;\n padding: 0;\n }\n [type=\"number\"]::-webkit-inner-spin-button,\n [type=\"number\"]::-webkit-outer-spin-button {\n -webkit-appearance: none !important;\n }\n input[type=\"number\"] {\n -moz-appearance: textfield;\n }\n [type=\"search\"] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n }\n [type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none !important;\n }\n ::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n }\n details {\n display: block;\n }\n summary {\n display: list-item;\n }\n template {\n display: none;\n }\n [hidden] {\n display: none !important;\n }\n body,\n blockquote,\n dl,\n dd,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n hr,\n figure,\n p,\n pre {\n margin: 0;\n }\n button {\n background: transparent;\n padding: 0;\n }\n fieldset {\n margin: 0;\n padding: 0;\n }\n ol,\n ul {\n margin: 0;\n padding: 0;\n }\n textarea {\n resize: vertical;\n }\n button,\n [role=\"button\"] {\n cursor: pointer;\n }\n button::-moz-focus-inner {\n border: 0 !important;\n }\n table {\n border-collapse: collapse;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n button,\n input,\n optgroup,\n select,\n textarea {\n padding: 0;\n line-height: inherit;\n color: inherit;\n }\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n }\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n [data-js-focus-visible] :focus:not([data-focus-visible-added]) {\n outline: none;\n box-shadow: none;\n }\n select::-ms-expand {\n display: none;\n }\n input {\n border-width: revert;\n border-color: revert;\n border-style: revert;\n }\n .array-item > hr {\n margin-top: 16px;\n margin-bottom: 16px;\n }\n "
|
|
@@ -1268,7 +1231,6 @@ var CSSReset = function CSSReset() {
|
|
|
1268
1231
|
* From: https://codesandbox.io/s/p98y9o7jz0?file=/src/frame-provider.js:0-650
|
|
1269
1232
|
* Also see: https://github.com/emotion-js/emotion/issues/760#issuecomment-404353706
|
|
1270
1233
|
*/
|
|
1271
|
-
|
|
1272
1234
|
var memoizedCreateCacheWithContainer = /*#__PURE__*/weakMemoize__default["default"](function (container) {
|
|
1273
1235
|
var newCache = createCache__default["default"]({
|
|
1274
1236
|
container: container,
|
|
@@ -1294,7 +1256,11 @@ var __createChakraFrameProvider = function __createChakraFrameProvider(props) {
|
|
|
1294
1256
|
exports.Form = Form;
|
|
1295
1257
|
exports.Templates = Templates;
|
|
1296
1258
|
exports.Theme = Theme;
|
|
1297
|
-
exports.Widgets =
|
|
1259
|
+
exports.Widgets = Widgets;
|
|
1298
1260
|
exports.__createChakraFrameProvider = __createChakraFrameProvider;
|
|
1299
1261
|
exports["default"] = Form;
|
|
1262
|
+
exports.generateForm = generateForm;
|
|
1263
|
+
exports.generateTemplates = generateTemplates;
|
|
1264
|
+
exports.generateTheme = generateTheme;
|
|
1265
|
+
exports.generateWidgets = generateWidgets;
|
|
1300
1266
|
//# sourceMappingURL=chakra-ui.cjs.development.js.map
|