@rjsf/semantic-ui 5.0.0-beta.13 → 5.0.0-beta.15

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.
@@ -14,23 +14,49 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
14
14
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
15
15
  var map__default = /*#__PURE__*/_interopDefaultLegacy(map);
16
16
 
17
+ function _extends() {
18
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
19
+ for (var i = 1; i < arguments.length; i++) {
20
+ var source = arguments[i];
21
+ for (var key in source) {
22
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
23
+ target[key] = source[key];
24
+ }
25
+ }
26
+ }
27
+ return target;
28
+ };
29
+ return _extends.apply(this, arguments);
30
+ }
31
+ function _objectWithoutPropertiesLoose(source, excluded) {
32
+ if (source == null) return {};
33
+ var target = {};
34
+ var sourceKeys = Object.keys(source);
35
+ var key, i;
36
+ for (i = 0; i < sourceKeys.length; i++) {
37
+ key = sourceKeys[i];
38
+ if (excluded.indexOf(key) >= 0) continue;
39
+ target[key] = source[key];
40
+ }
41
+ return target;
42
+ }
43
+
44
+ var _excluded$4 = ["uiSchema", "color"];
17
45
  function AddButton(_ref) {
18
- let {
19
- uiSchema,
20
- color,
21
- ...props
22
- } = _ref;
23
- return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Button, {
46
+ var color = _ref.color,
47
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
48
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Button, _extends({
24
49
  title: "Add Item",
25
- color: color,
26
- ...props,
50
+ color: color
51
+ }, props, {
27
52
  icon: true,
28
53
  size: "tiny"
29
- }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Icon, {
54
+ }), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Icon, {
30
55
  name: "plus"
31
56
  }));
32
57
  }
33
58
 
59
+ var _excluded$3 = ["wrap", "component"];
34
60
  /**
35
61
  * Extract props meant for semantic UI components from props that are
36
62
  * passed to Widgets, Templates and Fields.
@@ -43,25 +69,24 @@ function AddButton(_ref) {
43
69
  * @returns {any}
44
70
  */
45
71
  function getSemanticProps(_ref) {
46
- let {
47
- formContext = {},
48
- uiSchema = {},
49
- options = {},
50
- defaultSchemaProps = {
72
+ var _ref$formContext = _ref.formContext,
73
+ formContext = _ref$formContext === void 0 ? {} : _ref$formContext,
74
+ _ref$uiSchema = _ref.uiSchema,
75
+ uiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema,
76
+ _ref$options = _ref.options,
77
+ options = _ref$options === void 0 ? {} : _ref$options,
78
+ _ref$defaultSchemaPro = _ref.defaultSchemaProps,
79
+ defaultSchemaProps = _ref$defaultSchemaPro === void 0 ? {
51
80
  fluid: true,
52
81
  inverted: false
53
- },
54
- defaultContextProps = {}
55
- } = _ref;
56
- const formContextProps = formContext.semantic;
57
- const schemaProps = utils.getUiOptions(uiSchema).semantic;
58
- const optionProps = options.semantic;
82
+ } : _ref$defaultSchemaPro,
83
+ _ref$defaultContextPr = _ref.defaultContextProps,
84
+ defaultContextProps = _ref$defaultContextPr === void 0 ? {} : _ref$defaultContextPr;
85
+ var formContextProps = formContext.semantic;
86
+ var schemaProps = utils.getUiOptions(uiSchema).semantic;
87
+ var optionProps = options.semantic;
59
88
  // formContext props should overide other props
60
- return Object.assign({}, {
61
- ...defaultSchemaProps
62
- }, {
63
- ...defaultContextProps
64
- }, schemaProps, optionProps, formContextProps);
89
+ return Object.assign({}, _extends({}, defaultSchemaProps), _extends({}, defaultContextProps), schemaProps, optionProps, formContextProps);
65
90
  }
66
91
  /**
67
92
  * Extract error props meant for semantic UI components from props that are
@@ -73,22 +98,22 @@ function getSemanticProps(_ref) {
73
98
  * @returns {any}
74
99
  */
75
100
  function getSemanticErrorProps(_ref2) {
76
- let {
77
- formContext = {},
78
- uiSchema = {},
79
- options = {},
80
- defaultProps = {
101
+ var _ref2$formContext = _ref2.formContext,
102
+ formContext = _ref2$formContext === void 0 ? {} : _ref2$formContext,
103
+ _ref2$uiSchema = _ref2.uiSchema,
104
+ uiSchema = _ref2$uiSchema === void 0 ? {} : _ref2$uiSchema,
105
+ _ref2$options = _ref2.options,
106
+ options = _ref2$options === void 0 ? {} : _ref2$options,
107
+ _ref2$defaultProps = _ref2.defaultProps,
108
+ defaultProps = _ref2$defaultProps === void 0 ? {
81
109
  size: "small",
82
110
  pointing: "above"
83
- }
84
- } = _ref2;
85
- const formContextProps = formContext.semantic && formContext.semantic.errorOptions;
86
- const semanticOptions = utils.getUiOptions(uiSchema).semantic;
87
- const schemaProps = semanticOptions && semanticOptions.errorOptions;
88
- const optionProps = options.semantic && options.semantic.errorOptions;
89
- return Object.assign({}, {
90
- ...defaultProps
91
- }, schemaProps, optionProps, formContextProps);
111
+ } : _ref2$defaultProps;
112
+ var formContextProps = formContext.semantic && formContext.semantic.errorOptions;
113
+ var semanticOptions = utils.getUiOptions(uiSchema).semantic;
114
+ var schemaProps = semanticOptions && semanticOptions.errorOptions;
115
+ var optionProps = options.semantic && options.semantic.errorOptions;
116
+ return Object.assign({}, _extends({}, defaultProps), schemaProps, optionProps, formContextProps);
92
117
  }
93
118
  /**
94
119
  * Combine multiple strings containing class names into a single string,
@@ -105,10 +130,14 @@ function cleanClassNames(classNameArr, omit) {
105
130
  }
106
131
  // Split each arg on whitespace, and add it to an array. Skip false-y args
107
132
  // like "" and undefined.
108
- const classList = classNameArr.filter(Boolean).reduce((previous, current) => previous.concat(current.trim().split(/\s+/)), []);
133
+ var classList = classNameArr.filter(Boolean).reduce(function (previous, current) {
134
+ return previous.concat(current.trim().split(/\s+/));
135
+ }, []);
109
136
  // Remove any class names from omit, and make the rest unique before
110
137
  // returning them as a string
111
- return [...new Set(classList.filter(cn => !omit.includes(cn)))].join(" ");
138
+ return [].concat(new Set(classList.filter(function (cn) {
139
+ return !omit.includes(cn);
140
+ }))).join(" ");
112
141
  }
113
142
  /**
114
143
  *
@@ -119,56 +148,52 @@ function cleanClassNames(classNameArr, omit) {
119
148
  * @constructor
120
149
  */
121
150
  function MaybeWrap(_ref3) {
122
- let {
123
- wrap,
124
- component: Component = "div",
125
- ...props
126
- } = _ref3;
127
- return wrap ? /*#__PURE__*/React__default["default"].createElement(Component, {
128
- ...props
129
- }) : props.children;
151
+ var wrap = _ref3.wrap,
152
+ _ref3$component = _ref3.component,
153
+ Component = _ref3$component === void 0 ? "div" : _ref3$component,
154
+ props = _objectWithoutPropertiesLoose(_ref3, _excluded$3);
155
+ return wrap ? /*#__PURE__*/React__default["default"].createElement(Component, _extends({}, props)) : props.children;
130
156
  }
131
157
 
132
- const gridStyle = vertical => ({
133
- display: "grid",
134
- gridTemplateColumns: `1fr ${vertical ? 65 : 110}px`
135
- });
136
- const ArrayFieldItemTemplate = props => {
137
- const {
138
- children,
139
- disabled,
140
- hasToolbar,
141
- hasMoveDown,
142
- hasMoveUp,
143
- hasRemove,
144
- index,
145
- onDropIndexClick,
146
- onReorderClick,
147
- readonly,
148
- uiSchema,
149
- registry
150
- } = props;
151
- const {
152
- MoveDownButton,
153
- MoveUpButton,
154
- RemoveButton
155
- } = registry.templates.ButtonTemplates;
156
- const uiOptions = utils.getUiOptions(uiSchema);
158
+ var gridStyle = function gridStyle(vertical) {
159
+ return {
160
+ display: "grid",
161
+ gridTemplateColumns: "1fr " + (vertical ? 65 : 110) + "px"
162
+ };
163
+ };
164
+ var ArrayFieldItemTemplate = function ArrayFieldItemTemplate(props) {
165
+ var children = props.children,
166
+ disabled = props.disabled,
167
+ hasToolbar = props.hasToolbar,
168
+ hasMoveDown = props.hasMoveDown,
169
+ hasMoveUp = props.hasMoveUp,
170
+ hasRemove = props.hasRemove,
171
+ index = props.index,
172
+ onDropIndexClick = props.onDropIndexClick,
173
+ onReorderClick = props.onReorderClick,
174
+ readonly = props.readonly,
175
+ uiSchema = props.uiSchema,
176
+ registry = props.registry;
177
+ var _registry$templates$B = registry.templates.ButtonTemplates,
178
+ MoveDownButton = _registry$templates$B.MoveDownButton,
179
+ MoveUpButton = _registry$templates$B.MoveUpButton,
180
+ RemoveButton = _registry$templates$B.RemoveButton;
181
+ var uiOptions = utils.getUiOptions(uiSchema);
157
182
  // Pull the semantic props out of the uiOptions that were put in via the ArrayFieldTemplate
158
- const {
159
- horizontalButtons = false,
160
- wrapItem = false
161
- } = uiOptions.semantic;
183
+ var _uiOptions$semantic = uiOptions.semantic,
184
+ _uiOptions$semantic$h = _uiOptions$semantic.horizontalButtons,
185
+ horizontalButtons = _uiOptions$semantic$h === void 0 ? false : _uiOptions$semantic$h,
186
+ _uiOptions$semantic$w = _uiOptions$semantic.wrapItem,
187
+ wrapItem = _uiOptions$semantic$w === void 0 ? false : _uiOptions$semantic$w;
162
188
  return /*#__PURE__*/React__default["default"].createElement("div", {
163
189
  className: "array-item"
164
190
  }, /*#__PURE__*/React__default["default"].createElement(MaybeWrap, {
165
191
  wrap: wrapItem,
166
192
  component: semanticUiReact.Segment
167
193
  }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid, {
168
- style: index !== 0 ? {
169
- ...gridStyle(!horizontalButtons),
194
+ style: index !== 0 ? _extends({}, gridStyle(!horizontalButtons), {
170
195
  alignItems: "center"
171
- } : gridStyle(!horizontalButtons)
196
+ }) : gridStyle(!horizontalButtons)
172
197
  }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Column, {
173
198
  width: 16,
174
199
  verticalAlign: "middle"
@@ -193,50 +218,41 @@ const ArrayFieldItemTemplate = props => {
193
218
  }))))));
194
219
  };
195
220
 
221
+ var _excluded$2 = ["key", "uiSchema"];
196
222
  function ArrayFieldTemplate(_ref) {
197
- let {
198
- uiSchema,
199
- idSchema,
200
- canAdd,
201
- className,
202
- // classNames, This is not part of the type, so it is likely never passed in
203
- disabled,
204
- formContext,
205
- items,
206
- onAddClick,
207
- // options, This is not part of the type, so it is likely never passed in
208
- readonly,
209
- required,
210
- schema,
211
- title,
212
- registry
213
- } = _ref;
214
- const semanticProps = getSemanticProps({
215
- uiSchema,
216
- formContext,
223
+ var uiSchema = _ref.uiSchema,
224
+ idSchema = _ref.idSchema,
225
+ canAdd = _ref.canAdd,
226
+ className = _ref.className,
227
+ disabled = _ref.disabled,
228
+ formContext = _ref.formContext,
229
+ items = _ref.items,
230
+ onAddClick = _ref.onAddClick,
231
+ readonly = _ref.readonly,
232
+ required = _ref.required,
233
+ schema = _ref.schema,
234
+ title = _ref.title,
235
+ registry = _ref.registry;
236
+ var semanticProps = getSemanticProps({
237
+ uiSchema: uiSchema,
238
+ formContext: formContext,
217
239
  defaultSchemaProps: {
218
240
  horizontalButtons: false,
219
241
  wrapItem: false
220
242
  }
221
243
  });
222
- const {
223
- horizontalButtons,
224
- wrapItem
225
- } = semanticProps;
226
- const semantic = {
227
- horizontalButtons,
228
- wrapItem
244
+ var horizontalButtons = semanticProps.horizontalButtons,
245
+ wrapItem = semanticProps.wrapItem;
246
+ var semantic = {
247
+ horizontalButtons: horizontalButtons,
248
+ wrapItem: wrapItem
229
249
  };
230
- const uiOptions = utils.getUiOptions(uiSchema);
231
- const ArrayFieldDescriptionTemplate = utils.getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
232
- const ArrayFieldItemTemplate = utils.getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
233
- const ArrayFieldTitleTemplate = utils.getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
250
+ var uiOptions = utils.getUiOptions(uiSchema);
251
+ var ArrayFieldDescriptionTemplate = utils.getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
252
+ var ArrayFieldItemTemplate = utils.getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
253
+ var ArrayFieldTitleTemplate = utils.getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
234
254
  // Button templates are not overridden in the uiSchema
235
- const {
236
- ButtonTemplates: {
237
- AddButton
238
- }
239
- } = registry.templates;
255
+ var AddButton = registry.templates.ButtonTemplates.AddButton;
240
256
  return /*#__PURE__*/React__default["default"].createElement("div", {
241
257
  className: cleanClassNames([className, utils.isFixedItems(schema) ? "" : "sortable-form-fields"])
242
258
  }, /*#__PURE__*/React__default["default"].createElement(ArrayFieldTitleTemplate, {
@@ -253,28 +269,24 @@ function ArrayFieldTemplate(_ref) {
253
269
  uiSchema: uiSchema,
254
270
  registry: registry
255
271
  }), /*#__PURE__*/React__default["default"].createElement("div", {
256
- key: `array-item-list-${idSchema.$id}`
272
+ key: "array-item-list-" + idSchema.$id
257
273
  }, /*#__PURE__*/React__default["default"].createElement("div", {
258
274
  className: "row array-item-list"
259
- }, items && items.map(_ref2 => {
260
- let {
261
- key,
262
- uiSchema: itemUiSchema = {},
263
- ...props
264
- } = _ref2;
275
+ }, items && items.map(function (_ref2) {
276
+ var _extends2;
277
+ var key = _ref2.key,
278
+ _ref2$uiSchema = _ref2.uiSchema,
279
+ itemUiSchema = _ref2$uiSchema === void 0 ? {} : _ref2$uiSchema,
280
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$2);
265
281
  // Merge in the semantic props from the ArrayFieldTemplate into each of the items
266
- const mergedUiSchema = {
267
- ...itemUiSchema,
268
- [utils.UI_OPTIONS_KEY]: {
269
- ...itemUiSchema[utils.UI_OPTIONS_KEY],
270
- semantic
271
- }
272
- };
273
- return /*#__PURE__*/React__default["default"].createElement(ArrayFieldItemTemplate, {
274
- key: key,
275
- ...props,
282
+ var mergedUiSchema = _extends({}, itemUiSchema, (_extends2 = {}, _extends2[utils.UI_OPTIONS_KEY] = _extends({}, itemUiSchema[utils.UI_OPTIONS_KEY], {
283
+ semantic: semantic
284
+ }), _extends2));
285
+ return /*#__PURE__*/React__default["default"].createElement(ArrayFieldItemTemplate, _extends({
286
+ key: key
287
+ }, props, {
276
288
  uiSchema: mergedUiSchema
277
- });
289
+ }));
278
290
  })), canAdd && /*#__PURE__*/React__default["default"].createElement("div", {
279
291
  style: {
280
292
  marginTop: "1rem",
@@ -289,66 +301,63 @@ function ArrayFieldTemplate(_ref) {
289
301
  }
290
302
 
291
303
  function BaseInputTemplate(props) {
292
- const {
293
- id,
294
- placeholder,
295
- label,
296
- value,
297
- required,
298
- readonly,
299
- disabled,
300
- onChange,
301
- onBlur,
302
- onFocus,
303
- autofocus,
304
- options,
305
- schema,
306
- uiSchema,
307
- formContext,
308
- type,
309
- registry,
310
- rawErrors = []
311
- } = props;
312
- const inputProps = utils.getInputProps(schema, type, options);
313
- const semanticProps = getSemanticProps({
314
- uiSchema,
315
- formContext,
316
- options
304
+ var id = props.id,
305
+ placeholder = props.placeholder,
306
+ label = props.label,
307
+ value = props.value,
308
+ required = props.required,
309
+ readonly = props.readonly,
310
+ disabled = props.disabled,
311
+ onChange = props.onChange,
312
+ onBlur = props.onBlur,
313
+ onFocus = props.onFocus,
314
+ autofocus = props.autofocus,
315
+ options = props.options,
316
+ schema = props.schema,
317
+ uiSchema = props.uiSchema,
318
+ formContext = props.formContext,
319
+ type = props.type,
320
+ registry = props.registry,
321
+ _props$rawErrors = props.rawErrors,
322
+ rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors;
323
+ var inputProps = utils.getInputProps(schema, type, options);
324
+ var semanticProps = getSemanticProps({
325
+ uiSchema: uiSchema,
326
+ formContext: formContext,
327
+ options: options
317
328
  });
318
- const {
319
- schemaUtils
320
- } = registry;
321
- const _onChange = _ref => {
322
- let {
323
- target: {
324
- value
325
- }
326
- } = _ref;
329
+ var schemaUtils = registry.schemaUtils;
330
+ var _onChange = function _onChange(_ref) {
331
+ var value = _ref.target.value;
327
332
  return onChange(value === "" ? options.emptyValue : value);
328
333
  };
329
- const _onBlur = () => onBlur && onBlur(id, value);
330
- const _onFocus = () => onFocus && onFocus(id, value);
331
- const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
332
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Input, {
334
+ var _onBlur = function _onBlur() {
335
+ return onBlur && onBlur(id, value);
336
+ };
337
+ var _onFocus = function _onFocus() {
338
+ return onFocus && onFocus(id, value);
339
+ };
340
+ var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
341
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Input, _extends({
333
342
  key: id,
334
343
  id: id,
335
344
  name: id,
336
- placeholder: placeholder,
337
- ...inputProps,
345
+ placeholder: placeholder
346
+ }, inputProps, {
338
347
  label: displayLabel ? label || schema.title : false,
339
348
  required: required,
340
349
  autoFocus: autofocus,
341
350
  disabled: disabled || readonly,
342
- list: schema.examples ? `examples_${id}` : undefined,
343
- ...semanticProps,
351
+ list: schema.examples ? "examples_" + id : undefined
352
+ }, semanticProps, {
344
353
  value: value || value === 0 ? value : "",
345
354
  error: rawErrors.length > 0,
346
355
  onChange: _onChange,
347
356
  onBlur: _onBlur,
348
357
  onFocus: _onFocus
349
- }), schema.examples && /*#__PURE__*/React__default["default"].createElement("datalist", {
350
- id: `examples_${id}`
351
- }, schema.examples.concat(schema.default ? [schema.default] : []).map(example => {
358
+ })), schema.examples && /*#__PURE__*/React__default["default"].createElement("datalist", {
359
+ id: "examples_" + id
360
+ }, schema.examples.concat(schema["default"] ? [schema["default"]] : []).map(function (example) {
352
361
  return /*#__PURE__*/React__default["default"].createElement("option", {
353
362
  key: example,
354
363
  value: example
@@ -357,10 +366,8 @@ function BaseInputTemplate(props) {
357
366
  }
358
367
 
359
368
  function DescriptionField(_ref) {
360
- let {
361
- description,
362
- id
363
- } = _ref;
369
+ var description = _ref.description,
370
+ id = _ref.id;
364
371
  if (!description) {
365
372
  return null;
366
373
  }
@@ -377,56 +384,53 @@ function DescriptionField(_ref) {
377
384
  * @constructor
378
385
  */
379
386
  function ErrorList(_ref) {
380
- let {
381
- errors
382
- } = _ref;
387
+ var errors = _ref.errors;
383
388
  return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message, {
384
389
  negative: true
385
- }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message.Header, null, "Errors"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message.List, null, errors.map((error, index) => /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message.Item, {
386
- key: `error-${index}`
387
- }, error.stack))));
390
+ }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message.Header, null, "Errors"), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message.List, null, errors.map(function (error, index) {
391
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message.Item, {
392
+ key: "error-" + index
393
+ }, error.stack);
394
+ })));
388
395
  }
389
396
 
397
+ var _excluded$1 = ["icon", "iconType", "color", "className", "uiSchema"];
390
398
  function IconButton(props) {
391
- const {
392
- icon,
393
- iconType,
394
- color,
395
- className,
396
- uiSchema,
397
- ...otherProps
398
- } = props;
399
- return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Button, {
399
+ var icon = props.icon,
400
+ iconType = props.iconType,
401
+ color = props.color,
402
+ className = props.className,
403
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
404
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Button, _extends({
400
405
  icon: icon,
401
406
  size: iconType,
402
407
  color: color,
403
- className: className,
404
- ...otherProps
405
- });
408
+ className: className
409
+ }, otherProps));
406
410
  }
407
411
  function MoveDownButton(props) {
408
- return /*#__PURE__*/React__default["default"].createElement(IconButton, {
409
- title: "Move down",
410
- ...props,
412
+ return /*#__PURE__*/React__default["default"].createElement(IconButton, _extends({
413
+ title: "Move down"
414
+ }, props, {
411
415
  icon: "angle down"
412
- });
416
+ }));
413
417
  }
414
418
  function MoveUpButton(props) {
415
- return /*#__PURE__*/React__default["default"].createElement(IconButton, {
416
- title: "Move up",
417
- ...props,
419
+ return /*#__PURE__*/React__default["default"].createElement(IconButton, _extends({
420
+ title: "Move up"
421
+ }, props, {
418
422
  icon: "angle up"
419
- });
423
+ }));
420
424
  }
421
425
  function RemoveButton(props) {
422
- return /*#__PURE__*/React__default["default"].createElement(IconButton, {
423
- title: "Remove",
424
- ...props,
426
+ return /*#__PURE__*/React__default["default"].createElement(IconButton, _extends({
427
+ title: "Remove"
428
+ }, props, {
425
429
  icon: "trash"
426
- });
430
+ }));
427
431
  }
428
432
 
429
- const DEFAULT_OPTIONS$1 = {
433
+ var DEFAULT_OPTIONS$1 = {
430
434
  options: {
431
435
  pointing: "above",
432
436
  size: "small"
@@ -441,26 +445,20 @@ const DEFAULT_OPTIONS$1 = {
441
445
  * @return {null}
442
446
  */
443
447
  function FieldErrorTemplate(_ref) {
444
- let {
445
- errors,
446
- idSchema,
447
- uiSchema,
448
- registry
449
- } = _ref;
450
- const {
451
- formContext
452
- } = registry;
453
- const options = getSemanticErrorProps({
454
- formContext,
455
- uiSchema,
448
+ var errors = _ref.errors,
449
+ idSchema = _ref.idSchema,
450
+ uiSchema = _ref.uiSchema,
451
+ registry = _ref.registry;
452
+ var formContext = registry.formContext;
453
+ var options = getSemanticErrorProps({
454
+ formContext: formContext,
455
+ uiSchema: uiSchema,
456
456
  defaultProps: DEFAULT_OPTIONS$1
457
457
  });
458
- const {
459
- pointing,
460
- size
461
- } = options;
458
+ var pointing = options.pointing,
459
+ size = options.size;
462
460
  if (errors && errors.length > 0) {
463
- const id = `${idSchema.$id}__error`;
461
+ var id = idSchema.$id + "__error";
464
462
  return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Label, {
465
463
  id: id,
466
464
  color: "red",
@@ -469,9 +467,11 @@ function FieldErrorTemplate(_ref) {
469
467
  basic: true
470
468
  }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List, {
471
469
  bulleted: true
472
- }, errors.map(error => /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, {
473
- key: nanoid.nanoid()
474
- }, error))));
470
+ }, errors.map(function (error) {
471
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.List.Item, {
472
+ key: nanoid.nanoid()
473
+ }, error);
474
+ })));
475
475
  }
476
476
  return null;
477
477
  }
@@ -480,12 +480,10 @@ function FieldErrorTemplate(_ref) {
480
480
  * @return {null}
481
481
  */
482
482
  function FieldHelpTemplate(_ref) {
483
- let {
484
- help,
485
- idSchema
486
- } = _ref;
483
+ var help = _ref.help,
484
+ idSchema = _ref.idSchema;
487
485
  if (help) {
488
- const id = `${idSchema.$id}__help`;
486
+ var id = idSchema.$id + "__help";
489
487
  return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Message, {
490
488
  size: "mini",
491
489
  info: true,
@@ -496,30 +494,27 @@ function FieldHelpTemplate(_ref) {
496
494
  return null;
497
495
  }
498
496
 
497
+ var _excluded = ["id", "children", "classNames", "displayLabel", "label", "errors", "help", "hidden", "rawDescription", "registry", "schema", "uiSchema"];
499
498
  function FieldTemplate(_ref) {
500
- let {
501
- id,
502
- children,
503
- classNames,
504
- displayLabel,
505
- label,
506
- errors,
507
- help,
508
- hidden,
509
- rawDescription,
510
- registry,
511
- schema,
512
- uiSchema,
513
- ...props
514
- } = _ref;
515
- const semanticProps = getSemanticProps(props);
516
- const {
517
- wrapLabel,
518
- wrapContent
519
- } = semanticProps;
520
- const uiOptions = utils.getUiOptions(uiSchema);
521
- const WrapIfAdditionalTemplate = utils.getTemplate("WrapIfAdditionalTemplate", registry, uiOptions);
522
- const DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions);
499
+ var id = _ref.id,
500
+ children = _ref.children,
501
+ classNames = _ref.classNames,
502
+ displayLabel = _ref.displayLabel,
503
+ label = _ref.label,
504
+ errors = _ref.errors,
505
+ help = _ref.help,
506
+ hidden = _ref.hidden,
507
+ rawDescription = _ref.rawDescription,
508
+ registry = _ref.registry,
509
+ schema = _ref.schema,
510
+ uiSchema = _ref.uiSchema,
511
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
512
+ var semanticProps = getSemanticProps(props);
513
+ var wrapLabel = semanticProps.wrapLabel,
514
+ wrapContent = semanticProps.wrapContent;
515
+ var uiOptions = utils.getUiOptions(uiSchema);
516
+ var WrapIfAdditionalTemplate = utils.getTemplate("WrapIfAdditionalTemplate", registry, uiOptions);
517
+ var DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions);
523
518
  if (hidden) {
524
519
  return /*#__PURE__*/React__default["default"].createElement("div", {
525
520
  style: {
@@ -527,15 +522,14 @@ function FieldTemplate(_ref) {
527
522
  }
528
523
  }, children);
529
524
  }
530
- return /*#__PURE__*/React__default["default"].createElement(WrapIfAdditionalTemplate, {
525
+ return /*#__PURE__*/React__default["default"].createElement(WrapIfAdditionalTemplate, _extends({
531
526
  classNames: classNames,
532
527
  id: id,
533
528
  label: label,
534
529
  registry: registry,
535
530
  schema: schema,
536
- uiSchema: uiSchema,
537
- ...props
538
- }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Group, {
531
+ uiSchema: uiSchema
532
+ }, props), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Group, {
539
533
  key: id,
540
534
  widths: "equal",
541
535
  grouped: true
@@ -546,7 +540,7 @@ function FieldTemplate(_ref) {
546
540
  wrap: wrapLabel,
547
541
  className: "sui-field-label"
548
542
  }, rawDescription && /*#__PURE__*/React__default["default"].createElement(DescriptionFieldTemplate, {
549
- id: `${id}-description`,
543
+ id: id + "-description",
550
544
  description: rawDescription,
551
545
  schema: schema,
552
546
  uiSchema: uiSchema,
@@ -555,45 +549,41 @@ function FieldTemplate(_ref) {
555
549
  }
556
550
 
557
551
  function ObjectFieldTemplate(_ref) {
558
- let {
559
- description,
560
- onAddClick,
561
- title,
562
- properties,
563
- disabled,
564
- readonly,
565
- required,
566
- uiSchema,
567
- schema,
568
- formData,
569
- idSchema,
570
- registry
571
- } = _ref;
572
- const uiOptions = utils.getUiOptions(uiSchema);
573
- const TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, uiOptions);
574
- const DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions);
552
+ var description = _ref.description,
553
+ onAddClick = _ref.onAddClick,
554
+ title = _ref.title,
555
+ properties = _ref.properties,
556
+ disabled = _ref.disabled,
557
+ readonly = _ref.readonly,
558
+ required = _ref.required,
559
+ uiSchema = _ref.uiSchema,
560
+ schema = _ref.schema,
561
+ formData = _ref.formData,
562
+ idSchema = _ref.idSchema,
563
+ registry = _ref.registry;
564
+ var uiOptions = utils.getUiOptions(uiSchema);
565
+ var TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, uiOptions);
566
+ var DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions);
575
567
  // Button templates are not overridden in the uiSchema
576
- const {
577
- ButtonTemplates: {
578
- AddButton
579
- }
580
- } = registry.templates;
581
- const fieldTitle = uiOptions.title || title;
582
- const fieldDescription = uiOptions.description || description;
568
+ var AddButton = registry.templates.ButtonTemplates.AddButton;
569
+ var fieldTitle = uiOptions.title || title;
570
+ var fieldDescription = uiOptions.description || description;
583
571
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, fieldTitle && /*#__PURE__*/React__default["default"].createElement(TitleFieldTemplate, {
584
- id: `${idSchema.$id}-title`,
572
+ id: idSchema.$id + "-title",
585
573
  title: fieldTitle,
586
574
  required: required,
587
575
  schema: schema,
588
576
  uiSchema: uiSchema,
589
577
  registry: registry
590
578
  }), fieldDescription && /*#__PURE__*/React__default["default"].createElement(DescriptionFieldTemplate, {
591
- id: `${idSchema.$id}-description`,
579
+ id: idSchema.$id + "-description",
592
580
  description: fieldDescription,
593
581
  schema: schema,
594
582
  uiSchema: uiSchema,
595
583
  registry: registry
596
- }), properties.map(prop => prop.content), utils.canExpand(schema, uiSchema, formData) && /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Column, {
584
+ }), properties.map(function (prop) {
585
+ return prop.content;
586
+ }), utils.canExpand(schema, uiSchema, formData) && /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Column, {
597
587
  width: 16,
598
588
  verticalAlign: "middle"
599
589
  }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Row, null, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -609,88 +599,76 @@ function ObjectFieldTemplate(_ref) {
609
599
  })))));
610
600
  }
611
601
 
612
- var SubmitButton = (_ref => {
613
- let {
614
- uiSchema
615
- } = _ref;
616
- const {
617
- submitText,
618
- norender,
619
- props: submitButtonProps
620
- } = utils.getSubmitButtonOptions(uiSchema);
602
+ var SubmitButton = (function (_ref) {
603
+ var uiSchema = _ref.uiSchema;
604
+ var _getSubmitButtonOptio = utils.getSubmitButtonOptions(uiSchema),
605
+ submitText = _getSubmitButtonOptio.submitText,
606
+ norender = _getSubmitButtonOptio.norender,
607
+ submitButtonProps = _getSubmitButtonOptio.props;
621
608
  if (norender) {
622
609
  return null;
623
610
  }
624
- return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Button, {
611
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Button, _extends({
625
612
  type: "submit",
626
- primary: true,
627
- ...submitButtonProps
628
- }, submitText);
613
+ primary: true
614
+ }, submitButtonProps), submitText);
629
615
  });
630
616
 
631
- const DEFAULT_OPTIONS = {
617
+ var DEFAULT_OPTIONS = {
632
618
  inverted: false,
633
619
  dividing: true
634
620
  };
635
621
  function TitleField(_ref) {
636
- let {
637
- id,
638
- title,
639
- uiSchema
640
- } = _ref;
641
- const semanticProps = getSemanticProps({
642
- uiSchema,
622
+ var id = _ref.id,
623
+ title = _ref.title,
624
+ uiSchema = _ref.uiSchema;
625
+ var semanticProps = getSemanticProps({
626
+ uiSchema: uiSchema,
643
627
  defaultSchemaProps: DEFAULT_OPTIONS
644
628
  });
645
629
  if (!title) {
646
630
  return null;
647
631
  }
648
- return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Header, {
649
- id: id,
650
- ...semanticProps,
632
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Header, _extends({
633
+ id: id
634
+ }, semanticProps, {
651
635
  as: "h5"
652
- }, title);
636
+ }), title);
653
637
  }
654
638
 
655
- const WrapIfAdditionalTemplate = _ref => {
656
- let {
657
- children,
658
- classNames,
659
- disabled,
660
- id,
661
- label,
662
- onDropPropertyClick,
663
- onKeyChange,
664
- readonly,
665
- required,
666
- schema,
667
- uiSchema,
668
- registry
669
- } = _ref;
639
+ var WrapIfAdditionalTemplate = function WrapIfAdditionalTemplate(_ref) {
640
+ var children = _ref.children,
641
+ classNames = _ref.classNames,
642
+ disabled = _ref.disabled,
643
+ id = _ref.id,
644
+ label = _ref.label,
645
+ onDropPropertyClick = _ref.onDropPropertyClick,
646
+ onKeyChange = _ref.onKeyChange,
647
+ readonly = _ref.readonly,
648
+ required = _ref.required,
649
+ schema = _ref.schema,
650
+ uiSchema = _ref.uiSchema,
651
+ registry = _ref.registry;
670
652
  // Button templates are not overridden in the uiSchema
671
- const {
672
- RemoveButton
673
- } = registry.templates.ButtonTemplates;
674
- const {
675
- readonlyAsDisabled = true,
676
- wrapperStyle
677
- } = registry.formContext;
678
- const keyLabel = `${label} Key`; // i18n ?
679
- const additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
653
+ var RemoveButton = registry.templates.ButtonTemplates.RemoveButton;
654
+ var _registry$formContext = registry.formContext,
655
+ _registry$formContext2 = _registry$formContext.readonlyAsDisabled,
656
+ readonlyAsDisabled = _registry$formContext2 === void 0 ? true : _registry$formContext2,
657
+ wrapperStyle = _registry$formContext.wrapperStyle;
658
+ var keyLabel = label + " Key"; // i18n ?
659
+ var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
680
660
  if (!additional) {
681
661
  return /*#__PURE__*/React__default["default"].createElement("div", {
682
662
  className: classNames
683
663
  }, children);
684
664
  }
685
- const handleBlur = _ref2 => {
686
- let {
687
- target
688
- } = _ref2;
665
+ var handleBlur = function handleBlur(_ref2) {
666
+ var target = _ref2.target;
689
667
  return onKeyChange(target.value);
690
668
  };
691
669
  return /*#__PURE__*/React__default["default"].createElement("div", {
692
670
  className: classNames,
693
- key: `${id}-key`
671
+ key: id + "-key"
694
672
  }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid, {
695
673
  columns: "equal"
696
674
  }, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Row, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Grid.Column, {
@@ -702,13 +680,13 @@ const WrapIfAdditionalTemplate = _ref => {
702
680
  className: "form-group",
703
681
  hasFeedback: true,
704
682
  fluid: true,
705
- htmlFor: `${id}`,
683
+ htmlFor: "" + id,
706
684
  label: keyLabel,
707
685
  required: required,
708
686
  defaultValue: label,
709
687
  disabled: disabled || readonlyAsDisabled && readonly,
710
- id: `${id}`,
711
- name: `${id}`,
688
+ id: "" + id,
689
+ name: "" + id,
712
690
  onBlur: !readonly ? handleBlur : undefined,
713
691
  style: wrapperStyle,
714
692
  type: "text"
@@ -724,68 +702,71 @@ const WrapIfAdditionalTemplate = _ref => {
724
702
  })))));
725
703
  };
726
704
 
727
- const Templates = {
728
- ArrayFieldItemTemplate,
729
- ArrayFieldTemplate,
730
- BaseInputTemplate,
705
+ var Templates = {
706
+ ArrayFieldItemTemplate: ArrayFieldItemTemplate,
707
+ ArrayFieldTemplate: ArrayFieldTemplate,
708
+ BaseInputTemplate: BaseInputTemplate,
731
709
  ButtonTemplates: {
732
- AddButton,
733
- MoveDownButton,
734
- MoveUpButton,
735
- RemoveButton,
736
- SubmitButton
710
+ AddButton: AddButton,
711
+ MoveDownButton: MoveDownButton,
712
+ MoveUpButton: MoveUpButton,
713
+ RemoveButton: RemoveButton,
714
+ SubmitButton: SubmitButton
737
715
  },
738
716
  DescriptionFieldTemplate: DescriptionField,
739
717
  ErrorListTemplate: ErrorList,
740
- FieldErrorTemplate,
741
- FieldHelpTemplate,
742
- FieldTemplate,
743
- ObjectFieldTemplate,
718
+ FieldErrorTemplate: FieldErrorTemplate,
719
+ FieldHelpTemplate: FieldHelpTemplate,
720
+ FieldTemplate: FieldTemplate,
721
+ ObjectFieldTemplate: ObjectFieldTemplate,
744
722
  TitleFieldTemplate: TitleField,
745
- WrapIfAdditionalTemplate
723
+ WrapIfAdditionalTemplate: WrapIfAdditionalTemplate
746
724
  };
747
725
 
748
726
  function CheckboxWidget(props) {
749
- const {
750
- id,
751
- value,
752
- required,
753
- disabled,
754
- readonly,
755
- label,
756
- autofocus,
757
- onChange,
758
- onBlur,
759
- options,
760
- onFocus,
761
- formContext,
762
- schema,
763
- uiSchema,
764
- registry,
765
- rawErrors = []
766
- } = props;
767
- const semanticProps = getSemanticProps({
768
- options,
769
- formContext,
770
- uiSchema,
727
+ var id = props.id,
728
+ value = props.value,
729
+ required = props.required,
730
+ disabled = props.disabled,
731
+ readonly = props.readonly,
732
+ label = props.label,
733
+ autofocus = props.autofocus,
734
+ onChange = props.onChange,
735
+ onBlur = props.onBlur,
736
+ options = props.options,
737
+ onFocus = props.onFocus,
738
+ formContext = props.formContext,
739
+ schema = props.schema,
740
+ uiSchema = props.uiSchema,
741
+ registry = props.registry,
742
+ _props$rawErrors = props.rawErrors,
743
+ rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors;
744
+ var semanticProps = getSemanticProps({
745
+ options: options,
746
+ formContext: formContext,
747
+ uiSchema: uiSchema,
771
748
  defaultSchemaProps: {
772
749
  inverted: false
773
750
  }
774
751
  });
775
- const {
776
- schemaUtils
777
- } = registry;
778
- const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
779
- const _onChange = (_, data) => onChange && onChange(data.checked);
780
- const _onBlur = () => onBlur && onBlur(id, value);
781
- const _onFocus = () => onFocus && onFocus(id, value);
782
- const checked = value == "true" || value == true;
783
- return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Checkbox, {
752
+ var schemaUtils = registry.schemaUtils;
753
+ var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
754
+ var _onChange = function _onChange(_, data) {
755
+ return onChange && onChange(data.checked);
756
+ };
757
+ var _onBlur = function _onBlur() {
758
+ return onBlur && onBlur(id, value);
759
+ };
760
+ var _onFocus = function _onFocus() {
761
+ return onFocus && onFocus(id, value);
762
+ };
763
+ var checked = value == "true" || value == true;
764
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Checkbox, _extends({
784
765
  id: id,
785
766
  name: id,
786
767
  disabled: disabled || readonly,
787
- autoFocus: autofocus,
788
- ...semanticProps,
768
+ autoFocus: autofocus
769
+ }, semanticProps, {
789
770
  checked: typeof value === "undefined" ? false : checked,
790
771
  error: rawErrors.length > 0,
791
772
  onChange: _onChange,
@@ -793,98 +774,96 @@ function CheckboxWidget(props) {
793
774
  onFocus: _onFocus,
794
775
  required: required,
795
776
  label: displayLabel ? label || schema.title : false
796
- });
777
+ }));
797
778
  }
798
779
 
799
780
  function selectValue(value, selected, all) {
800
- const at = all.indexOf(value);
801
- const updated = selected.slice(0, at).concat(value, selected.slice(at));
781
+ var at = all.indexOf(value);
782
+ var updated = selected.slice(0, at).concat(value, selected.slice(at));
802
783
  // As inserting values at predefined index positions doesn't work with empty
803
784
  // arrays, we need to reorder the updated selection to match the initial order
804
- return updated.sort((a, b) => all.indexOf(a) > all.indexOf(b));
785
+ return updated.sort(function (a, b) {
786
+ return all.indexOf(a) > all.indexOf(b);
787
+ });
805
788
  }
806
789
  function deselectValue(value, selected) {
807
- return selected.filter(v => v !== value);
790
+ return selected.filter(function (v) {
791
+ return v !== value;
792
+ });
808
793
  }
809
794
  function CheckboxesWidget(props) {
810
- const {
811
- id,
812
- disabled,
813
- options,
814
- value,
815
- autofocus,
816
- readonly,
817
- onChange,
818
- onBlur,
819
- onFocus,
820
- formContext,
821
- schema,
822
- uiSchema,
823
- rawErrors = [],
824
- registry
825
- } = props;
826
- const TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, options);
827
- const {
828
- enumOptions,
829
- enumDisabled,
830
- inline
831
- } = options;
832
- const {
833
- title
834
- } = schema;
835
- const semanticProps = getSemanticProps({
836
- options,
837
- formContext,
838
- uiSchema,
795
+ var id = props.id,
796
+ disabled = props.disabled,
797
+ options = props.options,
798
+ value = props.value,
799
+ autofocus = props.autofocus,
800
+ readonly = props.readonly,
801
+ onChange = props.onChange,
802
+ onBlur = props.onBlur,
803
+ onFocus = props.onFocus,
804
+ formContext = props.formContext,
805
+ schema = props.schema,
806
+ uiSchema = props.uiSchema,
807
+ _props$rawErrors = props.rawErrors,
808
+ rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
809
+ registry = props.registry;
810
+ var TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, options);
811
+ var enumOptions = options.enumOptions,
812
+ enumDisabled = options.enumDisabled,
813
+ inline = options.inline;
814
+ var title = schema.title;
815
+ var semanticProps = getSemanticProps({
816
+ options: options,
817
+ formContext: formContext,
818
+ uiSchema: uiSchema,
839
819
  defaultSchemaProps: {
840
820
  inverted: false
841
821
  }
842
822
  });
843
- const _onChange = option => _ref => {
844
- let {
845
- target: {
846
- checked
823
+ var _onChange = function _onChange(option) {
824
+ return function (_ref) {
825
+ var checked = _ref.target.checked;
826
+ // eslint-disable-next-line no-shadow
827
+ var all = enumOptions ? enumOptions.map(function (_ref2) {
828
+ var value = _ref2.value;
829
+ return value;
830
+ }) : [];
831
+ if (checked) {
832
+ onChange(selectValue(option.value, value, all));
833
+ } else {
834
+ onChange(deselectValue(option.value, value));
847
835
  }
848
- } = _ref;
849
- // eslint-disable-next-line no-shadow
850
- const all = enumOptions ? enumOptions.map(_ref2 => {
851
- let {
852
- value
853
- } = _ref2;
854
- return value;
855
- }) : [];
856
- if (checked) {
857
- onChange(selectValue(option.value, value, all));
858
- } else {
859
- onChange(deselectValue(option.value, value));
860
- }
836
+ };
837
+ };
838
+ var _onBlur = function _onBlur() {
839
+ return onBlur && onBlur(id, value);
840
+ };
841
+ var _onFocus = function _onFocus() {
842
+ return onFocus && onFocus(id, value);
861
843
  };
862
- const _onBlur = () => onBlur && onBlur(id, value);
863
- const _onFocus = () => onFocus && onFocus(id, value);
864
- const inlineOption = inline ? {
844
+ var inlineOption = inline ? {
865
845
  inline: true
866
846
  } : {
867
847
  grouped: true
868
848
  };
869
849
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, title && /*#__PURE__*/React__default["default"].createElement(TitleFieldTemplate, {
870
- id: `${id}-title`,
850
+ id: id + "-title",
871
851
  title: title,
872
852
  schema: schema,
873
853
  uiSchema: uiSchema,
874
854
  registry: registry
875
- }), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Group, {
855
+ }), /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Group, _extends({
876
856
  id: id,
877
- name: id,
878
- ...inlineOption
879
- }, Array.isArray(enumOptions) && enumOptions.map((option, index) => {
880
- const checked = value.indexOf(option.value) !== -1;
881
- const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
882
- return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Checkbox, {
883
- id: `${id}-${option.value}`,
857
+ name: id
858
+ }, inlineOption), Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
859
+ var checked = value.indexOf(option.value) !== -1;
860
+ var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
861
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Checkbox, _extends({
862
+ id: id + "-" + option.value,
884
863
  name: id,
885
864
  key: option.value,
886
- label: option.label,
887
- ...semanticProps,
865
+ label: option.label
866
+ }, semanticProps, {
888
867
  checked: checked,
889
868
  error: rawErrors.length > 0,
890
869
  disabled: disabled || itemDisabled || readonly,
@@ -892,122 +871,117 @@ function CheckboxesWidget(props) {
892
871
  onChange: _onChange(option),
893
872
  onBlur: _onBlur,
894
873
  onFocus: _onFocus
895
- });
874
+ }));
896
875
  })));
897
876
  }
898
877
 
899
878
  function RadioWidget(props) {
900
- const {
901
- id,
902
- value,
903
- required,
904
- disabled,
905
- readonly,
906
- onChange,
907
- onBlur,
908
- onFocus,
909
- schema,
910
- options,
911
- formContext,
912
- uiSchema,
913
- rawErrors = []
914
- } = props;
915
- const {
916
- enumOptions,
917
- enumDisabled
918
- } = options;
919
- const semanticProps = getSemanticProps({
920
- formContext,
921
- options,
922
- uiSchema
879
+ var id = props.id,
880
+ value = props.value,
881
+ required = props.required,
882
+ disabled = props.disabled,
883
+ readonly = props.readonly,
884
+ onChange = props.onChange,
885
+ onBlur = props.onBlur,
886
+ onFocus = props.onFocus,
887
+ schema = props.schema,
888
+ options = props.options,
889
+ formContext = props.formContext,
890
+ uiSchema = props.uiSchema,
891
+ _props$rawErrors = props.rawErrors,
892
+ rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors;
893
+ var enumOptions = options.enumOptions,
894
+ enumDisabled = options.enumDisabled;
895
+ var semanticProps = getSemanticProps({
896
+ formContext: formContext,
897
+ options: options,
898
+ uiSchema: uiSchema
923
899
  });
924
900
  // eslint-disable-next-line no-shadow
925
- const _onChange = (_, _ref) => {
926
- let {
927
- value: eventValue
928
- } = _ref;
901
+ var _onChange = function _onChange(_, _ref) {
902
+ var eventValue = _ref.value;
929
903
  return onChange && onChange(schema.type === "boolean" ? eventValue !== "false" : eventValue);
930
904
  };
931
- const _onBlur = () => onBlur && onBlur(id, value);
932
- const _onFocus = () => onFocus && onFocus(id, value);
933
- const inlineOption = options.inline ? {
905
+ var _onBlur = function _onBlur() {
906
+ return onBlur && onBlur(id, value);
907
+ };
908
+ var _onFocus = function _onFocus() {
909
+ return onFocus && onFocus(id, value);
910
+ };
911
+ var inlineOption = options.inline ? {
934
912
  inline: true
935
913
  } : {
936
914
  grouped: true
937
915
  };
938
- return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Group, {
939
- ...inlineOption
940
- }, Array.isArray(enumOptions) && enumOptions.map(option => {
941
- const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
942
- return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Field, {
916
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Group, _extends({}, inlineOption), Array.isArray(enumOptions) && enumOptions.map(function (option) {
917
+ var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
918
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Field, _extends({
943
919
  required: required,
944
920
  control: semanticUiReact.Radio,
945
- id: `${id}-${option.value}`,
946
- name: id,
947
- ...semanticProps,
921
+ id: id + "-" + option.value,
922
+ name: id
923
+ }, semanticProps, {
948
924
  onFocus: _onFocus,
949
925
  onBlur: _onBlur,
950
- label: `${option.label}`,
951
- value: `${option.value}`,
926
+ label: "" + option.label,
927
+ value: "" + option.value,
952
928
  error: rawErrors.length > 0,
953
929
  key: option.value,
954
930
  checked: value == option.value,
955
931
  onChange: _onChange,
956
932
  disabled: disabled || itemDisabled || readonly
957
- });
933
+ }));
958
934
  }));
959
935
  }
960
936
 
961
937
  function RangeWidget(props) {
962
- const {
963
- id,
964
- value,
965
- required,
966
- readonly,
967
- disabled,
968
- onChange,
969
- onBlur,
970
- onFocus,
971
- options,
972
- schema,
973
- uiSchema,
974
- formContext,
975
- rawErrors = []
976
- } = props;
977
- const semanticProps = getSemanticProps({
978
- formContext,
979
- options,
980
- uiSchema,
938
+ var id = props.id,
939
+ value = props.value,
940
+ required = props.required,
941
+ readonly = props.readonly,
942
+ disabled = props.disabled,
943
+ onChange = props.onChange,
944
+ onBlur = props.onBlur,
945
+ onFocus = props.onFocus,
946
+ options = props.options,
947
+ schema = props.schema,
948
+ uiSchema = props.uiSchema,
949
+ formContext = props.formContext,
950
+ _props$rawErrors = props.rawErrors,
951
+ rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors;
952
+ var semanticProps = getSemanticProps({
953
+ formContext: formContext,
954
+ options: options,
955
+ uiSchema: uiSchema,
981
956
  defaultSchemaProps: {
982
957
  fluid: true
983
958
  }
984
959
  });
985
960
  // eslint-disable-next-line no-shadow
986
- const _onChange = _ref => {
987
- let {
988
- target: {
989
- value
990
- }
991
- } = _ref;
961
+ var _onChange = function _onChange(_ref) {
962
+ var value = _ref.target.value;
992
963
  return onChange && onChange(value === "" ? options.emptyValue : value);
993
964
  };
994
- const _onBlur = () => onBlur && onBlur(id, value);
995
- const _onFocus = () => onFocus && onFocus(id, value);
996
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Input, {
965
+ var _onBlur = function _onBlur() {
966
+ return onBlur && onBlur(id, value);
967
+ };
968
+ var _onFocus = function _onFocus() {
969
+ return onFocus && onFocus(id, value);
970
+ };
971
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Input, _extends({
997
972
  id: id,
998
973
  key: id,
999
974
  name: id,
1000
975
  type: "range",
1001
976
  required: required,
1002
- disabled: disabled || readonly,
1003
- ...utils.rangeSpec(schema),
1004
- ...semanticProps,
977
+ disabled: disabled || readonly
978
+ }, utils.rangeSpec(schema), semanticProps, {
1005
979
  value: value || "",
1006
980
  error: rawErrors.length > 0,
1007
981
  onChange: _onChange,
1008
982
  onBlur: _onBlur,
1009
983
  onFocus: _onFocus
1010
- }), /*#__PURE__*/React__default["default"].createElement("span", null, value));
984
+ })), /*#__PURE__*/React__default["default"].createElement("span", null, value));
1011
985
  }
1012
986
 
1013
987
  /**
@@ -1017,45 +991,42 @@ function RangeWidget(props) {
1017
991
  * @returns {*}
1018
992
  */
1019
993
  function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled) {
1020
- const disabledOptions = enumDisabled || [];
1021
- const options = map__default["default"](enumOptions, _ref => {
1022
- let {
1023
- label,
1024
- value
1025
- } = _ref;
994
+ var disabledOptions = enumDisabled || [];
995
+ var options = map__default["default"](enumOptions, function (_ref) {
996
+ var label = _ref.label,
997
+ value = _ref.value;
1026
998
  return {
1027
999
  disabled: disabledOptions.indexOf(value) !== -1,
1028
1000
  key: label,
1029
1001
  text: label,
1030
- value
1002
+ value: value
1031
1003
  };
1032
1004
  });
1033
1005
  return options;
1034
1006
  }
1035
1007
  function SelectWidget(props) {
1036
- const {
1037
- schema,
1038
- uiSchema,
1039
- formContext,
1040
- id,
1041
- options,
1042
- label,
1043
- required,
1044
- disabled,
1045
- readonly,
1046
- value,
1047
- multiple,
1048
- placeholder,
1049
- autofocus,
1050
- onChange,
1051
- onBlur,
1052
- onFocus,
1053
- rawErrors = []
1054
- } = props;
1055
- const semanticProps = getSemanticProps({
1056
- uiSchema,
1057
- formContext,
1058
- options,
1008
+ var schema = props.schema,
1009
+ uiSchema = props.uiSchema,
1010
+ formContext = props.formContext,
1011
+ id = props.id,
1012
+ options = props.options,
1013
+ label = props.label,
1014
+ required = props.required,
1015
+ disabled = props.disabled,
1016
+ readonly = props.readonly,
1017
+ value = props.value,
1018
+ multiple = props.multiple,
1019
+ placeholder = props.placeholder,
1020
+ autofocus = props.autofocus,
1021
+ onChange = props.onChange,
1022
+ onBlur = props.onBlur,
1023
+ onFocus = props.onFocus,
1024
+ _props$rawErrors = props.rawErrors,
1025
+ rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors;
1026
+ var semanticProps = getSemanticProps({
1027
+ uiSchema: uiSchema,
1028
+ formContext: formContext,
1029
+ options: options,
1059
1030
  defaultSchemaProps: {
1060
1031
  inverted: "false",
1061
1032
  selection: true,
@@ -1064,37 +1035,24 @@ function SelectWidget(props) {
1064
1035
  upward: false
1065
1036
  }
1066
1037
  });
1067
- const {
1068
- enumDisabled,
1069
- enumOptions
1070
- } = options;
1071
- const emptyValue = multiple ? [] : "";
1072
- const dropdownOptions = createDefaultValueOptionsForDropDown(enumOptions, enumDisabled);
1073
- const _onChange = (_, _ref2) => {
1074
- let {
1075
- value
1076
- } = _ref2;
1038
+ var enumDisabled = options.enumDisabled,
1039
+ enumOptions = options.enumOptions;
1040
+ var emptyValue = multiple ? [] : "";
1041
+ var dropdownOptions = createDefaultValueOptionsForDropDown(enumOptions, enumDisabled);
1042
+ var _onChange = function _onChange(_, _ref2) {
1043
+ var value = _ref2.value;
1077
1044
  return onChange && onChange(utils.processSelectValue(schema, value, options));
1078
1045
  };
1079
1046
  // eslint-disable-next-line no-shadow
1080
- const _onBlur = (_, _ref3) => {
1081
- let {
1082
- target: {
1083
- value
1084
- }
1085
- } = _ref3;
1047
+ var _onBlur = function _onBlur(_, _ref3) {
1048
+ var value = _ref3.target.value;
1086
1049
  return onBlur && onBlur(id, utils.processSelectValue(schema, value, options));
1087
1050
  };
1088
- const _onFocus = (_, _ref4) => {
1089
- let {
1090
- // eslint-disable-next-line no-shadow
1091
- target: {
1092
- value
1093
- }
1094
- } = _ref4;
1051
+ var _onFocus = function _onFocus(_, _ref4) {
1052
+ var value = _ref4.target.value;
1095
1053
  return onFocus && onFocus(id, utils.processSelectValue(schema, value, options));
1096
1054
  };
1097
- return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Dropdown, {
1055
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.Dropdown, _extends({
1098
1056
  key: id,
1099
1057
  id: id,
1100
1058
  name: id,
@@ -1103,8 +1061,8 @@ function SelectWidget(props) {
1103
1061
  value: typeof value === "undefined" ? emptyValue : value,
1104
1062
  error: rawErrors.length > 0,
1105
1063
  disabled: disabled,
1106
- placeholder: placeholder,
1107
- ...semanticProps,
1064
+ placeholder: placeholder
1065
+ }, semanticProps, {
1108
1066
  required: required,
1109
1067
  autoFocus: autofocus,
1110
1068
  readOnly: readonly,
@@ -1112,52 +1070,49 @@ function SelectWidget(props) {
1112
1070
  onChange: _onChange,
1113
1071
  onBlur: _onBlur,
1114
1072
  onFocus: _onFocus
1115
- });
1073
+ }));
1116
1074
  }
1117
1075
 
1118
1076
  function TextareaWidget(props) {
1119
- const {
1120
- id,
1121
- placeholder,
1122
- value,
1123
- required,
1124
- disabled,
1125
- autofocus,
1126
- label,
1127
- readonly,
1128
- onBlur,
1129
- onFocus,
1130
- onChange,
1131
- options,
1132
- schema,
1133
- uiSchema,
1134
- formContext,
1135
- registry,
1136
- rawErrors = []
1137
- } = props;
1138
- const semanticProps = getSemanticProps({
1139
- formContext,
1140
- options,
1077
+ var id = props.id,
1078
+ placeholder = props.placeholder,
1079
+ value = props.value,
1080
+ required = props.required,
1081
+ disabled = props.disabled,
1082
+ autofocus = props.autofocus,
1083
+ label = props.label,
1084
+ readonly = props.readonly,
1085
+ onBlur = props.onBlur,
1086
+ onFocus = props.onFocus,
1087
+ onChange = props.onChange,
1088
+ options = props.options,
1089
+ schema = props.schema,
1090
+ uiSchema = props.uiSchema,
1091
+ formContext = props.formContext,
1092
+ registry = props.registry,
1093
+ _props$rawErrors = props.rawErrors,
1094
+ rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors;
1095
+ var semanticProps = getSemanticProps({
1096
+ formContext: formContext,
1097
+ options: options,
1141
1098
  defaultSchemaProps: {
1142
1099
  inverted: false
1143
1100
  }
1144
1101
  });
1145
- const {
1146
- schemaUtils
1147
- } = registry;
1102
+ var schemaUtils = registry.schemaUtils;
1148
1103
  // eslint-disable-next-line no-shadow
1149
- const _onChange = _ref => {
1150
- let {
1151
- target: {
1152
- value
1153
- }
1154
- } = _ref;
1104
+ var _onChange = function _onChange(_ref) {
1105
+ var value = _ref.target.value;
1155
1106
  return onChange && onChange(value === "" ? options.emptyValue : value);
1156
1107
  };
1157
- const _onBlur = () => onBlur && onBlur(id, value);
1158
- const _onFocus = () => onFocus && onFocus(id, value);
1159
- const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
1160
- return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.TextArea, {
1108
+ var _onBlur = function _onBlur() {
1109
+ return onBlur && onBlur(id, value);
1110
+ };
1111
+ var _onFocus = function _onFocus() {
1112
+ return onFocus && onFocus(id, value);
1113
+ };
1114
+ var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema);
1115
+ return /*#__PURE__*/React__default["default"].createElement(semanticUiReact.Form.TextArea, _extends({
1161
1116
  id: id,
1162
1117
  key: id,
1163
1118
  name: id,
@@ -1165,33 +1120,33 @@ function TextareaWidget(props) {
1165
1120
  placeholder: placeholder,
1166
1121
  autoFocus: autofocus,
1167
1122
  required: required,
1168
- disabled: disabled || readonly,
1169
- ...semanticProps,
1123
+ disabled: disabled || readonly
1124
+ }, semanticProps, {
1170
1125
  value: value || "",
1171
1126
  error: rawErrors.length > 0,
1172
1127
  rows: options.rows || 5,
1173
1128
  onChange: _onChange,
1174
1129
  onBlur: _onBlur,
1175
1130
  onFocus: _onFocus
1176
- });
1131
+ }));
1177
1132
  }
1178
1133
 
1179
1134
  var Widgets = {
1180
- CheckboxWidget,
1181
- CheckboxesWidget,
1182
- RadioWidget,
1183
- RangeWidget,
1184
- SelectWidget,
1185
- TextareaWidget
1135
+ CheckboxWidget: CheckboxWidget,
1136
+ CheckboxesWidget: CheckboxesWidget,
1137
+ RadioWidget: RadioWidget,
1138
+ RangeWidget: RangeWidget,
1139
+ SelectWidget: SelectWidget,
1140
+ TextareaWidget: TextareaWidget
1186
1141
  };
1187
1142
 
1188
- const Theme = {
1143
+ var Theme = {
1189
1144
  templates: Templates,
1190
1145
  widgets: Widgets,
1191
1146
  _internalFormWrapper: semanticUiReact.Form
1192
1147
  };
1193
1148
 
1194
- const SemanticUIForm = /*#__PURE__*/core.withTheme(Theme);
1149
+ var SemanticUIForm = /*#__PURE__*/core.withTheme(Theme);
1195
1150
 
1196
1151
  exports.Form = SemanticUIForm;
1197
1152
  exports.Templates = Templates;