@rjsf/chakra-ui 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +183 -183
- package/README.md +4 -4
- package/dist/chakra-ui.cjs.development.js +479 -412
- package/dist/chakra-ui.cjs.development.js.map +1 -1
- package/dist/chakra-ui.cjs.production.min.js +1 -1
- package/dist/chakra-ui.cjs.production.min.js.map +1 -1
- package/dist/chakra-ui.esm.js +473 -387
- package/dist/chakra-ui.esm.js.map +1 -1
- package/dist/chakra-ui.umd.development.js +480 -414
- package/dist/chakra-ui.umd.development.js.map +1 -1
- package/dist/chakra-ui.umd.production.min.js +1 -1
- package/dist/chakra-ui.umd.production.min.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/package.json +6 -5
package/dist/chakra-ui.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { withTheme } from '@rjsf/core';
|
|
2
|
-
import
|
|
3
|
-
import React__default, { useMemo, useState, useEffect } from 'react';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
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';
|
|
5
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';
|
|
6
5
|
import { AddIcon, WarningIcon, ArrowDownIcon, ArrowUpIcon, DeleteIcon } from '@chakra-ui/icons';
|
|
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';
|
|
@@ -41,9 +41,11 @@ function AddButton(_ref) {
|
|
|
41
41
|
var registry = _ref.registry,
|
|
42
42
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
43
43
|
var translateString = registry.translateString;
|
|
44
|
-
return
|
|
45
|
-
leftIcon:
|
|
46
|
-
}, props
|
|
44
|
+
return jsx(Button, _extends({
|
|
45
|
+
leftIcon: jsx(AddIcon, {})
|
|
46
|
+
}, props, {
|
|
47
|
+
children: translateString(TranslatableString.AddItemButton)
|
|
48
|
+
}));
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
function ArrayFieldItemTemplate(props) {
|
|
@@ -72,30 +74,35 @@ function ArrayFieldItemTemplate(props) {
|
|
|
72
74
|
var onArrowDownClick = useMemo(function () {
|
|
73
75
|
return onReorderClick(index, index + 1);
|
|
74
76
|
}, [index, onReorderClick]);
|
|
75
|
-
return
|
|
76
|
-
alignItems:
|
|
77
|
-
py: 1
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
+
});
|
|
99
106
|
}
|
|
100
107
|
|
|
101
108
|
var _excluded$1 = ["key"];
|
|
@@ -112,49 +119,53 @@ function ArrayFieldTemplate(props) {
|
|
|
112
119
|
schema = props.schema,
|
|
113
120
|
title = props.title;
|
|
114
121
|
var uiOptions = getUiOptions(uiSchema);
|
|
115
|
-
var ArrayFieldDescriptionTemplate = getTemplate(
|
|
116
|
-
var ArrayFieldItemTemplate = getTemplate(
|
|
117
|
-
var ArrayFieldTitleTemplate = getTemplate(
|
|
122
|
+
var ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
123
|
+
var ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
124
|
+
var ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
118
125
|
// Button templates are not overridden in the uiSchema
|
|
119
126
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
120
|
-
return
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
+
});
|
|
152
163
|
}
|
|
153
164
|
|
|
154
165
|
function getChakra(_ref) {
|
|
155
166
|
var _ref$uiSchema = _ref.uiSchema,
|
|
156
167
|
uiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema;
|
|
157
|
-
var chakraProps = uiSchema[
|
|
168
|
+
var chakraProps = uiSchema['ui:options'] && uiSchema['ui:options'].chakra || {};
|
|
158
169
|
Object.keys(chakraProps).forEach(function (key) {
|
|
159
170
|
/**
|
|
160
171
|
* Leveraging `shouldForwardProp` to remove props
|
|
@@ -178,6 +189,7 @@ function BaseInputTemplate(props) {
|
|
|
178
189
|
schema = props.schema,
|
|
179
190
|
uiSchema = props.uiSchema,
|
|
180
191
|
onChange = props.onChange,
|
|
192
|
+
onChangeOverride = props.onChangeOverride,
|
|
181
193
|
onBlur = props.onBlur,
|
|
182
194
|
onFocus = props.onFocus,
|
|
183
195
|
options = props.options,
|
|
@@ -195,7 +207,7 @@ function BaseInputTemplate(props) {
|
|
|
195
207
|
var schemaUtils = registry.schemaUtils;
|
|
196
208
|
var _onChange = function _onChange(_ref) {
|
|
197
209
|
var value = _ref.target.value;
|
|
198
|
-
return onChange(value ===
|
|
210
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
199
211
|
};
|
|
200
212
|
var _onBlur = function _onBlur(_ref2) {
|
|
201
213
|
var value = _ref2.target.value;
|
|
@@ -206,36 +218,38 @@ function BaseInputTemplate(props) {
|
|
|
206
218
|
return onFocus(id, value);
|
|
207
219
|
};
|
|
208
220
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
209
|
-
return
|
|
221
|
+
return jsxs(FormControl, _extends({
|
|
210
222
|
mb: 1
|
|
211
223
|
}, chakraProps, {
|
|
212
224
|
isDisabled: disabled || readonly,
|
|
213
225
|
isRequired: required,
|
|
214
226
|
isReadOnly: readonly,
|
|
215
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
+
}));
|
|
239
253
|
}
|
|
240
254
|
|
|
241
255
|
function DescriptionField(_ref) {
|
|
@@ -244,70 +258,78 @@ function DescriptionField(_ref) {
|
|
|
244
258
|
if (!description) {
|
|
245
259
|
return null;
|
|
246
260
|
}
|
|
247
|
-
if (typeof description ===
|
|
248
|
-
return
|
|
261
|
+
if (typeof description === 'string') {
|
|
262
|
+
return jsx(Text, {
|
|
249
263
|
id: id,
|
|
250
264
|
mt: 2,
|
|
251
|
-
mb: 4
|
|
252
|
-
|
|
265
|
+
mb: 4,
|
|
266
|
+
children: description
|
|
267
|
+
});
|
|
253
268
|
}
|
|
254
|
-
return
|
|
269
|
+
return jsx(Fragment, {
|
|
270
|
+
children: description
|
|
271
|
+
});
|
|
255
272
|
}
|
|
256
273
|
|
|
257
274
|
function ErrorList(_ref) {
|
|
258
275
|
var errors = _ref.errors,
|
|
259
276
|
registry = _ref.registry;
|
|
260
277
|
var translateString = registry.translateString;
|
|
261
|
-
return
|
|
262
|
-
flexDirection:
|
|
263
|
-
alignItems:
|
|
278
|
+
return jsxs(Alert, {
|
|
279
|
+
flexDirection: 'column',
|
|
280
|
+
alignItems: 'flex-start',
|
|
264
281
|
gap: 3,
|
|
265
|
-
status:
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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
|
+
});
|
|
274
296
|
}
|
|
275
297
|
|
|
276
298
|
var _excluded = ["icon", "iconType", "uiSchema", "registry"];
|
|
277
299
|
function ChakraIconButton(props) {
|
|
278
300
|
var icon = props.icon,
|
|
279
301
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
280
|
-
return
|
|
302
|
+
return jsx(IconButton, _extends({
|
|
281
303
|
"aria-label": props.title
|
|
282
304
|
}, otherProps, {
|
|
283
305
|
icon: icon
|
|
284
306
|
}));
|
|
285
307
|
}
|
|
286
|
-
ChakraIconButton.displayName =
|
|
287
|
-
var ChakraIconButton$1 = /*#__PURE__*/
|
|
308
|
+
ChakraIconButton.displayName = 'ChakraIconButton';
|
|
309
|
+
var ChakraIconButton$1 = /*#__PURE__*/memo(ChakraIconButton);
|
|
288
310
|
|
|
289
311
|
function MoveDownButton(props) {
|
|
290
312
|
var translateString = props.registry.translateString;
|
|
291
|
-
return
|
|
313
|
+
return jsx(ChakraIconButton$1, _extends({
|
|
292
314
|
title: translateString(TranslatableString.MoveDownButton)
|
|
293
315
|
}, props, {
|
|
294
|
-
icon:
|
|
316
|
+
icon: jsx(ArrowDownIcon, {})
|
|
295
317
|
}));
|
|
296
318
|
}
|
|
297
319
|
function MoveUpButton(props) {
|
|
298
320
|
var translateString = props.registry.translateString;
|
|
299
|
-
return
|
|
321
|
+
return jsx(ChakraIconButton$1, _extends({
|
|
300
322
|
title: translateString(TranslatableString.MoveUpButton)
|
|
301
323
|
}, props, {
|
|
302
|
-
icon:
|
|
324
|
+
icon: jsx(ArrowUpIcon, {})
|
|
303
325
|
}));
|
|
304
326
|
}
|
|
305
327
|
function RemoveButton(props) {
|
|
306
328
|
var translateString = props.registry.translateString;
|
|
307
|
-
return
|
|
329
|
+
return jsx(ChakraIconButton$1, _extends({
|
|
308
330
|
title: translateString(TranslatableString.RemoveButton)
|
|
309
331
|
}, props, {
|
|
310
|
-
icon:
|
|
332
|
+
icon: jsx(DeleteIcon, {})
|
|
311
333
|
}));
|
|
312
334
|
}
|
|
313
335
|
|
|
@@ -323,13 +345,16 @@ function FieldErrorTemplate(props) {
|
|
|
323
345
|
return null;
|
|
324
346
|
}
|
|
325
347
|
var id = errorId(idSchema);
|
|
326
|
-
return
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
+
});
|
|
333
358
|
}
|
|
334
359
|
|
|
335
360
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -343,9 +368,10 @@ function FieldHelpTemplate(props) {
|
|
|
343
368
|
return null;
|
|
344
369
|
}
|
|
345
370
|
var id = helpId(idSchema);
|
|
346
|
-
return
|
|
347
|
-
id: id
|
|
348
|
-
|
|
371
|
+
return jsx(FormHelperText, {
|
|
372
|
+
id: id,
|
|
373
|
+
children: help
|
|
374
|
+
});
|
|
349
375
|
}
|
|
350
376
|
|
|
351
377
|
function FieldTemplate(props) {
|
|
@@ -370,15 +396,16 @@ function FieldTemplate(props) {
|
|
|
370
396
|
schema = props.schema,
|
|
371
397
|
uiSchema = props.uiSchema;
|
|
372
398
|
var uiOptions = getUiOptions(uiSchema);
|
|
373
|
-
var WrapIfAdditionalTemplate = getTemplate(
|
|
399
|
+
var WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
374
400
|
if (hidden) {
|
|
375
|
-
return
|
|
401
|
+
return jsx("div", {
|
|
376
402
|
style: {
|
|
377
|
-
display:
|
|
378
|
-
}
|
|
379
|
-
|
|
403
|
+
display: 'none'
|
|
404
|
+
},
|
|
405
|
+
children: children
|
|
406
|
+
});
|
|
380
407
|
}
|
|
381
|
-
return
|
|
408
|
+
return jsx(WrapIfAdditionalTemplate, {
|
|
382
409
|
classNames: classNames,
|
|
383
410
|
style: style,
|
|
384
411
|
disabled: disabled,
|
|
@@ -390,13 +417,16 @@ function FieldTemplate(props) {
|
|
|
390
417
|
required: required,
|
|
391
418
|
schema: schema,
|
|
392
419
|
uiSchema: uiSchema,
|
|
393
|
-
registry: registry
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
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
|
+
});
|
|
400
430
|
}
|
|
401
431
|
|
|
402
432
|
function ObjectFieldTemplate(props) {
|
|
@@ -413,39 +443,43 @@ function ObjectFieldTemplate(props) {
|
|
|
413
443
|
onAddClick = props.onAddClick,
|
|
414
444
|
registry = props.registry;
|
|
415
445
|
var uiOptions = getUiOptions(uiSchema);
|
|
416
|
-
var TitleFieldTemplate = getTemplate(
|
|
417
|
-
var DescriptionFieldTemplate = getTemplate(
|
|
446
|
+
var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
447
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
418
448
|
// Button templates are not overridden in the uiSchema
|
|
419
449
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
420
|
-
return
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
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
|
+
});
|
|
449
483
|
}
|
|
450
484
|
|
|
451
485
|
function SubmitButton(_ref) {
|
|
@@ -457,24 +491,29 @@ function SubmitButton(_ref) {
|
|
|
457
491
|
if (norender) {
|
|
458
492
|
return null;
|
|
459
493
|
}
|
|
460
|
-
return
|
|
461
|
-
marginTop: 3
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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
|
+
});
|
|
466
503
|
}
|
|
467
504
|
|
|
468
505
|
function TitleField(_ref) {
|
|
469
506
|
var id = _ref.id,
|
|
470
507
|
title = _ref.title;
|
|
471
|
-
return
|
|
508
|
+
return jsxs(Box, {
|
|
472
509
|
id: id,
|
|
473
510
|
mt: 1,
|
|
474
|
-
mb: 4
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
511
|
+
mb: 4,
|
|
512
|
+
children: [jsx(Heading, {
|
|
513
|
+
as: 'h5',
|
|
514
|
+
children: title
|
|
515
|
+
}), jsx(Divider, {})]
|
|
516
|
+
});
|
|
478
517
|
}
|
|
479
518
|
|
|
480
519
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -498,40 +537,49 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
498
537
|
var keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
499
538
|
var additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
500
539
|
if (!additional) {
|
|
501
|
-
return
|
|
540
|
+
return jsx("div", {
|
|
502
541
|
className: classNames,
|
|
503
|
-
style: style
|
|
504
|
-
|
|
542
|
+
style: style,
|
|
543
|
+
children: children
|
|
544
|
+
});
|
|
505
545
|
}
|
|
506
546
|
var handleBlur = function handleBlur(_ref) {
|
|
507
547
|
var target = _ref.target;
|
|
508
548
|
return onKeyChange(target.value);
|
|
509
549
|
};
|
|
510
|
-
return
|
|
511
|
-
key: id + "-key",
|
|
550
|
+
return jsxs(Grid, {
|
|
512
551
|
className: classNames,
|
|
513
552
|
style: style,
|
|
514
|
-
alignItems:
|
|
515
|
-
gap: 2
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
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");
|
|
535
583
|
}
|
|
536
584
|
|
|
537
585
|
function generateTemplates() {
|
|
@@ -571,9 +619,9 @@ var rangeOptions = function rangeOptions(start, stop) {
|
|
|
571
619
|
function DateElement(props) {
|
|
572
620
|
var SelectWidget = props.registry.widgets.SelectWidget;
|
|
573
621
|
var value = props.value ? props.value : undefined;
|
|
574
|
-
return
|
|
575
|
-
label:
|
|
576
|
-
className:
|
|
622
|
+
return jsx(SelectWidget, _extends({}, props, {
|
|
623
|
+
label: '',
|
|
624
|
+
className: 'form-control',
|
|
577
625
|
onChange: function onChange(elemValue) {
|
|
578
626
|
return props.select(props.type, elemValue);
|
|
579
627
|
},
|
|
@@ -582,7 +630,7 @@ function DateElement(props) {
|
|
|
582
630
|
},
|
|
583
631
|
placeholder: props.type,
|
|
584
632
|
schema: {
|
|
585
|
-
type:
|
|
633
|
+
type: 'integer'
|
|
586
634
|
},
|
|
587
635
|
value: value,
|
|
588
636
|
"aria-describedby": ariaDescribedByIds(props.name)
|
|
@@ -590,7 +638,7 @@ function DateElement(props) {
|
|
|
590
638
|
}
|
|
591
639
|
var readyForChange = function readyForChange(state) {
|
|
592
640
|
return Object.keys(state).every(function (key) {
|
|
593
|
-
return typeof state[key] !==
|
|
641
|
+
return typeof state[key] !== 'undefined' && state[key] !== -1;
|
|
594
642
|
});
|
|
595
643
|
};
|
|
596
644
|
function AltDateWidget(props) {
|
|
@@ -614,7 +662,7 @@ function AltDateWidget(props) {
|
|
|
614
662
|
}, [showTime, value]);
|
|
615
663
|
var handleChange = function handleChange(property, nextValue) {
|
|
616
664
|
var _extends2;
|
|
617
|
-
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue ===
|
|
665
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
|
|
618
666
|
if (readyForChange(nextState)) {
|
|
619
667
|
onChange(toDateString(nextState, showTime));
|
|
620
668
|
} else {
|
|
@@ -644,70 +692,76 @@ function AltDateWidget(props) {
|
|
|
644
692
|
minute = state.minute,
|
|
645
693
|
second = state.second;
|
|
646
694
|
var data = [{
|
|
647
|
-
type:
|
|
695
|
+
type: 'year',
|
|
648
696
|
range: options.yearsRange,
|
|
649
697
|
value: year
|
|
650
698
|
}, {
|
|
651
|
-
type:
|
|
699
|
+
type: 'month',
|
|
652
700
|
range: [1, 12],
|
|
653
701
|
value: month
|
|
654
702
|
}, {
|
|
655
|
-
type:
|
|
703
|
+
type: 'day',
|
|
656
704
|
range: [1, 31],
|
|
657
705
|
value: day
|
|
658
706
|
}];
|
|
659
707
|
if (showTime) {
|
|
660
708
|
data.push({
|
|
661
|
-
type:
|
|
709
|
+
type: 'hour',
|
|
662
710
|
range: [0, 23],
|
|
663
711
|
value: hour
|
|
664
712
|
}, {
|
|
665
|
-
type:
|
|
713
|
+
type: 'minute',
|
|
666
714
|
range: [0, 59],
|
|
667
715
|
value: minute
|
|
668
716
|
}, {
|
|
669
|
-
type:
|
|
717
|
+
type: 'second',
|
|
670
718
|
range: [0, 59],
|
|
671
719
|
value: second
|
|
672
720
|
});
|
|
673
721
|
}
|
|
674
722
|
return data;
|
|
675
723
|
};
|
|
676
|
-
return
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
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
|
+
});
|
|
711
765
|
}
|
|
712
766
|
AltDateWidget.defaultProps = {
|
|
713
767
|
autofocus: false,
|
|
@@ -721,7 +775,7 @@ AltDateWidget.defaultProps = {
|
|
|
721
775
|
|
|
722
776
|
function AltDateTimeWidget(props) {
|
|
723
777
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
724
|
-
return
|
|
778
|
+
return jsx(AltDateWidget, _extends({}, props, {
|
|
725
779
|
showTime: true
|
|
726
780
|
}));
|
|
727
781
|
}
|
|
@@ -759,20 +813,24 @@ function CheckboxWidget(props) {
|
|
|
759
813
|
var value = _ref3.target.value;
|
|
760
814
|
return onFocus(id, value);
|
|
761
815
|
};
|
|
762
|
-
return
|
|
816
|
+
return jsx(FormControl, _extends({
|
|
763
817
|
mb: 1
|
|
764
818
|
}, chakraProps, {
|
|
765
|
-
isRequired: required
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
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
|
+
}));
|
|
776
834
|
}
|
|
777
835
|
|
|
778
836
|
function CheckboxesWidget(props) {
|
|
@@ -807,38 +865,44 @@ function CheckboxesWidget(props) {
|
|
|
807
865
|
};
|
|
808
866
|
var row = options ? options.inline : false;
|
|
809
867
|
var selectedIndexes = enumOptionsIndexForValue(value, enumOptions, true);
|
|
810
|
-
return
|
|
868
|
+
return jsxs(FormControl, _extends({
|
|
811
869
|
mb: 1
|
|
812
870
|
}, chakraProps, {
|
|
813
871
|
isDisabled: disabled || readonly,
|
|
814
872
|
isRequired: required,
|
|
815
873
|
isReadOnly: readonly,
|
|
816
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
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
|
+
}));
|
|
842
906
|
}
|
|
843
907
|
|
|
844
908
|
function RadioWidget(_ref) {
|
|
@@ -873,33 +937,37 @@ function RadioWidget(_ref) {
|
|
|
873
937
|
};
|
|
874
938
|
var row = options ? options.inline : false;
|
|
875
939
|
var selectedIndex = enumOptionsIndexForValue(value, enumOptions);
|
|
876
|
-
return
|
|
940
|
+
return jsxs(FormControl, _extends({
|
|
877
941
|
mb: 1
|
|
878
942
|
}, chakraProps, {
|
|
879
943
|
isDisabled: disabled || readonly,
|
|
880
944
|
isRequired: required,
|
|
881
|
-
isReadOnly: readonly
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
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
|
+
}));
|
|
903
971
|
}
|
|
904
972
|
|
|
905
973
|
function RangeWidget(_ref) {
|
|
@@ -936,19 +1004,25 @@ function RangeWidget(_ref) {
|
|
|
936
1004
|
var value = _ref3.target.value;
|
|
937
1005
|
return onFocus(id, value);
|
|
938
1006
|
};
|
|
939
|
-
return
|
|
1007
|
+
return jsxs(FormControl, _extends({
|
|
940
1008
|
mb: 1
|
|
941
|
-
}, chakraProps
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
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
|
+
}));
|
|
952
1026
|
}
|
|
953
1027
|
|
|
954
1028
|
function SelectWidget(props) {
|
|
@@ -1002,7 +1076,7 @@ function SelectWidget(props) {
|
|
|
1002
1076
|
isDisabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1
|
|
1003
1077
|
};
|
|
1004
1078
|
}) : [];
|
|
1005
|
-
var isMultiple = typeof multiple !==
|
|
1079
|
+
var isMultiple = typeof multiple !== 'undefined' && Boolean(enumOptions);
|
|
1006
1080
|
var selectedIndex = enumOptionsIndexForValue(value, enumOptions, isMultiple);
|
|
1007
1081
|
var formValue = isMultiple ? (selectedIndex || []).map(function (i) {
|
|
1008
1082
|
return {
|
|
@@ -1010,31 +1084,33 @@ function SelectWidget(props) {
|
|
|
1010
1084
|
value: i
|
|
1011
1085
|
};
|
|
1012
1086
|
}) : {
|
|
1013
|
-
label: _valueLabelMap[selectedIndex] ||
|
|
1087
|
+
label: _valueLabelMap[selectedIndex] || '',
|
|
1014
1088
|
selectedIndex: selectedIndex
|
|
1015
1089
|
};
|
|
1016
|
-
return
|
|
1090
|
+
return jsxs(FormControl, _extends({
|
|
1017
1091
|
mb: 1
|
|
1018
1092
|
}, chakraProps, {
|
|
1019
1093
|
isDisabled: disabled || readonly,
|
|
1020
1094
|
isRequired: required,
|
|
1021
1095
|
isReadOnly: readonly,
|
|
1022
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
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
|
+
})]
|
|
1038
1114
|
}));
|
|
1039
1115
|
}
|
|
1040
1116
|
|
|
@@ -1062,7 +1138,7 @@ function TextareaWidget(_ref) {
|
|
|
1062
1138
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1063
1139
|
var _onChange = function _onChange(_ref2) {
|
|
1064
1140
|
var value = _ref2.target.value;
|
|
1065
|
-
return onChange(value ===
|
|
1141
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
1066
1142
|
};
|
|
1067
1143
|
var _onBlur = function _onBlur(_ref3) {
|
|
1068
1144
|
var value = _ref3.target.value;
|
|
@@ -1072,25 +1148,27 @@ function TextareaWidget(_ref) {
|
|
|
1072
1148
|
var value = _ref4.target.value;
|
|
1073
1149
|
return onFocus(id, value);
|
|
1074
1150
|
};
|
|
1075
|
-
return
|
|
1151
|
+
return jsxs(FormControl, _extends({
|
|
1076
1152
|
mb: 1
|
|
1077
1153
|
}, chakraProps, {
|
|
1078
1154
|
isDisabled: disabled || readonly,
|
|
1079
1155
|
isRequired: required,
|
|
1080
1156
|
isReadOnly: readonly,
|
|
1081
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
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
|
+
})]
|
|
1094
1172
|
}));
|
|
1095
1173
|
}
|
|
1096
1174
|
|
|
@@ -1124,25 +1202,30 @@ function UpDownWidget(props) {
|
|
|
1124
1202
|
var value = _ref2.target.value;
|
|
1125
1203
|
return onFocus(id, value);
|
|
1126
1204
|
};
|
|
1127
|
-
return
|
|
1205
|
+
return jsxs(FormControl, _extends({
|
|
1128
1206
|
mb: 1
|
|
1129
1207
|
}, chakraProps, {
|
|
1130
1208
|
isDisabled: disabled || readonly,
|
|
1131
1209
|
isRequired: required,
|
|
1132
1210
|
isReadOnly: readonly,
|
|
1133
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
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
|
+
}));
|
|
1146
1229
|
}
|
|
1147
1230
|
|
|
1148
1231
|
function generateWidgets() {
|
|
@@ -1195,7 +1278,7 @@ var Form = /*#__PURE__*/generateForm();
|
|
|
1195
1278
|
It is located at the bottom of the styles string.
|
|
1196
1279
|
*/
|
|
1197
1280
|
var CSSReset = function CSSReset() {
|
|
1198
|
-
return
|
|
1281
|
+
return jsx(Global, {
|
|
1199
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 "
|
|
1200
1283
|
});
|
|
1201
1284
|
};
|
|
@@ -1217,22 +1300,25 @@ var CSSReset = function CSSReset() {
|
|
|
1217
1300
|
var memoizedCreateCacheWithContainer = /*#__PURE__*/weakMemoize(function (container) {
|
|
1218
1301
|
var newCache = createCache({
|
|
1219
1302
|
container: container,
|
|
1220
|
-
key:
|
|
1303
|
+
key: 'rjsf'
|
|
1221
1304
|
});
|
|
1222
1305
|
return newCache;
|
|
1223
1306
|
});
|
|
1224
1307
|
var __createChakraFrameProvider = function __createChakraFrameProvider(props) {
|
|
1225
1308
|
return function (_ref) {
|
|
1226
1309
|
var document = _ref.document;
|
|
1227
|
-
return
|
|
1310
|
+
return jsx("div", {
|
|
1228
1311
|
style: {
|
|
1229
1312
|
margin: 2
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
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
|
+
});
|
|
1236
1322
|
};
|
|
1237
1323
|
};
|
|
1238
1324
|
|