@rjsf/chakra-ui 5.1.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 +497 -420
- 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 -395
- package/dist/chakra-ui.esm.js.map +1 -1
- package/dist/chakra-ui.umd.development.js +497 -421
- 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
|
+
var utils = require('@rjsf/utils');
|
|
7
8
|
var react = require('@chakra-ui/react');
|
|
8
9
|
var icons = require('@chakra-ui/icons');
|
|
9
|
-
var
|
|
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
|
|
|
@@ -66,10 +47,14 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
66
47
|
|
|
67
48
|
var _excluded$2 = ["uiSchema", "registry"];
|
|
68
49
|
function AddButton(_ref) {
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
50
|
+
var registry = _ref.registry,
|
|
51
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
52
|
+
var translateString = registry.translateString;
|
|
53
|
+
return jsxRuntime.jsx(react.Button, _extends({
|
|
54
|
+
leftIcon: jsxRuntime.jsx(icons.AddIcon, {})
|
|
55
|
+
}, props, {
|
|
56
|
+
children: translateString(utils.TranslatableString.AddItemButton)
|
|
57
|
+
}));
|
|
73
58
|
}
|
|
74
59
|
|
|
75
60
|
function ArrayFieldItemTemplate(props) {
|
|
@@ -89,39 +74,44 @@ function ArrayFieldItemTemplate(props) {
|
|
|
89
74
|
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
90
75
|
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
91
76
|
RemoveButton = _registry$templates$B.RemoveButton;
|
|
92
|
-
var onRemoveClick =
|
|
77
|
+
var onRemoveClick = react$1.useMemo(function () {
|
|
93
78
|
return onDropIndexClick(index);
|
|
94
79
|
}, [index, onDropIndexClick]);
|
|
95
|
-
var onArrowUpClick =
|
|
80
|
+
var onArrowUpClick = react$1.useMemo(function () {
|
|
96
81
|
return onReorderClick(index, index - 1);
|
|
97
82
|
}, [index, onReorderClick]);
|
|
98
|
-
var onArrowDownClick =
|
|
83
|
+
var onArrowDownClick = react$1.useMemo(function () {
|
|
99
84
|
return onReorderClick(index, index + 1);
|
|
100
85
|
}, [index, onReorderClick]);
|
|
101
|
-
return
|
|
102
|
-
alignItems:
|
|
103
|
-
py: 1
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
+
});
|
|
125
115
|
}
|
|
126
116
|
|
|
127
117
|
var _excluded$1 = ["key"];
|
|
@@ -138,49 +128,53 @@ function ArrayFieldTemplate(props) {
|
|
|
138
128
|
schema = props.schema,
|
|
139
129
|
title = props.title;
|
|
140
130
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
141
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
142
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
143
|
-
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);
|
|
144
134
|
// Button templates are not overridden in the uiSchema
|
|
145
135
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
146
|
-
return
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
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
|
+
});
|
|
178
172
|
}
|
|
179
173
|
|
|
180
174
|
function getChakra(_ref) {
|
|
181
175
|
var _ref$uiSchema = _ref.uiSchema,
|
|
182
176
|
uiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema;
|
|
183
|
-
var chakraProps = uiSchema[
|
|
177
|
+
var chakraProps = uiSchema['ui:options'] && uiSchema['ui:options'].chakra || {};
|
|
184
178
|
Object.keys(chakraProps).forEach(function (key) {
|
|
185
179
|
/**
|
|
186
180
|
* Leveraging `shouldForwardProp` to remove props
|
|
@@ -204,6 +198,7 @@ function BaseInputTemplate(props) {
|
|
|
204
198
|
schema = props.schema,
|
|
205
199
|
uiSchema = props.uiSchema,
|
|
206
200
|
onChange = props.onChange,
|
|
201
|
+
onChangeOverride = props.onChangeOverride,
|
|
207
202
|
onBlur = props.onBlur,
|
|
208
203
|
onFocus = props.onFocus,
|
|
209
204
|
options = props.options,
|
|
@@ -221,7 +216,7 @@ function BaseInputTemplate(props) {
|
|
|
221
216
|
var schemaUtils = registry.schemaUtils;
|
|
222
217
|
var _onChange = function _onChange(_ref) {
|
|
223
218
|
var value = _ref.target.value;
|
|
224
|
-
return onChange(value ===
|
|
219
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
225
220
|
};
|
|
226
221
|
var _onBlur = function _onBlur(_ref2) {
|
|
227
222
|
var value = _ref2.target.value;
|
|
@@ -232,36 +227,38 @@ function BaseInputTemplate(props) {
|
|
|
232
227
|
return onFocus(id, value);
|
|
233
228
|
};
|
|
234
229
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
235
|
-
return
|
|
230
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
236
231
|
mb: 1
|
|
237
232
|
}, chakraProps, {
|
|
238
233
|
isDisabled: disabled || readonly,
|
|
239
234
|
isRequired: required,
|
|
240
235
|
isReadOnly: readonly,
|
|
241
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
+
}));
|
|
265
262
|
}
|
|
266
263
|
|
|
267
264
|
function DescriptionField(_ref) {
|
|
@@ -270,65 +267,78 @@ function DescriptionField(_ref) {
|
|
|
270
267
|
if (!description) {
|
|
271
268
|
return null;
|
|
272
269
|
}
|
|
273
|
-
if (typeof description ===
|
|
274
|
-
return
|
|
270
|
+
if (typeof description === 'string') {
|
|
271
|
+
return jsxRuntime.jsx(react.Text, {
|
|
275
272
|
id: id,
|
|
276
273
|
mt: 2,
|
|
277
|
-
mb: 4
|
|
278
|
-
|
|
274
|
+
mb: 4,
|
|
275
|
+
children: description
|
|
276
|
+
});
|
|
279
277
|
}
|
|
280
|
-
return
|
|
278
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
279
|
+
children: description
|
|
280
|
+
});
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
function ErrorList(_ref) {
|
|
284
|
-
var errors = _ref.errors
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
284
|
+
var errors = _ref.errors,
|
|
285
|
+
registry = _ref.registry;
|
|
286
|
+
var translateString = registry.translateString;
|
|
287
|
+
return jsxRuntime.jsxs(react.Alert, {
|
|
288
|
+
flexDirection: 'column',
|
|
289
|
+
alignItems: 'flex-start',
|
|
288
290
|
gap: 3,
|
|
289
|
-
status:
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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
|
+
});
|
|
298
305
|
}
|
|
299
306
|
|
|
300
307
|
var _excluded = ["icon", "iconType", "uiSchema", "registry"];
|
|
301
308
|
function ChakraIconButton(props) {
|
|
302
309
|
var icon = props.icon,
|
|
303
310
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
304
|
-
return
|
|
311
|
+
return jsxRuntime.jsx(react.IconButton, _extends({
|
|
305
312
|
"aria-label": props.title
|
|
306
313
|
}, otherProps, {
|
|
307
314
|
icon: icon
|
|
308
315
|
}));
|
|
309
316
|
}
|
|
310
|
-
ChakraIconButton.displayName =
|
|
311
|
-
var ChakraIconButton$1 = /*#__PURE__*/
|
|
317
|
+
ChakraIconButton.displayName = 'ChakraIconButton';
|
|
318
|
+
var ChakraIconButton$1 = /*#__PURE__*/react$1.memo(ChakraIconButton);
|
|
312
319
|
|
|
313
320
|
function MoveDownButton(props) {
|
|
314
|
-
|
|
315
|
-
|
|
321
|
+
var translateString = props.registry.translateString;
|
|
322
|
+
return jsxRuntime.jsx(ChakraIconButton$1, _extends({
|
|
323
|
+
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
316
324
|
}, props, {
|
|
317
|
-
icon:
|
|
325
|
+
icon: jsxRuntime.jsx(icons.ArrowDownIcon, {})
|
|
318
326
|
}));
|
|
319
327
|
}
|
|
320
328
|
function MoveUpButton(props) {
|
|
321
|
-
|
|
322
|
-
|
|
329
|
+
var translateString = props.registry.translateString;
|
|
330
|
+
return jsxRuntime.jsx(ChakraIconButton$1, _extends({
|
|
331
|
+
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
323
332
|
}, props, {
|
|
324
|
-
icon:
|
|
333
|
+
icon: jsxRuntime.jsx(icons.ArrowUpIcon, {})
|
|
325
334
|
}));
|
|
326
335
|
}
|
|
327
336
|
function RemoveButton(props) {
|
|
328
|
-
|
|
329
|
-
|
|
337
|
+
var translateString = props.registry.translateString;
|
|
338
|
+
return jsxRuntime.jsx(ChakraIconButton$1, _extends({
|
|
339
|
+
title: translateString(utils.TranslatableString.RemoveButton)
|
|
330
340
|
}, props, {
|
|
331
|
-
icon:
|
|
341
|
+
icon: jsxRuntime.jsx(icons.DeleteIcon, {})
|
|
332
342
|
}));
|
|
333
343
|
}
|
|
334
344
|
|
|
@@ -344,13 +354,16 @@ function FieldErrorTemplate(props) {
|
|
|
344
354
|
return null;
|
|
345
355
|
}
|
|
346
356
|
var id = utils.errorId(idSchema);
|
|
347
|
-
return
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
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
|
+
});
|
|
354
367
|
}
|
|
355
368
|
|
|
356
369
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -364,9 +377,10 @@ function FieldHelpTemplate(props) {
|
|
|
364
377
|
return null;
|
|
365
378
|
}
|
|
366
379
|
var id = utils.helpId(idSchema);
|
|
367
|
-
return
|
|
368
|
-
id: id
|
|
369
|
-
|
|
380
|
+
return jsxRuntime.jsx(react.FormHelperText, {
|
|
381
|
+
id: id,
|
|
382
|
+
children: help
|
|
383
|
+
});
|
|
370
384
|
}
|
|
371
385
|
|
|
372
386
|
function FieldTemplate(props) {
|
|
@@ -391,15 +405,16 @@ function FieldTemplate(props) {
|
|
|
391
405
|
schema = props.schema,
|
|
392
406
|
uiSchema = props.uiSchema;
|
|
393
407
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
394
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
408
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
395
409
|
if (hidden) {
|
|
396
|
-
return
|
|
410
|
+
return jsxRuntime.jsx("div", {
|
|
397
411
|
style: {
|
|
398
|
-
display:
|
|
399
|
-
}
|
|
400
|
-
|
|
412
|
+
display: 'none'
|
|
413
|
+
},
|
|
414
|
+
children: children
|
|
415
|
+
});
|
|
401
416
|
}
|
|
402
|
-
return
|
|
417
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
403
418
|
classNames: classNames,
|
|
404
419
|
style: style,
|
|
405
420
|
disabled: disabled,
|
|
@@ -411,13 +426,16 @@ function FieldTemplate(props) {
|
|
|
411
426
|
required: required,
|
|
412
427
|
schema: schema,
|
|
413
428
|
uiSchema: uiSchema,
|
|
414
|
-
registry: registry
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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
|
+
});
|
|
421
439
|
}
|
|
422
440
|
|
|
423
441
|
function ObjectFieldTemplate(props) {
|
|
@@ -434,39 +452,43 @@ function ObjectFieldTemplate(props) {
|
|
|
434
452
|
onAddClick = props.onAddClick,
|
|
435
453
|
registry = props.registry;
|
|
436
454
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
437
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
438
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
455
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
456
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
439
457
|
// Button templates are not overridden in the uiSchema
|
|
440
458
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
441
|
-
return
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
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
|
+
});
|
|
470
492
|
}
|
|
471
493
|
|
|
472
494
|
function SubmitButton(_ref) {
|
|
@@ -478,24 +500,29 @@ function SubmitButton(_ref) {
|
|
|
478
500
|
if (norender) {
|
|
479
501
|
return null;
|
|
480
502
|
}
|
|
481
|
-
return
|
|
482
|
-
marginTop: 3
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
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
|
+
});
|
|
487
512
|
}
|
|
488
513
|
|
|
489
514
|
function TitleField(_ref) {
|
|
490
515
|
var id = _ref.id,
|
|
491
516
|
title = _ref.title;
|
|
492
|
-
return
|
|
517
|
+
return jsxRuntime.jsxs(react.Box, {
|
|
493
518
|
id: id,
|
|
494
519
|
mt: 1,
|
|
495
|
-
mb: 4
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
520
|
+
mb: 4,
|
|
521
|
+
children: [jsxRuntime.jsx(react.Heading, {
|
|
522
|
+
as: 'h5',
|
|
523
|
+
children: title
|
|
524
|
+
}), jsxRuntime.jsx(react.Divider, {})]
|
|
525
|
+
});
|
|
499
526
|
}
|
|
500
527
|
|
|
501
528
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -512,45 +539,56 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
512
539
|
required = props.required,
|
|
513
540
|
schema = props.schema,
|
|
514
541
|
uiSchema = props.uiSchema;
|
|
542
|
+
var templates = registry.templates,
|
|
543
|
+
translateString = registry.translateString;
|
|
515
544
|
// Button templates are not overridden in the uiSchema
|
|
516
|
-
var RemoveButton =
|
|
545
|
+
var RemoveButton = templates.ButtonTemplates.RemoveButton;
|
|
546
|
+
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
517
547
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
518
548
|
if (!additional) {
|
|
519
|
-
return
|
|
549
|
+
return jsxRuntime.jsx("div", {
|
|
520
550
|
className: classNames,
|
|
521
|
-
style: style
|
|
522
|
-
|
|
551
|
+
style: style,
|
|
552
|
+
children: children
|
|
553
|
+
});
|
|
523
554
|
}
|
|
524
|
-
var keyLabel = label + " Key";
|
|
525
555
|
var handleBlur = function handleBlur(_ref) {
|
|
526
556
|
var target = _ref.target;
|
|
527
557
|
return onKeyChange(target.value);
|
|
528
558
|
};
|
|
529
|
-
return
|
|
530
|
-
key: id + "-key",
|
|
559
|
+
return jsxRuntime.jsxs(react.Grid, {
|
|
531
560
|
className: classNames,
|
|
532
561
|
style: style,
|
|
533
|
-
alignItems:
|
|
534
|
-
gap: 2
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
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");
|
|
554
592
|
}
|
|
555
593
|
|
|
556
594
|
function generateTemplates() {
|
|
@@ -590,9 +628,9 @@ var rangeOptions = function rangeOptions(start, stop) {
|
|
|
590
628
|
function DateElement(props) {
|
|
591
629
|
var SelectWidget = props.registry.widgets.SelectWidget;
|
|
592
630
|
var value = props.value ? props.value : undefined;
|
|
593
|
-
return
|
|
594
|
-
label:
|
|
595
|
-
className:
|
|
631
|
+
return jsxRuntime.jsx(SelectWidget, _extends({}, props, {
|
|
632
|
+
label: '',
|
|
633
|
+
className: 'form-control',
|
|
596
634
|
onChange: function onChange(elemValue) {
|
|
597
635
|
return props.select(props.type, elemValue);
|
|
598
636
|
},
|
|
@@ -601,7 +639,7 @@ function DateElement(props) {
|
|
|
601
639
|
},
|
|
602
640
|
placeholder: props.type,
|
|
603
641
|
schema: {
|
|
604
|
-
type:
|
|
642
|
+
type: 'integer'
|
|
605
643
|
},
|
|
606
644
|
value: value,
|
|
607
645
|
"aria-describedby": utils.ariaDescribedByIds(props.name)
|
|
@@ -609,7 +647,7 @@ function DateElement(props) {
|
|
|
609
647
|
}
|
|
610
648
|
var readyForChange = function readyForChange(state) {
|
|
611
649
|
return Object.keys(state).every(function (key) {
|
|
612
|
-
return typeof state[key] !==
|
|
650
|
+
return typeof state[key] !== 'undefined' && state[key] !== -1;
|
|
613
651
|
});
|
|
614
652
|
};
|
|
615
653
|
function AltDateWidget(props) {
|
|
@@ -624,15 +662,16 @@ function AltDateWidget(props) {
|
|
|
624
662
|
registry = props.registry,
|
|
625
663
|
showTime = props.showTime,
|
|
626
664
|
value = props.value;
|
|
627
|
-
var
|
|
665
|
+
var translateString = registry.translateString;
|
|
666
|
+
var _useState = react$1.useState(utils.parseDateString(value, showTime)),
|
|
628
667
|
state = _useState[0],
|
|
629
668
|
setState = _useState[1];
|
|
630
|
-
|
|
669
|
+
react$1.useEffect(function () {
|
|
631
670
|
setState(utils.parseDateString(value, showTime));
|
|
632
671
|
}, [showTime, value]);
|
|
633
672
|
var handleChange = function handleChange(property, nextValue) {
|
|
634
673
|
var _extends2;
|
|
635
|
-
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue ===
|
|
674
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
|
|
636
675
|
if (readyForChange(nextState)) {
|
|
637
676
|
onChange(utils.toDateString(nextState, showTime));
|
|
638
677
|
} else {
|
|
@@ -662,70 +701,76 @@ function AltDateWidget(props) {
|
|
|
662
701
|
minute = state.minute,
|
|
663
702
|
second = state.second;
|
|
664
703
|
var data = [{
|
|
665
|
-
type:
|
|
704
|
+
type: 'year',
|
|
666
705
|
range: options.yearsRange,
|
|
667
706
|
value: year
|
|
668
707
|
}, {
|
|
669
|
-
type:
|
|
708
|
+
type: 'month',
|
|
670
709
|
range: [1, 12],
|
|
671
710
|
value: month
|
|
672
711
|
}, {
|
|
673
|
-
type:
|
|
712
|
+
type: 'day',
|
|
674
713
|
range: [1, 31],
|
|
675
714
|
value: day
|
|
676
715
|
}];
|
|
677
716
|
if (showTime) {
|
|
678
717
|
data.push({
|
|
679
|
-
type:
|
|
718
|
+
type: 'hour',
|
|
680
719
|
range: [0, 23],
|
|
681
720
|
value: hour
|
|
682
721
|
}, {
|
|
683
|
-
type:
|
|
722
|
+
type: 'minute',
|
|
684
723
|
range: [0, 59],
|
|
685
724
|
value: minute
|
|
686
725
|
}, {
|
|
687
|
-
type:
|
|
726
|
+
type: 'second',
|
|
688
727
|
range: [0, 59],
|
|
689
728
|
value: second
|
|
690
729
|
});
|
|
691
730
|
}
|
|
692
731
|
return data;
|
|
693
732
|
};
|
|
694
|
-
return
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
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
|
+
});
|
|
729
774
|
}
|
|
730
775
|
AltDateWidget.defaultProps = {
|
|
731
776
|
autofocus: false,
|
|
@@ -739,7 +784,7 @@ AltDateWidget.defaultProps = {
|
|
|
739
784
|
|
|
740
785
|
function AltDateTimeWidget(props) {
|
|
741
786
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
742
|
-
return
|
|
787
|
+
return jsxRuntime.jsx(AltDateWidget, _extends({}, props, {
|
|
743
788
|
showTime: true
|
|
744
789
|
}));
|
|
745
790
|
}
|
|
@@ -777,20 +822,24 @@ function CheckboxWidget(props) {
|
|
|
777
822
|
var value = _ref3.target.value;
|
|
778
823
|
return onFocus(id, value);
|
|
779
824
|
};
|
|
780
|
-
return
|
|
825
|
+
return jsxRuntime.jsx(react.FormControl, _extends({
|
|
781
826
|
mb: 1
|
|
782
827
|
}, chakraProps, {
|
|
783
|
-
isRequired: required
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
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
|
+
}));
|
|
794
843
|
}
|
|
795
844
|
|
|
796
845
|
function CheckboxesWidget(props) {
|
|
@@ -825,38 +874,44 @@ function CheckboxesWidget(props) {
|
|
|
825
874
|
};
|
|
826
875
|
var row = options ? options.inline : false;
|
|
827
876
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
|
|
828
|
-
return
|
|
877
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
829
878
|
mb: 1
|
|
830
879
|
}, chakraProps, {
|
|
831
880
|
isDisabled: disabled || readonly,
|
|
832
881
|
isRequired: required,
|
|
833
882
|
isReadOnly: readonly,
|
|
834
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
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
|
+
}));
|
|
860
915
|
}
|
|
861
916
|
|
|
862
917
|
function RadioWidget(_ref) {
|
|
@@ -891,33 +946,37 @@ function RadioWidget(_ref) {
|
|
|
891
946
|
};
|
|
892
947
|
var row = options ? options.inline : false;
|
|
893
948
|
var selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
894
|
-
return
|
|
949
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
895
950
|
mb: 1
|
|
896
951
|
}, chakraProps, {
|
|
897
952
|
isDisabled: disabled || readonly,
|
|
898
953
|
isRequired: required,
|
|
899
|
-
isReadOnly: readonly
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
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
|
+
}));
|
|
921
980
|
}
|
|
922
981
|
|
|
923
982
|
function RangeWidget(_ref) {
|
|
@@ -954,19 +1013,25 @@ function RangeWidget(_ref) {
|
|
|
954
1013
|
var value = _ref3.target.value;
|
|
955
1014
|
return onFocus(id, value);
|
|
956
1015
|
};
|
|
957
|
-
return
|
|
1016
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
958
1017
|
mb: 1
|
|
959
|
-
}, chakraProps
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
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
|
+
}));
|
|
970
1035
|
}
|
|
971
1036
|
|
|
972
1037
|
function SelectWidget(props) {
|
|
@@ -1020,7 +1085,7 @@ function SelectWidget(props) {
|
|
|
1020
1085
|
isDisabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1
|
|
1021
1086
|
};
|
|
1022
1087
|
}) : [];
|
|
1023
|
-
var isMultiple = typeof multiple !==
|
|
1088
|
+
var isMultiple = typeof multiple !== 'undefined' && Boolean(enumOptions);
|
|
1024
1089
|
var selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions, isMultiple);
|
|
1025
1090
|
var formValue = isMultiple ? (selectedIndex || []).map(function (i) {
|
|
1026
1091
|
return {
|
|
@@ -1028,31 +1093,33 @@ function SelectWidget(props) {
|
|
|
1028
1093
|
value: i
|
|
1029
1094
|
};
|
|
1030
1095
|
}) : {
|
|
1031
|
-
label: _valueLabelMap[selectedIndex] ||
|
|
1096
|
+
label: _valueLabelMap[selectedIndex] || '',
|
|
1032
1097
|
selectedIndex: selectedIndex
|
|
1033
1098
|
};
|
|
1034
|
-
return
|
|
1099
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
1035
1100
|
mb: 1
|
|
1036
1101
|
}, chakraProps, {
|
|
1037
1102
|
isDisabled: disabled || readonly,
|
|
1038
1103
|
isRequired: required,
|
|
1039
1104
|
isReadOnly: readonly,
|
|
1040
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
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
|
+
})]
|
|
1056
1123
|
}));
|
|
1057
1124
|
}
|
|
1058
1125
|
|
|
@@ -1080,7 +1147,7 @@ function TextareaWidget(_ref) {
|
|
|
1080
1147
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1081
1148
|
var _onChange = function _onChange(_ref2) {
|
|
1082
1149
|
var value = _ref2.target.value;
|
|
1083
|
-
return onChange(value ===
|
|
1150
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
1084
1151
|
};
|
|
1085
1152
|
var _onBlur = function _onBlur(_ref3) {
|
|
1086
1153
|
var value = _ref3.target.value;
|
|
@@ -1090,25 +1157,27 @@ function TextareaWidget(_ref) {
|
|
|
1090
1157
|
var value = _ref4.target.value;
|
|
1091
1158
|
return onFocus(id, value);
|
|
1092
1159
|
};
|
|
1093
|
-
return
|
|
1160
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
1094
1161
|
mb: 1
|
|
1095
1162
|
}, chakraProps, {
|
|
1096
1163
|
isDisabled: disabled || readonly,
|
|
1097
1164
|
isRequired: required,
|
|
1098
1165
|
isReadOnly: readonly,
|
|
1099
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
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
|
+
})]
|
|
1112
1181
|
}));
|
|
1113
1182
|
}
|
|
1114
1183
|
|
|
@@ -1142,25 +1211,30 @@ function UpDownWidget(props) {
|
|
|
1142
1211
|
var value = _ref2.target.value;
|
|
1143
1212
|
return onFocus(id, value);
|
|
1144
1213
|
};
|
|
1145
|
-
return
|
|
1214
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
1146
1215
|
mb: 1
|
|
1147
1216
|
}, chakraProps, {
|
|
1148
1217
|
isDisabled: disabled || readonly,
|
|
1149
1218
|
isRequired: required,
|
|
1150
1219
|
isReadOnly: readonly,
|
|
1151
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
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
|
+
}));
|
|
1164
1238
|
}
|
|
1165
1239
|
|
|
1166
1240
|
function generateWidgets() {
|
|
@@ -1213,7 +1287,7 @@ var Form = /*#__PURE__*/generateForm();
|
|
|
1213
1287
|
It is located at the bottom of the styles string.
|
|
1214
1288
|
*/
|
|
1215
1289
|
var CSSReset = function CSSReset() {
|
|
1216
|
-
return
|
|
1290
|
+
return jsxRuntime.jsx(react$2.Global, {
|
|
1217
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 "
|
|
1218
1292
|
});
|
|
1219
1293
|
};
|
|
@@ -1235,22 +1309,25 @@ var CSSReset = function CSSReset() {
|
|
|
1235
1309
|
var memoizedCreateCacheWithContainer = /*#__PURE__*/weakMemoize__default["default"](function (container) {
|
|
1236
1310
|
var newCache = createCache__default["default"]({
|
|
1237
1311
|
container: container,
|
|
1238
|
-
key:
|
|
1312
|
+
key: 'rjsf'
|
|
1239
1313
|
});
|
|
1240
1314
|
return newCache;
|
|
1241
1315
|
});
|
|
1242
1316
|
var __createChakraFrameProvider = function __createChakraFrameProvider(props) {
|
|
1243
1317
|
return function (_ref) {
|
|
1244
1318
|
var document = _ref.document;
|
|
1245
|
-
return
|
|
1319
|
+
return jsxRuntime.jsx("div", {
|
|
1246
1320
|
style: {
|
|
1247
1321
|
margin: 2
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
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
|
+
});
|
|
1254
1331
|
};
|
|
1255
1332
|
};
|
|
1256
1333
|
|