@rjsf/chakra-ui 5.2.0 → 5.2.1
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/LICENSE.md +183 -183
- package/README.md +4 -4
- package/dist/chakra-ui.cjs.development.js +479 -412
- 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 +473 -387
- package/dist/chakra-ui.esm.js.map +1 -1
- package/dist/chakra-ui.umd.development.js +480 -414
- 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 +3 -3
- package/package.json +6 -5
|
@@ -3,37 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@rjsf/core');
|
|
6
|
-
var
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var utils = require('@rjsf/utils');
|
|
8
8
|
var react = require('@chakra-ui/react');
|
|
9
9
|
var icons = require('@chakra-ui/icons');
|
|
10
|
+
var react$1 = require('react');
|
|
10
11
|
var chakraReactSelect = require('chakra-react-select');
|
|
11
|
-
var react$
|
|
12
|
+
var react$2 = require('@emotion/react');
|
|
12
13
|
var createCache = require('@emotion/cache');
|
|
13
14
|
var weakMemoize = require('@emotion/weak-memoize');
|
|
14
15
|
|
|
15
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
17
|
|
|
17
|
-
function _interopNamespace(e) {
|
|
18
|
-
if (e && e.__esModule) return e;
|
|
19
|
-
var n = Object.create(null);
|
|
20
|
-
if (e) {
|
|
21
|
-
Object.keys(e).forEach(function (k) {
|
|
22
|
-
if (k !== 'default') {
|
|
23
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
24
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return e[k]; }
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
n["default"] = e;
|
|
32
|
-
return n;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
36
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
37
18
|
var createCache__default = /*#__PURE__*/_interopDefaultLegacy(createCache);
|
|
38
19
|
var weakMemoize__default = /*#__PURE__*/_interopDefaultLegacy(weakMemoize);
|
|
39
20
|
|
|
@@ -69,9 +50,11 @@ function AddButton(_ref) {
|
|
|
69
50
|
var registry = _ref.registry,
|
|
70
51
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
71
52
|
var translateString = registry.translateString;
|
|
72
|
-
return
|
|
73
|
-
leftIcon:
|
|
74
|
-
}, props
|
|
53
|
+
return jsxRuntime.jsx(react.Button, _extends({
|
|
54
|
+
leftIcon: jsxRuntime.jsx(icons.AddIcon, {})
|
|
55
|
+
}, props, {
|
|
56
|
+
children: translateString(utils.TranslatableString.AddItemButton)
|
|
57
|
+
}));
|
|
75
58
|
}
|
|
76
59
|
|
|
77
60
|
function ArrayFieldItemTemplate(props) {
|
|
@@ -91,39 +74,44 @@ function ArrayFieldItemTemplate(props) {
|
|
|
91
74
|
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
92
75
|
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
93
76
|
RemoveButton = _registry$templates$B.RemoveButton;
|
|
94
|
-
var onRemoveClick =
|
|
77
|
+
var onRemoveClick = react$1.useMemo(function () {
|
|
95
78
|
return onDropIndexClick(index);
|
|
96
79
|
}, [index, onDropIndexClick]);
|
|
97
|
-
var onArrowUpClick =
|
|
80
|
+
var onArrowUpClick = react$1.useMemo(function () {
|
|
98
81
|
return onReorderClick(index, index - 1);
|
|
99
82
|
}, [index, onReorderClick]);
|
|
100
|
-
var onArrowDownClick =
|
|
83
|
+
var onArrowDownClick = react$1.useMemo(function () {
|
|
101
84
|
return onReorderClick(index, index + 1);
|
|
102
85
|
}, [index, onReorderClick]);
|
|
103
|
-
return
|
|
104
|
-
alignItems:
|
|
105
|
-
py: 1
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
86
|
+
return jsxRuntime.jsxs(react.HStack, {
|
|
87
|
+
alignItems: 'flex-end',
|
|
88
|
+
py: 1,
|
|
89
|
+
children: [jsxRuntime.jsx(react.Box, {
|
|
90
|
+
w: '100%',
|
|
91
|
+
children: children
|
|
92
|
+
}), hasToolbar && jsxRuntime.jsx(react.Box, {
|
|
93
|
+
children: jsxRuntime.jsxs(react.ButtonGroup, {
|
|
94
|
+
isAttached: true,
|
|
95
|
+
mb: 1,
|
|
96
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
97
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
98
|
+
onClick: onArrowUpClick,
|
|
99
|
+
uiSchema: uiSchema,
|
|
100
|
+
registry: registry
|
|
101
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
102
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
103
|
+
onClick: onArrowDownClick,
|
|
104
|
+
uiSchema: uiSchema,
|
|
105
|
+
registry: registry
|
|
106
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
107
|
+
disabled: disabled || readonly,
|
|
108
|
+
onClick: onRemoveClick,
|
|
109
|
+
uiSchema: uiSchema,
|
|
110
|
+
registry: registry
|
|
111
|
+
})]
|
|
112
|
+
})
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
127
115
|
}
|
|
128
116
|
|
|
129
117
|
var _excluded$1 = ["key"];
|
|
@@ -140,49 +128,53 @@ function ArrayFieldTemplate(props) {
|
|
|
140
128
|
schema = props.schema,
|
|
141
129
|
title = props.title;
|
|
142
130
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
143
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
144
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
145
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
131
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
132
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
133
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
146
134
|
// Button templates are not overridden in the uiSchema
|
|
147
135
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
148
|
-
return
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
136
|
+
return jsxRuntime.jsxs(react.Box, {
|
|
137
|
+
children: [jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
138
|
+
idSchema: idSchema,
|
|
139
|
+
title: uiOptions.title || title,
|
|
140
|
+
schema: schema,
|
|
141
|
+
uiSchema: uiSchema,
|
|
142
|
+
required: required,
|
|
143
|
+
registry: registry
|
|
144
|
+
}), jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
145
|
+
idSchema: idSchema,
|
|
146
|
+
description: uiOptions.description || schema.description,
|
|
147
|
+
schema: schema,
|
|
148
|
+
uiSchema: uiSchema,
|
|
149
|
+
registry: registry
|
|
150
|
+
}), jsxRuntime.jsxs(react.Grid, {
|
|
151
|
+
children: [jsxRuntime.jsx(react.GridItem, {
|
|
152
|
+
children: items.length > 0 && items.map(function (_ref) {
|
|
153
|
+
var key = _ref.key,
|
|
154
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
155
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
156
|
+
})
|
|
157
|
+
}), canAdd && jsxRuntime.jsx(react.GridItem, {
|
|
158
|
+
justifySelf: 'flex-end',
|
|
159
|
+
children: jsxRuntime.jsx(react.Box, {
|
|
160
|
+
mt: 2,
|
|
161
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
162
|
+
className: 'array-item-add',
|
|
163
|
+
onClick: onAddClick,
|
|
164
|
+
disabled: disabled || readonly,
|
|
165
|
+
uiSchema: uiSchema,
|
|
166
|
+
registry: registry
|
|
167
|
+
})
|
|
168
|
+
})
|
|
169
|
+
})]
|
|
170
|
+
}, "array-item-list-" + idSchema.$id)]
|
|
171
|
+
});
|
|
180
172
|
}
|
|
181
173
|
|
|
182
174
|
function getChakra(_ref) {
|
|
183
175
|
var _ref$uiSchema = _ref.uiSchema,
|
|
184
176
|
uiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema;
|
|
185
|
-
var chakraProps = uiSchema[
|
|
177
|
+
var chakraProps = uiSchema['ui:options'] && uiSchema['ui:options'].chakra || {};
|
|
186
178
|
Object.keys(chakraProps).forEach(function (key) {
|
|
187
179
|
/**
|
|
188
180
|
* Leveraging `shouldForwardProp` to remove props
|
|
@@ -206,6 +198,7 @@ function BaseInputTemplate(props) {
|
|
|
206
198
|
schema = props.schema,
|
|
207
199
|
uiSchema = props.uiSchema,
|
|
208
200
|
onChange = props.onChange,
|
|
201
|
+
onChangeOverride = props.onChangeOverride,
|
|
209
202
|
onBlur = props.onBlur,
|
|
210
203
|
onFocus = props.onFocus,
|
|
211
204
|
options = props.options,
|
|
@@ -223,7 +216,7 @@ function BaseInputTemplate(props) {
|
|
|
223
216
|
var schemaUtils = registry.schemaUtils;
|
|
224
217
|
var _onChange = function _onChange(_ref) {
|
|
225
218
|
var value = _ref.target.value;
|
|
226
|
-
return onChange(value ===
|
|
219
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
227
220
|
};
|
|
228
221
|
var _onBlur = function _onBlur(_ref2) {
|
|
229
222
|
var value = _ref2.target.value;
|
|
@@ -234,36 +227,38 @@ function BaseInputTemplate(props) {
|
|
|
234
227
|
return onFocus(id, value);
|
|
235
228
|
};
|
|
236
229
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
237
|
-
return
|
|
230
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
238
231
|
mb: 1
|
|
239
232
|
}, chakraProps, {
|
|
240
233
|
isDisabled: disabled || readonly,
|
|
241
234
|
isRequired: required,
|
|
242
235
|
isReadOnly: readonly,
|
|
243
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
236
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
237
|
+
children: [displayLabel ? jsxRuntime.jsx(react.FormLabel, {
|
|
238
|
+
htmlFor: id,
|
|
239
|
+
id: id + "-label",
|
|
240
|
+
children: label || schema.title
|
|
241
|
+
}) : null, jsxRuntime.jsx(react.Input, _extends({
|
|
242
|
+
id: id,
|
|
243
|
+
name: id,
|
|
244
|
+
value: value || value === 0 ? value : '',
|
|
245
|
+
onChange: onChangeOverride || _onChange,
|
|
246
|
+
onBlur: _onBlur,
|
|
247
|
+
onFocus: _onFocus,
|
|
248
|
+
autoFocus: autofocus,
|
|
249
|
+
placeholder: placeholder
|
|
250
|
+
}, inputProps, {
|
|
251
|
+
list: schema.examples ? utils.examplesId(id) : undefined,
|
|
252
|
+
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
253
|
+
})), Array.isArray(schema.examples) ? jsxRuntime.jsx("datalist", {
|
|
254
|
+
id: utils.examplesId(id),
|
|
255
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
256
|
+
return jsxRuntime.jsx("option", {
|
|
257
|
+
value: example
|
|
258
|
+
}, example);
|
|
259
|
+
})
|
|
260
|
+
}) : null]
|
|
261
|
+
}));
|
|
267
262
|
}
|
|
268
263
|
|
|
269
264
|
function DescriptionField(_ref) {
|
|
@@ -272,70 +267,78 @@ function DescriptionField(_ref) {
|
|
|
272
267
|
if (!description) {
|
|
273
268
|
return null;
|
|
274
269
|
}
|
|
275
|
-
if (typeof description ===
|
|
276
|
-
return
|
|
270
|
+
if (typeof description === 'string') {
|
|
271
|
+
return jsxRuntime.jsx(react.Text, {
|
|
277
272
|
id: id,
|
|
278
273
|
mt: 2,
|
|
279
|
-
mb: 4
|
|
280
|
-
|
|
274
|
+
mb: 4,
|
|
275
|
+
children: description
|
|
276
|
+
});
|
|
281
277
|
}
|
|
282
|
-
return
|
|
278
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
279
|
+
children: description
|
|
280
|
+
});
|
|
283
281
|
}
|
|
284
282
|
|
|
285
283
|
function ErrorList(_ref) {
|
|
286
284
|
var errors = _ref.errors,
|
|
287
285
|
registry = _ref.registry;
|
|
288
286
|
var translateString = registry.translateString;
|
|
289
|
-
return
|
|
290
|
-
flexDirection:
|
|
291
|
-
alignItems:
|
|
287
|
+
return jsxRuntime.jsxs(react.Alert, {
|
|
288
|
+
flexDirection: 'column',
|
|
289
|
+
alignItems: 'flex-start',
|
|
292
290
|
gap: 3,
|
|
293
|
-
status:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
291
|
+
status: 'error',
|
|
292
|
+
children: [jsxRuntime.jsx(react.AlertTitle, {
|
|
293
|
+
children: translateString(utils.TranslatableString.ErrorsLabel)
|
|
294
|
+
}), jsxRuntime.jsx(react.List, {
|
|
295
|
+
children: errors.map(function (error, i) {
|
|
296
|
+
return jsxRuntime.jsxs(react.ListItem, {
|
|
297
|
+
children: [jsxRuntime.jsx(react.ListIcon, {
|
|
298
|
+
as: icons.WarningIcon,
|
|
299
|
+
color: 'red.500'
|
|
300
|
+
}), error.stack]
|
|
301
|
+
}, i);
|
|
302
|
+
})
|
|
303
|
+
})]
|
|
304
|
+
});
|
|
302
305
|
}
|
|
303
306
|
|
|
304
307
|
var _excluded = ["icon", "iconType", "uiSchema", "registry"];
|
|
305
308
|
function ChakraIconButton(props) {
|
|
306
309
|
var icon = props.icon,
|
|
307
310
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
308
|
-
return
|
|
311
|
+
return jsxRuntime.jsx(react.IconButton, _extends({
|
|
309
312
|
"aria-label": props.title
|
|
310
313
|
}, otherProps, {
|
|
311
314
|
icon: icon
|
|
312
315
|
}));
|
|
313
316
|
}
|
|
314
|
-
ChakraIconButton.displayName =
|
|
315
|
-
var ChakraIconButton$1 = /*#__PURE__*/
|
|
317
|
+
ChakraIconButton.displayName = 'ChakraIconButton';
|
|
318
|
+
var ChakraIconButton$1 = /*#__PURE__*/react$1.memo(ChakraIconButton);
|
|
316
319
|
|
|
317
320
|
function MoveDownButton(props) {
|
|
318
321
|
var translateString = props.registry.translateString;
|
|
319
|
-
return
|
|
322
|
+
return jsxRuntime.jsx(ChakraIconButton$1, _extends({
|
|
320
323
|
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
321
324
|
}, props, {
|
|
322
|
-
icon:
|
|
325
|
+
icon: jsxRuntime.jsx(icons.ArrowDownIcon, {})
|
|
323
326
|
}));
|
|
324
327
|
}
|
|
325
328
|
function MoveUpButton(props) {
|
|
326
329
|
var translateString = props.registry.translateString;
|
|
327
|
-
return
|
|
330
|
+
return jsxRuntime.jsx(ChakraIconButton$1, _extends({
|
|
328
331
|
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
329
332
|
}, props, {
|
|
330
|
-
icon:
|
|
333
|
+
icon: jsxRuntime.jsx(icons.ArrowUpIcon, {})
|
|
331
334
|
}));
|
|
332
335
|
}
|
|
333
336
|
function RemoveButton(props) {
|
|
334
337
|
var translateString = props.registry.translateString;
|
|
335
|
-
return
|
|
338
|
+
return jsxRuntime.jsx(ChakraIconButton$1, _extends({
|
|
336
339
|
title: translateString(utils.TranslatableString.RemoveButton)
|
|
337
340
|
}, props, {
|
|
338
|
-
icon:
|
|
341
|
+
icon: jsxRuntime.jsx(icons.DeleteIcon, {})
|
|
339
342
|
}));
|
|
340
343
|
}
|
|
341
344
|
|
|
@@ -351,13 +354,16 @@ function FieldErrorTemplate(props) {
|
|
|
351
354
|
return null;
|
|
352
355
|
}
|
|
353
356
|
var id = utils.errorId(idSchema);
|
|
354
|
-
return
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
357
|
+
return jsxRuntime.jsx(react.List, {
|
|
358
|
+
children: errors.map(function (error, i) {
|
|
359
|
+
return jsxRuntime.jsx(react.ListItem, {
|
|
360
|
+
children: jsxRuntime.jsx(react.FormErrorMessage, {
|
|
361
|
+
id: id,
|
|
362
|
+
children: error
|
|
363
|
+
})
|
|
364
|
+
}, i);
|
|
365
|
+
})
|
|
366
|
+
});
|
|
361
367
|
}
|
|
362
368
|
|
|
363
369
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -371,9 +377,10 @@ function FieldHelpTemplate(props) {
|
|
|
371
377
|
return null;
|
|
372
378
|
}
|
|
373
379
|
var id = utils.helpId(idSchema);
|
|
374
|
-
return
|
|
375
|
-
id: id
|
|
376
|
-
|
|
380
|
+
return jsxRuntime.jsx(react.FormHelperText, {
|
|
381
|
+
id: id,
|
|
382
|
+
children: help
|
|
383
|
+
});
|
|
377
384
|
}
|
|
378
385
|
|
|
379
386
|
function FieldTemplate(props) {
|
|
@@ -398,15 +405,16 @@ function FieldTemplate(props) {
|
|
|
398
405
|
schema = props.schema,
|
|
399
406
|
uiSchema = props.uiSchema;
|
|
400
407
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
401
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
408
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
402
409
|
if (hidden) {
|
|
403
|
-
return
|
|
410
|
+
return jsxRuntime.jsx("div", {
|
|
404
411
|
style: {
|
|
405
|
-
display:
|
|
406
|
-
}
|
|
407
|
-
|
|
412
|
+
display: 'none'
|
|
413
|
+
},
|
|
414
|
+
children: children
|
|
415
|
+
});
|
|
408
416
|
}
|
|
409
|
-
return
|
|
417
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
410
418
|
classNames: classNames,
|
|
411
419
|
style: style,
|
|
412
420
|
disabled: disabled,
|
|
@@ -418,13 +426,16 @@ function FieldTemplate(props) {
|
|
|
418
426
|
required: required,
|
|
419
427
|
schema: schema,
|
|
420
428
|
uiSchema: uiSchema,
|
|
421
|
-
registry: registry
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
429
|
+
registry: registry,
|
|
430
|
+
children: jsxRuntime.jsxs(react.FormControl, {
|
|
431
|
+
isRequired: required,
|
|
432
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
433
|
+
children: [children, displayLabel && rawDescription ? jsxRuntime.jsx(react.Text, {
|
|
434
|
+
mt: 2,
|
|
435
|
+
children: rawDescription
|
|
436
|
+
}) : null, errors, help]
|
|
437
|
+
})
|
|
438
|
+
});
|
|
428
439
|
}
|
|
429
440
|
|
|
430
441
|
function ObjectFieldTemplate(props) {
|
|
@@ -441,39 +452,43 @@ function ObjectFieldTemplate(props) {
|
|
|
441
452
|
onAddClick = props.onAddClick,
|
|
442
453
|
registry = props.registry;
|
|
443
454
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
444
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
445
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
455
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
456
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
446
457
|
// Button templates are not overridden in the uiSchema
|
|
447
458
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
448
|
-
return
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
459
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
460
|
+
children: [(uiOptions.title || title) && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
461
|
+
id: utils.titleId(idSchema),
|
|
462
|
+
title: uiOptions.title || title,
|
|
463
|
+
required: required,
|
|
464
|
+
schema: schema,
|
|
465
|
+
uiSchema: uiSchema,
|
|
466
|
+
registry: registry
|
|
467
|
+
}), (uiOptions.description || description) && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
468
|
+
id: utils.descriptionId(idSchema),
|
|
469
|
+
description: uiOptions.description || description,
|
|
470
|
+
schema: schema,
|
|
471
|
+
uiSchema: uiSchema,
|
|
472
|
+
registry: registry
|
|
473
|
+
}), jsxRuntime.jsxs(react.Grid, {
|
|
474
|
+
gap: description ? 2 : 6,
|
|
475
|
+
mb: 4,
|
|
476
|
+
children: [properties.map(function (element, index) {
|
|
477
|
+
return element.hidden ? element.content : jsxRuntime.jsx(react.GridItem, {
|
|
478
|
+
children: element.content
|
|
479
|
+
}, idSchema.$id + "-" + element.name + "-" + index);
|
|
480
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(react.GridItem, {
|
|
481
|
+
justifySelf: 'flex-end',
|
|
482
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
483
|
+
className: 'object-property-expand',
|
|
484
|
+
onClick: onAddClick(schema),
|
|
485
|
+
disabled: disabled || readonly,
|
|
486
|
+
uiSchema: uiSchema,
|
|
487
|
+
registry: registry
|
|
488
|
+
})
|
|
489
|
+
})]
|
|
490
|
+
})]
|
|
491
|
+
});
|
|
477
492
|
}
|
|
478
493
|
|
|
479
494
|
function SubmitButton(_ref) {
|
|
@@ -485,24 +500,29 @@ function SubmitButton(_ref) {
|
|
|
485
500
|
if (norender) {
|
|
486
501
|
return null;
|
|
487
502
|
}
|
|
488
|
-
return
|
|
489
|
-
marginTop: 3
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
503
|
+
return jsxRuntime.jsx(react.Box, {
|
|
504
|
+
marginTop: 3,
|
|
505
|
+
children: jsxRuntime.jsx(react.Button, _extends({
|
|
506
|
+
type: 'submit',
|
|
507
|
+
variant: 'solid'
|
|
508
|
+
}, submitButtonProps, {
|
|
509
|
+
children: submitText
|
|
510
|
+
}))
|
|
511
|
+
});
|
|
494
512
|
}
|
|
495
513
|
|
|
496
514
|
function TitleField(_ref) {
|
|
497
515
|
var id = _ref.id,
|
|
498
516
|
title = _ref.title;
|
|
499
|
-
return
|
|
517
|
+
return jsxRuntime.jsxs(react.Box, {
|
|
500
518
|
id: id,
|
|
501
519
|
mt: 1,
|
|
502
|
-
mb: 4
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
520
|
+
mb: 4,
|
|
521
|
+
children: [jsxRuntime.jsx(react.Heading, {
|
|
522
|
+
as: 'h5',
|
|
523
|
+
children: title
|
|
524
|
+
}), jsxRuntime.jsx(react.Divider, {})]
|
|
525
|
+
});
|
|
506
526
|
}
|
|
507
527
|
|
|
508
528
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -526,40 +546,49 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
526
546
|
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
527
547
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
528
548
|
if (!additional) {
|
|
529
|
-
return
|
|
549
|
+
return jsxRuntime.jsx("div", {
|
|
530
550
|
className: classNames,
|
|
531
|
-
style: style
|
|
532
|
-
|
|
551
|
+
style: style,
|
|
552
|
+
children: children
|
|
553
|
+
});
|
|
533
554
|
}
|
|
534
555
|
var handleBlur = function handleBlur(_ref) {
|
|
535
556
|
var target = _ref.target;
|
|
536
557
|
return onKeyChange(target.value);
|
|
537
558
|
};
|
|
538
|
-
return
|
|
539
|
-
key: id + "-key",
|
|
559
|
+
return jsxRuntime.jsxs(react.Grid, {
|
|
540
560
|
className: classNames,
|
|
541
561
|
style: style,
|
|
542
|
-
alignItems:
|
|
543
|
-
gap: 2
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
562
|
+
alignItems: 'center',
|
|
563
|
+
gap: 2,
|
|
564
|
+
children: [jsxRuntime.jsx(react.GridItem, {
|
|
565
|
+
children: jsxRuntime.jsxs(react.FormControl, {
|
|
566
|
+
isRequired: required,
|
|
567
|
+
children: [jsxRuntime.jsx(react.FormLabel, {
|
|
568
|
+
htmlFor: id + "-key",
|
|
569
|
+
id: id + "-key-label",
|
|
570
|
+
children: keyLabel
|
|
571
|
+
}), jsxRuntime.jsx(react.Input, {
|
|
572
|
+
defaultValue: label,
|
|
573
|
+
disabled: disabled || readonly,
|
|
574
|
+
id: id + "-key",
|
|
575
|
+
name: id + "-key",
|
|
576
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
577
|
+
type: 'text',
|
|
578
|
+
mb: 1
|
|
579
|
+
})]
|
|
580
|
+
})
|
|
581
|
+
}), jsxRuntime.jsx(react.GridItem, {
|
|
582
|
+
children: children
|
|
583
|
+
}), jsxRuntime.jsx(react.GridItem, {
|
|
584
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
585
|
+
disabled: disabled || readonly,
|
|
586
|
+
onClick: onDropPropertyClick(label),
|
|
587
|
+
uiSchema: uiSchema,
|
|
588
|
+
registry: registry
|
|
589
|
+
})
|
|
590
|
+
})]
|
|
591
|
+
}, id + "-key");
|
|
563
592
|
}
|
|
564
593
|
|
|
565
594
|
function generateTemplates() {
|
|
@@ -599,9 +628,9 @@ var rangeOptions = function rangeOptions(start, stop) {
|
|
|
599
628
|
function DateElement(props) {
|
|
600
629
|
var SelectWidget = props.registry.widgets.SelectWidget;
|
|
601
630
|
var value = props.value ? props.value : undefined;
|
|
602
|
-
return
|
|
603
|
-
label:
|
|
604
|
-
className:
|
|
631
|
+
return jsxRuntime.jsx(SelectWidget, _extends({}, props, {
|
|
632
|
+
label: '',
|
|
633
|
+
className: 'form-control',
|
|
605
634
|
onChange: function onChange(elemValue) {
|
|
606
635
|
return props.select(props.type, elemValue);
|
|
607
636
|
},
|
|
@@ -610,7 +639,7 @@ function DateElement(props) {
|
|
|
610
639
|
},
|
|
611
640
|
placeholder: props.type,
|
|
612
641
|
schema: {
|
|
613
|
-
type:
|
|
642
|
+
type: 'integer'
|
|
614
643
|
},
|
|
615
644
|
value: value,
|
|
616
645
|
"aria-describedby": utils.ariaDescribedByIds(props.name)
|
|
@@ -618,7 +647,7 @@ function DateElement(props) {
|
|
|
618
647
|
}
|
|
619
648
|
var readyForChange = function readyForChange(state) {
|
|
620
649
|
return Object.keys(state).every(function (key) {
|
|
621
|
-
return typeof state[key] !==
|
|
650
|
+
return typeof state[key] !== 'undefined' && state[key] !== -1;
|
|
622
651
|
});
|
|
623
652
|
};
|
|
624
653
|
function AltDateWidget(props) {
|
|
@@ -634,15 +663,15 @@ function AltDateWidget(props) {
|
|
|
634
663
|
showTime = props.showTime,
|
|
635
664
|
value = props.value;
|
|
636
665
|
var translateString = registry.translateString;
|
|
637
|
-
var _useState =
|
|
666
|
+
var _useState = react$1.useState(utils.parseDateString(value, showTime)),
|
|
638
667
|
state = _useState[0],
|
|
639
668
|
setState = _useState[1];
|
|
640
|
-
|
|
669
|
+
react$1.useEffect(function () {
|
|
641
670
|
setState(utils.parseDateString(value, showTime));
|
|
642
671
|
}, [showTime, value]);
|
|
643
672
|
var handleChange = function handleChange(property, nextValue) {
|
|
644
673
|
var _extends2;
|
|
645
|
-
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue ===
|
|
674
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
|
|
646
675
|
if (readyForChange(nextState)) {
|
|
647
676
|
onChange(utils.toDateString(nextState, showTime));
|
|
648
677
|
} else {
|
|
@@ -672,70 +701,76 @@ function AltDateWidget(props) {
|
|
|
672
701
|
minute = state.minute,
|
|
673
702
|
second = state.second;
|
|
674
703
|
var data = [{
|
|
675
|
-
type:
|
|
704
|
+
type: 'year',
|
|
676
705
|
range: options.yearsRange,
|
|
677
706
|
value: year
|
|
678
707
|
}, {
|
|
679
|
-
type:
|
|
708
|
+
type: 'month',
|
|
680
709
|
range: [1, 12],
|
|
681
710
|
value: month
|
|
682
711
|
}, {
|
|
683
|
-
type:
|
|
712
|
+
type: 'day',
|
|
684
713
|
range: [1, 31],
|
|
685
714
|
value: day
|
|
686
715
|
}];
|
|
687
716
|
if (showTime) {
|
|
688
717
|
data.push({
|
|
689
|
-
type:
|
|
718
|
+
type: 'hour',
|
|
690
719
|
range: [0, 23],
|
|
691
720
|
value: hour
|
|
692
721
|
}, {
|
|
693
|
-
type:
|
|
722
|
+
type: 'minute',
|
|
694
723
|
range: [0, 59],
|
|
695
724
|
value: minute
|
|
696
725
|
}, {
|
|
697
|
-
type:
|
|
726
|
+
type: 'second',
|
|
698
727
|
range: [0, 59],
|
|
699
728
|
value: second
|
|
700
729
|
});
|
|
701
730
|
}
|
|
702
731
|
return data;
|
|
703
732
|
};
|
|
704
|
-
return
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
733
|
+
return jsxRuntime.jsxs(react.Box, {
|
|
734
|
+
children: [jsxRuntime.jsx(react.Box, {
|
|
735
|
+
display: 'flex',
|
|
736
|
+
flexWrap: 'wrap',
|
|
737
|
+
alignItems: 'center',
|
|
738
|
+
justify: 'center',
|
|
739
|
+
children: dateElementProps().map(function (elemProps, i) {
|
|
740
|
+
var elemId = id + '_' + elemProps.type;
|
|
741
|
+
return jsxRuntime.jsx(react.Box, {
|
|
742
|
+
mr: '2',
|
|
743
|
+
mb: '2',
|
|
744
|
+
children: jsxRuntime.jsx(DateElement, _extends({}, props, elemProps, {
|
|
745
|
+
autofocus: autofocus && i === 0,
|
|
746
|
+
disabled: disabled,
|
|
747
|
+
id: elemId,
|
|
748
|
+
name: id,
|
|
749
|
+
onBlur: onBlur,
|
|
750
|
+
onFocus: onFocus,
|
|
751
|
+
readonly: readonly,
|
|
752
|
+
registry: registry,
|
|
753
|
+
select: handleChange,
|
|
754
|
+
value: elemProps.value < 0 ? '' : elemProps.value
|
|
755
|
+
}))
|
|
756
|
+
}, elemId);
|
|
757
|
+
})
|
|
758
|
+
}), jsxRuntime.jsxs(react.Box, {
|
|
759
|
+
display: 'flex',
|
|
760
|
+
children: [!options.hideNowButton && jsxRuntime.jsx(react.Button, {
|
|
761
|
+
onClick: function onClick(e) {
|
|
762
|
+
return handleNow(e);
|
|
763
|
+
},
|
|
764
|
+
mr: '2',
|
|
765
|
+
children: translateString(utils.TranslatableString.NowLabel)
|
|
766
|
+
}), !options.hideClearButton && jsxRuntime.jsx(react.Button, {
|
|
767
|
+
onClick: function onClick(e) {
|
|
768
|
+
return handleClear(e);
|
|
769
|
+
},
|
|
770
|
+
children: translateString(utils.TranslatableString.ClearLabel)
|
|
771
|
+
})]
|
|
772
|
+
})]
|
|
773
|
+
});
|
|
739
774
|
}
|
|
740
775
|
AltDateWidget.defaultProps = {
|
|
741
776
|
autofocus: false,
|
|
@@ -749,7 +784,7 @@ AltDateWidget.defaultProps = {
|
|
|
749
784
|
|
|
750
785
|
function AltDateTimeWidget(props) {
|
|
751
786
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
752
|
-
return
|
|
787
|
+
return jsxRuntime.jsx(AltDateWidget, _extends({}, props, {
|
|
753
788
|
showTime: true
|
|
754
789
|
}));
|
|
755
790
|
}
|
|
@@ -787,20 +822,24 @@ function CheckboxWidget(props) {
|
|
|
787
822
|
var value = _ref3.target.value;
|
|
788
823
|
return onFocus(id, value);
|
|
789
824
|
};
|
|
790
|
-
return
|
|
825
|
+
return jsxRuntime.jsx(react.FormControl, _extends({
|
|
791
826
|
mb: 1
|
|
792
827
|
}, chakraProps, {
|
|
793
|
-
isRequired: required
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
828
|
+
isRequired: required,
|
|
829
|
+
children: jsxRuntime.jsx(react.Checkbox, {
|
|
830
|
+
id: id,
|
|
831
|
+
name: id,
|
|
832
|
+
isChecked: typeof value === 'undefined' ? false : value,
|
|
833
|
+
isDisabled: disabled || readonly,
|
|
834
|
+
onChange: _onChange,
|
|
835
|
+
onBlur: _onBlur,
|
|
836
|
+
onFocus: _onFocus,
|
|
837
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
838
|
+
children: label && jsxRuntime.jsx(react.Text, {
|
|
839
|
+
children: label
|
|
840
|
+
})
|
|
841
|
+
})
|
|
842
|
+
}));
|
|
804
843
|
}
|
|
805
844
|
|
|
806
845
|
function CheckboxesWidget(props) {
|
|
@@ -835,38 +874,44 @@ function CheckboxesWidget(props) {
|
|
|
835
874
|
};
|
|
836
875
|
var row = options ? options.inline : false;
|
|
837
876
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
|
|
838
|
-
return
|
|
877
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
839
878
|
mb: 1
|
|
840
879
|
}, chakraProps, {
|
|
841
880
|
isDisabled: disabled || readonly,
|
|
842
881
|
isRequired: required,
|
|
843
882
|
isReadOnly: readonly,
|
|
844
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
883
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
884
|
+
children: [jsxRuntime.jsx(react.FormLabel, {
|
|
885
|
+
htmlFor: id,
|
|
886
|
+
id: id + "-label",
|
|
887
|
+
children: label || schema.title
|
|
888
|
+
}), jsxRuntime.jsx(react.CheckboxGroup, {
|
|
889
|
+
onChange: function onChange(option) {
|
|
890
|
+
return _onChange(utils.enumOptionsValueForIndex(option, enumOptions, emptyValue));
|
|
891
|
+
},
|
|
892
|
+
defaultValue: selectedIndexes,
|
|
893
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
894
|
+
children: jsxRuntime.jsx(react.Stack, {
|
|
895
|
+
direction: row ? 'row' : 'column',
|
|
896
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
897
|
+
var checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
898
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
899
|
+
return jsxRuntime.jsx(react.Checkbox, {
|
|
900
|
+
id: utils.optionId(id, index),
|
|
901
|
+
name: id,
|
|
902
|
+
value: String(index),
|
|
903
|
+
isChecked: checked,
|
|
904
|
+
isDisabled: disabled || itemDisabled || readonly,
|
|
905
|
+
onBlur: _onBlur,
|
|
906
|
+
onFocus: _onFocus,
|
|
907
|
+
children: option.label && jsxRuntime.jsx(react.Text, {
|
|
908
|
+
children: option.label
|
|
909
|
+
})
|
|
910
|
+
}, index);
|
|
911
|
+
})
|
|
912
|
+
})
|
|
913
|
+
})]
|
|
914
|
+
}));
|
|
870
915
|
}
|
|
871
916
|
|
|
872
917
|
function RadioWidget(_ref) {
|
|
@@ -901,33 +946,37 @@ function RadioWidget(_ref) {
|
|
|
901
946
|
};
|
|
902
947
|
var row = options ? options.inline : false;
|
|
903
948
|
var selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
904
|
-
return
|
|
949
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
905
950
|
mb: 1
|
|
906
951
|
}, chakraProps, {
|
|
907
952
|
isDisabled: disabled || readonly,
|
|
908
953
|
isRequired: required,
|
|
909
|
-
isReadOnly: readonly
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
954
|
+
isReadOnly: readonly,
|
|
955
|
+
children: [jsxRuntime.jsx(react.FormLabel, {
|
|
956
|
+
htmlFor: id,
|
|
957
|
+
id: id + "-label",
|
|
958
|
+
children: label || schema.title
|
|
959
|
+
}), jsxRuntime.jsx(react.RadioGroup, {
|
|
960
|
+
onChange: _onChange,
|
|
961
|
+
onBlur: _onBlur,
|
|
962
|
+
onFocus: _onFocus,
|
|
963
|
+
value: selectedIndex,
|
|
964
|
+
name: id,
|
|
965
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
966
|
+
children: jsxRuntime.jsx(react.Stack, {
|
|
967
|
+
direction: row ? 'row' : 'column',
|
|
968
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
969
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
970
|
+
return jsxRuntime.jsx(react.Radio, {
|
|
971
|
+
value: String(index),
|
|
972
|
+
id: utils.optionId(id, index),
|
|
973
|
+
disabled: disabled || itemDisabled || readonly,
|
|
974
|
+
children: option.label
|
|
975
|
+
}, index);
|
|
976
|
+
})
|
|
977
|
+
})
|
|
978
|
+
})]
|
|
979
|
+
}));
|
|
931
980
|
}
|
|
932
981
|
|
|
933
982
|
function RangeWidget(_ref) {
|
|
@@ -964,19 +1013,25 @@ function RangeWidget(_ref) {
|
|
|
964
1013
|
var value = _ref3.target.value;
|
|
965
1014
|
return onFocus(id, value);
|
|
966
1015
|
};
|
|
967
|
-
return
|
|
1016
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
968
1017
|
mb: 1
|
|
969
|
-
}, chakraProps
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1018
|
+
}, chakraProps, {
|
|
1019
|
+
children: [displayLabel ? jsxRuntime.jsx(react.FormLabel, {
|
|
1020
|
+
htmlFor: id,
|
|
1021
|
+
children: label || schema.title
|
|
1022
|
+
}) : null, jsxRuntime.jsxs(react.Slider, _extends({}, sliderWidgetProps, {
|
|
1023
|
+
id: id,
|
|
1024
|
+
name: id,
|
|
1025
|
+
isDisabled: disabled || readonly,
|
|
1026
|
+
onChange: _onChange,
|
|
1027
|
+
onBlur: _onBlur,
|
|
1028
|
+
onFocus: _onFocus,
|
|
1029
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1030
|
+
children: [jsxRuntime.jsx(react.SliderTrack, {
|
|
1031
|
+
children: jsxRuntime.jsx(react.SliderFilledTrack, {})
|
|
1032
|
+
}), jsxRuntime.jsx(react.SliderThumb, {})]
|
|
1033
|
+
}))]
|
|
1034
|
+
}));
|
|
980
1035
|
}
|
|
981
1036
|
|
|
982
1037
|
function SelectWidget(props) {
|
|
@@ -1030,7 +1085,7 @@ function SelectWidget(props) {
|
|
|
1030
1085
|
isDisabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1
|
|
1031
1086
|
};
|
|
1032
1087
|
}) : [];
|
|
1033
|
-
var isMultiple = typeof multiple !==
|
|
1088
|
+
var isMultiple = typeof multiple !== 'undefined' && Boolean(enumOptions);
|
|
1034
1089
|
var selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions, isMultiple);
|
|
1035
1090
|
var formValue = isMultiple ? (selectedIndex || []).map(function (i) {
|
|
1036
1091
|
return {
|
|
@@ -1038,31 +1093,33 @@ function SelectWidget(props) {
|
|
|
1038
1093
|
value: i
|
|
1039
1094
|
};
|
|
1040
1095
|
}) : {
|
|
1041
|
-
label: _valueLabelMap[selectedIndex] ||
|
|
1096
|
+
label: _valueLabelMap[selectedIndex] || '',
|
|
1042
1097
|
selectedIndex: selectedIndex
|
|
1043
1098
|
};
|
|
1044
|
-
return
|
|
1099
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
1045
1100
|
mb: 1
|
|
1046
1101
|
}, chakraProps, {
|
|
1047
1102
|
isDisabled: disabled || readonly,
|
|
1048
1103
|
isRequired: required,
|
|
1049
1104
|
isReadOnly: readonly,
|
|
1050
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1105
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1106
|
+
children: [(label || schema.title) && jsxRuntime.jsx(react.FormLabel, {
|
|
1107
|
+
htmlFor: isMultiple ? undefined : id,
|
|
1108
|
+
children: label || schema.title
|
|
1109
|
+
}), jsxRuntime.jsx(chakraReactSelect.Select, {
|
|
1110
|
+
inputId: id,
|
|
1111
|
+
name: id,
|
|
1112
|
+
isMulti: isMultiple,
|
|
1113
|
+
options: displayEnumOptions,
|
|
1114
|
+
placeholder: placeholder,
|
|
1115
|
+
closeMenuOnSelect: !isMultiple,
|
|
1116
|
+
onBlur: _onBlur,
|
|
1117
|
+
onChange: isMultiple ? _onMultiChange : _onChange,
|
|
1118
|
+
onFocus: _onFocus,
|
|
1119
|
+
autoFocus: autofocus,
|
|
1120
|
+
value: formValue,
|
|
1121
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1122
|
+
})]
|
|
1066
1123
|
}));
|
|
1067
1124
|
}
|
|
1068
1125
|
|
|
@@ -1090,7 +1147,7 @@ function TextareaWidget(_ref) {
|
|
|
1090
1147
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1091
1148
|
var _onChange = function _onChange(_ref2) {
|
|
1092
1149
|
var value = _ref2.target.value;
|
|
1093
|
-
return onChange(value ===
|
|
1150
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
1094
1151
|
};
|
|
1095
1152
|
var _onBlur = function _onBlur(_ref3) {
|
|
1096
1153
|
var value = _ref3.target.value;
|
|
@@ -1100,25 +1157,27 @@ function TextareaWidget(_ref) {
|
|
|
1100
1157
|
var value = _ref4.target.value;
|
|
1101
1158
|
return onFocus(id, value);
|
|
1102
1159
|
};
|
|
1103
|
-
return
|
|
1160
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
1104
1161
|
mb: 1
|
|
1105
1162
|
}, chakraProps, {
|
|
1106
1163
|
isDisabled: disabled || readonly,
|
|
1107
1164
|
isRequired: required,
|
|
1108
1165
|
isReadOnly: readonly,
|
|
1109
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1166
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1167
|
+
children: [displayLabel ? jsxRuntime.jsx(react.FormLabel, {
|
|
1168
|
+
htmlFor: id,
|
|
1169
|
+
children: label || schema.title
|
|
1170
|
+
}) : null, jsxRuntime.jsx(react.Textarea, {
|
|
1171
|
+
id: id,
|
|
1172
|
+
name: id,
|
|
1173
|
+
value: value != null ? value : '',
|
|
1174
|
+
placeholder: placeholder,
|
|
1175
|
+
autoFocus: autofocus,
|
|
1176
|
+
onChange: _onChange,
|
|
1177
|
+
onBlur: _onBlur,
|
|
1178
|
+
onFocus: _onFocus,
|
|
1179
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1180
|
+
})]
|
|
1122
1181
|
}));
|
|
1123
1182
|
}
|
|
1124
1183
|
|
|
@@ -1152,25 +1211,30 @@ function UpDownWidget(props) {
|
|
|
1152
1211
|
var value = _ref2.target.value;
|
|
1153
1212
|
return onFocus(id, value);
|
|
1154
1213
|
};
|
|
1155
|
-
return
|
|
1214
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
1156
1215
|
mb: 1
|
|
1157
1216
|
}, chakraProps, {
|
|
1158
1217
|
isDisabled: disabled || readonly,
|
|
1159
1218
|
isRequired: required,
|
|
1160
1219
|
isReadOnly: readonly,
|
|
1161
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1220
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1221
|
+
children: [displayLabel ? jsxRuntime.jsx(react.FormLabel, {
|
|
1222
|
+
htmlFor: id,
|
|
1223
|
+
children: label || schema.title
|
|
1224
|
+
}) : null, jsxRuntime.jsxs(react.NumberInput, {
|
|
1225
|
+
value: value != null ? value : '',
|
|
1226
|
+
onChange: _onChange,
|
|
1227
|
+
onBlur: _onBlur,
|
|
1228
|
+
onFocus: _onFocus,
|
|
1229
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1230
|
+
children: [jsxRuntime.jsx(react.NumberInputField, {
|
|
1231
|
+
id: id,
|
|
1232
|
+
name: id
|
|
1233
|
+
}), jsxRuntime.jsxs(react.NumberInputStepper, {
|
|
1234
|
+
children: [jsxRuntime.jsx(react.NumberIncrementStepper, {}), jsxRuntime.jsx(react.NumberDecrementStepper, {})]
|
|
1235
|
+
})]
|
|
1236
|
+
})]
|
|
1237
|
+
}));
|
|
1174
1238
|
}
|
|
1175
1239
|
|
|
1176
1240
|
function generateWidgets() {
|
|
@@ -1223,7 +1287,7 @@ var Form = /*#__PURE__*/generateForm();
|
|
|
1223
1287
|
It is located at the bottom of the styles string.
|
|
1224
1288
|
*/
|
|
1225
1289
|
var CSSReset = function CSSReset() {
|
|
1226
|
-
return
|
|
1290
|
+
return jsxRuntime.jsx(react$2.Global, {
|
|
1227
1291
|
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 "
|
|
1228
1292
|
});
|
|
1229
1293
|
};
|
|
@@ -1245,22 +1309,25 @@ var CSSReset = function CSSReset() {
|
|
|
1245
1309
|
var memoizedCreateCacheWithContainer = /*#__PURE__*/weakMemoize__default["default"](function (container) {
|
|
1246
1310
|
var newCache = createCache__default["default"]({
|
|
1247
1311
|
container: container,
|
|
1248
|
-
key:
|
|
1312
|
+
key: 'rjsf'
|
|
1249
1313
|
});
|
|
1250
1314
|
return newCache;
|
|
1251
1315
|
});
|
|
1252
1316
|
var __createChakraFrameProvider = function __createChakraFrameProvider(props) {
|
|
1253
1317
|
return function (_ref) {
|
|
1254
1318
|
var document = _ref.document;
|
|
1255
|
-
return
|
|
1319
|
+
return jsxRuntime.jsx("div", {
|
|
1256
1320
|
style: {
|
|
1257
1321
|
margin: 2
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1322
|
+
},
|
|
1323
|
+
children: jsxRuntime.jsx(react$2.CacheProvider, {
|
|
1324
|
+
value: memoizedCreateCacheWithContainer(document.head),
|
|
1325
|
+
children: jsxRuntime.jsxs(react.ChakraProvider, {
|
|
1326
|
+
resetCSS: false,
|
|
1327
|
+
children: [jsxRuntime.jsx(CSSReset, {}), props.children]
|
|
1328
|
+
})
|
|
1329
|
+
})
|
|
1330
|
+
});
|
|
1264
1331
|
};
|
|
1265
1332
|
};
|
|
1266
1333
|
|