@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
package/dist/chakra-ui.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { withTheme } from '@rjsf/core';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { TranslatableString, getUiOptions, getTemplate, getInputProps, examplesId, ariaDescribedByIds, errorId, helpId, titleId, descriptionId, canExpand, getSubmitButtonOptions, ADDITIONAL_PROPERTY_FLAG, parseDateString, toDateString, pad, schemaRequiresTrueValue, enumOptionsIndexForValue, enumOptionsValueForIndex, enumOptionsIsSelected, optionId, rangeSpec } from '@rjsf/utils';
|
|
4
4
|
import { Button, HStack, Box, ButtonGroup, Grid, GridItem, shouldForwardProp, FormControl, FormLabel, Input, Text, Alert, AlertTitle, List, ListItem, ListIcon, IconButton, FormErrorMessage, FormHelperText, Heading, Divider, Checkbox, CheckboxGroup, Stack, RadioGroup, Radio, Slider, SliderTrack, SliderFilledTrack, SliderThumb, Textarea, NumberInput, NumberInputField, NumberInputStepper, NumberIncrementStepper, NumberDecrementStepper, ChakraProvider } from '@chakra-ui/react';
|
|
5
5
|
import { AddIcon, WarningIcon, ArrowDownIcon, ArrowUpIcon, DeleteIcon } from '@chakra-ui/icons';
|
|
6
|
-
import {
|
|
6
|
+
import { useMemo, memo, useState, useEffect } from 'react';
|
|
7
7
|
import { Select } from 'chakra-react-select';
|
|
8
8
|
import { Global, CacheProvider } from '@emotion/react';
|
|
9
9
|
import createCache from '@emotion/cache';
|
|
@@ -38,10 +38,14 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
38
38
|
|
|
39
39
|
var _excluded$2 = ["uiSchema", "registry"];
|
|
40
40
|
function AddButton(_ref) {
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
var registry = _ref.registry,
|
|
42
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
43
|
+
var translateString = registry.translateString;
|
|
44
|
+
return jsx(Button, _extends({
|
|
45
|
+
leftIcon: jsx(AddIcon, {})
|
|
46
|
+
}, props, {
|
|
47
|
+
children: translateString(TranslatableString.AddItemButton)
|
|
48
|
+
}));
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
function ArrayFieldItemTemplate(props) {
|
|
@@ -70,30 +74,35 @@ function ArrayFieldItemTemplate(props) {
|
|
|
70
74
|
var onArrowDownClick = useMemo(function () {
|
|
71
75
|
return onReorderClick(index, index + 1);
|
|
72
76
|
}, [index, onReorderClick]);
|
|
73
|
-
return
|
|
74
|
-
alignItems:
|
|
75
|
-
py: 1
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
77
|
+
return jsxs(HStack, {
|
|
78
|
+
alignItems: 'flex-end',
|
|
79
|
+
py: 1,
|
|
80
|
+
children: [jsx(Box, {
|
|
81
|
+
w: '100%',
|
|
82
|
+
children: children
|
|
83
|
+
}), hasToolbar && jsx(Box, {
|
|
84
|
+
children: jsxs(ButtonGroup, {
|
|
85
|
+
isAttached: true,
|
|
86
|
+
mb: 1,
|
|
87
|
+
children: [(hasMoveUp || hasMoveDown) && jsx(MoveUpButton, {
|
|
88
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
89
|
+
onClick: onArrowUpClick,
|
|
90
|
+
uiSchema: uiSchema,
|
|
91
|
+
registry: registry
|
|
92
|
+
}), (hasMoveUp || hasMoveDown) && jsx(MoveDownButton, {
|
|
93
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
94
|
+
onClick: onArrowDownClick,
|
|
95
|
+
uiSchema: uiSchema,
|
|
96
|
+
registry: registry
|
|
97
|
+
}), hasRemove && jsx(RemoveButton, {
|
|
98
|
+
disabled: disabled || readonly,
|
|
99
|
+
onClick: onRemoveClick,
|
|
100
|
+
uiSchema: uiSchema,
|
|
101
|
+
registry: registry
|
|
102
|
+
})]
|
|
103
|
+
})
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
97
106
|
}
|
|
98
107
|
|
|
99
108
|
var _excluded$1 = ["key"];
|
|
@@ -110,49 +119,53 @@ function ArrayFieldTemplate(props) {
|
|
|
110
119
|
schema = props.schema,
|
|
111
120
|
title = props.title;
|
|
112
121
|
var uiOptions = getUiOptions(uiSchema);
|
|
113
|
-
var ArrayFieldDescriptionTemplate = getTemplate(
|
|
114
|
-
var ArrayFieldItemTemplate = getTemplate(
|
|
115
|
-
var ArrayFieldTitleTemplate = getTemplate(
|
|
122
|
+
var ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
123
|
+
var ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
124
|
+
var ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
116
125
|
// Button templates are not overridden in the uiSchema
|
|
117
126
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
118
|
-
return
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
127
|
+
return jsxs(Box, {
|
|
128
|
+
children: [jsx(ArrayFieldTitleTemplate, {
|
|
129
|
+
idSchema: idSchema,
|
|
130
|
+
title: uiOptions.title || title,
|
|
131
|
+
schema: schema,
|
|
132
|
+
uiSchema: uiSchema,
|
|
133
|
+
required: required,
|
|
134
|
+
registry: registry
|
|
135
|
+
}), jsx(ArrayFieldDescriptionTemplate, {
|
|
136
|
+
idSchema: idSchema,
|
|
137
|
+
description: uiOptions.description || schema.description,
|
|
138
|
+
schema: schema,
|
|
139
|
+
uiSchema: uiSchema,
|
|
140
|
+
registry: registry
|
|
141
|
+
}), jsxs(Grid, {
|
|
142
|
+
children: [jsx(GridItem, {
|
|
143
|
+
children: items.length > 0 && items.map(function (_ref) {
|
|
144
|
+
var key = _ref.key,
|
|
145
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
146
|
+
return jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
147
|
+
})
|
|
148
|
+
}), canAdd && jsx(GridItem, {
|
|
149
|
+
justifySelf: 'flex-end',
|
|
150
|
+
children: jsx(Box, {
|
|
151
|
+
mt: 2,
|
|
152
|
+
children: jsx(AddButton, {
|
|
153
|
+
className: 'array-item-add',
|
|
154
|
+
onClick: onAddClick,
|
|
155
|
+
disabled: disabled || readonly,
|
|
156
|
+
uiSchema: uiSchema,
|
|
157
|
+
registry: registry
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
})]
|
|
161
|
+
}, "array-item-list-" + idSchema.$id)]
|
|
162
|
+
});
|
|
150
163
|
}
|
|
151
164
|
|
|
152
165
|
function getChakra(_ref) {
|
|
153
166
|
var _ref$uiSchema = _ref.uiSchema,
|
|
154
167
|
uiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema;
|
|
155
|
-
var chakraProps = uiSchema[
|
|
168
|
+
var chakraProps = uiSchema['ui:options'] && uiSchema['ui:options'].chakra || {};
|
|
156
169
|
Object.keys(chakraProps).forEach(function (key) {
|
|
157
170
|
/**
|
|
158
171
|
* Leveraging `shouldForwardProp` to remove props
|
|
@@ -176,6 +189,7 @@ function BaseInputTemplate(props) {
|
|
|
176
189
|
schema = props.schema,
|
|
177
190
|
uiSchema = props.uiSchema,
|
|
178
191
|
onChange = props.onChange,
|
|
192
|
+
onChangeOverride = props.onChangeOverride,
|
|
179
193
|
onBlur = props.onBlur,
|
|
180
194
|
onFocus = props.onFocus,
|
|
181
195
|
options = props.options,
|
|
@@ -193,7 +207,7 @@ function BaseInputTemplate(props) {
|
|
|
193
207
|
var schemaUtils = registry.schemaUtils;
|
|
194
208
|
var _onChange = function _onChange(_ref) {
|
|
195
209
|
var value = _ref.target.value;
|
|
196
|
-
return onChange(value ===
|
|
210
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
197
211
|
};
|
|
198
212
|
var _onBlur = function _onBlur(_ref2) {
|
|
199
213
|
var value = _ref2.target.value;
|
|
@@ -204,36 +218,38 @@ function BaseInputTemplate(props) {
|
|
|
204
218
|
return onFocus(id, value);
|
|
205
219
|
};
|
|
206
220
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
207
|
-
return
|
|
221
|
+
return jsxs(FormControl, _extends({
|
|
208
222
|
mb: 1
|
|
209
223
|
}, chakraProps, {
|
|
210
224
|
isDisabled: disabled || readonly,
|
|
211
225
|
isRequired: required,
|
|
212
226
|
isReadOnly: readonly,
|
|
213
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
227
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
228
|
+
children: [displayLabel ? jsx(FormLabel, {
|
|
229
|
+
htmlFor: id,
|
|
230
|
+
id: id + "-label",
|
|
231
|
+
children: label || schema.title
|
|
232
|
+
}) : null, jsx(Input, _extends({
|
|
233
|
+
id: id,
|
|
234
|
+
name: id,
|
|
235
|
+
value: value || value === 0 ? value : '',
|
|
236
|
+
onChange: onChangeOverride || _onChange,
|
|
237
|
+
onBlur: _onBlur,
|
|
238
|
+
onFocus: _onFocus,
|
|
239
|
+
autoFocus: autofocus,
|
|
240
|
+
placeholder: placeholder
|
|
241
|
+
}, inputProps, {
|
|
242
|
+
list: schema.examples ? examplesId(id) : undefined,
|
|
243
|
+
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
244
|
+
})), Array.isArray(schema.examples) ? jsx("datalist", {
|
|
245
|
+
id: examplesId(id),
|
|
246
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
247
|
+
return jsx("option", {
|
|
248
|
+
value: example
|
|
249
|
+
}, example);
|
|
250
|
+
})
|
|
251
|
+
}) : null]
|
|
252
|
+
}));
|
|
237
253
|
}
|
|
238
254
|
|
|
239
255
|
function DescriptionField(_ref) {
|
|
@@ -242,65 +258,78 @@ function DescriptionField(_ref) {
|
|
|
242
258
|
if (!description) {
|
|
243
259
|
return null;
|
|
244
260
|
}
|
|
245
|
-
if (typeof description ===
|
|
246
|
-
return
|
|
261
|
+
if (typeof description === 'string') {
|
|
262
|
+
return jsx(Text, {
|
|
247
263
|
id: id,
|
|
248
264
|
mt: 2,
|
|
249
|
-
mb: 4
|
|
250
|
-
|
|
265
|
+
mb: 4,
|
|
266
|
+
children: description
|
|
267
|
+
});
|
|
251
268
|
}
|
|
252
|
-
return
|
|
269
|
+
return jsx(Fragment, {
|
|
270
|
+
children: description
|
|
271
|
+
});
|
|
253
272
|
}
|
|
254
273
|
|
|
255
274
|
function ErrorList(_ref) {
|
|
256
|
-
var errors = _ref.errors
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
275
|
+
var errors = _ref.errors,
|
|
276
|
+
registry = _ref.registry;
|
|
277
|
+
var translateString = registry.translateString;
|
|
278
|
+
return jsxs(Alert, {
|
|
279
|
+
flexDirection: 'column',
|
|
280
|
+
alignItems: 'flex-start',
|
|
260
281
|
gap: 3,
|
|
261
|
-
status:
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
282
|
+
status: 'error',
|
|
283
|
+
children: [jsx(AlertTitle, {
|
|
284
|
+
children: translateString(TranslatableString.ErrorsLabel)
|
|
285
|
+
}), jsx(List, {
|
|
286
|
+
children: errors.map(function (error, i) {
|
|
287
|
+
return jsxs(ListItem, {
|
|
288
|
+
children: [jsx(ListIcon, {
|
|
289
|
+
as: WarningIcon,
|
|
290
|
+
color: 'red.500'
|
|
291
|
+
}), error.stack]
|
|
292
|
+
}, i);
|
|
293
|
+
})
|
|
294
|
+
})]
|
|
295
|
+
});
|
|
270
296
|
}
|
|
271
297
|
|
|
272
298
|
var _excluded = ["icon", "iconType", "uiSchema", "registry"];
|
|
273
299
|
function ChakraIconButton(props) {
|
|
274
300
|
var icon = props.icon,
|
|
275
301
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
276
|
-
return
|
|
302
|
+
return jsx(IconButton, _extends({
|
|
277
303
|
"aria-label": props.title
|
|
278
304
|
}, otherProps, {
|
|
279
305
|
icon: icon
|
|
280
306
|
}));
|
|
281
307
|
}
|
|
282
|
-
ChakraIconButton.displayName =
|
|
283
|
-
var ChakraIconButton$1 = /*#__PURE__*/
|
|
308
|
+
ChakraIconButton.displayName = 'ChakraIconButton';
|
|
309
|
+
var ChakraIconButton$1 = /*#__PURE__*/memo(ChakraIconButton);
|
|
284
310
|
|
|
285
311
|
function MoveDownButton(props) {
|
|
286
|
-
|
|
287
|
-
|
|
312
|
+
var translateString = props.registry.translateString;
|
|
313
|
+
return jsx(ChakraIconButton$1, _extends({
|
|
314
|
+
title: translateString(TranslatableString.MoveDownButton)
|
|
288
315
|
}, props, {
|
|
289
|
-
icon:
|
|
316
|
+
icon: jsx(ArrowDownIcon, {})
|
|
290
317
|
}));
|
|
291
318
|
}
|
|
292
319
|
function MoveUpButton(props) {
|
|
293
|
-
|
|
294
|
-
|
|
320
|
+
var translateString = props.registry.translateString;
|
|
321
|
+
return jsx(ChakraIconButton$1, _extends({
|
|
322
|
+
title: translateString(TranslatableString.MoveUpButton)
|
|
295
323
|
}, props, {
|
|
296
|
-
icon:
|
|
324
|
+
icon: jsx(ArrowUpIcon, {})
|
|
297
325
|
}));
|
|
298
326
|
}
|
|
299
327
|
function RemoveButton(props) {
|
|
300
|
-
|
|
301
|
-
|
|
328
|
+
var translateString = props.registry.translateString;
|
|
329
|
+
return jsx(ChakraIconButton$1, _extends({
|
|
330
|
+
title: translateString(TranslatableString.RemoveButton)
|
|
302
331
|
}, props, {
|
|
303
|
-
icon:
|
|
332
|
+
icon: jsx(DeleteIcon, {})
|
|
304
333
|
}));
|
|
305
334
|
}
|
|
306
335
|
|
|
@@ -316,13 +345,16 @@ function FieldErrorTemplate(props) {
|
|
|
316
345
|
return null;
|
|
317
346
|
}
|
|
318
347
|
var id = errorId(idSchema);
|
|
319
|
-
return
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
348
|
+
return jsx(List, {
|
|
349
|
+
children: errors.map(function (error, i) {
|
|
350
|
+
return jsx(ListItem, {
|
|
351
|
+
children: jsx(FormErrorMessage, {
|
|
352
|
+
id: id,
|
|
353
|
+
children: error
|
|
354
|
+
})
|
|
355
|
+
}, i);
|
|
356
|
+
})
|
|
357
|
+
});
|
|
326
358
|
}
|
|
327
359
|
|
|
328
360
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -336,9 +368,10 @@ function FieldHelpTemplate(props) {
|
|
|
336
368
|
return null;
|
|
337
369
|
}
|
|
338
370
|
var id = helpId(idSchema);
|
|
339
|
-
return
|
|
340
|
-
id: id
|
|
341
|
-
|
|
371
|
+
return jsx(FormHelperText, {
|
|
372
|
+
id: id,
|
|
373
|
+
children: help
|
|
374
|
+
});
|
|
342
375
|
}
|
|
343
376
|
|
|
344
377
|
function FieldTemplate(props) {
|
|
@@ -363,15 +396,16 @@ function FieldTemplate(props) {
|
|
|
363
396
|
schema = props.schema,
|
|
364
397
|
uiSchema = props.uiSchema;
|
|
365
398
|
var uiOptions = getUiOptions(uiSchema);
|
|
366
|
-
var WrapIfAdditionalTemplate = getTemplate(
|
|
399
|
+
var WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
367
400
|
if (hidden) {
|
|
368
|
-
return
|
|
401
|
+
return jsx("div", {
|
|
369
402
|
style: {
|
|
370
|
-
display:
|
|
371
|
-
}
|
|
372
|
-
|
|
403
|
+
display: 'none'
|
|
404
|
+
},
|
|
405
|
+
children: children
|
|
406
|
+
});
|
|
373
407
|
}
|
|
374
|
-
return
|
|
408
|
+
return jsx(WrapIfAdditionalTemplate, {
|
|
375
409
|
classNames: classNames,
|
|
376
410
|
style: style,
|
|
377
411
|
disabled: disabled,
|
|
@@ -383,13 +417,16 @@ function FieldTemplate(props) {
|
|
|
383
417
|
required: required,
|
|
384
418
|
schema: schema,
|
|
385
419
|
uiSchema: uiSchema,
|
|
386
|
-
registry: registry
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
420
|
+
registry: registry,
|
|
421
|
+
children: jsxs(FormControl, {
|
|
422
|
+
isRequired: required,
|
|
423
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
424
|
+
children: [children, displayLabel && rawDescription ? jsx(Text, {
|
|
425
|
+
mt: 2,
|
|
426
|
+
children: rawDescription
|
|
427
|
+
}) : null, errors, help]
|
|
428
|
+
})
|
|
429
|
+
});
|
|
393
430
|
}
|
|
394
431
|
|
|
395
432
|
function ObjectFieldTemplate(props) {
|
|
@@ -406,39 +443,43 @@ function ObjectFieldTemplate(props) {
|
|
|
406
443
|
onAddClick = props.onAddClick,
|
|
407
444
|
registry = props.registry;
|
|
408
445
|
var uiOptions = getUiOptions(uiSchema);
|
|
409
|
-
var TitleFieldTemplate = getTemplate(
|
|
410
|
-
var DescriptionFieldTemplate = getTemplate(
|
|
446
|
+
var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
447
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
411
448
|
// Button templates are not overridden in the uiSchema
|
|
412
449
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
413
|
-
return
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
450
|
+
return jsxs(Fragment, {
|
|
451
|
+
children: [(uiOptions.title || title) && jsx(TitleFieldTemplate, {
|
|
452
|
+
id: titleId(idSchema),
|
|
453
|
+
title: uiOptions.title || title,
|
|
454
|
+
required: required,
|
|
455
|
+
schema: schema,
|
|
456
|
+
uiSchema: uiSchema,
|
|
457
|
+
registry: registry
|
|
458
|
+
}), (uiOptions.description || description) && jsx(DescriptionFieldTemplate, {
|
|
459
|
+
id: descriptionId(idSchema),
|
|
460
|
+
description: uiOptions.description || description,
|
|
461
|
+
schema: schema,
|
|
462
|
+
uiSchema: uiSchema,
|
|
463
|
+
registry: registry
|
|
464
|
+
}), jsxs(Grid, {
|
|
465
|
+
gap: description ? 2 : 6,
|
|
466
|
+
mb: 4,
|
|
467
|
+
children: [properties.map(function (element, index) {
|
|
468
|
+
return element.hidden ? element.content : jsx(GridItem, {
|
|
469
|
+
children: element.content
|
|
470
|
+
}, idSchema.$id + "-" + element.name + "-" + index);
|
|
471
|
+
}), canExpand(schema, uiSchema, formData) && jsx(GridItem, {
|
|
472
|
+
justifySelf: 'flex-end',
|
|
473
|
+
children: jsx(AddButton, {
|
|
474
|
+
className: 'object-property-expand',
|
|
475
|
+
onClick: onAddClick(schema),
|
|
476
|
+
disabled: disabled || readonly,
|
|
477
|
+
uiSchema: uiSchema,
|
|
478
|
+
registry: registry
|
|
479
|
+
})
|
|
480
|
+
})]
|
|
481
|
+
})]
|
|
482
|
+
});
|
|
442
483
|
}
|
|
443
484
|
|
|
444
485
|
function SubmitButton(_ref) {
|
|
@@ -450,24 +491,29 @@ function SubmitButton(_ref) {
|
|
|
450
491
|
if (norender) {
|
|
451
492
|
return null;
|
|
452
493
|
}
|
|
453
|
-
return
|
|
454
|
-
marginTop: 3
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
494
|
+
return jsx(Box, {
|
|
495
|
+
marginTop: 3,
|
|
496
|
+
children: jsx(Button, _extends({
|
|
497
|
+
type: 'submit',
|
|
498
|
+
variant: 'solid'
|
|
499
|
+
}, submitButtonProps, {
|
|
500
|
+
children: submitText
|
|
501
|
+
}))
|
|
502
|
+
});
|
|
459
503
|
}
|
|
460
504
|
|
|
461
505
|
function TitleField(_ref) {
|
|
462
506
|
var id = _ref.id,
|
|
463
507
|
title = _ref.title;
|
|
464
|
-
return
|
|
508
|
+
return jsxs(Box, {
|
|
465
509
|
id: id,
|
|
466
510
|
mt: 1,
|
|
467
|
-
mb: 4
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
511
|
+
mb: 4,
|
|
512
|
+
children: [jsx(Heading, {
|
|
513
|
+
as: 'h5',
|
|
514
|
+
children: title
|
|
515
|
+
}), jsx(Divider, {})]
|
|
516
|
+
});
|
|
471
517
|
}
|
|
472
518
|
|
|
473
519
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -484,45 +530,56 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
484
530
|
required = props.required,
|
|
485
531
|
schema = props.schema,
|
|
486
532
|
uiSchema = props.uiSchema;
|
|
533
|
+
var templates = registry.templates,
|
|
534
|
+
translateString = registry.translateString;
|
|
487
535
|
// Button templates are not overridden in the uiSchema
|
|
488
|
-
var RemoveButton =
|
|
536
|
+
var RemoveButton = templates.ButtonTemplates.RemoveButton;
|
|
537
|
+
var keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
489
538
|
var additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
490
539
|
if (!additional) {
|
|
491
|
-
return
|
|
540
|
+
return jsx("div", {
|
|
492
541
|
className: classNames,
|
|
493
|
-
style: style
|
|
494
|
-
|
|
542
|
+
style: style,
|
|
543
|
+
children: children
|
|
544
|
+
});
|
|
495
545
|
}
|
|
496
|
-
var keyLabel = label + " Key";
|
|
497
546
|
var handleBlur = function handleBlur(_ref) {
|
|
498
547
|
var target = _ref.target;
|
|
499
548
|
return onKeyChange(target.value);
|
|
500
549
|
};
|
|
501
|
-
return
|
|
502
|
-
key: id + "-key",
|
|
550
|
+
return jsxs(Grid, {
|
|
503
551
|
className: classNames,
|
|
504
552
|
style: style,
|
|
505
|
-
alignItems:
|
|
506
|
-
gap: 2
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
553
|
+
alignItems: 'center',
|
|
554
|
+
gap: 2,
|
|
555
|
+
children: [jsx(GridItem, {
|
|
556
|
+
children: jsxs(FormControl, {
|
|
557
|
+
isRequired: required,
|
|
558
|
+
children: [jsx(FormLabel, {
|
|
559
|
+
htmlFor: id + "-key",
|
|
560
|
+
id: id + "-key-label",
|
|
561
|
+
children: keyLabel
|
|
562
|
+
}), jsx(Input, {
|
|
563
|
+
defaultValue: label,
|
|
564
|
+
disabled: disabled || readonly,
|
|
565
|
+
id: id + "-key",
|
|
566
|
+
name: id + "-key",
|
|
567
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
568
|
+
type: 'text',
|
|
569
|
+
mb: 1
|
|
570
|
+
})]
|
|
571
|
+
})
|
|
572
|
+
}), jsx(GridItem, {
|
|
573
|
+
children: children
|
|
574
|
+
}), jsx(GridItem, {
|
|
575
|
+
children: jsx(RemoveButton, {
|
|
576
|
+
disabled: disabled || readonly,
|
|
577
|
+
onClick: onDropPropertyClick(label),
|
|
578
|
+
uiSchema: uiSchema,
|
|
579
|
+
registry: registry
|
|
580
|
+
})
|
|
581
|
+
})]
|
|
582
|
+
}, id + "-key");
|
|
526
583
|
}
|
|
527
584
|
|
|
528
585
|
function generateTemplates() {
|
|
@@ -562,9 +619,9 @@ var rangeOptions = function rangeOptions(start, stop) {
|
|
|
562
619
|
function DateElement(props) {
|
|
563
620
|
var SelectWidget = props.registry.widgets.SelectWidget;
|
|
564
621
|
var value = props.value ? props.value : undefined;
|
|
565
|
-
return
|
|
566
|
-
label:
|
|
567
|
-
className:
|
|
622
|
+
return jsx(SelectWidget, _extends({}, props, {
|
|
623
|
+
label: '',
|
|
624
|
+
className: 'form-control',
|
|
568
625
|
onChange: function onChange(elemValue) {
|
|
569
626
|
return props.select(props.type, elemValue);
|
|
570
627
|
},
|
|
@@ -573,7 +630,7 @@ function DateElement(props) {
|
|
|
573
630
|
},
|
|
574
631
|
placeholder: props.type,
|
|
575
632
|
schema: {
|
|
576
|
-
type:
|
|
633
|
+
type: 'integer'
|
|
577
634
|
},
|
|
578
635
|
value: value,
|
|
579
636
|
"aria-describedby": ariaDescribedByIds(props.name)
|
|
@@ -581,7 +638,7 @@ function DateElement(props) {
|
|
|
581
638
|
}
|
|
582
639
|
var readyForChange = function readyForChange(state) {
|
|
583
640
|
return Object.keys(state).every(function (key) {
|
|
584
|
-
return typeof state[key] !==
|
|
641
|
+
return typeof state[key] !== 'undefined' && state[key] !== -1;
|
|
585
642
|
});
|
|
586
643
|
};
|
|
587
644
|
function AltDateWidget(props) {
|
|
@@ -596,6 +653,7 @@ function AltDateWidget(props) {
|
|
|
596
653
|
registry = props.registry,
|
|
597
654
|
showTime = props.showTime,
|
|
598
655
|
value = props.value;
|
|
656
|
+
var translateString = registry.translateString;
|
|
599
657
|
var _useState = useState(parseDateString(value, showTime)),
|
|
600
658
|
state = _useState[0],
|
|
601
659
|
setState = _useState[1];
|
|
@@ -604,7 +662,7 @@ function AltDateWidget(props) {
|
|
|
604
662
|
}, [showTime, value]);
|
|
605
663
|
var handleChange = function handleChange(property, nextValue) {
|
|
606
664
|
var _extends2;
|
|
607
|
-
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue ===
|
|
665
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
|
|
608
666
|
if (readyForChange(nextState)) {
|
|
609
667
|
onChange(toDateString(nextState, showTime));
|
|
610
668
|
} else {
|
|
@@ -634,70 +692,76 @@ function AltDateWidget(props) {
|
|
|
634
692
|
minute = state.minute,
|
|
635
693
|
second = state.second;
|
|
636
694
|
var data = [{
|
|
637
|
-
type:
|
|
695
|
+
type: 'year',
|
|
638
696
|
range: options.yearsRange,
|
|
639
697
|
value: year
|
|
640
698
|
}, {
|
|
641
|
-
type:
|
|
699
|
+
type: 'month',
|
|
642
700
|
range: [1, 12],
|
|
643
701
|
value: month
|
|
644
702
|
}, {
|
|
645
|
-
type:
|
|
703
|
+
type: 'day',
|
|
646
704
|
range: [1, 31],
|
|
647
705
|
value: day
|
|
648
706
|
}];
|
|
649
707
|
if (showTime) {
|
|
650
708
|
data.push({
|
|
651
|
-
type:
|
|
709
|
+
type: 'hour',
|
|
652
710
|
range: [0, 23],
|
|
653
711
|
value: hour
|
|
654
712
|
}, {
|
|
655
|
-
type:
|
|
713
|
+
type: 'minute',
|
|
656
714
|
range: [0, 59],
|
|
657
715
|
value: minute
|
|
658
716
|
}, {
|
|
659
|
-
type:
|
|
717
|
+
type: 'second',
|
|
660
718
|
range: [0, 59],
|
|
661
719
|
value: second
|
|
662
720
|
});
|
|
663
721
|
}
|
|
664
722
|
return data;
|
|
665
723
|
};
|
|
666
|
-
return
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
724
|
+
return jsxs(Box, {
|
|
725
|
+
children: [jsx(Box, {
|
|
726
|
+
display: 'flex',
|
|
727
|
+
flexWrap: 'wrap',
|
|
728
|
+
alignItems: 'center',
|
|
729
|
+
justify: 'center',
|
|
730
|
+
children: dateElementProps().map(function (elemProps, i) {
|
|
731
|
+
var elemId = id + '_' + elemProps.type;
|
|
732
|
+
return jsx(Box, {
|
|
733
|
+
mr: '2',
|
|
734
|
+
mb: '2',
|
|
735
|
+
children: jsx(DateElement, _extends({}, props, elemProps, {
|
|
736
|
+
autofocus: autofocus && i === 0,
|
|
737
|
+
disabled: disabled,
|
|
738
|
+
id: elemId,
|
|
739
|
+
name: id,
|
|
740
|
+
onBlur: onBlur,
|
|
741
|
+
onFocus: onFocus,
|
|
742
|
+
readonly: readonly,
|
|
743
|
+
registry: registry,
|
|
744
|
+
select: handleChange,
|
|
745
|
+
value: elemProps.value < 0 ? '' : elemProps.value
|
|
746
|
+
}))
|
|
747
|
+
}, elemId);
|
|
748
|
+
})
|
|
749
|
+
}), jsxs(Box, {
|
|
750
|
+
display: 'flex',
|
|
751
|
+
children: [!options.hideNowButton && jsx(Button, {
|
|
752
|
+
onClick: function onClick(e) {
|
|
753
|
+
return handleNow(e);
|
|
754
|
+
},
|
|
755
|
+
mr: '2',
|
|
756
|
+
children: translateString(TranslatableString.NowLabel)
|
|
757
|
+
}), !options.hideClearButton && jsx(Button, {
|
|
758
|
+
onClick: function onClick(e) {
|
|
759
|
+
return handleClear(e);
|
|
760
|
+
},
|
|
761
|
+
children: translateString(TranslatableString.ClearLabel)
|
|
762
|
+
})]
|
|
763
|
+
})]
|
|
764
|
+
});
|
|
701
765
|
}
|
|
702
766
|
AltDateWidget.defaultProps = {
|
|
703
767
|
autofocus: false,
|
|
@@ -711,7 +775,7 @@ AltDateWidget.defaultProps = {
|
|
|
711
775
|
|
|
712
776
|
function AltDateTimeWidget(props) {
|
|
713
777
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
714
|
-
return
|
|
778
|
+
return jsx(AltDateWidget, _extends({}, props, {
|
|
715
779
|
showTime: true
|
|
716
780
|
}));
|
|
717
781
|
}
|
|
@@ -749,20 +813,24 @@ function CheckboxWidget(props) {
|
|
|
749
813
|
var value = _ref3.target.value;
|
|
750
814
|
return onFocus(id, value);
|
|
751
815
|
};
|
|
752
|
-
return
|
|
816
|
+
return jsx(FormControl, _extends({
|
|
753
817
|
mb: 1
|
|
754
818
|
}, chakraProps, {
|
|
755
|
-
isRequired: required
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
819
|
+
isRequired: required,
|
|
820
|
+
children: jsx(Checkbox, {
|
|
821
|
+
id: id,
|
|
822
|
+
name: id,
|
|
823
|
+
isChecked: typeof value === 'undefined' ? false : value,
|
|
824
|
+
isDisabled: disabled || readonly,
|
|
825
|
+
onChange: _onChange,
|
|
826
|
+
onBlur: _onBlur,
|
|
827
|
+
onFocus: _onFocus,
|
|
828
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
829
|
+
children: label && jsx(Text, {
|
|
830
|
+
children: label
|
|
831
|
+
})
|
|
832
|
+
})
|
|
833
|
+
}));
|
|
766
834
|
}
|
|
767
835
|
|
|
768
836
|
function CheckboxesWidget(props) {
|
|
@@ -797,38 +865,44 @@ function CheckboxesWidget(props) {
|
|
|
797
865
|
};
|
|
798
866
|
var row = options ? options.inline : false;
|
|
799
867
|
var selectedIndexes = enumOptionsIndexForValue(value, enumOptions, true);
|
|
800
|
-
return
|
|
868
|
+
return jsxs(FormControl, _extends({
|
|
801
869
|
mb: 1
|
|
802
870
|
}, chakraProps, {
|
|
803
871
|
isDisabled: disabled || readonly,
|
|
804
872
|
isRequired: required,
|
|
805
873
|
isReadOnly: readonly,
|
|
806
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
874
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
875
|
+
children: [jsx(FormLabel, {
|
|
876
|
+
htmlFor: id,
|
|
877
|
+
id: id + "-label",
|
|
878
|
+
children: label || schema.title
|
|
879
|
+
}), jsx(CheckboxGroup, {
|
|
880
|
+
onChange: function onChange(option) {
|
|
881
|
+
return _onChange(enumOptionsValueForIndex(option, enumOptions, emptyValue));
|
|
882
|
+
},
|
|
883
|
+
defaultValue: selectedIndexes,
|
|
884
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
885
|
+
children: jsx(Stack, {
|
|
886
|
+
direction: row ? 'row' : 'column',
|
|
887
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
888
|
+
var checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
889
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
890
|
+
return jsx(Checkbox, {
|
|
891
|
+
id: optionId(id, index),
|
|
892
|
+
name: id,
|
|
893
|
+
value: String(index),
|
|
894
|
+
isChecked: checked,
|
|
895
|
+
isDisabled: disabled || itemDisabled || readonly,
|
|
896
|
+
onBlur: _onBlur,
|
|
897
|
+
onFocus: _onFocus,
|
|
898
|
+
children: option.label && jsx(Text, {
|
|
899
|
+
children: option.label
|
|
900
|
+
})
|
|
901
|
+
}, index);
|
|
902
|
+
})
|
|
903
|
+
})
|
|
904
|
+
})]
|
|
905
|
+
}));
|
|
832
906
|
}
|
|
833
907
|
|
|
834
908
|
function RadioWidget(_ref) {
|
|
@@ -863,33 +937,37 @@ function RadioWidget(_ref) {
|
|
|
863
937
|
};
|
|
864
938
|
var row = options ? options.inline : false;
|
|
865
939
|
var selectedIndex = enumOptionsIndexForValue(value, enumOptions);
|
|
866
|
-
return
|
|
940
|
+
return jsxs(FormControl, _extends({
|
|
867
941
|
mb: 1
|
|
868
942
|
}, chakraProps, {
|
|
869
943
|
isDisabled: disabled || readonly,
|
|
870
944
|
isRequired: required,
|
|
871
|
-
isReadOnly: readonly
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
945
|
+
isReadOnly: readonly,
|
|
946
|
+
children: [jsx(FormLabel, {
|
|
947
|
+
htmlFor: id,
|
|
948
|
+
id: id + "-label",
|
|
949
|
+
children: label || schema.title
|
|
950
|
+
}), jsx(RadioGroup, {
|
|
951
|
+
onChange: _onChange,
|
|
952
|
+
onBlur: _onBlur,
|
|
953
|
+
onFocus: _onFocus,
|
|
954
|
+
value: selectedIndex,
|
|
955
|
+
name: id,
|
|
956
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
957
|
+
children: jsx(Stack, {
|
|
958
|
+
direction: row ? 'row' : 'column',
|
|
959
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
960
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
961
|
+
return jsx(Radio, {
|
|
962
|
+
value: String(index),
|
|
963
|
+
id: optionId(id, index),
|
|
964
|
+
disabled: disabled || itemDisabled || readonly,
|
|
965
|
+
children: option.label
|
|
966
|
+
}, index);
|
|
967
|
+
})
|
|
968
|
+
})
|
|
969
|
+
})]
|
|
970
|
+
}));
|
|
893
971
|
}
|
|
894
972
|
|
|
895
973
|
function RangeWidget(_ref) {
|
|
@@ -926,19 +1004,25 @@ function RangeWidget(_ref) {
|
|
|
926
1004
|
var value = _ref3.target.value;
|
|
927
1005
|
return onFocus(id, value);
|
|
928
1006
|
};
|
|
929
|
-
return
|
|
1007
|
+
return jsxs(FormControl, _extends({
|
|
930
1008
|
mb: 1
|
|
931
|
-
}, chakraProps
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1009
|
+
}, chakraProps, {
|
|
1010
|
+
children: [displayLabel ? jsx(FormLabel, {
|
|
1011
|
+
htmlFor: id,
|
|
1012
|
+
children: label || schema.title
|
|
1013
|
+
}) : null, jsxs(Slider, _extends({}, sliderWidgetProps, {
|
|
1014
|
+
id: id,
|
|
1015
|
+
name: id,
|
|
1016
|
+
isDisabled: disabled || readonly,
|
|
1017
|
+
onChange: _onChange,
|
|
1018
|
+
onBlur: _onBlur,
|
|
1019
|
+
onFocus: _onFocus,
|
|
1020
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
1021
|
+
children: [jsx(SliderTrack, {
|
|
1022
|
+
children: jsx(SliderFilledTrack, {})
|
|
1023
|
+
}), jsx(SliderThumb, {})]
|
|
1024
|
+
}))]
|
|
1025
|
+
}));
|
|
942
1026
|
}
|
|
943
1027
|
|
|
944
1028
|
function SelectWidget(props) {
|
|
@@ -992,7 +1076,7 @@ function SelectWidget(props) {
|
|
|
992
1076
|
isDisabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1
|
|
993
1077
|
};
|
|
994
1078
|
}) : [];
|
|
995
|
-
var isMultiple = typeof multiple !==
|
|
1079
|
+
var isMultiple = typeof multiple !== 'undefined' && Boolean(enumOptions);
|
|
996
1080
|
var selectedIndex = enumOptionsIndexForValue(value, enumOptions, isMultiple);
|
|
997
1081
|
var formValue = isMultiple ? (selectedIndex || []).map(function (i) {
|
|
998
1082
|
return {
|
|
@@ -1000,31 +1084,33 @@ function SelectWidget(props) {
|
|
|
1000
1084
|
value: i
|
|
1001
1085
|
};
|
|
1002
1086
|
}) : {
|
|
1003
|
-
label: _valueLabelMap[selectedIndex] ||
|
|
1087
|
+
label: _valueLabelMap[selectedIndex] || '',
|
|
1004
1088
|
selectedIndex: selectedIndex
|
|
1005
1089
|
};
|
|
1006
|
-
return
|
|
1090
|
+
return jsxs(FormControl, _extends({
|
|
1007
1091
|
mb: 1
|
|
1008
1092
|
}, chakraProps, {
|
|
1009
1093
|
isDisabled: disabled || readonly,
|
|
1010
1094
|
isRequired: required,
|
|
1011
1095
|
isReadOnly: readonly,
|
|
1012
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1096
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1097
|
+
children: [(label || schema.title) && jsx(FormLabel, {
|
|
1098
|
+
htmlFor: isMultiple ? undefined : id,
|
|
1099
|
+
children: label || schema.title
|
|
1100
|
+
}), jsx(Select, {
|
|
1101
|
+
inputId: id,
|
|
1102
|
+
name: id,
|
|
1103
|
+
isMulti: isMultiple,
|
|
1104
|
+
options: displayEnumOptions,
|
|
1105
|
+
placeholder: placeholder,
|
|
1106
|
+
closeMenuOnSelect: !isMultiple,
|
|
1107
|
+
onBlur: _onBlur,
|
|
1108
|
+
onChange: isMultiple ? _onMultiChange : _onChange,
|
|
1109
|
+
onFocus: _onFocus,
|
|
1110
|
+
autoFocus: autofocus,
|
|
1111
|
+
value: formValue,
|
|
1112
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1113
|
+
})]
|
|
1028
1114
|
}));
|
|
1029
1115
|
}
|
|
1030
1116
|
|
|
@@ -1052,7 +1138,7 @@ function TextareaWidget(_ref) {
|
|
|
1052
1138
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1053
1139
|
var _onChange = function _onChange(_ref2) {
|
|
1054
1140
|
var value = _ref2.target.value;
|
|
1055
|
-
return onChange(value ===
|
|
1141
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
1056
1142
|
};
|
|
1057
1143
|
var _onBlur = function _onBlur(_ref3) {
|
|
1058
1144
|
var value = _ref3.target.value;
|
|
@@ -1062,25 +1148,27 @@ function TextareaWidget(_ref) {
|
|
|
1062
1148
|
var value = _ref4.target.value;
|
|
1063
1149
|
return onFocus(id, value);
|
|
1064
1150
|
};
|
|
1065
|
-
return
|
|
1151
|
+
return jsxs(FormControl, _extends({
|
|
1066
1152
|
mb: 1
|
|
1067
1153
|
}, chakraProps, {
|
|
1068
1154
|
isDisabled: disabled || readonly,
|
|
1069
1155
|
isRequired: required,
|
|
1070
1156
|
isReadOnly: readonly,
|
|
1071
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1157
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1158
|
+
children: [displayLabel ? jsx(FormLabel, {
|
|
1159
|
+
htmlFor: id,
|
|
1160
|
+
children: label || schema.title
|
|
1161
|
+
}) : null, jsx(Textarea, {
|
|
1162
|
+
id: id,
|
|
1163
|
+
name: id,
|
|
1164
|
+
value: value != null ? value : '',
|
|
1165
|
+
placeholder: placeholder,
|
|
1166
|
+
autoFocus: autofocus,
|
|
1167
|
+
onChange: _onChange,
|
|
1168
|
+
onBlur: _onBlur,
|
|
1169
|
+
onFocus: _onFocus,
|
|
1170
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1171
|
+
})]
|
|
1084
1172
|
}));
|
|
1085
1173
|
}
|
|
1086
1174
|
|
|
@@ -1114,25 +1202,30 @@ function UpDownWidget(props) {
|
|
|
1114
1202
|
var value = _ref2.target.value;
|
|
1115
1203
|
return onFocus(id, value);
|
|
1116
1204
|
};
|
|
1117
|
-
return
|
|
1205
|
+
return jsxs(FormControl, _extends({
|
|
1118
1206
|
mb: 1
|
|
1119
1207
|
}, chakraProps, {
|
|
1120
1208
|
isDisabled: disabled || readonly,
|
|
1121
1209
|
isRequired: required,
|
|
1122
1210
|
isReadOnly: readonly,
|
|
1123
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1211
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1212
|
+
children: [displayLabel ? jsx(FormLabel, {
|
|
1213
|
+
htmlFor: id,
|
|
1214
|
+
children: label || schema.title
|
|
1215
|
+
}) : null, jsxs(NumberInput, {
|
|
1216
|
+
value: value != null ? value : '',
|
|
1217
|
+
onChange: _onChange,
|
|
1218
|
+
onBlur: _onBlur,
|
|
1219
|
+
onFocus: _onFocus,
|
|
1220
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
1221
|
+
children: [jsx(NumberInputField, {
|
|
1222
|
+
id: id,
|
|
1223
|
+
name: id
|
|
1224
|
+
}), jsxs(NumberInputStepper, {
|
|
1225
|
+
children: [jsx(NumberIncrementStepper, {}), jsx(NumberDecrementStepper, {})]
|
|
1226
|
+
})]
|
|
1227
|
+
})]
|
|
1228
|
+
}));
|
|
1136
1229
|
}
|
|
1137
1230
|
|
|
1138
1231
|
function generateWidgets() {
|
|
@@ -1185,7 +1278,7 @@ var Form = /*#__PURE__*/generateForm();
|
|
|
1185
1278
|
It is located at the bottom of the styles string.
|
|
1186
1279
|
*/
|
|
1187
1280
|
var CSSReset = function CSSReset() {
|
|
1188
|
-
return
|
|
1281
|
+
return jsx(Global, {
|
|
1189
1282
|
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 "
|
|
1190
1283
|
});
|
|
1191
1284
|
};
|
|
@@ -1207,22 +1300,25 @@ var CSSReset = function CSSReset() {
|
|
|
1207
1300
|
var memoizedCreateCacheWithContainer = /*#__PURE__*/weakMemoize(function (container) {
|
|
1208
1301
|
var newCache = createCache({
|
|
1209
1302
|
container: container,
|
|
1210
|
-
key:
|
|
1303
|
+
key: 'rjsf'
|
|
1211
1304
|
});
|
|
1212
1305
|
return newCache;
|
|
1213
1306
|
});
|
|
1214
1307
|
var __createChakraFrameProvider = function __createChakraFrameProvider(props) {
|
|
1215
1308
|
return function (_ref) {
|
|
1216
1309
|
var document = _ref.document;
|
|
1217
|
-
return
|
|
1310
|
+
return jsx("div", {
|
|
1218
1311
|
style: {
|
|
1219
1312
|
margin: 2
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1313
|
+
},
|
|
1314
|
+
children: jsx(CacheProvider, {
|
|
1315
|
+
value: memoizedCreateCacheWithContainer(document.head),
|
|
1316
|
+
children: jsxs(ChakraProvider, {
|
|
1317
|
+
resetCSS: false,
|
|
1318
|
+
children: [jsx(CSSReset, {}), props.children]
|
|
1319
|
+
})
|
|
1320
|
+
})
|
|
1321
|
+
});
|
|
1226
1322
|
};
|
|
1227
1323
|
};
|
|
1228
1324
|
|