@rjsf/chakra-ui 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +183 -183
- package/README.md +4 -4
- package/dist/chakra-ui.cjs.development.js +499 -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 +494 -388
- package/dist/chakra-ui.esm.js.map +1 -1
- package/dist/chakra-ui.umd.development.js +500 -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 +12 -11
|
@@ -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,61 +50,79 @@ 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) {
|
|
78
61
|
var children = props.children,
|
|
79
62
|
disabled = props.disabled,
|
|
80
63
|
hasToolbar = props.hasToolbar,
|
|
64
|
+
hasCopy = props.hasCopy,
|
|
81
65
|
hasMoveDown = props.hasMoveDown,
|
|
82
66
|
hasMoveUp = props.hasMoveUp,
|
|
83
67
|
hasRemove = props.hasRemove,
|
|
84
68
|
index = props.index,
|
|
69
|
+
onCopyIndexClick = props.onCopyIndexClick,
|
|
85
70
|
onDropIndexClick = props.onDropIndexClick,
|
|
86
71
|
onReorderClick = props.onReorderClick,
|
|
87
72
|
readonly = props.readonly,
|
|
88
73
|
uiSchema = props.uiSchema,
|
|
89
74
|
registry = props.registry;
|
|
90
75
|
var _registry$templates$B = registry.templates.ButtonTemplates,
|
|
76
|
+
CopyButton = _registry$templates$B.CopyButton,
|
|
91
77
|
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
92
78
|
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
93
79
|
RemoveButton = _registry$templates$B.RemoveButton;
|
|
94
|
-
var
|
|
80
|
+
var onCopyClick = react$1.useMemo(function () {
|
|
81
|
+
return onCopyIndexClick(index);
|
|
82
|
+
}, [index, onCopyIndexClick]);
|
|
83
|
+
var onRemoveClick = react$1.useMemo(function () {
|
|
95
84
|
return onDropIndexClick(index);
|
|
96
85
|
}, [index, onDropIndexClick]);
|
|
97
|
-
var onArrowUpClick =
|
|
86
|
+
var onArrowUpClick = react$1.useMemo(function () {
|
|
98
87
|
return onReorderClick(index, index - 1);
|
|
99
88
|
}, [index, onReorderClick]);
|
|
100
|
-
var onArrowDownClick =
|
|
89
|
+
var onArrowDownClick = react$1.useMemo(function () {
|
|
101
90
|
return onReorderClick(index, index + 1);
|
|
102
91
|
}, [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
|
-
|
|
92
|
+
return jsxRuntime.jsxs(react.HStack, {
|
|
93
|
+
alignItems: 'flex-end',
|
|
94
|
+
py: 1,
|
|
95
|
+
children: [jsxRuntime.jsx(react.Box, {
|
|
96
|
+
w: '100%',
|
|
97
|
+
children: children
|
|
98
|
+
}), hasToolbar && jsxRuntime.jsx(react.Box, {
|
|
99
|
+
children: jsxRuntime.jsxs(react.ButtonGroup, {
|
|
100
|
+
isAttached: true,
|
|
101
|
+
mb: 1,
|
|
102
|
+
children: [(hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveUpButton, {
|
|
103
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
104
|
+
onClick: onArrowUpClick,
|
|
105
|
+
uiSchema: uiSchema,
|
|
106
|
+
registry: registry
|
|
107
|
+
}), (hasMoveUp || hasMoveDown) && jsxRuntime.jsx(MoveDownButton, {
|
|
108
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
109
|
+
onClick: onArrowDownClick,
|
|
110
|
+
uiSchema: uiSchema,
|
|
111
|
+
registry: registry
|
|
112
|
+
}), hasCopy && jsxRuntime.jsx(CopyButton, {
|
|
113
|
+
disabled: disabled || readonly,
|
|
114
|
+
onClick: onCopyClick,
|
|
115
|
+
uiSchema: uiSchema,
|
|
116
|
+
registry: registry
|
|
117
|
+
}), hasRemove && jsxRuntime.jsx(RemoveButton, {
|
|
118
|
+
disabled: disabled || readonly,
|
|
119
|
+
onClick: onRemoveClick,
|
|
120
|
+
uiSchema: uiSchema,
|
|
121
|
+
registry: registry
|
|
122
|
+
})]
|
|
123
|
+
})
|
|
124
|
+
})]
|
|
125
|
+
});
|
|
127
126
|
}
|
|
128
127
|
|
|
129
128
|
var _excluded$1 = ["key"];
|
|
@@ -140,49 +139,53 @@ function ArrayFieldTemplate(props) {
|
|
|
140
139
|
schema = props.schema,
|
|
141
140
|
title = props.title;
|
|
142
141
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
143
|
-
var ArrayFieldDescriptionTemplate = utils.getTemplate(
|
|
144
|
-
var ArrayFieldItemTemplate = utils.getTemplate(
|
|
145
|
-
var ArrayFieldTitleTemplate = utils.getTemplate(
|
|
142
|
+
var ArrayFieldDescriptionTemplate = utils.getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
143
|
+
var ArrayFieldItemTemplate = utils.getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
144
|
+
var ArrayFieldTitleTemplate = utils.getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
146
145
|
// Button templates are not overridden in the uiSchema
|
|
147
146
|
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
|
-
|
|
147
|
+
return jsxRuntime.jsxs(react.Box, {
|
|
148
|
+
children: [jsxRuntime.jsx(ArrayFieldTitleTemplate, {
|
|
149
|
+
idSchema: idSchema,
|
|
150
|
+
title: uiOptions.title || title,
|
|
151
|
+
schema: schema,
|
|
152
|
+
uiSchema: uiSchema,
|
|
153
|
+
required: required,
|
|
154
|
+
registry: registry
|
|
155
|
+
}), jsxRuntime.jsx(ArrayFieldDescriptionTemplate, {
|
|
156
|
+
idSchema: idSchema,
|
|
157
|
+
description: uiOptions.description || schema.description,
|
|
158
|
+
schema: schema,
|
|
159
|
+
uiSchema: uiSchema,
|
|
160
|
+
registry: registry
|
|
161
|
+
}), jsxRuntime.jsxs(react.Grid, {
|
|
162
|
+
children: [jsxRuntime.jsx(react.GridItem, {
|
|
163
|
+
children: items.length > 0 && items.map(function (_ref) {
|
|
164
|
+
var key = _ref.key,
|
|
165
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
166
|
+
return jsxRuntime.jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
167
|
+
})
|
|
168
|
+
}), canAdd && jsxRuntime.jsx(react.GridItem, {
|
|
169
|
+
justifySelf: 'flex-end',
|
|
170
|
+
children: jsxRuntime.jsx(react.Box, {
|
|
171
|
+
mt: 2,
|
|
172
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
173
|
+
className: 'array-item-add',
|
|
174
|
+
onClick: onAddClick,
|
|
175
|
+
disabled: disabled || readonly,
|
|
176
|
+
uiSchema: uiSchema,
|
|
177
|
+
registry: registry
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
})]
|
|
181
|
+
}, "array-item-list-" + idSchema.$id)]
|
|
182
|
+
});
|
|
180
183
|
}
|
|
181
184
|
|
|
182
185
|
function getChakra(_ref) {
|
|
183
186
|
var _ref$uiSchema = _ref.uiSchema,
|
|
184
187
|
uiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema;
|
|
185
|
-
var chakraProps = uiSchema[
|
|
188
|
+
var chakraProps = uiSchema['ui:options'] && uiSchema['ui:options'].chakra || {};
|
|
186
189
|
Object.keys(chakraProps).forEach(function (key) {
|
|
187
190
|
/**
|
|
188
191
|
* Leveraging `shouldForwardProp` to remove props
|
|
@@ -206,6 +209,7 @@ function BaseInputTemplate(props) {
|
|
|
206
209
|
schema = props.schema,
|
|
207
210
|
uiSchema = props.uiSchema,
|
|
208
211
|
onChange = props.onChange,
|
|
212
|
+
onChangeOverride = props.onChangeOverride,
|
|
209
213
|
onBlur = props.onBlur,
|
|
210
214
|
onFocus = props.onFocus,
|
|
211
215
|
options = props.options,
|
|
@@ -223,7 +227,7 @@ function BaseInputTemplate(props) {
|
|
|
223
227
|
var schemaUtils = registry.schemaUtils;
|
|
224
228
|
var _onChange = function _onChange(_ref) {
|
|
225
229
|
var value = _ref.target.value;
|
|
226
|
-
return onChange(value ===
|
|
230
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
227
231
|
};
|
|
228
232
|
var _onBlur = function _onBlur(_ref2) {
|
|
229
233
|
var value = _ref2.target.value;
|
|
@@ -234,36 +238,38 @@ function BaseInputTemplate(props) {
|
|
|
234
238
|
return onFocus(id, value);
|
|
235
239
|
};
|
|
236
240
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
237
|
-
return
|
|
241
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
238
242
|
mb: 1
|
|
239
243
|
}, chakraProps, {
|
|
240
244
|
isDisabled: disabled || readonly,
|
|
241
245
|
isRequired: required,
|
|
242
246
|
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
|
-
|
|
247
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
248
|
+
children: [displayLabel ? jsxRuntime.jsx(react.FormLabel, {
|
|
249
|
+
htmlFor: id,
|
|
250
|
+
id: id + "-label",
|
|
251
|
+
children: label || schema.title
|
|
252
|
+
}) : null, jsxRuntime.jsx(react.Input, _extends({
|
|
253
|
+
id: id,
|
|
254
|
+
name: id,
|
|
255
|
+
value: value || value === 0 ? value : '',
|
|
256
|
+
onChange: onChangeOverride || _onChange,
|
|
257
|
+
onBlur: _onBlur,
|
|
258
|
+
onFocus: _onFocus,
|
|
259
|
+
autoFocus: autofocus,
|
|
260
|
+
placeholder: placeholder
|
|
261
|
+
}, inputProps, {
|
|
262
|
+
list: schema.examples ? utils.examplesId(id) : undefined,
|
|
263
|
+
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
264
|
+
})), Array.isArray(schema.examples) ? jsxRuntime.jsx("datalist", {
|
|
265
|
+
id: utils.examplesId(id),
|
|
266
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
267
|
+
return jsxRuntime.jsx("option", {
|
|
268
|
+
value: example
|
|
269
|
+
}, example);
|
|
270
|
+
})
|
|
271
|
+
}) : null]
|
|
272
|
+
}));
|
|
267
273
|
}
|
|
268
274
|
|
|
269
275
|
function DescriptionField(_ref) {
|
|
@@ -272,70 +278,86 @@ function DescriptionField(_ref) {
|
|
|
272
278
|
if (!description) {
|
|
273
279
|
return null;
|
|
274
280
|
}
|
|
275
|
-
if (typeof description ===
|
|
276
|
-
return
|
|
281
|
+
if (typeof description === 'string') {
|
|
282
|
+
return jsxRuntime.jsx(react.Text, {
|
|
277
283
|
id: id,
|
|
278
284
|
mt: 2,
|
|
279
|
-
mb: 4
|
|
280
|
-
|
|
285
|
+
mb: 4,
|
|
286
|
+
children: description
|
|
287
|
+
});
|
|
281
288
|
}
|
|
282
|
-
return
|
|
289
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
290
|
+
children: description
|
|
291
|
+
});
|
|
283
292
|
}
|
|
284
293
|
|
|
285
294
|
function ErrorList(_ref) {
|
|
286
295
|
var errors = _ref.errors,
|
|
287
296
|
registry = _ref.registry;
|
|
288
297
|
var translateString = registry.translateString;
|
|
289
|
-
return
|
|
290
|
-
flexDirection:
|
|
291
|
-
alignItems:
|
|
298
|
+
return jsxRuntime.jsxs(react.Alert, {
|
|
299
|
+
flexDirection: 'column',
|
|
300
|
+
alignItems: 'flex-start',
|
|
292
301
|
gap: 3,
|
|
293
|
-
status:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
+
status: 'error',
|
|
303
|
+
children: [jsxRuntime.jsx(react.AlertTitle, {
|
|
304
|
+
children: translateString(utils.TranslatableString.ErrorsLabel)
|
|
305
|
+
}), jsxRuntime.jsx(react.List, {
|
|
306
|
+
children: errors.map(function (error, i) {
|
|
307
|
+
return jsxRuntime.jsxs(react.ListItem, {
|
|
308
|
+
children: [jsxRuntime.jsx(react.ListIcon, {
|
|
309
|
+
as: icons.WarningIcon,
|
|
310
|
+
color: 'red.500'
|
|
311
|
+
}), error.stack]
|
|
312
|
+
}, i);
|
|
313
|
+
})
|
|
314
|
+
})]
|
|
315
|
+
});
|
|
302
316
|
}
|
|
303
317
|
|
|
304
318
|
var _excluded = ["icon", "iconType", "uiSchema", "registry"];
|
|
305
319
|
function ChakraIconButton(props) {
|
|
306
320
|
var icon = props.icon,
|
|
307
321
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
308
|
-
return
|
|
322
|
+
return jsxRuntime.jsx(react.IconButton, _extends({
|
|
309
323
|
"aria-label": props.title
|
|
310
324
|
}, otherProps, {
|
|
311
325
|
icon: icon
|
|
312
326
|
}));
|
|
313
327
|
}
|
|
314
|
-
ChakraIconButton.displayName =
|
|
315
|
-
var ChakraIconButton$1 = /*#__PURE__*/
|
|
328
|
+
ChakraIconButton.displayName = 'ChakraIconButton';
|
|
329
|
+
var ChakraIconButton$1 = /*#__PURE__*/react$1.memo(ChakraIconButton);
|
|
316
330
|
|
|
331
|
+
function CopyButton(props) {
|
|
332
|
+
var translateString = props.registry.translateString;
|
|
333
|
+
return jsxRuntime.jsx(ChakraIconButton$1, _extends({
|
|
334
|
+
title: translateString(utils.TranslatableString.CopyButton)
|
|
335
|
+
}, props, {
|
|
336
|
+
icon: jsxRuntime.jsx(icons.CopyIcon, {})
|
|
337
|
+
}));
|
|
338
|
+
}
|
|
317
339
|
function MoveDownButton(props) {
|
|
318
340
|
var translateString = props.registry.translateString;
|
|
319
|
-
return
|
|
341
|
+
return jsxRuntime.jsx(ChakraIconButton$1, _extends({
|
|
320
342
|
title: translateString(utils.TranslatableString.MoveDownButton)
|
|
321
343
|
}, props, {
|
|
322
|
-
icon:
|
|
344
|
+
icon: jsxRuntime.jsx(icons.ArrowDownIcon, {})
|
|
323
345
|
}));
|
|
324
346
|
}
|
|
325
347
|
function MoveUpButton(props) {
|
|
326
348
|
var translateString = props.registry.translateString;
|
|
327
|
-
return
|
|
349
|
+
return jsxRuntime.jsx(ChakraIconButton$1, _extends({
|
|
328
350
|
title: translateString(utils.TranslatableString.MoveUpButton)
|
|
329
351
|
}, props, {
|
|
330
|
-
icon:
|
|
352
|
+
icon: jsxRuntime.jsx(icons.ArrowUpIcon, {})
|
|
331
353
|
}));
|
|
332
354
|
}
|
|
333
355
|
function RemoveButton(props) {
|
|
334
356
|
var translateString = props.registry.translateString;
|
|
335
|
-
return
|
|
357
|
+
return jsxRuntime.jsx(ChakraIconButton$1, _extends({
|
|
336
358
|
title: translateString(utils.TranslatableString.RemoveButton)
|
|
337
359
|
}, props, {
|
|
338
|
-
icon:
|
|
360
|
+
icon: jsxRuntime.jsx(icons.DeleteIcon, {})
|
|
339
361
|
}));
|
|
340
362
|
}
|
|
341
363
|
|
|
@@ -351,13 +373,16 @@ function FieldErrorTemplate(props) {
|
|
|
351
373
|
return null;
|
|
352
374
|
}
|
|
353
375
|
var id = utils.errorId(idSchema);
|
|
354
|
-
return
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
376
|
+
return jsxRuntime.jsx(react.List, {
|
|
377
|
+
children: errors.map(function (error, i) {
|
|
378
|
+
return jsxRuntime.jsx(react.ListItem, {
|
|
379
|
+
children: jsxRuntime.jsx(react.FormErrorMessage, {
|
|
380
|
+
id: id,
|
|
381
|
+
children: error
|
|
382
|
+
})
|
|
383
|
+
}, i);
|
|
384
|
+
})
|
|
385
|
+
});
|
|
361
386
|
}
|
|
362
387
|
|
|
363
388
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -371,9 +396,10 @@ function FieldHelpTemplate(props) {
|
|
|
371
396
|
return null;
|
|
372
397
|
}
|
|
373
398
|
var id = utils.helpId(idSchema);
|
|
374
|
-
return
|
|
375
|
-
id: id
|
|
376
|
-
|
|
399
|
+
return jsxRuntime.jsx(react.FormHelperText, {
|
|
400
|
+
id: id,
|
|
401
|
+
children: help
|
|
402
|
+
});
|
|
377
403
|
}
|
|
378
404
|
|
|
379
405
|
function FieldTemplate(props) {
|
|
@@ -398,15 +424,16 @@ function FieldTemplate(props) {
|
|
|
398
424
|
schema = props.schema,
|
|
399
425
|
uiSchema = props.uiSchema;
|
|
400
426
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
401
|
-
var WrapIfAdditionalTemplate = utils.getTemplate(
|
|
427
|
+
var WrapIfAdditionalTemplate = utils.getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
402
428
|
if (hidden) {
|
|
403
|
-
return
|
|
429
|
+
return jsxRuntime.jsx("div", {
|
|
404
430
|
style: {
|
|
405
|
-
display:
|
|
406
|
-
}
|
|
407
|
-
|
|
431
|
+
display: 'none'
|
|
432
|
+
},
|
|
433
|
+
children: children
|
|
434
|
+
});
|
|
408
435
|
}
|
|
409
|
-
return
|
|
436
|
+
return jsxRuntime.jsx(WrapIfAdditionalTemplate, {
|
|
410
437
|
classNames: classNames,
|
|
411
438
|
style: style,
|
|
412
439
|
disabled: disabled,
|
|
@@ -418,13 +445,16 @@ function FieldTemplate(props) {
|
|
|
418
445
|
required: required,
|
|
419
446
|
schema: schema,
|
|
420
447
|
uiSchema: uiSchema,
|
|
421
|
-
registry: registry
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
448
|
+
registry: registry,
|
|
449
|
+
children: jsxRuntime.jsxs(react.FormControl, {
|
|
450
|
+
isRequired: required,
|
|
451
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
452
|
+
children: [children, displayLabel && rawDescription ? jsxRuntime.jsx(react.Text, {
|
|
453
|
+
mt: 2,
|
|
454
|
+
children: rawDescription
|
|
455
|
+
}) : null, errors, help]
|
|
456
|
+
})
|
|
457
|
+
});
|
|
428
458
|
}
|
|
429
459
|
|
|
430
460
|
function ObjectFieldTemplate(props) {
|
|
@@ -441,39 +471,43 @@ function ObjectFieldTemplate(props) {
|
|
|
441
471
|
onAddClick = props.onAddClick,
|
|
442
472
|
registry = props.registry;
|
|
443
473
|
var uiOptions = utils.getUiOptions(uiSchema);
|
|
444
|
-
var TitleFieldTemplate = utils.getTemplate(
|
|
445
|
-
var DescriptionFieldTemplate = utils.getTemplate(
|
|
474
|
+
var TitleFieldTemplate = utils.getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
475
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
446
476
|
// Button templates are not overridden in the uiSchema
|
|
447
477
|
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
|
-
|
|
478
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
479
|
+
children: [(uiOptions.title || title) && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
480
|
+
id: utils.titleId(idSchema),
|
|
481
|
+
title: uiOptions.title || title,
|
|
482
|
+
required: required,
|
|
483
|
+
schema: schema,
|
|
484
|
+
uiSchema: uiSchema,
|
|
485
|
+
registry: registry
|
|
486
|
+
}), (uiOptions.description || description) && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
487
|
+
id: utils.descriptionId(idSchema),
|
|
488
|
+
description: uiOptions.description || description,
|
|
489
|
+
schema: schema,
|
|
490
|
+
uiSchema: uiSchema,
|
|
491
|
+
registry: registry
|
|
492
|
+
}), jsxRuntime.jsxs(react.Grid, {
|
|
493
|
+
gap: description ? 2 : 6,
|
|
494
|
+
mb: 4,
|
|
495
|
+
children: [properties.map(function (element, index) {
|
|
496
|
+
return element.hidden ? element.content : jsxRuntime.jsx(react.GridItem, {
|
|
497
|
+
children: element.content
|
|
498
|
+
}, idSchema.$id + "-" + element.name + "-" + index);
|
|
499
|
+
}), utils.canExpand(schema, uiSchema, formData) && jsxRuntime.jsx(react.GridItem, {
|
|
500
|
+
justifySelf: 'flex-end',
|
|
501
|
+
children: jsxRuntime.jsx(AddButton, {
|
|
502
|
+
className: 'object-property-expand',
|
|
503
|
+
onClick: onAddClick(schema),
|
|
504
|
+
disabled: disabled || readonly,
|
|
505
|
+
uiSchema: uiSchema,
|
|
506
|
+
registry: registry
|
|
507
|
+
})
|
|
508
|
+
})]
|
|
509
|
+
})]
|
|
510
|
+
});
|
|
477
511
|
}
|
|
478
512
|
|
|
479
513
|
function SubmitButton(_ref) {
|
|
@@ -485,24 +519,29 @@ function SubmitButton(_ref) {
|
|
|
485
519
|
if (norender) {
|
|
486
520
|
return null;
|
|
487
521
|
}
|
|
488
|
-
return
|
|
489
|
-
marginTop: 3
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
522
|
+
return jsxRuntime.jsx(react.Box, {
|
|
523
|
+
marginTop: 3,
|
|
524
|
+
children: jsxRuntime.jsx(react.Button, _extends({
|
|
525
|
+
type: 'submit',
|
|
526
|
+
variant: 'solid'
|
|
527
|
+
}, submitButtonProps, {
|
|
528
|
+
children: submitText
|
|
529
|
+
}))
|
|
530
|
+
});
|
|
494
531
|
}
|
|
495
532
|
|
|
496
533
|
function TitleField(_ref) {
|
|
497
534
|
var id = _ref.id,
|
|
498
535
|
title = _ref.title;
|
|
499
|
-
return
|
|
536
|
+
return jsxRuntime.jsxs(react.Box, {
|
|
500
537
|
id: id,
|
|
501
538
|
mt: 1,
|
|
502
|
-
mb: 4
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
539
|
+
mb: 4,
|
|
540
|
+
children: [jsxRuntime.jsx(react.Heading, {
|
|
541
|
+
as: 'h5',
|
|
542
|
+
children: title
|
|
543
|
+
}), jsxRuntime.jsx(react.Divider, {})]
|
|
544
|
+
});
|
|
506
545
|
}
|
|
507
546
|
|
|
508
547
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -526,40 +565,49 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
526
565
|
var keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
|
|
527
566
|
var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
|
|
528
567
|
if (!additional) {
|
|
529
|
-
return
|
|
568
|
+
return jsxRuntime.jsx("div", {
|
|
530
569
|
className: classNames,
|
|
531
|
-
style: style
|
|
532
|
-
|
|
570
|
+
style: style,
|
|
571
|
+
children: children
|
|
572
|
+
});
|
|
533
573
|
}
|
|
534
574
|
var handleBlur = function handleBlur(_ref) {
|
|
535
575
|
var target = _ref.target;
|
|
536
576
|
return onKeyChange(target.value);
|
|
537
577
|
};
|
|
538
|
-
return
|
|
539
|
-
key: id + "-key",
|
|
578
|
+
return jsxRuntime.jsxs(react.Grid, {
|
|
540
579
|
className: classNames,
|
|
541
580
|
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
|
-
|
|
581
|
+
alignItems: 'center',
|
|
582
|
+
gap: 2,
|
|
583
|
+
children: [jsxRuntime.jsx(react.GridItem, {
|
|
584
|
+
children: jsxRuntime.jsxs(react.FormControl, {
|
|
585
|
+
isRequired: required,
|
|
586
|
+
children: [jsxRuntime.jsx(react.FormLabel, {
|
|
587
|
+
htmlFor: id + "-key",
|
|
588
|
+
id: id + "-key-label",
|
|
589
|
+
children: keyLabel
|
|
590
|
+
}), jsxRuntime.jsx(react.Input, {
|
|
591
|
+
defaultValue: label,
|
|
592
|
+
disabled: disabled || readonly,
|
|
593
|
+
id: id + "-key",
|
|
594
|
+
name: id + "-key",
|
|
595
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
596
|
+
type: 'text',
|
|
597
|
+
mb: 1
|
|
598
|
+
})]
|
|
599
|
+
})
|
|
600
|
+
}), jsxRuntime.jsx(react.GridItem, {
|
|
601
|
+
children: children
|
|
602
|
+
}), jsxRuntime.jsx(react.GridItem, {
|
|
603
|
+
children: jsxRuntime.jsx(RemoveButton, {
|
|
604
|
+
disabled: disabled || readonly,
|
|
605
|
+
onClick: onDropPropertyClick(label),
|
|
606
|
+
uiSchema: uiSchema,
|
|
607
|
+
registry: registry
|
|
608
|
+
})
|
|
609
|
+
})]
|
|
610
|
+
}, id + "-key");
|
|
563
611
|
}
|
|
564
612
|
|
|
565
613
|
function generateTemplates() {
|
|
@@ -568,6 +616,7 @@ function generateTemplates() {
|
|
|
568
616
|
ArrayFieldTemplate: ArrayFieldTemplate,
|
|
569
617
|
BaseInputTemplate: BaseInputTemplate,
|
|
570
618
|
ButtonTemplates: {
|
|
619
|
+
CopyButton: CopyButton,
|
|
571
620
|
AddButton: AddButton,
|
|
572
621
|
MoveDownButton: MoveDownButton,
|
|
573
622
|
MoveUpButton: MoveUpButton,
|
|
@@ -599,9 +648,9 @@ var rangeOptions = function rangeOptions(start, stop) {
|
|
|
599
648
|
function DateElement(props) {
|
|
600
649
|
var SelectWidget = props.registry.widgets.SelectWidget;
|
|
601
650
|
var value = props.value ? props.value : undefined;
|
|
602
|
-
return
|
|
603
|
-
label:
|
|
604
|
-
className:
|
|
651
|
+
return jsxRuntime.jsx(SelectWidget, _extends({}, props, {
|
|
652
|
+
label: '',
|
|
653
|
+
className: 'form-control',
|
|
605
654
|
onChange: function onChange(elemValue) {
|
|
606
655
|
return props.select(props.type, elemValue);
|
|
607
656
|
},
|
|
@@ -610,7 +659,7 @@ function DateElement(props) {
|
|
|
610
659
|
},
|
|
611
660
|
placeholder: props.type,
|
|
612
661
|
schema: {
|
|
613
|
-
type:
|
|
662
|
+
type: 'integer'
|
|
614
663
|
},
|
|
615
664
|
value: value,
|
|
616
665
|
"aria-describedby": utils.ariaDescribedByIds(props.name)
|
|
@@ -618,7 +667,7 @@ function DateElement(props) {
|
|
|
618
667
|
}
|
|
619
668
|
var readyForChange = function readyForChange(state) {
|
|
620
669
|
return Object.keys(state).every(function (key) {
|
|
621
|
-
return typeof state[key] !==
|
|
670
|
+
return typeof state[key] !== 'undefined' && state[key] !== -1;
|
|
622
671
|
});
|
|
623
672
|
};
|
|
624
673
|
function AltDateWidget(props) {
|
|
@@ -634,15 +683,15 @@ function AltDateWidget(props) {
|
|
|
634
683
|
showTime = props.showTime,
|
|
635
684
|
value = props.value;
|
|
636
685
|
var translateString = registry.translateString;
|
|
637
|
-
var _useState =
|
|
686
|
+
var _useState = react$1.useState(utils.parseDateString(value, showTime)),
|
|
638
687
|
state = _useState[0],
|
|
639
688
|
setState = _useState[1];
|
|
640
|
-
|
|
689
|
+
react$1.useEffect(function () {
|
|
641
690
|
setState(utils.parseDateString(value, showTime));
|
|
642
691
|
}, [showTime, value]);
|
|
643
692
|
var handleChange = function handleChange(property, nextValue) {
|
|
644
693
|
var _extends2;
|
|
645
|
-
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue ===
|
|
694
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
|
|
646
695
|
if (readyForChange(nextState)) {
|
|
647
696
|
onChange(utils.toDateString(nextState, showTime));
|
|
648
697
|
} else {
|
|
@@ -672,70 +721,76 @@ function AltDateWidget(props) {
|
|
|
672
721
|
minute = state.minute,
|
|
673
722
|
second = state.second;
|
|
674
723
|
var data = [{
|
|
675
|
-
type:
|
|
724
|
+
type: 'year',
|
|
676
725
|
range: options.yearsRange,
|
|
677
726
|
value: year
|
|
678
727
|
}, {
|
|
679
|
-
type:
|
|
728
|
+
type: 'month',
|
|
680
729
|
range: [1, 12],
|
|
681
730
|
value: month
|
|
682
731
|
}, {
|
|
683
|
-
type:
|
|
732
|
+
type: 'day',
|
|
684
733
|
range: [1, 31],
|
|
685
734
|
value: day
|
|
686
735
|
}];
|
|
687
736
|
if (showTime) {
|
|
688
737
|
data.push({
|
|
689
|
-
type:
|
|
738
|
+
type: 'hour',
|
|
690
739
|
range: [0, 23],
|
|
691
740
|
value: hour
|
|
692
741
|
}, {
|
|
693
|
-
type:
|
|
742
|
+
type: 'minute',
|
|
694
743
|
range: [0, 59],
|
|
695
744
|
value: minute
|
|
696
745
|
}, {
|
|
697
|
-
type:
|
|
746
|
+
type: 'second',
|
|
698
747
|
range: [0, 59],
|
|
699
748
|
value: second
|
|
700
749
|
});
|
|
701
750
|
}
|
|
702
751
|
return data;
|
|
703
752
|
};
|
|
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
|
-
|
|
753
|
+
return jsxRuntime.jsxs(react.Box, {
|
|
754
|
+
children: [jsxRuntime.jsx(react.Box, {
|
|
755
|
+
display: 'flex',
|
|
756
|
+
flexWrap: 'wrap',
|
|
757
|
+
alignItems: 'center',
|
|
758
|
+
justify: 'center',
|
|
759
|
+
children: dateElementProps().map(function (elemProps, i) {
|
|
760
|
+
var elemId = id + '_' + elemProps.type;
|
|
761
|
+
return jsxRuntime.jsx(react.Box, {
|
|
762
|
+
mr: '2',
|
|
763
|
+
mb: '2',
|
|
764
|
+
children: jsxRuntime.jsx(DateElement, _extends({}, props, elemProps, {
|
|
765
|
+
autofocus: autofocus && i === 0,
|
|
766
|
+
disabled: disabled,
|
|
767
|
+
id: elemId,
|
|
768
|
+
name: id,
|
|
769
|
+
onBlur: onBlur,
|
|
770
|
+
onFocus: onFocus,
|
|
771
|
+
readonly: readonly,
|
|
772
|
+
registry: registry,
|
|
773
|
+
select: handleChange,
|
|
774
|
+
value: elemProps.value < 0 ? '' : elemProps.value
|
|
775
|
+
}))
|
|
776
|
+
}, elemId);
|
|
777
|
+
})
|
|
778
|
+
}), jsxRuntime.jsxs(react.Box, {
|
|
779
|
+
display: 'flex',
|
|
780
|
+
children: [!options.hideNowButton && jsxRuntime.jsx(react.Button, {
|
|
781
|
+
onClick: function onClick(e) {
|
|
782
|
+
return handleNow(e);
|
|
783
|
+
},
|
|
784
|
+
mr: '2',
|
|
785
|
+
children: translateString(utils.TranslatableString.NowLabel)
|
|
786
|
+
}), !options.hideClearButton && jsxRuntime.jsx(react.Button, {
|
|
787
|
+
onClick: function onClick(e) {
|
|
788
|
+
return handleClear(e);
|
|
789
|
+
},
|
|
790
|
+
children: translateString(utils.TranslatableString.ClearLabel)
|
|
791
|
+
})]
|
|
792
|
+
})]
|
|
793
|
+
});
|
|
739
794
|
}
|
|
740
795
|
AltDateWidget.defaultProps = {
|
|
741
796
|
autofocus: false,
|
|
@@ -749,7 +804,7 @@ AltDateWidget.defaultProps = {
|
|
|
749
804
|
|
|
750
805
|
function AltDateTimeWidget(props) {
|
|
751
806
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
752
|
-
return
|
|
807
|
+
return jsxRuntime.jsx(AltDateWidget, _extends({}, props, {
|
|
753
808
|
showTime: true
|
|
754
809
|
}));
|
|
755
810
|
}
|
|
@@ -787,20 +842,24 @@ function CheckboxWidget(props) {
|
|
|
787
842
|
var value = _ref3.target.value;
|
|
788
843
|
return onFocus(id, value);
|
|
789
844
|
};
|
|
790
|
-
return
|
|
845
|
+
return jsxRuntime.jsx(react.FormControl, _extends({
|
|
791
846
|
mb: 1
|
|
792
847
|
}, chakraProps, {
|
|
793
|
-
isRequired: required
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
848
|
+
isRequired: required,
|
|
849
|
+
children: jsxRuntime.jsx(react.Checkbox, {
|
|
850
|
+
id: id,
|
|
851
|
+
name: id,
|
|
852
|
+
isChecked: typeof value === 'undefined' ? false : value,
|
|
853
|
+
isDisabled: disabled || readonly,
|
|
854
|
+
onChange: _onChange,
|
|
855
|
+
onBlur: _onBlur,
|
|
856
|
+
onFocus: _onFocus,
|
|
857
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
858
|
+
children: label && jsxRuntime.jsx(react.Text, {
|
|
859
|
+
children: label
|
|
860
|
+
})
|
|
861
|
+
})
|
|
862
|
+
}));
|
|
804
863
|
}
|
|
805
864
|
|
|
806
865
|
function CheckboxesWidget(props) {
|
|
@@ -835,38 +894,44 @@ function CheckboxesWidget(props) {
|
|
|
835
894
|
};
|
|
836
895
|
var row = options ? options.inline : false;
|
|
837
896
|
var selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
|
|
838
|
-
return
|
|
897
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
839
898
|
mb: 1
|
|
840
899
|
}, chakraProps, {
|
|
841
900
|
isDisabled: disabled || readonly,
|
|
842
901
|
isRequired: required,
|
|
843
902
|
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
|
-
|
|
903
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
904
|
+
children: [jsxRuntime.jsx(react.FormLabel, {
|
|
905
|
+
htmlFor: id,
|
|
906
|
+
id: id + "-label",
|
|
907
|
+
children: label || schema.title
|
|
908
|
+
}), jsxRuntime.jsx(react.CheckboxGroup, {
|
|
909
|
+
onChange: function onChange(option) {
|
|
910
|
+
return _onChange(utils.enumOptionsValueForIndex(option, enumOptions, emptyValue));
|
|
911
|
+
},
|
|
912
|
+
defaultValue: selectedIndexes,
|
|
913
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
914
|
+
children: jsxRuntime.jsx(react.Stack, {
|
|
915
|
+
direction: row ? 'row' : 'column',
|
|
916
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
917
|
+
var checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
918
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
919
|
+
return jsxRuntime.jsx(react.Checkbox, {
|
|
920
|
+
id: utils.optionId(id, index),
|
|
921
|
+
name: id,
|
|
922
|
+
value: String(index),
|
|
923
|
+
isChecked: checked,
|
|
924
|
+
isDisabled: disabled || itemDisabled || readonly,
|
|
925
|
+
onBlur: _onBlur,
|
|
926
|
+
onFocus: _onFocus,
|
|
927
|
+
children: option.label && jsxRuntime.jsx(react.Text, {
|
|
928
|
+
children: option.label
|
|
929
|
+
})
|
|
930
|
+
}, index);
|
|
931
|
+
})
|
|
932
|
+
})
|
|
933
|
+
})]
|
|
934
|
+
}));
|
|
870
935
|
}
|
|
871
936
|
|
|
872
937
|
function RadioWidget(_ref) {
|
|
@@ -901,33 +966,37 @@ function RadioWidget(_ref) {
|
|
|
901
966
|
};
|
|
902
967
|
var row = options ? options.inline : false;
|
|
903
968
|
var selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
904
|
-
return
|
|
969
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
905
970
|
mb: 1
|
|
906
971
|
}, chakraProps, {
|
|
907
972
|
isDisabled: disabled || readonly,
|
|
908
973
|
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
|
-
|
|
974
|
+
isReadOnly: readonly,
|
|
975
|
+
children: [jsxRuntime.jsx(react.FormLabel, {
|
|
976
|
+
htmlFor: id,
|
|
977
|
+
id: id + "-label",
|
|
978
|
+
children: label || schema.title
|
|
979
|
+
}), jsxRuntime.jsx(react.RadioGroup, {
|
|
980
|
+
onChange: _onChange,
|
|
981
|
+
onBlur: _onBlur,
|
|
982
|
+
onFocus: _onFocus,
|
|
983
|
+
value: selectedIndex,
|
|
984
|
+
name: id,
|
|
985
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
986
|
+
children: jsxRuntime.jsx(react.Stack, {
|
|
987
|
+
direction: row ? 'row' : 'column',
|
|
988
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
989
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
990
|
+
return jsxRuntime.jsx(react.Radio, {
|
|
991
|
+
value: String(index),
|
|
992
|
+
id: utils.optionId(id, index),
|
|
993
|
+
disabled: disabled || itemDisabled || readonly,
|
|
994
|
+
children: option.label
|
|
995
|
+
}, index);
|
|
996
|
+
})
|
|
997
|
+
})
|
|
998
|
+
})]
|
|
999
|
+
}));
|
|
931
1000
|
}
|
|
932
1001
|
|
|
933
1002
|
function RangeWidget(_ref) {
|
|
@@ -964,19 +1033,25 @@ function RangeWidget(_ref) {
|
|
|
964
1033
|
var value = _ref3.target.value;
|
|
965
1034
|
return onFocus(id, value);
|
|
966
1035
|
};
|
|
967
|
-
return
|
|
1036
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
968
1037
|
mb: 1
|
|
969
|
-
}, chakraProps
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1038
|
+
}, chakraProps, {
|
|
1039
|
+
children: [displayLabel ? jsxRuntime.jsx(react.FormLabel, {
|
|
1040
|
+
htmlFor: id,
|
|
1041
|
+
children: label || schema.title
|
|
1042
|
+
}) : null, jsxRuntime.jsxs(react.Slider, _extends({}, sliderWidgetProps, {
|
|
1043
|
+
id: id,
|
|
1044
|
+
name: id,
|
|
1045
|
+
isDisabled: disabled || readonly,
|
|
1046
|
+
onChange: _onChange,
|
|
1047
|
+
onBlur: _onBlur,
|
|
1048
|
+
onFocus: _onFocus,
|
|
1049
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1050
|
+
children: [jsxRuntime.jsx(react.SliderTrack, {
|
|
1051
|
+
children: jsxRuntime.jsx(react.SliderFilledTrack, {})
|
|
1052
|
+
}), jsxRuntime.jsx(react.SliderThumb, {})]
|
|
1053
|
+
}))]
|
|
1054
|
+
}));
|
|
980
1055
|
}
|
|
981
1056
|
|
|
982
1057
|
function SelectWidget(props) {
|
|
@@ -1030,7 +1105,7 @@ function SelectWidget(props) {
|
|
|
1030
1105
|
isDisabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1
|
|
1031
1106
|
};
|
|
1032
1107
|
}) : [];
|
|
1033
|
-
var isMultiple = typeof multiple !==
|
|
1108
|
+
var isMultiple = typeof multiple !== 'undefined' && Boolean(enumOptions);
|
|
1034
1109
|
var selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions, isMultiple);
|
|
1035
1110
|
var formValue = isMultiple ? (selectedIndex || []).map(function (i) {
|
|
1036
1111
|
return {
|
|
@@ -1038,31 +1113,33 @@ function SelectWidget(props) {
|
|
|
1038
1113
|
value: i
|
|
1039
1114
|
};
|
|
1040
1115
|
}) : {
|
|
1041
|
-
label: _valueLabelMap[selectedIndex] ||
|
|
1116
|
+
label: _valueLabelMap[selectedIndex] || '',
|
|
1042
1117
|
selectedIndex: selectedIndex
|
|
1043
1118
|
};
|
|
1044
|
-
return
|
|
1119
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
1045
1120
|
mb: 1
|
|
1046
1121
|
}, chakraProps, {
|
|
1047
1122
|
isDisabled: disabled || readonly,
|
|
1048
1123
|
isRequired: required,
|
|
1049
1124
|
isReadOnly: readonly,
|
|
1050
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1125
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1126
|
+
children: [(label || schema.title) && jsxRuntime.jsx(react.FormLabel, {
|
|
1127
|
+
htmlFor: isMultiple ? undefined : id,
|
|
1128
|
+
children: label || schema.title
|
|
1129
|
+
}), jsxRuntime.jsx(chakraReactSelect.Select, {
|
|
1130
|
+
inputId: id,
|
|
1131
|
+
name: id,
|
|
1132
|
+
isMulti: isMultiple,
|
|
1133
|
+
options: displayEnumOptions,
|
|
1134
|
+
placeholder: placeholder,
|
|
1135
|
+
closeMenuOnSelect: !isMultiple,
|
|
1136
|
+
onBlur: _onBlur,
|
|
1137
|
+
onChange: isMultiple ? _onMultiChange : _onChange,
|
|
1138
|
+
onFocus: _onFocus,
|
|
1139
|
+
autoFocus: autofocus,
|
|
1140
|
+
value: formValue,
|
|
1141
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1142
|
+
})]
|
|
1066
1143
|
}));
|
|
1067
1144
|
}
|
|
1068
1145
|
|
|
@@ -1090,7 +1167,7 @@ function TextareaWidget(_ref) {
|
|
|
1090
1167
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1091
1168
|
var _onChange = function _onChange(_ref2) {
|
|
1092
1169
|
var value = _ref2.target.value;
|
|
1093
|
-
return onChange(value ===
|
|
1170
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
1094
1171
|
};
|
|
1095
1172
|
var _onBlur = function _onBlur(_ref3) {
|
|
1096
1173
|
var value = _ref3.target.value;
|
|
@@ -1100,25 +1177,27 @@ function TextareaWidget(_ref) {
|
|
|
1100
1177
|
var value = _ref4.target.value;
|
|
1101
1178
|
return onFocus(id, value);
|
|
1102
1179
|
};
|
|
1103
|
-
return
|
|
1180
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
1104
1181
|
mb: 1
|
|
1105
1182
|
}, chakraProps, {
|
|
1106
1183
|
isDisabled: disabled || readonly,
|
|
1107
1184
|
isRequired: required,
|
|
1108
1185
|
isReadOnly: readonly,
|
|
1109
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1186
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1187
|
+
children: [displayLabel ? jsxRuntime.jsx(react.FormLabel, {
|
|
1188
|
+
htmlFor: id,
|
|
1189
|
+
children: label || schema.title
|
|
1190
|
+
}) : null, jsxRuntime.jsx(react.Textarea, {
|
|
1191
|
+
id: id,
|
|
1192
|
+
name: id,
|
|
1193
|
+
value: value != null ? value : '',
|
|
1194
|
+
placeholder: placeholder,
|
|
1195
|
+
autoFocus: autofocus,
|
|
1196
|
+
onChange: _onChange,
|
|
1197
|
+
onBlur: _onBlur,
|
|
1198
|
+
onFocus: _onFocus,
|
|
1199
|
+
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1200
|
+
})]
|
|
1122
1201
|
}));
|
|
1123
1202
|
}
|
|
1124
1203
|
|
|
@@ -1152,25 +1231,30 @@ function UpDownWidget(props) {
|
|
|
1152
1231
|
var value = _ref2.target.value;
|
|
1153
1232
|
return onFocus(id, value);
|
|
1154
1233
|
};
|
|
1155
|
-
return
|
|
1234
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
1156
1235
|
mb: 1
|
|
1157
1236
|
}, chakraProps, {
|
|
1158
1237
|
isDisabled: disabled || readonly,
|
|
1159
1238
|
isRequired: required,
|
|
1160
1239
|
isReadOnly: readonly,
|
|
1161
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1240
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1241
|
+
children: [displayLabel ? jsxRuntime.jsx(react.FormLabel, {
|
|
1242
|
+
htmlFor: id,
|
|
1243
|
+
children: label || schema.title
|
|
1244
|
+
}) : null, jsxRuntime.jsxs(react.NumberInput, {
|
|
1245
|
+
value: value != null ? value : '',
|
|
1246
|
+
onChange: _onChange,
|
|
1247
|
+
onBlur: _onBlur,
|
|
1248
|
+
onFocus: _onFocus,
|
|
1249
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1250
|
+
children: [jsxRuntime.jsx(react.NumberInputField, {
|
|
1251
|
+
id: id,
|
|
1252
|
+
name: id
|
|
1253
|
+
}), jsxRuntime.jsxs(react.NumberInputStepper, {
|
|
1254
|
+
children: [jsxRuntime.jsx(react.NumberIncrementStepper, {}), jsxRuntime.jsx(react.NumberDecrementStepper, {})]
|
|
1255
|
+
})]
|
|
1256
|
+
})]
|
|
1257
|
+
}));
|
|
1174
1258
|
}
|
|
1175
1259
|
|
|
1176
1260
|
function generateWidgets() {
|
|
@@ -1223,7 +1307,7 @@ var Form = /*#__PURE__*/generateForm();
|
|
|
1223
1307
|
It is located at the bottom of the styles string.
|
|
1224
1308
|
*/
|
|
1225
1309
|
var CSSReset = function CSSReset() {
|
|
1226
|
-
return
|
|
1310
|
+
return jsxRuntime.jsx(react$2.Global, {
|
|
1227
1311
|
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
1312
|
});
|
|
1229
1313
|
};
|
|
@@ -1245,22 +1329,25 @@ var CSSReset = function CSSReset() {
|
|
|
1245
1329
|
var memoizedCreateCacheWithContainer = /*#__PURE__*/weakMemoize__default["default"](function (container) {
|
|
1246
1330
|
var newCache = createCache__default["default"]({
|
|
1247
1331
|
container: container,
|
|
1248
|
-
key:
|
|
1332
|
+
key: 'rjsf'
|
|
1249
1333
|
});
|
|
1250
1334
|
return newCache;
|
|
1251
1335
|
});
|
|
1252
1336
|
var __createChakraFrameProvider = function __createChakraFrameProvider(props) {
|
|
1253
1337
|
return function (_ref) {
|
|
1254
1338
|
var document = _ref.document;
|
|
1255
|
-
return
|
|
1339
|
+
return jsxRuntime.jsx("div", {
|
|
1256
1340
|
style: {
|
|
1257
1341
|
margin: 2
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1342
|
+
},
|
|
1343
|
+
children: jsxRuntime.jsx(react$2.CacheProvider, {
|
|
1344
|
+
value: memoizedCreateCacheWithContainer(document.head),
|
|
1345
|
+
children: jsxRuntime.jsxs(react.ChakraProvider, {
|
|
1346
|
+
resetCSS: false,
|
|
1347
|
+
children: [jsxRuntime.jsx(CSSReset, {}), props.children]
|
|
1348
|
+
})
|
|
1349
|
+
})
|
|
1350
|
+
});
|
|
1264
1351
|
};
|
|
1265
1352
|
};
|
|
1266
1353
|
|