@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
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
|
-
import { AddIcon, WarningIcon, ArrowDownIcon, ArrowUpIcon, DeleteIcon } from '@chakra-ui/icons';
|
|
5
|
+
import { AddIcon, WarningIcon, CopyIcon, 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,28 +41,36 @@ 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) {
|
|
50
52
|
var children = props.children,
|
|
51
53
|
disabled = props.disabled,
|
|
52
54
|
hasToolbar = props.hasToolbar,
|
|
55
|
+
hasCopy = props.hasCopy,
|
|
53
56
|
hasMoveDown = props.hasMoveDown,
|
|
54
57
|
hasMoveUp = props.hasMoveUp,
|
|
55
58
|
hasRemove = props.hasRemove,
|
|
56
59
|
index = props.index,
|
|
60
|
+
onCopyIndexClick = props.onCopyIndexClick,
|
|
57
61
|
onDropIndexClick = props.onDropIndexClick,
|
|
58
62
|
onReorderClick = props.onReorderClick,
|
|
59
63
|
readonly = props.readonly,
|
|
60
64
|
uiSchema = props.uiSchema,
|
|
61
65
|
registry = props.registry;
|
|
62
66
|
var _registry$templates$B = registry.templates.ButtonTemplates,
|
|
67
|
+
CopyButton = _registry$templates$B.CopyButton,
|
|
63
68
|
MoveDownButton = _registry$templates$B.MoveDownButton,
|
|
64
69
|
MoveUpButton = _registry$templates$B.MoveUpButton,
|
|
65
70
|
RemoveButton = _registry$templates$B.RemoveButton;
|
|
71
|
+
var onCopyClick = useMemo(function () {
|
|
72
|
+
return onCopyIndexClick(index);
|
|
73
|
+
}, [index, onCopyIndexClick]);
|
|
66
74
|
var onRemoveClick = useMemo(function () {
|
|
67
75
|
return onDropIndexClick(index);
|
|
68
76
|
}, [index, onDropIndexClick]);
|
|
@@ -72,30 +80,40 @@ function ArrayFieldItemTemplate(props) {
|
|
|
72
80
|
var onArrowDownClick = useMemo(function () {
|
|
73
81
|
return onReorderClick(index, index + 1);
|
|
74
82
|
}, [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
|
-
|
|
83
|
+
return jsxs(HStack, {
|
|
84
|
+
alignItems: 'flex-end',
|
|
85
|
+
py: 1,
|
|
86
|
+
children: [jsx(Box, {
|
|
87
|
+
w: '100%',
|
|
88
|
+
children: children
|
|
89
|
+
}), hasToolbar && jsx(Box, {
|
|
90
|
+
children: jsxs(ButtonGroup, {
|
|
91
|
+
isAttached: true,
|
|
92
|
+
mb: 1,
|
|
93
|
+
children: [(hasMoveUp || hasMoveDown) && jsx(MoveUpButton, {
|
|
94
|
+
disabled: disabled || readonly || !hasMoveUp,
|
|
95
|
+
onClick: onArrowUpClick,
|
|
96
|
+
uiSchema: uiSchema,
|
|
97
|
+
registry: registry
|
|
98
|
+
}), (hasMoveUp || hasMoveDown) && jsx(MoveDownButton, {
|
|
99
|
+
disabled: disabled || readonly || !hasMoveDown,
|
|
100
|
+
onClick: onArrowDownClick,
|
|
101
|
+
uiSchema: uiSchema,
|
|
102
|
+
registry: registry
|
|
103
|
+
}), hasCopy && jsx(CopyButton, {
|
|
104
|
+
disabled: disabled || readonly,
|
|
105
|
+
onClick: onCopyClick,
|
|
106
|
+
uiSchema: uiSchema,
|
|
107
|
+
registry: registry
|
|
108
|
+
}), hasRemove && jsx(RemoveButton, {
|
|
109
|
+
disabled: disabled || readonly,
|
|
110
|
+
onClick: onRemoveClick,
|
|
111
|
+
uiSchema: uiSchema,
|
|
112
|
+
registry: registry
|
|
113
|
+
})]
|
|
114
|
+
})
|
|
115
|
+
})]
|
|
116
|
+
});
|
|
99
117
|
}
|
|
100
118
|
|
|
101
119
|
var _excluded$1 = ["key"];
|
|
@@ -112,49 +130,53 @@ function ArrayFieldTemplate(props) {
|
|
|
112
130
|
schema = props.schema,
|
|
113
131
|
title = props.title;
|
|
114
132
|
var uiOptions = getUiOptions(uiSchema);
|
|
115
|
-
var ArrayFieldDescriptionTemplate = getTemplate(
|
|
116
|
-
var ArrayFieldItemTemplate = getTemplate(
|
|
117
|
-
var ArrayFieldTitleTemplate = getTemplate(
|
|
133
|
+
var ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
134
|
+
var ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
135
|
+
var ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
118
136
|
// Button templates are not overridden in the uiSchema
|
|
119
137
|
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
|
-
|
|
138
|
+
return jsxs(Box, {
|
|
139
|
+
children: [jsx(ArrayFieldTitleTemplate, {
|
|
140
|
+
idSchema: idSchema,
|
|
141
|
+
title: uiOptions.title || title,
|
|
142
|
+
schema: schema,
|
|
143
|
+
uiSchema: uiSchema,
|
|
144
|
+
required: required,
|
|
145
|
+
registry: registry
|
|
146
|
+
}), jsx(ArrayFieldDescriptionTemplate, {
|
|
147
|
+
idSchema: idSchema,
|
|
148
|
+
description: uiOptions.description || schema.description,
|
|
149
|
+
schema: schema,
|
|
150
|
+
uiSchema: uiSchema,
|
|
151
|
+
registry: registry
|
|
152
|
+
}), jsxs(Grid, {
|
|
153
|
+
children: [jsx(GridItem, {
|
|
154
|
+
children: items.length > 0 && items.map(function (_ref) {
|
|
155
|
+
var key = _ref.key,
|
|
156
|
+
itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
157
|
+
return jsx(ArrayFieldItemTemplate, _extends({}, itemProps), key);
|
|
158
|
+
})
|
|
159
|
+
}), canAdd && jsx(GridItem, {
|
|
160
|
+
justifySelf: 'flex-end',
|
|
161
|
+
children: jsx(Box, {
|
|
162
|
+
mt: 2,
|
|
163
|
+
children: jsx(AddButton, {
|
|
164
|
+
className: 'array-item-add',
|
|
165
|
+
onClick: onAddClick,
|
|
166
|
+
disabled: disabled || readonly,
|
|
167
|
+
uiSchema: uiSchema,
|
|
168
|
+
registry: registry
|
|
169
|
+
})
|
|
170
|
+
})
|
|
171
|
+
})]
|
|
172
|
+
}, "array-item-list-" + idSchema.$id)]
|
|
173
|
+
});
|
|
152
174
|
}
|
|
153
175
|
|
|
154
176
|
function getChakra(_ref) {
|
|
155
177
|
var _ref$uiSchema = _ref.uiSchema,
|
|
156
178
|
uiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema;
|
|
157
|
-
var chakraProps = uiSchema[
|
|
179
|
+
var chakraProps = uiSchema['ui:options'] && uiSchema['ui:options'].chakra || {};
|
|
158
180
|
Object.keys(chakraProps).forEach(function (key) {
|
|
159
181
|
/**
|
|
160
182
|
* Leveraging `shouldForwardProp` to remove props
|
|
@@ -178,6 +200,7 @@ function BaseInputTemplate(props) {
|
|
|
178
200
|
schema = props.schema,
|
|
179
201
|
uiSchema = props.uiSchema,
|
|
180
202
|
onChange = props.onChange,
|
|
203
|
+
onChangeOverride = props.onChangeOverride,
|
|
181
204
|
onBlur = props.onBlur,
|
|
182
205
|
onFocus = props.onFocus,
|
|
183
206
|
options = props.options,
|
|
@@ -195,7 +218,7 @@ function BaseInputTemplate(props) {
|
|
|
195
218
|
var schemaUtils = registry.schemaUtils;
|
|
196
219
|
var _onChange = function _onChange(_ref) {
|
|
197
220
|
var value = _ref.target.value;
|
|
198
|
-
return onChange(value ===
|
|
221
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
199
222
|
};
|
|
200
223
|
var _onBlur = function _onBlur(_ref2) {
|
|
201
224
|
var value = _ref2.target.value;
|
|
@@ -206,36 +229,38 @@ function BaseInputTemplate(props) {
|
|
|
206
229
|
return onFocus(id, value);
|
|
207
230
|
};
|
|
208
231
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
209
|
-
return
|
|
232
|
+
return jsxs(FormControl, _extends({
|
|
210
233
|
mb: 1
|
|
211
234
|
}, chakraProps, {
|
|
212
235
|
isDisabled: disabled || readonly,
|
|
213
236
|
isRequired: required,
|
|
214
237
|
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
|
-
|
|
238
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
239
|
+
children: [displayLabel ? jsx(FormLabel, {
|
|
240
|
+
htmlFor: id,
|
|
241
|
+
id: id + "-label",
|
|
242
|
+
children: label || schema.title
|
|
243
|
+
}) : null, jsx(Input, _extends({
|
|
244
|
+
id: id,
|
|
245
|
+
name: id,
|
|
246
|
+
value: value || value === 0 ? value : '',
|
|
247
|
+
onChange: onChangeOverride || _onChange,
|
|
248
|
+
onBlur: _onBlur,
|
|
249
|
+
onFocus: _onFocus,
|
|
250
|
+
autoFocus: autofocus,
|
|
251
|
+
placeholder: placeholder
|
|
252
|
+
}, inputProps, {
|
|
253
|
+
list: schema.examples ? examplesId(id) : undefined,
|
|
254
|
+
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
255
|
+
})), Array.isArray(schema.examples) ? jsx("datalist", {
|
|
256
|
+
id: examplesId(id),
|
|
257
|
+
children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
|
|
258
|
+
return jsx("option", {
|
|
259
|
+
value: example
|
|
260
|
+
}, example);
|
|
261
|
+
})
|
|
262
|
+
}) : null]
|
|
263
|
+
}));
|
|
239
264
|
}
|
|
240
265
|
|
|
241
266
|
function DescriptionField(_ref) {
|
|
@@ -244,70 +269,86 @@ function DescriptionField(_ref) {
|
|
|
244
269
|
if (!description) {
|
|
245
270
|
return null;
|
|
246
271
|
}
|
|
247
|
-
if (typeof description ===
|
|
248
|
-
return
|
|
272
|
+
if (typeof description === 'string') {
|
|
273
|
+
return jsx(Text, {
|
|
249
274
|
id: id,
|
|
250
275
|
mt: 2,
|
|
251
|
-
mb: 4
|
|
252
|
-
|
|
276
|
+
mb: 4,
|
|
277
|
+
children: description
|
|
278
|
+
});
|
|
253
279
|
}
|
|
254
|
-
return
|
|
280
|
+
return jsx(Fragment, {
|
|
281
|
+
children: description
|
|
282
|
+
});
|
|
255
283
|
}
|
|
256
284
|
|
|
257
285
|
function ErrorList(_ref) {
|
|
258
286
|
var errors = _ref.errors,
|
|
259
287
|
registry = _ref.registry;
|
|
260
288
|
var translateString = registry.translateString;
|
|
261
|
-
return
|
|
262
|
-
flexDirection:
|
|
263
|
-
alignItems:
|
|
289
|
+
return jsxs(Alert, {
|
|
290
|
+
flexDirection: 'column',
|
|
291
|
+
alignItems: 'flex-start',
|
|
264
292
|
gap: 3,
|
|
265
|
-
status:
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
293
|
+
status: 'error',
|
|
294
|
+
children: [jsx(AlertTitle, {
|
|
295
|
+
children: translateString(TranslatableString.ErrorsLabel)
|
|
296
|
+
}), jsx(List, {
|
|
297
|
+
children: errors.map(function (error, i) {
|
|
298
|
+
return jsxs(ListItem, {
|
|
299
|
+
children: [jsx(ListIcon, {
|
|
300
|
+
as: WarningIcon,
|
|
301
|
+
color: 'red.500'
|
|
302
|
+
}), error.stack]
|
|
303
|
+
}, i);
|
|
304
|
+
})
|
|
305
|
+
})]
|
|
306
|
+
});
|
|
274
307
|
}
|
|
275
308
|
|
|
276
309
|
var _excluded = ["icon", "iconType", "uiSchema", "registry"];
|
|
277
310
|
function ChakraIconButton(props) {
|
|
278
311
|
var icon = props.icon,
|
|
279
312
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
280
|
-
return
|
|
313
|
+
return jsx(IconButton, _extends({
|
|
281
314
|
"aria-label": props.title
|
|
282
315
|
}, otherProps, {
|
|
283
316
|
icon: icon
|
|
284
317
|
}));
|
|
285
318
|
}
|
|
286
|
-
ChakraIconButton.displayName =
|
|
287
|
-
var ChakraIconButton$1 = /*#__PURE__*/
|
|
319
|
+
ChakraIconButton.displayName = 'ChakraIconButton';
|
|
320
|
+
var ChakraIconButton$1 = /*#__PURE__*/memo(ChakraIconButton);
|
|
288
321
|
|
|
322
|
+
function CopyButton(props) {
|
|
323
|
+
var translateString = props.registry.translateString;
|
|
324
|
+
return jsx(ChakraIconButton$1, _extends({
|
|
325
|
+
title: translateString(TranslatableString.CopyButton)
|
|
326
|
+
}, props, {
|
|
327
|
+
icon: jsx(CopyIcon, {})
|
|
328
|
+
}));
|
|
329
|
+
}
|
|
289
330
|
function MoveDownButton(props) {
|
|
290
331
|
var translateString = props.registry.translateString;
|
|
291
|
-
return
|
|
332
|
+
return jsx(ChakraIconButton$1, _extends({
|
|
292
333
|
title: translateString(TranslatableString.MoveDownButton)
|
|
293
334
|
}, props, {
|
|
294
|
-
icon:
|
|
335
|
+
icon: jsx(ArrowDownIcon, {})
|
|
295
336
|
}));
|
|
296
337
|
}
|
|
297
338
|
function MoveUpButton(props) {
|
|
298
339
|
var translateString = props.registry.translateString;
|
|
299
|
-
return
|
|
340
|
+
return jsx(ChakraIconButton$1, _extends({
|
|
300
341
|
title: translateString(TranslatableString.MoveUpButton)
|
|
301
342
|
}, props, {
|
|
302
|
-
icon:
|
|
343
|
+
icon: jsx(ArrowUpIcon, {})
|
|
303
344
|
}));
|
|
304
345
|
}
|
|
305
346
|
function RemoveButton(props) {
|
|
306
347
|
var translateString = props.registry.translateString;
|
|
307
|
-
return
|
|
348
|
+
return jsx(ChakraIconButton$1, _extends({
|
|
308
349
|
title: translateString(TranslatableString.RemoveButton)
|
|
309
350
|
}, props, {
|
|
310
|
-
icon:
|
|
351
|
+
icon: jsx(DeleteIcon, {})
|
|
311
352
|
}));
|
|
312
353
|
}
|
|
313
354
|
|
|
@@ -323,13 +364,16 @@ function FieldErrorTemplate(props) {
|
|
|
323
364
|
return null;
|
|
324
365
|
}
|
|
325
366
|
var id = errorId(idSchema);
|
|
326
|
-
return
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
367
|
+
return jsx(List, {
|
|
368
|
+
children: errors.map(function (error, i) {
|
|
369
|
+
return jsx(ListItem, {
|
|
370
|
+
children: jsx(FormErrorMessage, {
|
|
371
|
+
id: id,
|
|
372
|
+
children: error
|
|
373
|
+
})
|
|
374
|
+
}, i);
|
|
375
|
+
})
|
|
376
|
+
});
|
|
333
377
|
}
|
|
334
378
|
|
|
335
379
|
/** The `FieldHelpTemplate` component renders any help desired for a field
|
|
@@ -343,9 +387,10 @@ function FieldHelpTemplate(props) {
|
|
|
343
387
|
return null;
|
|
344
388
|
}
|
|
345
389
|
var id = helpId(idSchema);
|
|
346
|
-
return
|
|
347
|
-
id: id
|
|
348
|
-
|
|
390
|
+
return jsx(FormHelperText, {
|
|
391
|
+
id: id,
|
|
392
|
+
children: help
|
|
393
|
+
});
|
|
349
394
|
}
|
|
350
395
|
|
|
351
396
|
function FieldTemplate(props) {
|
|
@@ -370,15 +415,16 @@ function FieldTemplate(props) {
|
|
|
370
415
|
schema = props.schema,
|
|
371
416
|
uiSchema = props.uiSchema;
|
|
372
417
|
var uiOptions = getUiOptions(uiSchema);
|
|
373
|
-
var WrapIfAdditionalTemplate = getTemplate(
|
|
418
|
+
var WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
|
|
374
419
|
if (hidden) {
|
|
375
|
-
return
|
|
420
|
+
return jsx("div", {
|
|
376
421
|
style: {
|
|
377
|
-
display:
|
|
378
|
-
}
|
|
379
|
-
|
|
422
|
+
display: 'none'
|
|
423
|
+
},
|
|
424
|
+
children: children
|
|
425
|
+
});
|
|
380
426
|
}
|
|
381
|
-
return
|
|
427
|
+
return jsx(WrapIfAdditionalTemplate, {
|
|
382
428
|
classNames: classNames,
|
|
383
429
|
style: style,
|
|
384
430
|
disabled: disabled,
|
|
@@ -390,13 +436,16 @@ function FieldTemplate(props) {
|
|
|
390
436
|
required: required,
|
|
391
437
|
schema: schema,
|
|
392
438
|
uiSchema: uiSchema,
|
|
393
|
-
registry: registry
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
439
|
+
registry: registry,
|
|
440
|
+
children: jsxs(FormControl, {
|
|
441
|
+
isRequired: required,
|
|
442
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
443
|
+
children: [children, displayLabel && rawDescription ? jsx(Text, {
|
|
444
|
+
mt: 2,
|
|
445
|
+
children: rawDescription
|
|
446
|
+
}) : null, errors, help]
|
|
447
|
+
})
|
|
448
|
+
});
|
|
400
449
|
}
|
|
401
450
|
|
|
402
451
|
function ObjectFieldTemplate(props) {
|
|
@@ -413,39 +462,43 @@ function ObjectFieldTemplate(props) {
|
|
|
413
462
|
onAddClick = props.onAddClick,
|
|
414
463
|
registry = props.registry;
|
|
415
464
|
var uiOptions = getUiOptions(uiSchema);
|
|
416
|
-
var TitleFieldTemplate = getTemplate(
|
|
417
|
-
var DescriptionFieldTemplate = getTemplate(
|
|
465
|
+
var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
|
|
466
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
|
|
418
467
|
// Button templates are not overridden in the uiSchema
|
|
419
468
|
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
|
-
|
|
469
|
+
return jsxs(Fragment, {
|
|
470
|
+
children: [(uiOptions.title || title) && jsx(TitleFieldTemplate, {
|
|
471
|
+
id: titleId(idSchema),
|
|
472
|
+
title: uiOptions.title || title,
|
|
473
|
+
required: required,
|
|
474
|
+
schema: schema,
|
|
475
|
+
uiSchema: uiSchema,
|
|
476
|
+
registry: registry
|
|
477
|
+
}), (uiOptions.description || description) && jsx(DescriptionFieldTemplate, {
|
|
478
|
+
id: descriptionId(idSchema),
|
|
479
|
+
description: uiOptions.description || description,
|
|
480
|
+
schema: schema,
|
|
481
|
+
uiSchema: uiSchema,
|
|
482
|
+
registry: registry
|
|
483
|
+
}), jsxs(Grid, {
|
|
484
|
+
gap: description ? 2 : 6,
|
|
485
|
+
mb: 4,
|
|
486
|
+
children: [properties.map(function (element, index) {
|
|
487
|
+
return element.hidden ? element.content : jsx(GridItem, {
|
|
488
|
+
children: element.content
|
|
489
|
+
}, idSchema.$id + "-" + element.name + "-" + index);
|
|
490
|
+
}), canExpand(schema, uiSchema, formData) && jsx(GridItem, {
|
|
491
|
+
justifySelf: 'flex-end',
|
|
492
|
+
children: jsx(AddButton, {
|
|
493
|
+
className: 'object-property-expand',
|
|
494
|
+
onClick: onAddClick(schema),
|
|
495
|
+
disabled: disabled || readonly,
|
|
496
|
+
uiSchema: uiSchema,
|
|
497
|
+
registry: registry
|
|
498
|
+
})
|
|
499
|
+
})]
|
|
500
|
+
})]
|
|
501
|
+
});
|
|
449
502
|
}
|
|
450
503
|
|
|
451
504
|
function SubmitButton(_ref) {
|
|
@@ -457,24 +510,29 @@ function SubmitButton(_ref) {
|
|
|
457
510
|
if (norender) {
|
|
458
511
|
return null;
|
|
459
512
|
}
|
|
460
|
-
return
|
|
461
|
-
marginTop: 3
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
513
|
+
return jsx(Box, {
|
|
514
|
+
marginTop: 3,
|
|
515
|
+
children: jsx(Button, _extends({
|
|
516
|
+
type: 'submit',
|
|
517
|
+
variant: 'solid'
|
|
518
|
+
}, submitButtonProps, {
|
|
519
|
+
children: submitText
|
|
520
|
+
}))
|
|
521
|
+
});
|
|
466
522
|
}
|
|
467
523
|
|
|
468
524
|
function TitleField(_ref) {
|
|
469
525
|
var id = _ref.id,
|
|
470
526
|
title = _ref.title;
|
|
471
|
-
return
|
|
527
|
+
return jsxs(Box, {
|
|
472
528
|
id: id,
|
|
473
529
|
mt: 1,
|
|
474
|
-
mb: 4
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
530
|
+
mb: 4,
|
|
531
|
+
children: [jsx(Heading, {
|
|
532
|
+
as: 'h5',
|
|
533
|
+
children: title
|
|
534
|
+
}), jsx(Divider, {})]
|
|
535
|
+
});
|
|
478
536
|
}
|
|
479
537
|
|
|
480
538
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -498,40 +556,49 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
498
556
|
var keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
499
557
|
var additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
500
558
|
if (!additional) {
|
|
501
|
-
return
|
|
559
|
+
return jsx("div", {
|
|
502
560
|
className: classNames,
|
|
503
|
-
style: style
|
|
504
|
-
|
|
561
|
+
style: style,
|
|
562
|
+
children: children
|
|
563
|
+
});
|
|
505
564
|
}
|
|
506
565
|
var handleBlur = function handleBlur(_ref) {
|
|
507
566
|
var target = _ref.target;
|
|
508
567
|
return onKeyChange(target.value);
|
|
509
568
|
};
|
|
510
|
-
return
|
|
511
|
-
key: id + "-key",
|
|
569
|
+
return jsxs(Grid, {
|
|
512
570
|
className: classNames,
|
|
513
571
|
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
|
-
|
|
572
|
+
alignItems: 'center',
|
|
573
|
+
gap: 2,
|
|
574
|
+
children: [jsx(GridItem, {
|
|
575
|
+
children: jsxs(FormControl, {
|
|
576
|
+
isRequired: required,
|
|
577
|
+
children: [jsx(FormLabel, {
|
|
578
|
+
htmlFor: id + "-key",
|
|
579
|
+
id: id + "-key-label",
|
|
580
|
+
children: keyLabel
|
|
581
|
+
}), jsx(Input, {
|
|
582
|
+
defaultValue: label,
|
|
583
|
+
disabled: disabled || readonly,
|
|
584
|
+
id: id + "-key",
|
|
585
|
+
name: id + "-key",
|
|
586
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
587
|
+
type: 'text',
|
|
588
|
+
mb: 1
|
|
589
|
+
})]
|
|
590
|
+
})
|
|
591
|
+
}), jsx(GridItem, {
|
|
592
|
+
children: children
|
|
593
|
+
}), jsx(GridItem, {
|
|
594
|
+
children: jsx(RemoveButton, {
|
|
595
|
+
disabled: disabled || readonly,
|
|
596
|
+
onClick: onDropPropertyClick(label),
|
|
597
|
+
uiSchema: uiSchema,
|
|
598
|
+
registry: registry
|
|
599
|
+
})
|
|
600
|
+
})]
|
|
601
|
+
}, id + "-key");
|
|
535
602
|
}
|
|
536
603
|
|
|
537
604
|
function generateTemplates() {
|
|
@@ -540,6 +607,7 @@ function generateTemplates() {
|
|
|
540
607
|
ArrayFieldTemplate: ArrayFieldTemplate,
|
|
541
608
|
BaseInputTemplate: BaseInputTemplate,
|
|
542
609
|
ButtonTemplates: {
|
|
610
|
+
CopyButton: CopyButton,
|
|
543
611
|
AddButton: AddButton,
|
|
544
612
|
MoveDownButton: MoveDownButton,
|
|
545
613
|
MoveUpButton: MoveUpButton,
|
|
@@ -571,9 +639,9 @@ var rangeOptions = function rangeOptions(start, stop) {
|
|
|
571
639
|
function DateElement(props) {
|
|
572
640
|
var SelectWidget = props.registry.widgets.SelectWidget;
|
|
573
641
|
var value = props.value ? props.value : undefined;
|
|
574
|
-
return
|
|
575
|
-
label:
|
|
576
|
-
className:
|
|
642
|
+
return jsx(SelectWidget, _extends({}, props, {
|
|
643
|
+
label: '',
|
|
644
|
+
className: 'form-control',
|
|
577
645
|
onChange: function onChange(elemValue) {
|
|
578
646
|
return props.select(props.type, elemValue);
|
|
579
647
|
},
|
|
@@ -582,7 +650,7 @@ function DateElement(props) {
|
|
|
582
650
|
},
|
|
583
651
|
placeholder: props.type,
|
|
584
652
|
schema: {
|
|
585
|
-
type:
|
|
653
|
+
type: 'integer'
|
|
586
654
|
},
|
|
587
655
|
value: value,
|
|
588
656
|
"aria-describedby": ariaDescribedByIds(props.name)
|
|
@@ -590,7 +658,7 @@ function DateElement(props) {
|
|
|
590
658
|
}
|
|
591
659
|
var readyForChange = function readyForChange(state) {
|
|
592
660
|
return Object.keys(state).every(function (key) {
|
|
593
|
-
return typeof state[key] !==
|
|
661
|
+
return typeof state[key] !== 'undefined' && state[key] !== -1;
|
|
594
662
|
});
|
|
595
663
|
};
|
|
596
664
|
function AltDateWidget(props) {
|
|
@@ -614,7 +682,7 @@ function AltDateWidget(props) {
|
|
|
614
682
|
}, [showTime, value]);
|
|
615
683
|
var handleChange = function handleChange(property, nextValue) {
|
|
616
684
|
var _extends2;
|
|
617
|
-
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue ===
|
|
685
|
+
var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === 'undefined' ? -1 : nextValue, _extends2));
|
|
618
686
|
if (readyForChange(nextState)) {
|
|
619
687
|
onChange(toDateString(nextState, showTime));
|
|
620
688
|
} else {
|
|
@@ -644,70 +712,76 @@ function AltDateWidget(props) {
|
|
|
644
712
|
minute = state.minute,
|
|
645
713
|
second = state.second;
|
|
646
714
|
var data = [{
|
|
647
|
-
type:
|
|
715
|
+
type: 'year',
|
|
648
716
|
range: options.yearsRange,
|
|
649
717
|
value: year
|
|
650
718
|
}, {
|
|
651
|
-
type:
|
|
719
|
+
type: 'month',
|
|
652
720
|
range: [1, 12],
|
|
653
721
|
value: month
|
|
654
722
|
}, {
|
|
655
|
-
type:
|
|
723
|
+
type: 'day',
|
|
656
724
|
range: [1, 31],
|
|
657
725
|
value: day
|
|
658
726
|
}];
|
|
659
727
|
if (showTime) {
|
|
660
728
|
data.push({
|
|
661
|
-
type:
|
|
729
|
+
type: 'hour',
|
|
662
730
|
range: [0, 23],
|
|
663
731
|
value: hour
|
|
664
732
|
}, {
|
|
665
|
-
type:
|
|
733
|
+
type: 'minute',
|
|
666
734
|
range: [0, 59],
|
|
667
735
|
value: minute
|
|
668
736
|
}, {
|
|
669
|
-
type:
|
|
737
|
+
type: 'second',
|
|
670
738
|
range: [0, 59],
|
|
671
739
|
value: second
|
|
672
740
|
});
|
|
673
741
|
}
|
|
674
742
|
return data;
|
|
675
743
|
};
|
|
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
|
-
|
|
744
|
+
return jsxs(Box, {
|
|
745
|
+
children: [jsx(Box, {
|
|
746
|
+
display: 'flex',
|
|
747
|
+
flexWrap: 'wrap',
|
|
748
|
+
alignItems: 'center',
|
|
749
|
+
justify: 'center',
|
|
750
|
+
children: dateElementProps().map(function (elemProps, i) {
|
|
751
|
+
var elemId = id + '_' + elemProps.type;
|
|
752
|
+
return jsx(Box, {
|
|
753
|
+
mr: '2',
|
|
754
|
+
mb: '2',
|
|
755
|
+
children: jsx(DateElement, _extends({}, props, elemProps, {
|
|
756
|
+
autofocus: autofocus && i === 0,
|
|
757
|
+
disabled: disabled,
|
|
758
|
+
id: elemId,
|
|
759
|
+
name: id,
|
|
760
|
+
onBlur: onBlur,
|
|
761
|
+
onFocus: onFocus,
|
|
762
|
+
readonly: readonly,
|
|
763
|
+
registry: registry,
|
|
764
|
+
select: handleChange,
|
|
765
|
+
value: elemProps.value < 0 ? '' : elemProps.value
|
|
766
|
+
}))
|
|
767
|
+
}, elemId);
|
|
768
|
+
})
|
|
769
|
+
}), jsxs(Box, {
|
|
770
|
+
display: 'flex',
|
|
771
|
+
children: [!options.hideNowButton && jsx(Button, {
|
|
772
|
+
onClick: function onClick(e) {
|
|
773
|
+
return handleNow(e);
|
|
774
|
+
},
|
|
775
|
+
mr: '2',
|
|
776
|
+
children: translateString(TranslatableString.NowLabel)
|
|
777
|
+
}), !options.hideClearButton && jsx(Button, {
|
|
778
|
+
onClick: function onClick(e) {
|
|
779
|
+
return handleClear(e);
|
|
780
|
+
},
|
|
781
|
+
children: translateString(TranslatableString.ClearLabel)
|
|
782
|
+
})]
|
|
783
|
+
})]
|
|
784
|
+
});
|
|
711
785
|
}
|
|
712
786
|
AltDateWidget.defaultProps = {
|
|
713
787
|
autofocus: false,
|
|
@@ -721,7 +795,7 @@ AltDateWidget.defaultProps = {
|
|
|
721
795
|
|
|
722
796
|
function AltDateTimeWidget(props) {
|
|
723
797
|
var AltDateWidget = props.registry.widgets.AltDateWidget;
|
|
724
|
-
return
|
|
798
|
+
return jsx(AltDateWidget, _extends({}, props, {
|
|
725
799
|
showTime: true
|
|
726
800
|
}));
|
|
727
801
|
}
|
|
@@ -759,20 +833,24 @@ function CheckboxWidget(props) {
|
|
|
759
833
|
var value = _ref3.target.value;
|
|
760
834
|
return onFocus(id, value);
|
|
761
835
|
};
|
|
762
|
-
return
|
|
836
|
+
return jsx(FormControl, _extends({
|
|
763
837
|
mb: 1
|
|
764
838
|
}, chakraProps, {
|
|
765
|
-
isRequired: required
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
839
|
+
isRequired: required,
|
|
840
|
+
children: jsx(Checkbox, {
|
|
841
|
+
id: id,
|
|
842
|
+
name: id,
|
|
843
|
+
isChecked: typeof value === 'undefined' ? false : value,
|
|
844
|
+
isDisabled: disabled || readonly,
|
|
845
|
+
onChange: _onChange,
|
|
846
|
+
onBlur: _onBlur,
|
|
847
|
+
onFocus: _onFocus,
|
|
848
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
849
|
+
children: label && jsx(Text, {
|
|
850
|
+
children: label
|
|
851
|
+
})
|
|
852
|
+
})
|
|
853
|
+
}));
|
|
776
854
|
}
|
|
777
855
|
|
|
778
856
|
function CheckboxesWidget(props) {
|
|
@@ -807,38 +885,44 @@ function CheckboxesWidget(props) {
|
|
|
807
885
|
};
|
|
808
886
|
var row = options ? options.inline : false;
|
|
809
887
|
var selectedIndexes = enumOptionsIndexForValue(value, enumOptions, true);
|
|
810
|
-
return
|
|
888
|
+
return jsxs(FormControl, _extends({
|
|
811
889
|
mb: 1
|
|
812
890
|
}, chakraProps, {
|
|
813
891
|
isDisabled: disabled || readonly,
|
|
814
892
|
isRequired: required,
|
|
815
893
|
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
|
-
|
|
894
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
895
|
+
children: [jsx(FormLabel, {
|
|
896
|
+
htmlFor: id,
|
|
897
|
+
id: id + "-label",
|
|
898
|
+
children: label || schema.title
|
|
899
|
+
}), jsx(CheckboxGroup, {
|
|
900
|
+
onChange: function onChange(option) {
|
|
901
|
+
return _onChange(enumOptionsValueForIndex(option, enumOptions, emptyValue));
|
|
902
|
+
},
|
|
903
|
+
defaultValue: selectedIndexes,
|
|
904
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
905
|
+
children: jsx(Stack, {
|
|
906
|
+
direction: row ? 'row' : 'column',
|
|
907
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
908
|
+
var checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
909
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
910
|
+
return jsx(Checkbox, {
|
|
911
|
+
id: optionId(id, index),
|
|
912
|
+
name: id,
|
|
913
|
+
value: String(index),
|
|
914
|
+
isChecked: checked,
|
|
915
|
+
isDisabled: disabled || itemDisabled || readonly,
|
|
916
|
+
onBlur: _onBlur,
|
|
917
|
+
onFocus: _onFocus,
|
|
918
|
+
children: option.label && jsx(Text, {
|
|
919
|
+
children: option.label
|
|
920
|
+
})
|
|
921
|
+
}, index);
|
|
922
|
+
})
|
|
923
|
+
})
|
|
924
|
+
})]
|
|
925
|
+
}));
|
|
842
926
|
}
|
|
843
927
|
|
|
844
928
|
function RadioWidget(_ref) {
|
|
@@ -873,33 +957,37 @@ function RadioWidget(_ref) {
|
|
|
873
957
|
};
|
|
874
958
|
var row = options ? options.inline : false;
|
|
875
959
|
var selectedIndex = enumOptionsIndexForValue(value, enumOptions);
|
|
876
|
-
return
|
|
960
|
+
return jsxs(FormControl, _extends({
|
|
877
961
|
mb: 1
|
|
878
962
|
}, chakraProps, {
|
|
879
963
|
isDisabled: disabled || readonly,
|
|
880
964
|
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
|
-
|
|
965
|
+
isReadOnly: readonly,
|
|
966
|
+
children: [jsx(FormLabel, {
|
|
967
|
+
htmlFor: id,
|
|
968
|
+
id: id + "-label",
|
|
969
|
+
children: label || schema.title
|
|
970
|
+
}), jsx(RadioGroup, {
|
|
971
|
+
onChange: _onChange,
|
|
972
|
+
onBlur: _onBlur,
|
|
973
|
+
onFocus: _onFocus,
|
|
974
|
+
value: selectedIndex,
|
|
975
|
+
name: id,
|
|
976
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
977
|
+
children: jsx(Stack, {
|
|
978
|
+
direction: row ? 'row' : 'column',
|
|
979
|
+
children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
|
|
980
|
+
var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
981
|
+
return jsx(Radio, {
|
|
982
|
+
value: String(index),
|
|
983
|
+
id: optionId(id, index),
|
|
984
|
+
disabled: disabled || itemDisabled || readonly,
|
|
985
|
+
children: option.label
|
|
986
|
+
}, index);
|
|
987
|
+
})
|
|
988
|
+
})
|
|
989
|
+
})]
|
|
990
|
+
}));
|
|
903
991
|
}
|
|
904
992
|
|
|
905
993
|
function RangeWidget(_ref) {
|
|
@@ -936,19 +1024,25 @@ function RangeWidget(_ref) {
|
|
|
936
1024
|
var value = _ref3.target.value;
|
|
937
1025
|
return onFocus(id, value);
|
|
938
1026
|
};
|
|
939
|
-
return
|
|
1027
|
+
return jsxs(FormControl, _extends({
|
|
940
1028
|
mb: 1
|
|
941
|
-
}, chakraProps
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1029
|
+
}, chakraProps, {
|
|
1030
|
+
children: [displayLabel ? jsx(FormLabel, {
|
|
1031
|
+
htmlFor: id,
|
|
1032
|
+
children: label || schema.title
|
|
1033
|
+
}) : null, jsxs(Slider, _extends({}, sliderWidgetProps, {
|
|
1034
|
+
id: id,
|
|
1035
|
+
name: id,
|
|
1036
|
+
isDisabled: disabled || readonly,
|
|
1037
|
+
onChange: _onChange,
|
|
1038
|
+
onBlur: _onBlur,
|
|
1039
|
+
onFocus: _onFocus,
|
|
1040
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
1041
|
+
children: [jsx(SliderTrack, {
|
|
1042
|
+
children: jsx(SliderFilledTrack, {})
|
|
1043
|
+
}), jsx(SliderThumb, {})]
|
|
1044
|
+
}))]
|
|
1045
|
+
}));
|
|
952
1046
|
}
|
|
953
1047
|
|
|
954
1048
|
function SelectWidget(props) {
|
|
@@ -1002,7 +1096,7 @@ function SelectWidget(props) {
|
|
|
1002
1096
|
isDisabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1
|
|
1003
1097
|
};
|
|
1004
1098
|
}) : [];
|
|
1005
|
-
var isMultiple = typeof multiple !==
|
|
1099
|
+
var isMultiple = typeof multiple !== 'undefined' && Boolean(enumOptions);
|
|
1006
1100
|
var selectedIndex = enumOptionsIndexForValue(value, enumOptions, isMultiple);
|
|
1007
1101
|
var formValue = isMultiple ? (selectedIndex || []).map(function (i) {
|
|
1008
1102
|
return {
|
|
@@ -1010,31 +1104,33 @@ function SelectWidget(props) {
|
|
|
1010
1104
|
value: i
|
|
1011
1105
|
};
|
|
1012
1106
|
}) : {
|
|
1013
|
-
label: _valueLabelMap[selectedIndex] ||
|
|
1107
|
+
label: _valueLabelMap[selectedIndex] || '',
|
|
1014
1108
|
selectedIndex: selectedIndex
|
|
1015
1109
|
};
|
|
1016
|
-
return
|
|
1110
|
+
return jsxs(FormControl, _extends({
|
|
1017
1111
|
mb: 1
|
|
1018
1112
|
}, chakraProps, {
|
|
1019
1113
|
isDisabled: disabled || readonly,
|
|
1020
1114
|
isRequired: required,
|
|
1021
1115
|
isReadOnly: readonly,
|
|
1022
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1116
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1117
|
+
children: [(label || schema.title) && jsx(FormLabel, {
|
|
1118
|
+
htmlFor: isMultiple ? undefined : id,
|
|
1119
|
+
children: label || schema.title
|
|
1120
|
+
}), jsx(Select, {
|
|
1121
|
+
inputId: id,
|
|
1122
|
+
name: id,
|
|
1123
|
+
isMulti: isMultiple,
|
|
1124
|
+
options: displayEnumOptions,
|
|
1125
|
+
placeholder: placeholder,
|
|
1126
|
+
closeMenuOnSelect: !isMultiple,
|
|
1127
|
+
onBlur: _onBlur,
|
|
1128
|
+
onChange: isMultiple ? _onMultiChange : _onChange,
|
|
1129
|
+
onFocus: _onFocus,
|
|
1130
|
+
autoFocus: autofocus,
|
|
1131
|
+
value: formValue,
|
|
1132
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1133
|
+
})]
|
|
1038
1134
|
}));
|
|
1039
1135
|
}
|
|
1040
1136
|
|
|
@@ -1062,7 +1158,7 @@ function TextareaWidget(_ref) {
|
|
|
1062
1158
|
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1063
1159
|
var _onChange = function _onChange(_ref2) {
|
|
1064
1160
|
var value = _ref2.target.value;
|
|
1065
|
-
return onChange(value ===
|
|
1161
|
+
return onChange(value === '' ? options.emptyValue : value);
|
|
1066
1162
|
};
|
|
1067
1163
|
var _onBlur = function _onBlur(_ref3) {
|
|
1068
1164
|
var value = _ref3.target.value;
|
|
@@ -1072,25 +1168,27 @@ function TextareaWidget(_ref) {
|
|
|
1072
1168
|
var value = _ref4.target.value;
|
|
1073
1169
|
return onFocus(id, value);
|
|
1074
1170
|
};
|
|
1075
|
-
return
|
|
1171
|
+
return jsxs(FormControl, _extends({
|
|
1076
1172
|
mb: 1
|
|
1077
1173
|
}, chakraProps, {
|
|
1078
1174
|
isDisabled: disabled || readonly,
|
|
1079
1175
|
isRequired: required,
|
|
1080
1176
|
isReadOnly: readonly,
|
|
1081
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1177
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1178
|
+
children: [displayLabel ? jsx(FormLabel, {
|
|
1179
|
+
htmlFor: id,
|
|
1180
|
+
children: label || schema.title
|
|
1181
|
+
}) : null, jsx(Textarea, {
|
|
1182
|
+
id: id,
|
|
1183
|
+
name: id,
|
|
1184
|
+
value: value != null ? value : '',
|
|
1185
|
+
placeholder: placeholder,
|
|
1186
|
+
autoFocus: autofocus,
|
|
1187
|
+
onChange: _onChange,
|
|
1188
|
+
onBlur: _onBlur,
|
|
1189
|
+
onFocus: _onFocus,
|
|
1190
|
+
"aria-describedby": ariaDescribedByIds(id)
|
|
1191
|
+
})]
|
|
1094
1192
|
}));
|
|
1095
1193
|
}
|
|
1096
1194
|
|
|
@@ -1124,25 +1222,30 @@ function UpDownWidget(props) {
|
|
|
1124
1222
|
var value = _ref2.target.value;
|
|
1125
1223
|
return onFocus(id, value);
|
|
1126
1224
|
};
|
|
1127
|
-
return
|
|
1225
|
+
return jsxs(FormControl, _extends({
|
|
1128
1226
|
mb: 1
|
|
1129
1227
|
}, chakraProps, {
|
|
1130
1228
|
isDisabled: disabled || readonly,
|
|
1131
1229
|
isRequired: required,
|
|
1132
1230
|
isReadOnly: readonly,
|
|
1133
|
-
isInvalid: rawErrors && rawErrors.length > 0
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1231
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1232
|
+
children: [displayLabel ? jsx(FormLabel, {
|
|
1233
|
+
htmlFor: id,
|
|
1234
|
+
children: label || schema.title
|
|
1235
|
+
}) : null, jsxs(NumberInput, {
|
|
1236
|
+
value: value != null ? value : '',
|
|
1237
|
+
onChange: _onChange,
|
|
1238
|
+
onBlur: _onBlur,
|
|
1239
|
+
onFocus: _onFocus,
|
|
1240
|
+
"aria-describedby": ariaDescribedByIds(id),
|
|
1241
|
+
children: [jsx(NumberInputField, {
|
|
1242
|
+
id: id,
|
|
1243
|
+
name: id
|
|
1244
|
+
}), jsxs(NumberInputStepper, {
|
|
1245
|
+
children: [jsx(NumberIncrementStepper, {}), jsx(NumberDecrementStepper, {})]
|
|
1246
|
+
})]
|
|
1247
|
+
})]
|
|
1248
|
+
}));
|
|
1146
1249
|
}
|
|
1147
1250
|
|
|
1148
1251
|
function generateWidgets() {
|
|
@@ -1195,7 +1298,7 @@ var Form = /*#__PURE__*/generateForm();
|
|
|
1195
1298
|
It is located at the bottom of the styles string.
|
|
1196
1299
|
*/
|
|
1197
1300
|
var CSSReset = function CSSReset() {
|
|
1198
|
-
return
|
|
1301
|
+
return jsx(Global, {
|
|
1199
1302
|
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
1303
|
});
|
|
1201
1304
|
};
|
|
@@ -1217,22 +1320,25 @@ var CSSReset = function CSSReset() {
|
|
|
1217
1320
|
var memoizedCreateCacheWithContainer = /*#__PURE__*/weakMemoize(function (container) {
|
|
1218
1321
|
var newCache = createCache({
|
|
1219
1322
|
container: container,
|
|
1220
|
-
key:
|
|
1323
|
+
key: 'rjsf'
|
|
1221
1324
|
});
|
|
1222
1325
|
return newCache;
|
|
1223
1326
|
});
|
|
1224
1327
|
var __createChakraFrameProvider = function __createChakraFrameProvider(props) {
|
|
1225
1328
|
return function (_ref) {
|
|
1226
1329
|
var document = _ref.document;
|
|
1227
|
-
return
|
|
1330
|
+
return jsx("div", {
|
|
1228
1331
|
style: {
|
|
1229
1332
|
margin: 2
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1333
|
+
},
|
|
1334
|
+
children: jsx(CacheProvider, {
|
|
1335
|
+
value: memoizedCreateCacheWithContainer(document.head),
|
|
1336
|
+
children: jsxs(ChakraProvider, {
|
|
1337
|
+
resetCSS: false,
|
|
1338
|
+
children: [jsx(CSSReset, {}), props.children]
|
|
1339
|
+
})
|
|
1340
|
+
})
|
|
1341
|
+
});
|
|
1236
1342
|
};
|
|
1237
1343
|
};
|
|
1238
1344
|
|