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