@rjsf/semantic-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.
@@ -1,8 +1,9 @@
1
1
  import { withTheme } from '@rjsf/core';
2
2
  import { Button, Icon, Segment, Grid, Form, Message, Label, List, Header, Radio, Input } from 'semantic-ui-react';
3
- import React from 'react';
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { TranslatableString, getUiOptions, getTemplate, isFixedItems, UI_OPTIONS_KEY, getInputProps, examplesId, ariaDescribedByIds, errorId, helpId, descriptionId, titleId, canExpand, getSubmitButtonOptions, ADDITIONAL_PROPERTY_FLAG, schemaRequiresTrueValue, enumOptionsIsSelected, optionId, enumOptionsSelectValue, enumOptionsDeselectValue, enumOptionsValueForIndex, rangeSpec, enumOptionsIndexForValue } from '@rjsf/utils';
5
5
  import { nanoid } from 'nanoid';
6
+ import { createElement } from 'react';
6
7
  import map from 'lodash-es/map';
7
8
 
8
9
  function _extends() {
@@ -40,14 +41,15 @@ function AddButton(_ref) {
40
41
  color = _ref.color,
41
42
  props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
42
43
  var translateString = registry.translateString;
43
- return /*#__PURE__*/React.createElement(Button, _extends({
44
+ return jsx(Button, _extends({
44
45
  title: translateString(TranslatableString.AddItemButton),
45
46
  color: color
46
47
  }, props, {
47
48
  icon: true,
48
- size: "tiny"
49
- }), /*#__PURE__*/React.createElement(Icon, {
50
- name: "plus"
49
+ size: 'tiny',
50
+ children: jsx(Icon, {
51
+ name: 'plus'
52
+ })
51
53
  }));
52
54
  }
53
55
 
@@ -101,8 +103,8 @@ function getSemanticErrorProps(_ref2) {
101
103
  options = _ref2$options === void 0 ? {} : _ref2$options,
102
104
  _ref2$defaultProps = _ref2.defaultProps,
103
105
  defaultProps = _ref2$defaultProps === void 0 ? {
104
- size: "small",
105
- pointing: "above"
106
+ size: 'small',
107
+ pointing: 'above'
106
108
  } : _ref2$defaultProps;
107
109
  var formContextProps = formContext.semantic && formContext.semantic.errorOptions;
108
110
  var semanticOptions = getUiOptions(uiSchema).semantic;
@@ -132,7 +134,7 @@ function cleanClassNames(classNameArr, omit) {
132
134
  // returning them as a string
133
135
  return [].concat(new Set(classList.filter(function (cn) {
134
136
  return !omit.includes(cn);
135
- }))).join(" ");
137
+ }))).join(' ');
136
138
  }
137
139
  /**
138
140
  *
@@ -145,14 +147,14 @@ function cleanClassNames(classNameArr, omit) {
145
147
  function MaybeWrap(_ref3) {
146
148
  var wrap = _ref3.wrap,
147
149
  _ref3$component = _ref3.component,
148
- Component = _ref3$component === void 0 ? "div" : _ref3$component,
150
+ Component = _ref3$component === void 0 ? 'div' : _ref3$component,
149
151
  props = _objectWithoutPropertiesLoose(_ref3, _excluded$3);
150
- return wrap ? /*#__PURE__*/React.createElement(Component, _extends({}, props)) : props.children;
152
+ return wrap ? jsx(Component, _extends({}, props)) : props.children;
151
153
  }
152
154
 
153
155
  var gridStyle = function gridStyle(vertical) {
154
156
  return {
155
- display: "grid",
157
+ display: 'grid',
156
158
  gridTemplateColumns: "1fr " + (vertical ? 65 : 110) + "px"
157
159
  };
158
160
  };
@@ -184,40 +186,47 @@ function ArrayFieldItemTemplate(props) {
184
186
  horizontalButtons = _uiOptions$semantic$h === void 0 ? false : _uiOptions$semantic$h,
185
187
  _uiOptions$semantic$w = _uiOptions$semantic.wrapItem,
186
188
  wrapItem = _uiOptions$semantic$w === void 0 ? false : _uiOptions$semantic$w;
187
- return /*#__PURE__*/React.createElement("div", {
188
- className: "array-item"
189
- }, /*#__PURE__*/React.createElement(MaybeWrap, {
190
- wrap: wrapItem,
191
- component: Segment
192
- }, /*#__PURE__*/React.createElement(Grid, {
193
- style: index !== 0 ? _extends({}, gridStyle(!horizontalButtons), {
194
- alignItems: "center"
195
- }) : gridStyle(!horizontalButtons)
196
- }, /*#__PURE__*/React.createElement(Grid.Column, {
197
- width: 16,
198
- verticalAlign: "middle"
199
- }, children), hasToolbar && /*#__PURE__*/React.createElement(Grid.Column, null, (hasMoveUp || hasMoveDown || hasRemove) && /*#__PURE__*/React.createElement(Button.Group, {
200
- size: "mini",
201
- vertical: !horizontalButtons
202
- }, (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(MoveUpButton, {
203
- className: "array-item-move-up",
204
- disabled: disabled || readonly || !hasMoveUp,
205
- onClick: onReorderClick(index, index - 1),
206
- uiSchema: uiSchema,
207
- registry: registry
208
- }), (hasMoveUp || hasMoveDown) && /*#__PURE__*/React.createElement(MoveDownButton, {
209
- className: "array-item-move-down",
210
- disabled: disabled || readonly || !hasMoveDown,
211
- onClick: onReorderClick(index, index + 1),
212
- uiSchema: uiSchema,
213
- registry: registry
214
- }), hasRemove && /*#__PURE__*/React.createElement(RemoveButton, {
215
- className: "array-item-remove",
216
- disabled: disabled || readonly,
217
- onClick: onDropIndexClick(index),
218
- uiSchema: uiSchema,
219
- registry: registry
220
- }))))));
189
+ return jsx("div", {
190
+ className: 'array-item',
191
+ children: jsx(MaybeWrap, {
192
+ wrap: wrapItem,
193
+ component: Segment,
194
+ children: jsxs(Grid, {
195
+ style: index !== 0 ? _extends({}, gridStyle(!horizontalButtons), {
196
+ alignItems: 'center'
197
+ }) : gridStyle(!horizontalButtons),
198
+ children: [jsx(Grid.Column, {
199
+ width: 16,
200
+ verticalAlign: 'middle',
201
+ children: children
202
+ }), hasToolbar && jsx(Grid.Column, {
203
+ children: (hasMoveUp || hasMoveDown || hasRemove) && jsxs(Button.Group, {
204
+ size: 'mini',
205
+ vertical: !horizontalButtons,
206
+ children: [(hasMoveUp || hasMoveDown) && jsx(MoveUpButton, {
207
+ className: 'array-item-move-up',
208
+ disabled: disabled || readonly || !hasMoveUp,
209
+ onClick: onReorderClick(index, index - 1),
210
+ uiSchema: uiSchema,
211
+ registry: registry
212
+ }), (hasMoveUp || hasMoveDown) && jsx(MoveDownButton, {
213
+ className: 'array-item-move-down',
214
+ disabled: disabled || readonly || !hasMoveDown,
215
+ onClick: onReorderClick(index, index + 1),
216
+ uiSchema: uiSchema,
217
+ registry: registry
218
+ }), hasRemove && jsx(RemoveButton, {
219
+ className: 'array-item-remove',
220
+ disabled: disabled || readonly,
221
+ onClick: onDropIndexClick(index),
222
+ uiSchema: uiSchema,
223
+ registry: registry
224
+ })]
225
+ })
226
+ })]
227
+ })
228
+ })
229
+ });
221
230
  }
222
231
 
223
232
  var _excluded$2 = ["key", "uiSchema"];
@@ -254,57 +263,58 @@ function ArrayFieldTemplate(props) {
254
263
  wrapItem: wrapItem
255
264
  };
256
265
  var uiOptions = getUiOptions(uiSchema);
257
- var ArrayFieldDescriptionTemplate = getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
258
- var ArrayFieldItemTemplate = getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
259
- var ArrayFieldTitleTemplate = getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
266
+ var ArrayFieldDescriptionTemplate = getTemplate('ArrayFieldDescriptionTemplate', registry, uiOptions);
267
+ var ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
268
+ var ArrayFieldTitleTemplate = getTemplate('ArrayFieldTitleTemplate', registry, uiOptions);
260
269
  // Button templates are not overridden in the uiSchema
261
270
  var AddButton = registry.templates.ButtonTemplates.AddButton;
262
- return /*#__PURE__*/React.createElement("div", {
263
- className: cleanClassNames([className, isFixedItems(schema) ? "" : "sortable-form-fields"])
264
- }, /*#__PURE__*/React.createElement(ArrayFieldTitleTemplate, {
265
- idSchema: idSchema,
266
- title: uiOptions.title || title,
267
- schema: schema,
268
- uiSchema: uiSchema,
269
- required: required,
270
- registry: registry
271
- }), /*#__PURE__*/React.createElement(ArrayFieldDescriptionTemplate, {
272
- idSchema: idSchema,
273
- description: uiOptions.description || schema.description,
274
- schema: schema,
275
- uiSchema: uiSchema,
276
- registry: registry
277
- }), /*#__PURE__*/React.createElement("div", {
278
- key: "array-item-list-" + idSchema.$id
279
- }, /*#__PURE__*/React.createElement("div", {
280
- className: "row array-item-list"
281
- }, items && items.map(function (_ref) {
282
- var _extends2;
283
- var key = _ref.key,
284
- _ref$uiSchema = _ref.uiSchema,
285
- itemUiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema,
286
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
287
- // Merge in the semantic props from the ArrayFieldTemplate into each of the items
288
- var mergedUiSchema = _extends({}, itemUiSchema, (_extends2 = {}, _extends2[UI_OPTIONS_KEY] = _extends({}, itemUiSchema[UI_OPTIONS_KEY], {
289
- semantic: semantic
290
- }), _extends2));
291
- return /*#__PURE__*/React.createElement(ArrayFieldItemTemplate, _extends({
292
- key: key
293
- }, props, {
294
- uiSchema: mergedUiSchema
295
- }));
296
- })), canAdd && /*#__PURE__*/React.createElement("div", {
297
- style: {
298
- marginTop: "1rem",
299
- position: "relative",
300
- textAlign: "right"
301
- }
302
- }, /*#__PURE__*/React.createElement(AddButton, {
303
- onClick: onAddClick,
304
- disabled: disabled || readonly,
305
- uiSchema: uiSchema,
306
- registry: registry
307
- }))));
271
+ return jsxs("div", {
272
+ className: cleanClassNames([className, isFixedItems(schema) ? '' : 'sortable-form-fields']),
273
+ children: [jsx(ArrayFieldTitleTemplate, {
274
+ idSchema: idSchema,
275
+ title: uiOptions.title || title,
276
+ schema: schema,
277
+ uiSchema: uiSchema,
278
+ required: required,
279
+ registry: registry
280
+ }), jsx(ArrayFieldDescriptionTemplate, {
281
+ idSchema: idSchema,
282
+ description: uiOptions.description || schema.description,
283
+ schema: schema,
284
+ uiSchema: uiSchema,
285
+ registry: registry
286
+ }), jsxs("div", {
287
+ children: [jsx("div", {
288
+ className: 'row array-item-list',
289
+ children: items && items.map(function (_ref) {
290
+ var _extends2;
291
+ var key = _ref.key,
292
+ _ref$uiSchema = _ref.uiSchema,
293
+ itemUiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema,
294
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
295
+ // Merge in the semantic props from the ArrayFieldTemplate into each of the items
296
+ var mergedUiSchema = _extends({}, itemUiSchema, (_extends2 = {}, _extends2[UI_OPTIONS_KEY] = _extends({}, itemUiSchema[UI_OPTIONS_KEY], {
297
+ semantic: semantic
298
+ }), _extends2));
299
+ return jsx(ArrayFieldItemTemplate, _extends({}, props, {
300
+ uiSchema: mergedUiSchema
301
+ }), key);
302
+ })
303
+ }), canAdd && jsx("div", {
304
+ style: {
305
+ marginTop: '1rem',
306
+ position: 'relative',
307
+ textAlign: 'right'
308
+ },
309
+ children: jsx(AddButton, {
310
+ onClick: onAddClick,
311
+ disabled: disabled || readonly,
312
+ uiSchema: uiSchema,
313
+ registry: registry
314
+ })
315
+ })]
316
+ }, "array-item-list-" + idSchema.$id)]
317
+ });
308
318
  }
309
319
 
310
320
  /** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
@@ -322,6 +332,7 @@ function BaseInputTemplate(props) {
322
332
  readonly = props.readonly,
323
333
  disabled = props.disabled,
324
334
  onChange = props.onChange,
335
+ onChangeOverride = props.onChangeOverride,
325
336
  onBlur = props.onBlur,
326
337
  onFocus = props.onFocus,
327
338
  autofocus = props.autofocus,
@@ -342,7 +353,7 @@ function BaseInputTemplate(props) {
342
353
  var schemaUtils = registry.schemaUtils;
343
354
  var _onChange = function _onChange(_ref) {
344
355
  var value = _ref.target.value;
345
- return onChange(value === "" ? options.emptyValue : value);
356
+ return onChange(value === '' ? options.emptyValue : value);
346
357
  };
347
358
  var _onBlur = function _onBlur() {
348
359
  return onBlur && onBlur(id, value);
@@ -351,32 +362,33 @@ function BaseInputTemplate(props) {
351
362
  return onFocus && onFocus(id, value);
352
363
  };
353
364
  var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
354
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Input, _extends({
355
- key: id,
356
- id: id,
357
- name: id,
358
- placeholder: placeholder
359
- }, inputProps, {
360
- label: displayLabel ? label || schema.title : false,
361
- required: required,
362
- autoFocus: autofocus,
363
- disabled: disabled || readonly,
364
- list: schema.examples ? examplesId(id) : undefined
365
- }, semanticProps, {
366
- value: value || value === 0 ? value : "",
367
- error: rawErrors.length > 0,
368
- onChange: _onChange,
369
- onBlur: _onBlur,
370
- onFocus: _onFocus,
371
- "aria-describedby": ariaDescribedByIds(id, !!schema.examples)
372
- })), Array.isArray(schema.examples) && /*#__PURE__*/React.createElement("datalist", {
373
- id: examplesId(id)
374
- }, schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
375
- return /*#__PURE__*/React.createElement("option", {
376
- key: example,
377
- value: example
378
- });
379
- })));
365
+ return jsxs(Fragment, {
366
+ children: [jsx(Form.Input, _extends({
367
+ id: id,
368
+ name: id,
369
+ placeholder: placeholder
370
+ }, inputProps, {
371
+ label: displayLabel ? label || schema.title : false,
372
+ required: required,
373
+ autoFocus: autofocus,
374
+ disabled: disabled || readonly,
375
+ list: schema.examples ? examplesId(id) : undefined
376
+ }, semanticProps, {
377
+ value: value || value === 0 ? value : '',
378
+ error: rawErrors.length > 0,
379
+ onChange: onChangeOverride || _onChange,
380
+ onBlur: _onBlur,
381
+ onFocus: _onFocus,
382
+ "aria-describedby": ariaDescribedByIds(id, !!schema.examples)
383
+ }), id), Array.isArray(schema.examples) && jsx("datalist", {
384
+ id: examplesId(id),
385
+ children: schema.examples.concat(schema["default"] && !schema.examples.includes(schema["default"]) ? [schema["default"]] : []).map(function (example) {
386
+ return jsx("option", {
387
+ value: example
388
+ }, example);
389
+ })
390
+ })]
391
+ });
380
392
  }
381
393
 
382
394
  /** The `DescriptionField` is the template to use to render the description of a field
@@ -389,10 +401,11 @@ function DescriptionField(props) {
389
401
  if (!description) {
390
402
  return null;
391
403
  }
392
- return /*#__PURE__*/React.createElement("p", {
404
+ return jsx("p", {
393
405
  id: id,
394
- className: "sui-description"
395
- }, description);
406
+ className: 'sui-description',
407
+ children: description
408
+ });
396
409
  }
397
410
 
398
411
  /** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
@@ -403,13 +416,18 @@ function ErrorList(_ref) {
403
416
  var errors = _ref.errors,
404
417
  registry = _ref.registry;
405
418
  var translateString = registry.translateString;
406
- return /*#__PURE__*/React.createElement(Message, {
407
- negative: true
408
- }, /*#__PURE__*/React.createElement(Message.Header, null, translateString(TranslatableString.ErrorsLabel)), /*#__PURE__*/React.createElement(Message.List, null, errors.map(function (error, index) {
409
- return /*#__PURE__*/React.createElement(Message.Item, {
410
- key: "error-" + index
411
- }, error.stack);
412
- })));
419
+ return jsxs(Message, {
420
+ negative: true,
421
+ children: [jsx(Message.Header, {
422
+ children: translateString(TranslatableString.ErrorsLabel)
423
+ }), jsx(Message.List, {
424
+ children: errors.map(function (error, index) {
425
+ return jsx(Message.Item, {
426
+ children: error.stack
427
+ }, "error-" + index);
428
+ })
429
+ })]
430
+ });
413
431
  }
414
432
 
415
433
  var _excluded$1 = ["icon", "iconType", "color", "className", "uiSchema", "registry"];
@@ -419,7 +437,7 @@ function IconButton(props) {
419
437
  color = props.color,
420
438
  className = props.className,
421
439
  otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
422
- return /*#__PURE__*/React.createElement(Button, _extends({
440
+ return jsx(Button, _extends({
423
441
  icon: icon,
424
442
  size: iconType,
425
443
  color: color,
@@ -428,33 +446,33 @@ function IconButton(props) {
428
446
  }
429
447
  function MoveDownButton(props) {
430
448
  var translateString = props.registry.translateString;
431
- return /*#__PURE__*/React.createElement(IconButton, _extends({
449
+ return jsx(IconButton, _extends({
432
450
  title: translateString(TranslatableString.MoveDownButton)
433
451
  }, props, {
434
- icon: "angle down"
452
+ icon: 'angle down'
435
453
  }));
436
454
  }
437
455
  function MoveUpButton(props) {
438
456
  var translateString = props.registry.translateString;
439
- return /*#__PURE__*/React.createElement(IconButton, _extends({
457
+ return jsx(IconButton, _extends({
440
458
  title: translateString(TranslatableString.MoveUpButton)
441
459
  }, props, {
442
- icon: "angle up"
460
+ icon: 'angle up'
443
461
  }));
444
462
  }
445
463
  function RemoveButton(props) {
446
464
  var translateString = props.registry.translateString;
447
- return /*#__PURE__*/React.createElement(IconButton, _extends({
465
+ return jsx(IconButton, _extends({
448
466
  title: translateString(TranslatableString.RemoveButton)
449
467
  }, props, {
450
- icon: "trash"
468
+ icon: 'trash'
451
469
  }));
452
470
  }
453
471
 
454
472
  var DEFAULT_OPTIONS$1 = {
455
473
  options: {
456
- pointing: "above",
457
- size: "small"
474
+ pointing: 'above',
475
+ size: 'small'
458
476
  }
459
477
  };
460
478
  /** The `FieldErrorTemplate` component renders the errors local to the particular field
@@ -476,19 +494,21 @@ function FieldErrorTemplate(_ref) {
476
494
  size = options.size;
477
495
  if (errors && errors.length > 0) {
478
496
  var id = errorId(idSchema);
479
- return /*#__PURE__*/React.createElement(Label, {
497
+ return jsx(Label, {
480
498
  id: id,
481
- color: "red",
482
- pointing: pointing || "above",
483
- size: size || "small",
484
- basic: true
485
- }, /*#__PURE__*/React.createElement(List, {
486
- bulleted: true
487
- }, errors.map(function (error) {
488
- return /*#__PURE__*/React.createElement(List.Item, {
489
- key: nanoid()
490
- }, error);
491
- })));
499
+ color: 'red',
500
+ pointing: pointing || 'above',
501
+ size: size || 'small',
502
+ basic: true,
503
+ children: jsx(List, {
504
+ bulleted: true,
505
+ children: errors.map(function (error) {
506
+ return jsx(List.Item, {
507
+ children: error
508
+ }, nanoid());
509
+ })
510
+ })
511
+ });
492
512
  }
493
513
  return null;
494
514
  }
@@ -502,8 +522,8 @@ function FieldHelpTemplate(props) {
502
522
  help = props.help;
503
523
  if (help) {
504
524
  var id = helpId(idSchema);
505
- return /*#__PURE__*/React.createElement(Message, {
506
- size: "mini",
525
+ return jsx(Message, {
526
+ size: 'mini',
507
527
  info: true,
508
528
  id: id,
509
529
  content: help
@@ -537,16 +557,17 @@ function FieldTemplate(props) {
537
557
  var wrapLabel = semanticProps.wrapLabel,
538
558
  wrapContent = semanticProps.wrapContent;
539
559
  var uiOptions = getUiOptions(uiSchema);
540
- var WrapIfAdditionalTemplate = getTemplate("WrapIfAdditionalTemplate", registry, uiOptions);
541
- var DescriptionFieldTemplate = getTemplate("DescriptionFieldTemplate", registry, uiOptions);
560
+ var WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
561
+ var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
542
562
  if (hidden) {
543
- return /*#__PURE__*/React.createElement("div", {
563
+ return jsx("div", {
544
564
  style: {
545
- display: "none"
546
- }
547
- }, children);
565
+ display: 'none'
566
+ },
567
+ children: children
568
+ });
548
569
  }
549
- return /*#__PURE__*/React.createElement(WrapIfAdditionalTemplate, _extends({
570
+ return jsx(WrapIfAdditionalTemplate, _extends({
550
571
  classNames: classNames,
551
572
  style: style,
552
573
  id: id,
@@ -554,23 +575,27 @@ function FieldTemplate(props) {
554
575
  registry: registry,
555
576
  schema: schema,
556
577
  uiSchema: uiSchema
557
- }, otherProps), /*#__PURE__*/React.createElement(Form.Group, {
558
- key: id,
559
- widths: "equal",
560
- grouped: true
561
- }, /*#__PURE__*/React.createElement(MaybeWrap, {
562
- wrap: wrapContent,
563
- className: "sui-field-content"
564
- }, children, displayLabel && rawDescription && /*#__PURE__*/React.createElement(MaybeWrap, {
565
- wrap: wrapLabel,
566
- className: "sui-field-label"
567
- }, rawDescription && /*#__PURE__*/React.createElement(DescriptionFieldTemplate, {
568
- id: descriptionId(id),
569
- description: rawDescription,
570
- schema: schema,
571
- uiSchema: uiSchema,
572
- registry: registry
573
- })), help, errors)));
578
+ }, otherProps, {
579
+ children: jsx(Form.Group, {
580
+ widths: 'equal',
581
+ grouped: true,
582
+ children: jsxs(MaybeWrap, {
583
+ wrap: wrapContent,
584
+ className: 'sui-field-content',
585
+ children: [children, displayLabel && rawDescription && jsx(MaybeWrap, {
586
+ wrap: wrapLabel,
587
+ className: 'sui-field-label',
588
+ children: rawDescription && jsx(DescriptionFieldTemplate, {
589
+ id: descriptionId(id),
590
+ description: rawDescription,
591
+ schema: schema,
592
+ uiSchema: uiSchema,
593
+ registry: registry
594
+ })
595
+ }), help, errors]
596
+ })
597
+ }, id)
598
+ }));
574
599
  }
575
600
 
576
601
  /** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
@@ -593,42 +618,48 @@ function ObjectFieldTemplate(props) {
593
618
  idSchema = props.idSchema,
594
619
  registry = props.registry;
595
620
  var uiOptions = getUiOptions(uiSchema);
596
- var TitleFieldTemplate = getTemplate("TitleFieldTemplate", registry, uiOptions);
597
- var DescriptionFieldTemplate = getTemplate("DescriptionFieldTemplate", registry, uiOptions);
621
+ var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
622
+ var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
598
623
  // Button templates are not overridden in the uiSchema
599
624
  var AddButton = registry.templates.ButtonTemplates.AddButton;
600
625
  var fieldTitle = uiOptions.title || title;
601
626
  var fieldDescription = uiOptions.description || description;
602
- return /*#__PURE__*/React.createElement(React.Fragment, null, fieldTitle && /*#__PURE__*/React.createElement(TitleFieldTemplate, {
603
- id: titleId(idSchema),
604
- title: fieldTitle,
605
- required: required,
606
- schema: schema,
607
- uiSchema: uiSchema,
608
- registry: registry
609
- }), fieldDescription && /*#__PURE__*/React.createElement(DescriptionFieldTemplate, {
610
- id: descriptionId(idSchema),
611
- description: fieldDescription,
612
- schema: schema,
613
- uiSchema: uiSchema,
614
- registry: registry
615
- }), properties.map(function (prop) {
616
- return prop.content;
617
- }), canExpand(schema, uiSchema, formData) && /*#__PURE__*/React.createElement(Grid.Column, {
618
- width: 16,
619
- verticalAlign: "middle"
620
- }, /*#__PURE__*/React.createElement(Grid.Row, null, /*#__PURE__*/React.createElement("div", {
621
- style: {
622
- marginTop: "1rem",
623
- position: "relative",
624
- textAlign: "right"
625
- }
626
- }, /*#__PURE__*/React.createElement(AddButton, {
627
- onClick: onAddClick(schema),
628
- disabled: disabled || readonly,
629
- uiSchema: uiSchema,
630
- registry: registry
631
- })))));
627
+ return jsxs(Fragment, {
628
+ children: [fieldTitle && jsx(TitleFieldTemplate, {
629
+ id: titleId(idSchema),
630
+ title: fieldTitle,
631
+ required: required,
632
+ schema: schema,
633
+ uiSchema: uiSchema,
634
+ registry: registry
635
+ }), fieldDescription && jsx(DescriptionFieldTemplate, {
636
+ id: descriptionId(idSchema),
637
+ description: fieldDescription,
638
+ schema: schema,
639
+ uiSchema: uiSchema,
640
+ registry: registry
641
+ }), properties.map(function (prop) {
642
+ return prop.content;
643
+ }), canExpand(schema, uiSchema, formData) && jsx(Grid.Column, {
644
+ width: 16,
645
+ verticalAlign: 'middle',
646
+ children: jsx(Grid.Row, {
647
+ children: jsx("div", {
648
+ style: {
649
+ marginTop: '1rem',
650
+ position: 'relative',
651
+ textAlign: 'right'
652
+ },
653
+ children: jsx(AddButton, {
654
+ onClick: onAddClick(schema),
655
+ disabled: disabled || readonly,
656
+ uiSchema: uiSchema,
657
+ registry: registry
658
+ })
659
+ })
660
+ })
661
+ })]
662
+ });
632
663
  }
633
664
 
634
665
  /** The `SubmitButton` renders a button that represent the `Submit` action on a form
@@ -643,10 +674,12 @@ function SubmitButton(_ref) {
643
674
  if (norender) {
644
675
  return null;
645
676
  }
646
- return /*#__PURE__*/React.createElement(Button, _extends({
647
- type: "submit",
677
+ return jsx(Button, _extends({
678
+ type: 'submit',
648
679
  primary: true
649
- }, submitButtonProps), submitText);
680
+ }, submitButtonProps, {
681
+ children: submitText
682
+ }));
650
683
  }
651
684
 
652
685
  var DEFAULT_OPTIONS = {
@@ -668,11 +701,12 @@ function TitleField(_ref) {
668
701
  if (!title) {
669
702
  return null;
670
703
  }
671
- return /*#__PURE__*/React.createElement(Header, _extends({
704
+ return jsx(Header, _extends({
672
705
  id: id
673
706
  }, semanticProps, {
674
- as: "h5"
675
- }), title);
707
+ as: 'h5',
708
+ children: title
709
+ }));
676
710
  }
677
711
 
678
712
  /** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
@@ -705,51 +739,60 @@ function WrapIfAdditionalTemplate(props) {
705
739
  wrapperStyle = _registry$formContext.wrapperStyle;
706
740
  var additional = (ADDITIONAL_PROPERTY_FLAG in schema);
707
741
  if (!additional) {
708
- return /*#__PURE__*/React.createElement("div", {
742
+ return jsx("div", {
709
743
  className: classNames,
710
- style: style
711
- }, children);
744
+ style: style,
745
+ children: children
746
+ });
712
747
  }
713
748
  var handleBlur = function handleBlur(_ref) {
714
749
  var target = _ref.target;
715
750
  return onKeyChange(target.value);
716
751
  };
717
- return /*#__PURE__*/React.createElement("div", {
752
+ return jsx("div", {
718
753
  className: classNames,
719
754
  style: style,
720
- key: id + "-key"
721
- }, /*#__PURE__*/React.createElement(Grid, {
722
- columns: "equal"
723
- }, /*#__PURE__*/React.createElement(Grid.Row, null, /*#__PURE__*/React.createElement(Grid.Column, {
724
- className: "form-additional"
725
- }, /*#__PURE__*/React.createElement(Form.Group, {
726
- widths: "equal",
727
- grouped: true
728
- }, /*#__PURE__*/React.createElement(Form.Input, {
729
- className: "form-group",
730
- hasFeedback: true,
731
- fluid: true,
732
- htmlFor: "" + id,
733
- label: keyLabel,
734
- required: required,
735
- defaultValue: label,
736
- disabled: disabled || readonlyAsDisabled && readonly,
737
- id: "" + id,
738
- name: "" + id,
739
- onBlur: !readonly ? handleBlur : undefined,
740
- style: wrapperStyle,
741
- type: "text"
742
- }))), /*#__PURE__*/React.createElement(Grid.Column, {
743
- className: "form-additional",
744
- verticalAlign: "middle"
745
- }, children), /*#__PURE__*/React.createElement(Grid.Column, null, /*#__PURE__*/React.createElement(RemoveButton, {
746
- iconType: "mini",
747
- className: "array-item-remove",
748
- disabled: disabled || readonly,
749
- onClick: onDropPropertyClick(label),
750
- uiSchema: uiSchema,
751
- registry: registry
752
- })))));
755
+ children: jsx(Grid, {
756
+ columns: 'equal',
757
+ children: jsxs(Grid.Row, {
758
+ children: [jsx(Grid.Column, {
759
+ className: 'form-additional',
760
+ children: jsx(Form.Group, {
761
+ widths: 'equal',
762
+ grouped: true,
763
+ children: jsx(Form.Input, {
764
+ className: 'form-group',
765
+ hasFeedback: true,
766
+ fluid: true,
767
+ htmlFor: "" + id,
768
+ label: keyLabel,
769
+ required: required,
770
+ defaultValue: label,
771
+ disabled: disabled || readonlyAsDisabled && readonly,
772
+ id: "" + id,
773
+ name: "" + id,
774
+ onBlur: !readonly ? handleBlur : undefined,
775
+ style: wrapperStyle,
776
+ type: 'text'
777
+ })
778
+ })
779
+ }), jsx(Grid.Column, {
780
+ className: 'form-additional',
781
+ verticalAlign: 'middle',
782
+ children: children
783
+ }), jsx(Grid.Column, {
784
+ children: jsx(RemoveButton, {
785
+ iconType: 'mini',
786
+ className: 'array-item-remove',
787
+ disabled: disabled || readonly,
788
+ onClick: onDropPropertyClick(label),
789
+ uiSchema: uiSchema,
790
+ registry: registry
791
+ })
792
+ })]
793
+ })
794
+ })
795
+ }, id + "-key");
753
796
  }
754
797
 
755
798
  function generateTemplates() {
@@ -818,20 +861,20 @@ function CheckboxWidget(props) {
818
861
  var _onFocus = function _onFocus() {
819
862
  return onFocus && onFocus(id, value);
820
863
  };
821
- var checked = value == "true" || value == true;
822
- return /*#__PURE__*/React.createElement(Form.Checkbox, _extends({
864
+ var checked = value == 'true' || value == true;
865
+ return jsx(Form.Checkbox, _extends({
823
866
  id: id,
824
867
  name: id,
825
868
  disabled: disabled || readonly,
826
869
  autoFocus: autofocus
827
870
  }, semanticProps, {
828
- checked: typeof value === "undefined" ? false : checked,
871
+ checked: typeof value === 'undefined' ? false : checked,
829
872
  error: rawErrors.length > 0,
830
873
  onChange: _onChange,
831
874
  onBlur: _onBlur,
832
875
  onFocus: _onFocus,
833
876
  required: required,
834
- label: label || "",
877
+ label: label || '',
835
878
  "aria-describedby": ariaDescribedByIds(id)
836
879
  }));
837
880
  }
@@ -857,7 +900,7 @@ function CheckboxesWidget(props) {
857
900
  _props$rawErrors = props.rawErrors,
858
901
  rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
859
902
  registry = props.registry;
860
- var TitleFieldTemplate = getTemplate("TitleFieldTemplate", registry, options);
903
+ var TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, options);
861
904
  var enumOptions = options.enumOptions,
862
905
  enumDisabled = options.enumDisabled,
863
906
  inline = options.inline;
@@ -893,34 +936,37 @@ function CheckboxesWidget(props) {
893
936
  } : {
894
937
  grouped: true
895
938
  };
896
- return /*#__PURE__*/React.createElement(React.Fragment, null, title && /*#__PURE__*/React.createElement(TitleFieldTemplate, {
897
- id: titleId(id),
898
- title: title,
899
- schema: schema,
900
- uiSchema: uiSchema,
901
- registry: registry
902
- }), /*#__PURE__*/React.createElement(Form.Group, _extends({
903
- id: id,
904
- name: id
905
- }, inlineOption), Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
906
- var checked = enumOptionsIsSelected(option.value, checkboxesValues);
907
- var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
908
- return /*#__PURE__*/React.createElement(Form.Checkbox, _extends({
909
- id: optionId(id, index),
910
- name: id,
911
- key: index,
912
- label: option.label
913
- }, semanticProps, {
914
- checked: checked,
915
- error: rawErrors.length > 0,
916
- disabled: disabled || itemDisabled || readonly,
917
- autoFocus: autofocus && index === 0,
918
- onChange: _onChange(index),
919
- onBlur: _onBlur,
920
- onFocus: _onFocus,
921
- "aria-describedby": ariaDescribedByIds(id)
922
- }));
923
- })));
939
+ return jsxs(Fragment, {
940
+ children: [title && jsx(TitleFieldTemplate, {
941
+ id: titleId(id),
942
+ title: title,
943
+ schema: schema,
944
+ uiSchema: uiSchema,
945
+ registry: registry
946
+ }), jsx(Form.Group, _extends({
947
+ id: id,
948
+ name: id
949
+ }, inlineOption, {
950
+ children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
951
+ var checked = enumOptionsIsSelected(option.value, checkboxesValues);
952
+ var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
953
+ return jsx(Form.Checkbox, _extends({
954
+ id: optionId(id, index),
955
+ name: id,
956
+ label: option.label
957
+ }, semanticProps, {
958
+ checked: checked,
959
+ error: rawErrors.length > 0,
960
+ disabled: disabled || itemDisabled || readonly,
961
+ autoFocus: autofocus && index === 0,
962
+ onChange: _onChange(index),
963
+ onBlur: _onBlur,
964
+ onFocus: _onFocus,
965
+ "aria-describedby": ariaDescribedByIds(id)
966
+ }), index);
967
+ })
968
+ }))]
969
+ });
924
970
  }
925
971
 
926
972
  /** The `RadioWidget` is a widget for rendering a radio group.
@@ -965,26 +1011,28 @@ function RadioWidget(props) {
965
1011
  } : {
966
1012
  grouped: true
967
1013
  };
968
- return /*#__PURE__*/React.createElement(Form.Group, _extends({}, inlineOption), Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
969
- var checked = enumOptionsIsSelected(option.value, value);
970
- var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
971
- return /*#__PURE__*/React.createElement(Form.Field, _extends({
972
- required: required,
973
- control: Radio,
974
- id: optionId(id, index),
975
- name: id
976
- }, semanticProps, {
977
- onFocus: _onFocus,
978
- onBlur: _onBlur,
979
- onChange: _onChange,
980
- label: option.label,
981
- value: String(index),
982
- error: rawErrors.length > 0,
983
- key: index,
984
- checked: checked,
985
- disabled: disabled || itemDisabled || readonly,
986
- "aria-describedby": ariaDescribedByIds(id)
987
- }));
1014
+ return jsx(Form.Group, _extends({}, inlineOption, {
1015
+ children: Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
1016
+ var checked = enumOptionsIsSelected(option.value, value);
1017
+ var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
1018
+ return /*#__PURE__*/createElement(Form.Field, _extends({
1019
+ required: required,
1020
+ control: Radio,
1021
+ id: optionId(id, index),
1022
+ name: id
1023
+ }, semanticProps, {
1024
+ onFocus: _onFocus,
1025
+ onBlur: _onBlur,
1026
+ onChange: _onChange,
1027
+ label: option.label,
1028
+ value: String(index),
1029
+ error: rawErrors.length > 0,
1030
+ key: index,
1031
+ checked: checked,
1032
+ disabled: disabled || itemDisabled || readonly,
1033
+ "aria-describedby": ariaDescribedByIds(id)
1034
+ }));
1035
+ })
988
1036
  }));
989
1037
  }
990
1038
 
@@ -1019,7 +1067,7 @@ function RangeWidget(props) {
1019
1067
  // eslint-disable-next-line no-shadow
1020
1068
  var _onChange = function _onChange(_ref) {
1021
1069
  var value = _ref.target.value;
1022
- return onChange && onChange(value === "" ? options.emptyValue : value);
1070
+ return onChange && onChange(value === '' ? options.emptyValue : value);
1023
1071
  };
1024
1072
  var _onBlur = function _onBlur() {
1025
1073
  return onBlur && onBlur(id, value);
@@ -1027,21 +1075,24 @@ function RangeWidget(props) {
1027
1075
  var _onFocus = function _onFocus() {
1028
1076
  return onFocus && onFocus(id, value);
1029
1077
  };
1030
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input, _extends({
1031
- id: id,
1032
- key: id,
1033
- name: id,
1034
- type: "range",
1035
- required: required,
1036
- disabled: disabled || readonly
1037
- }, rangeSpec(schema), semanticProps, {
1038
- value: value || "",
1039
- error: rawErrors.length > 0,
1040
- onChange: _onChange,
1041
- onBlur: _onBlur,
1042
- onFocus: _onFocus,
1043
- "aria-describedby": ariaDescribedByIds(id)
1044
- })), /*#__PURE__*/React.createElement("span", null, value));
1078
+ return jsxs(Fragment, {
1079
+ children: [jsx(Input, _extends({
1080
+ id: id,
1081
+ name: id,
1082
+ type: 'range',
1083
+ required: required,
1084
+ disabled: disabled || readonly
1085
+ }, rangeSpec(schema), semanticProps, {
1086
+ value: value || '',
1087
+ error: rawErrors.length > 0,
1088
+ onChange: _onChange,
1089
+ onBlur: _onBlur,
1090
+ onFocus: _onFocus,
1091
+ "aria-describedby": ariaDescribedByIds(id)
1092
+ }), id), jsx("span", {
1093
+ children: value
1094
+ })]
1095
+ });
1045
1096
  }
1046
1097
 
1047
1098
  /**
@@ -1093,7 +1144,7 @@ function SelectWidget(props) {
1093
1144
  formContext: formContext,
1094
1145
  options: options,
1095
1146
  defaultSchemaProps: {
1096
- inverted: "false",
1147
+ inverted: 'false',
1097
1148
  selection: true,
1098
1149
  fluid: true,
1099
1150
  scrolling: true,
@@ -1103,7 +1154,7 @@ function SelectWidget(props) {
1103
1154
  var enumDisabled = options.enumDisabled,
1104
1155
  enumOptions = options.enumOptions,
1105
1156
  optEmptyVal = options.emptyValue;
1106
- var emptyValue = multiple ? [] : "";
1157
+ var emptyValue = multiple ? [] : '';
1107
1158
  var dropdownOptions = createDefaultValueOptionsForDropDown(enumOptions, enumDisabled);
1108
1159
  var _onChange = function _onChange(_, _ref2) {
1109
1160
  var value = _ref2.value;
@@ -1119,13 +1170,12 @@ function SelectWidget(props) {
1119
1170
  return onFocus(id, enumOptionsValueForIndex(value, enumOptions, optEmptyVal));
1120
1171
  };
1121
1172
  var selectedIndexes = enumOptionsIndexForValue(value, enumOptions, multiple);
1122
- return /*#__PURE__*/React.createElement(Form.Dropdown, _extends({
1123
- key: id,
1173
+ return jsx(Form.Dropdown, _extends({
1124
1174
  id: id,
1125
1175
  name: id,
1126
1176
  label: label || schema.title,
1127
- multiple: typeof multiple === "undefined" ? false : multiple,
1128
- value: typeof value === "undefined" ? emptyValue : selectedIndexes,
1177
+ multiple: typeof multiple === 'undefined' ? false : multiple,
1178
+ value: typeof value === 'undefined' ? emptyValue : selectedIndexes,
1129
1179
  error: rawErrors.length > 0,
1130
1180
  disabled: disabled,
1131
1181
  placeholder: placeholder
@@ -1138,7 +1188,7 @@ function SelectWidget(props) {
1138
1188
  onBlur: _onBlur,
1139
1189
  onFocus: _onFocus,
1140
1190
  "aria-describedby": ariaDescribedByIds(id)
1141
- }));
1191
+ }), id);
1142
1192
  }
1143
1193
 
1144
1194
  /** The `TextareaWidget` is a widget for rendering input fields as textarea.
@@ -1175,7 +1225,7 @@ function TextareaWidget(props) {
1175
1225
  // eslint-disable-next-line no-shadow
1176
1226
  var _onChange = function _onChange(_ref) {
1177
1227
  var value = _ref.target.value;
1178
- return onChange && onChange(value === "" ? options.emptyValue : value);
1228
+ return onChange && onChange(value === '' ? options.emptyValue : value);
1179
1229
  };
1180
1230
  var _onBlur = function _onBlur() {
1181
1231
  return onBlur && onBlur(id, value);
@@ -1184,9 +1234,8 @@ function TextareaWidget(props) {
1184
1234
  return onFocus && onFocus(id, value);
1185
1235
  };
1186
1236
  var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
1187
- return /*#__PURE__*/React.createElement(Form.TextArea, _extends({
1237
+ return jsx(Form.TextArea, _extends({
1188
1238
  id: id,
1189
- key: id,
1190
1239
  name: id,
1191
1240
  label: displayLabel ? label || schema.title : false,
1192
1241
  placeholder: placeholder,
@@ -1194,14 +1243,14 @@ function TextareaWidget(props) {
1194
1243
  required: required,
1195
1244
  disabled: disabled || readonly
1196
1245
  }, semanticProps, {
1197
- value: value || "",
1246
+ value: value || '',
1198
1247
  error: rawErrors.length > 0,
1199
1248
  rows: options.rows || 5,
1200
1249
  onChange: _onChange,
1201
1250
  onBlur: _onBlur,
1202
1251
  onFocus: _onFocus,
1203
1252
  "aria-describedby": ariaDescribedByIds(id)
1204
- }));
1253
+ }), id);
1205
1254
  }
1206
1255
 
1207
1256
  function generateWidgets() {