@rjsf/semantic-ui 6.0.0-beta.8 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +7 -3
  2. package/dist/{index.js → index.cjs} +159 -111
  3. package/dist/index.cjs.map +7 -0
  4. package/dist/semantic-ui.esm.js +160 -113
  5. package/dist/semantic-ui.esm.js.map +4 -4
  6. package/dist/semantic-ui.umd.js +122 -80
  7. package/lib/AddButton/AddButton.d.ts +3 -2
  8. package/lib/AddButton/AddButton.js +1 -1
  9. package/lib/AddButton/AddButton.js.map +1 -1
  10. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +3 -3
  11. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +9 -5
  12. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
  13. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
  14. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +8 -26
  15. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
  16. package/lib/BaseInputTemplate/BaseInputTemplate.js +3 -3
  17. package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
  18. package/lib/CheckboxWidget/CheckboxWidget.js +4 -4
  19. package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
  20. package/lib/CheckboxesWidget/CheckboxesWidget.js +4 -4
  21. package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
  22. package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +1 -1
  23. package/lib/FieldErrorTemplate/FieldErrorTemplate.js +4 -4
  24. package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
  25. package/lib/FieldHelpTemplate/FieldHelpTemplate.js +2 -2
  26. package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
  27. package/lib/FieldTemplate/FieldTemplate.js +4 -1
  28. package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
  29. package/lib/IconButton/IconButton.d.ts +7 -6
  30. package/lib/IconButton/IconButton.js +1 -2
  31. package/lib/IconButton/IconButton.js.map +1 -1
  32. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +2 -0
  33. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +6 -0
  34. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -0
  35. package/lib/MultiSchemaFieldTemplate/index.d.ts +2 -0
  36. package/lib/MultiSchemaFieldTemplate/index.js +3 -0
  37. package/lib/MultiSchemaFieldTemplate/index.js.map +1 -0
  38. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +4 -3
  39. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
  40. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +10 -0
  41. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +22 -0
  42. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -0
  43. package/lib/OptionalDataControlsTemplate/index.d.ts +2 -0
  44. package/lib/OptionalDataControlsTemplate/index.js +3 -0
  45. package/lib/OptionalDataControlsTemplate/index.js.map +1 -0
  46. package/lib/RadioWidget/RadioWidget.js +3 -3
  47. package/lib/RadioWidget/RadioWidget.js.map +1 -1
  48. package/lib/RangeWidget/RangeWidget.js +2 -2
  49. package/lib/RangeWidget/RangeWidget.js.map +1 -1
  50. package/lib/SelectWidget/SelectWidget.js +3 -3
  51. package/lib/SelectWidget/SelectWidget.js.map +1 -1
  52. package/lib/Templates/Templates.js +4 -0
  53. package/lib/Templates/Templates.js.map +1 -1
  54. package/lib/TextareaWidget/TextareaWidget.js +3 -3
  55. package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
  56. package/lib/TitleField/TitleField.d.ts +1 -1
  57. package/lib/TitleField/TitleField.js +7 -6
  58. package/lib/TitleField/TitleField.js.map +1 -1
  59. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +2 -3
  60. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
  61. package/lib/index.d.ts +3 -0
  62. package/lib/index.js +3 -0
  63. package/lib/index.js.map +1 -1
  64. package/lib/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +16 -17
  66. package/src/AddButton/AddButton.tsx +5 -3
  67. package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +11 -8
  68. package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +12 -34
  69. package/src/BaseInputTemplate/BaseInputTemplate.tsx +7 -6
  70. package/src/CheckboxWidget/CheckboxWidget.tsx +8 -8
  71. package/src/CheckboxesWidget/CheckboxesWidget.tsx +6 -6
  72. package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +4 -4
  73. package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -2
  74. package/src/FieldTemplate/FieldTemplate.tsx +4 -1
  75. package/src/IconButton/IconButton.tsx +12 -8
  76. package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +16 -0
  77. package/src/MultiSchemaFieldTemplate/index.ts +2 -0
  78. package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +10 -6
  79. package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +44 -0
  80. package/src/OptionalDataControlsTemplate/index.ts +2 -0
  81. package/src/RadioWidget/RadioWidget.tsx +5 -4
  82. package/src/RangeWidget/RangeWidget.tsx +3 -3
  83. package/src/SelectWidget/SelectWidget.tsx +5 -4
  84. package/src/Templates/Templates.ts +4 -0
  85. package/src/TextareaWidget/TextareaWidget.tsx +5 -4
  86. package/src/TitleField/TitleField.tsx +16 -6
  87. package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +5 -8
  88. package/src/index.ts +3 -0
  89. package/dist/index.js.map +0 -7
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('semantic-ui-react'), require('@rjsf/utils'), require('react/jsx-runtime'), require('nanoid'), require('react'), require('lodash/map')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', 'semantic-ui-react', '@rjsf/utils', 'react/jsx-runtime', 'nanoid', 'react', 'lodash/map'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/semantic-ui"] = {}, global.core, global.semanticUiReact, global.utils, global.jsxRuntime, global.nanoid, global.react, global.map));
5
- })(this, (function (exports, core, semanticUiReact, utils, jsxRuntime, nanoid, react, map) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('semantic-ui-react'), require('@rjsf/utils'), require('react/jsx-runtime'), require('lodash/uniqueId'), require('react'), require('lodash/map')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', 'semantic-ui-react', '@rjsf/utils', 'react/jsx-runtime', 'lodash/uniqueId', 'react', 'lodash/map'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/semantic-ui"] = {}, global.core, global.semanticUiReact, global.utils, global.jsxRuntime, global.uniqueId, global.react, global.map));
5
+ })(this, (function (exports, core, semanticUiReact, utils, jsxRuntime, uniqueId, react, map) { 'use strict';
6
6
 
7
7
  // src/SemanticUIForm/SemanticUIForm.ts
8
8
  function AddButton({
@@ -17,9 +17,9 @@
17
17
  {
18
18
  title: translateString(utils.TranslatableString.AddItemButton),
19
19
  color,
20
+ size: "tiny",
20
21
  ...props,
21
22
  icon: true,
22
- size: "tiny",
23
23
  children: /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Icon, { name: "plus" })
24
24
  }
25
25
  );
@@ -67,14 +67,19 @@
67
67
  gridTemplateColumns: `1fr ${vertical ? 65 : 150}px`
68
68
  });
69
69
  function ArrayFieldItemTemplate(props) {
70
- const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
70
+ const { children, buttonsProps, hasToolbar, uiSchema, registry, parentUiSchema } = props;
71
71
  const uiOptions = utils.getUiOptions(uiSchema);
72
72
  const ArrayFieldItemButtonsTemplate = utils.getTemplate(
73
73
  "ArrayFieldItemButtonsTemplate",
74
74
  registry,
75
75
  uiOptions
76
76
  );
77
- const { horizontalButtons = true, wrapItem = false } = uiOptions.semantic;
77
+ const semanticProps = getSemanticProps({
78
+ uiSchema: parentUiSchema,
79
+ formContext: registry.formContext,
80
+ defaultSchemaProps: { horizontalButtons: true, wrapItem: false }
81
+ });
82
+ const { horizontalButtons = true, wrapItem = false } = semanticProps;
78
83
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rjsf-array-item", children: /* @__PURE__ */ jsxRuntime.jsx(MaybeWrap, { wrap: wrapItem, component: semanticUiReact.Segment, children: /* @__PURE__ */ jsxRuntime.jsxs(semanticUiReact.Grid, { style: { ...gridStyle(!horizontalButtons), alignItems: "center" }, children: [
79
84
  /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Grid.Column, { width: 16, verticalAlign: "middle", children }),
80
85
  hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Grid.Column, { children: /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Button.Group, { size: "mini", vertical: !horizontalButtons, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps }) }) })
@@ -83,13 +88,13 @@
83
88
  function ArrayFieldTemplate(props) {
84
89
  const {
85
90
  uiSchema,
86
- idSchema,
91
+ fieldPathId,
87
92
  canAdd,
88
93
  className,
89
94
  // classNames, This is not part of the type, so it is likely never passed in
90
95
  disabled,
91
- formContext,
92
96
  items,
97
+ optionalDataControl,
93
98
  onAddClick,
94
99
  // options, This is not part of the type, so it is likely never passed in
95
100
  readonly,
@@ -98,29 +103,18 @@
98
103
  title,
99
104
  registry
100
105
  } = props;
101
- const semanticProps = getSemanticProps({
102
- uiSchema,
103
- formContext,
104
- defaultSchemaProps: { horizontalButtons: true, wrapItem: false }
105
- });
106
- const { horizontalButtons, wrapItem } = semanticProps;
107
- const semantic = { horizontalButtons, wrapItem };
108
106
  const uiOptions = utils.getUiOptions(uiSchema);
109
107
  const ArrayFieldDescriptionTemplate = utils.getTemplate(
110
108
  "ArrayFieldDescriptionTemplate",
111
109
  registry,
112
110
  uiOptions
113
111
  );
114
- const ArrayFieldItemTemplate2 = utils.getTemplate(
115
- "ArrayFieldItemTemplate",
116
- registry,
117
- uiOptions
118
- );
119
112
  const ArrayFieldTitleTemplate = utils.getTemplate(
120
113
  "ArrayFieldTitleTemplate",
121
114
  registry,
122
115
  uiOptions
123
116
  );
117
+ const showOptionalDataControlInTitle = !readonly && !disabled;
124
118
  const {
125
119
  ButtonTemplates: { AddButton: AddButton2 }
126
120
  } = registry.templates;
@@ -128,18 +122,19 @@
128
122
  /* @__PURE__ */ jsxRuntime.jsx(
129
123
  ArrayFieldTitleTemplate,
130
124
  {
131
- idSchema,
125
+ fieldPathId,
132
126
  title: uiOptions.title || title,
133
127
  schema,
134
128
  uiSchema,
135
129
  required,
136
- registry
130
+ registry,
131
+ optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
137
132
  }
138
133
  ),
139
134
  /* @__PURE__ */ jsxRuntime.jsx(
140
135
  ArrayFieldDescriptionTemplate,
141
136
  {
142
- idSchema,
137
+ fieldPathId,
143
138
  description: uiOptions.description || schema.description,
144
139
  schema,
145
140
  uiSchema,
@@ -147,16 +142,10 @@
147
142
  }
148
143
  ),
149
144
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
150
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "row array-item-list", children: items && items.map(({ key, uiSchema: itemUiSchema = {}, ...props2 }) => {
151
- const mergedUiSchema = {
152
- ...itemUiSchema,
153
- [utils.UI_OPTIONS_KEY]: {
154
- ...itemUiSchema[utils.UI_OPTIONS_KEY],
155
- semantic
156
- }
157
- };
158
- return /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemTemplate2, { ...props2, uiSchema: mergedUiSchema }, key);
159
- }) }),
145
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "row array-item-list", children: [
146
+ !showOptionalDataControlInTitle ? optionalDataControl : void 0,
147
+ items
148
+ ] }),
160
149
  canAdd && /* @__PURE__ */ jsxRuntime.jsx(
161
150
  "div",
162
151
  {
@@ -168,7 +157,7 @@
168
157
  children: /* @__PURE__ */ jsxRuntime.jsx(
169
158
  AddButton2,
170
159
  {
171
- id: utils.buttonId(idSchema, "add"),
160
+ id: utils.buttonId(fieldPathId, "add"),
172
161
  className: "rjsf-array-item-add",
173
162
  onClick: onAddClick,
174
163
  disabled: disabled || readonly,
@@ -178,12 +167,13 @@
178
167
  )
179
168
  }
180
169
  )
181
- ] }, `array-item-list-${idSchema.$id}`)
170
+ ] }, `array-item-list-${fieldPathId.$id}`)
182
171
  ] });
183
172
  }
184
173
  function BaseInputTemplate(props) {
185
174
  const {
186
175
  id,
176
+ htmlName,
187
177
  placeholder,
188
178
  label,
189
179
  hideLabel,
@@ -199,14 +189,14 @@
199
189
  options,
200
190
  schema,
201
191
  uiSchema,
202
- formContext,
192
+ registry,
203
193
  type,
204
194
  rawErrors = []
205
195
  } = props;
206
196
  const inputProps = utils.getInputProps(schema, type, options);
207
197
  const semanticProps = getSemanticProps({
208
198
  uiSchema,
209
- formContext,
199
+ formContext: registry.formContext,
210
200
  options
211
201
  });
212
202
  const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
@@ -217,7 +207,7 @@
217
207
  semanticUiReact.Form.Input,
218
208
  {
219
209
  id,
220
- name: id,
210
+ name: htmlName || id,
221
211
  placeholder,
222
212
  ...inputProps,
223
213
  label: utils.labelValue(label || void 0, hideLabel, false),
@@ -300,7 +290,7 @@
300
290
  size: "small"
301
291
  }
302
292
  };
303
- function FieldErrorTemplate({ errors, idSchema, uiSchema, registry }) {
293
+ function FieldErrorTemplate({ errors, fieldPathId, uiSchema, registry }) {
304
294
  const { formContext } = registry;
305
295
  const options = getSemanticErrorProps({
306
296
  formContext,
@@ -309,15 +299,15 @@
309
299
  });
310
300
  const { pointing, size } = options;
311
301
  if (errors && errors.length > 0) {
312
- const id = utils.errorId(idSchema);
313
- return /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Label, { id, color: "red", pointing: pointing || "above", size: size || "small", basic: true, children: /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.List, { bulleted: true, children: errors.map((error) => /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.List.Item, { children: error }, nanoid.nanoid())) }) });
302
+ const id = utils.errorId(fieldPathId);
303
+ return /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Label, { id, color: "red", pointing: pointing || "above", size: size || "small", basic: true, children: /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.List, { bulleted: true, children: errors.map((error) => /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.List.Item, { children: error }, uniqueId("field-error-"))) }) });
314
304
  }
315
305
  return null;
316
306
  }
317
307
  function FieldHelpTemplate(props) {
318
- const { idSchema, help } = props;
308
+ const { fieldPathId, help } = props;
319
309
  if (help) {
320
- const id = utils.helpId(idSchema);
310
+ const id = utils.helpId(fieldPathId);
321
311
  return /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Message, { size: "mini", info: true, id, content: help });
322
312
  }
323
313
  return null;
@@ -340,7 +330,10 @@
340
330
  uiSchema,
341
331
  ...otherProps
342
332
  } = props;
343
- const semanticProps = getSemanticProps(otherProps);
333
+ const semanticProps = getSemanticProps({
334
+ ...otherProps,
335
+ formContext: registry.formContext
336
+ });
344
337
  const { wrapLabel, wrapContent } = semanticProps;
345
338
  const uiOptions = utils.getUiOptions(uiSchema);
346
339
  const WrapIfAdditionalTemplate2 = utils.getTemplate(
@@ -378,10 +371,18 @@
378
371
  }
379
372
  return /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Grid, { ...rest, children });
380
373
  }
374
+ function MultiSchemaFieldTemplate(props) {
375
+ const { selector, optionSchemaField } = props;
376
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
377
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: selector }),
378
+ optionSchemaField
379
+ ] });
380
+ }
381
381
  function ObjectFieldTemplate(props) {
382
382
  const {
383
383
  description,
384
- onAddClick,
384
+ optionalDataControl,
385
+ onAddProperty,
385
386
  title,
386
387
  properties,
387
388
  disabled,
@@ -390,7 +391,7 @@
390
391
  uiSchema,
391
392
  schema,
392
393
  formData,
393
- idSchema,
394
+ fieldPathId,
394
395
  registry
395
396
  } = props;
396
397
  const uiOptions = utils.getUiOptions(uiSchema);
@@ -400,6 +401,7 @@
400
401
  registry,
401
402
  uiOptions
402
403
  );
404
+ const showOptionalDataControlInTitle = !readonly && !disabled;
403
405
  const {
404
406
  ButtonTemplates: { AddButton: AddButton2 }
405
407
  } = registry.templates;
@@ -407,24 +409,26 @@
407
409
  title && /* @__PURE__ */ jsxRuntime.jsx(
408
410
  TitleFieldTemplate,
409
411
  {
410
- id: utils.titleId(idSchema),
412
+ id: utils.titleId(fieldPathId),
411
413
  title,
412
414
  required,
413
415
  schema,
414
416
  uiSchema,
415
- registry
417
+ registry,
418
+ optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
416
419
  }
417
420
  ),
418
421
  description && /* @__PURE__ */ jsxRuntime.jsx(
419
422
  DescriptionFieldTemplate,
420
423
  {
421
- id: utils.descriptionId(idSchema),
424
+ id: utils.descriptionId(fieldPathId),
422
425
  description,
423
426
  schema,
424
427
  uiSchema,
425
428
  registry
426
429
  }
427
430
  ),
431
+ !showOptionalDataControlInTitle ? optionalDataControl : void 0,
428
432
  properties.map((prop) => prop.content),
429
433
  utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Grid.Column, { width: 16, verticalAlign: "middle", children: /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Grid.Row, { children: /* @__PURE__ */ jsxRuntime.jsx(
430
434
  "div",
@@ -437,9 +441,9 @@
437
441
  children: /* @__PURE__ */ jsxRuntime.jsx(
438
442
  AddButton2,
439
443
  {
440
- id: utils.buttonId(idSchema, "add"),
444
+ id: utils.buttonId(fieldPathId, "add"),
441
445
  className: "rjsf-object-property-expand",
442
- onClick: onAddClick(schema),
446
+ onClick: onAddProperty,
443
447
  disabled: disabled || readonly,
444
448
  uiSchema,
445
449
  registry
@@ -449,6 +453,35 @@
449
453
  ) }) })
450
454
  ] });
451
455
  }
456
+ function OptionalDataControlsTemplate(props) {
457
+ const { id, registry, label, onAddClick, onRemoveClick } = props;
458
+ if (onAddClick) {
459
+ return /* @__PURE__ */ jsxRuntime.jsx(
460
+ AddButton,
461
+ {
462
+ id,
463
+ registry,
464
+ className: "rjsf-add-optional-data",
465
+ onClick: onAddClick,
466
+ title: label,
467
+ size: "mini"
468
+ }
469
+ );
470
+ } else if (onRemoveClick) {
471
+ return /* @__PURE__ */ jsxRuntime.jsx(
472
+ RemoveButton,
473
+ {
474
+ id,
475
+ registry,
476
+ className: "rjsf-remove-optional-data",
477
+ onClick: onRemoveClick,
478
+ title: label,
479
+ size: "mini"
480
+ }
481
+ );
482
+ }
483
+ return /* @__PURE__ */ jsxRuntime.jsx("em", { id, children: label });
484
+ }
452
485
  function SubmitButton({ uiSchema }) {
453
486
  const { submitText, norender, props: submitButtonProps = {} } = utils.getSubmitButtonOptions(uiSchema);
454
487
  if (norender) {
@@ -463,16 +496,21 @@
463
496
  function TitleField({
464
497
  id,
465
498
  title,
466
- uiSchema
499
+ uiSchema,
500
+ optionalDataControl
467
501
  }) {
468
502
  const semanticProps = getSemanticProps({
469
503
  uiSchema,
470
504
  defaultSchemaProps: DEFAULT_OPTIONS2
471
505
  });
472
- if (!title) {
473
- return null;
506
+ let heading = title ? /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Header, { id, ...semanticProps, as: "h5", children: title }) : null;
507
+ if (optionalDataControl) {
508
+ heading = /* @__PURE__ */ jsxRuntime.jsxs(semanticUiReact.Grid, { colums: 2, relaxed: true, children: [
509
+ /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Grid.Column, { width: 14, style: { paddingRight: 0 }, children: heading }),
510
+ /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Grid.Column, { width: 2, children: optionalDataControl })
511
+ ] });
474
512
  }
475
- return /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Header, { id, ...semanticProps, as: "h5", children: title });
513
+ return heading;
476
514
  }
477
515
  function WrapIfAdditionalTemplate(props) {
478
516
  const {
@@ -482,8 +520,8 @@
482
520
  disabled,
483
521
  id,
484
522
  label,
485
- onDropPropertyClick,
486
- onKeyChange,
523
+ onKeyRenameBlur,
524
+ onRemoveProperty,
487
525
  readonly,
488
526
  required,
489
527
  schema,
@@ -498,7 +536,6 @@
498
536
  if (!additional) {
499
537
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, style, children });
500
538
  }
501
- const handleBlur = ({ target }) => onKeyChange(target.value);
502
539
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, style, children: /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Grid, { columns: "equal", children: /* @__PURE__ */ jsxRuntime.jsxs(semanticUiReact.Grid.Row, { children: [
503
540
  /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Grid.Column, { className: "form-additional", children: /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Form.Group, { widths: "equal", grouped: true, children: /* @__PURE__ */ jsxRuntime.jsx(
504
541
  semanticUiReact.Form.Input,
@@ -513,7 +550,7 @@
513
550
  disabled: disabled || readonlyAsDisabled && readonly,
514
551
  id: `${id}`,
515
552
  name: `${id}`,
516
- onBlur: !readonly ? handleBlur : void 0,
553
+ onBlur: !readonly ? onKeyRenameBlur : void 0,
517
554
  style: wrapperStyle,
518
555
  type: "text"
519
556
  }
@@ -526,7 +563,7 @@
526
563
  iconType: "mini",
527
564
  className: "rjsf-object-property-remove",
528
565
  disabled: disabled || readonly,
529
- onClick: onDropPropertyClick(label),
566
+ onClick: onRemoveProperty,
530
567
  uiSchema,
531
568
  registry
532
569
  }
@@ -554,7 +591,9 @@
554
591
  FieldHelpTemplate,
555
592
  FieldTemplate,
556
593
  GridTemplate,
594
+ MultiSchemaFieldTemplate,
557
595
  ObjectFieldTemplate,
596
+ OptionalDataControlsTemplate,
558
597
  TitleFieldTemplate: TitleField,
559
598
  WrapIfAdditionalTemplate
560
599
  };
@@ -563,6 +602,7 @@
563
602
  function CheckboxWidget(props) {
564
603
  const {
565
604
  id,
605
+ htmlName,
566
606
  value,
567
607
  disabled,
568
608
  readonly,
@@ -573,7 +613,6 @@
573
613
  onBlur,
574
614
  options,
575
615
  onFocus,
576
- formContext,
577
616
  schema,
578
617
  uiSchema,
579
618
  rawErrors = [],
@@ -581,7 +620,7 @@
581
620
  } = props;
582
621
  const semanticProps = getSemanticProps({
583
622
  options,
584
- formContext,
623
+ formContext: registry.formContext,
585
624
  uiSchema,
586
625
  defaultSchemaProps: {
587
626
  inverted: "false"
@@ -593,10 +632,10 @@
593
632
  options
594
633
  );
595
634
  const required = utils.schemaRequiresTrueValue(schema);
635
+ const checked = value == "true" || value == true;
596
636
  const _onChange = (_, data) => onChange && onChange(data.checked);
597
637
  const _onBlur = () => onBlur && onBlur(id, value);
598
638
  const _onFocus = () => onFocus && onFocus(id, value);
599
- const checked = value == "true" || value == true;
600
639
  const description = options.description ?? schema.description;
601
640
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
602
641
  !hideLabel && description && /* @__PURE__ */ jsxRuntime.jsx(
@@ -613,7 +652,7 @@
613
652
  semanticUiReact.Form.Checkbox,
614
653
  {
615
654
  id,
616
- name: id,
655
+ name: htmlName || id,
617
656
  disabled: disabled || readonly,
618
657
  autoFocus: autofocus,
619
658
  ...semanticProps,
@@ -632,6 +671,7 @@
632
671
  function CheckboxesWidget(props) {
633
672
  const {
634
673
  id,
674
+ htmlName,
635
675
  disabled,
636
676
  options,
637
677
  value,
@@ -642,7 +682,6 @@
642
682
  onChange,
643
683
  onBlur,
644
684
  onFocus,
645
- formContext,
646
685
  schema,
647
686
  uiSchema,
648
687
  rawErrors = [],
@@ -653,7 +692,7 @@
653
692
  const checkboxesValues = Array.isArray(value) ? value : [value];
654
693
  const semanticProps = getSemanticProps({
655
694
  options,
656
- formContext,
695
+ formContext: registry.formContext,
657
696
  uiSchema,
658
697
  defaultSchemaProps: {
659
698
  inverted: "false"
@@ -671,14 +710,14 @@
671
710
  const inlineOption = inline ? { inline: true } : { grouped: true };
672
711
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
673
712
  !hideLabel && !!label && /* @__PURE__ */ jsxRuntime.jsx(TitleFieldTemplate, { id: utils.titleId(id), title: label, schema, uiSchema, registry }),
674
- /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Form.Group, { id, name: id, ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
713
+ /* @__PURE__ */ jsxRuntime.jsx(semanticUiReact.Form.Group, { id, name: htmlName || id, ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
675
714
  const checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
676
715
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
677
716
  return /* @__PURE__ */ jsxRuntime.jsx(
678
717
  semanticUiReact.Form.Checkbox,
679
718
  {
680
719
  id: utils.optionId(id, index),
681
- name: id,
720
+ name: htmlName || id,
682
721
  label: option.label,
683
722
  ...semanticProps,
684
723
  checked,
@@ -698,6 +737,7 @@
698
737
  function RadioWidget(props) {
699
738
  const {
700
739
  id,
740
+ htmlName,
701
741
  value,
702
742
  required,
703
743
  disabled,
@@ -706,13 +746,13 @@
706
746
  onBlur,
707
747
  onFocus,
708
748
  options,
709
- formContext,
749
+ registry,
710
750
  uiSchema,
711
751
  rawErrors = []
712
752
  } = props;
713
753
  const { enumOptions, enumDisabled, emptyValue } = options;
714
754
  const semanticProps = getSemanticProps({
715
- formContext,
755
+ formContext: registry.formContext,
716
756
  options,
717
757
  uiSchema
718
758
  });
@@ -731,7 +771,7 @@
731
771
  required,
732
772
  control: semanticUiReact.Radio,
733
773
  id: utils.optionId(id, index),
734
- name: id,
774
+ name: htmlName || id,
735
775
  ...semanticProps,
736
776
  onFocus: _onFocus,
737
777
  onBlur: _onBlur,
@@ -760,11 +800,11 @@
760
800
  options,
761
801
  schema,
762
802
  uiSchema,
763
- formContext,
803
+ registry,
764
804
  rawErrors = []
765
805
  } = props;
766
806
  const semanticProps = getSemanticProps({
767
- formContext,
807
+ formContext: registry.formContext,
768
808
  options,
769
809
  uiSchema,
770
810
  defaultSchemaProps: {
@@ -813,8 +853,9 @@
813
853
  function SelectWidget(props) {
814
854
  const {
815
855
  uiSchema,
816
- formContext,
856
+ registry,
817
857
  id,
858
+ htmlName,
818
859
  options,
819
860
  label,
820
861
  hideLabel,
@@ -833,7 +874,7 @@
833
874
  } = props;
834
875
  const semanticProps = getSemanticProps({
835
876
  uiSchema,
836
- formContext,
877
+ formContext: registry.formContext,
837
878
  options,
838
879
  defaultSchemaProps: {
839
880
  inverted: "false",
@@ -860,7 +901,7 @@
860
901
  semanticUiReact.Form.Dropdown,
861
902
  {
862
903
  id,
863
- name: id,
904
+ name: htmlName || id,
864
905
  label: utils.labelValue(label || void 0, hideLabel, false),
865
906
  multiple: typeof multiple === "undefined" ? false : multiple,
866
907
  value: typeof value === "undefined" ? emptyValue : selectedIndexes,
@@ -883,6 +924,7 @@
883
924
  function TextareaWidget(props) {
884
925
  const {
885
926
  id,
927
+ htmlName,
886
928
  placeholder,
887
929
  value,
888
930
  required,
@@ -895,11 +937,11 @@
895
937
  onFocus,
896
938
  onChange,
897
939
  options,
898
- formContext,
940
+ registry,
899
941
  rawErrors = []
900
942
  } = props;
901
943
  const semanticProps = getSemanticProps({
902
- formContext,
944
+ formContext: registry.formContext,
903
945
  options,
904
946
  defaultSchemaProps: { inverted: "false" }
905
947
  });
@@ -910,7 +952,7 @@
910
952
  semanticUiReact.Form.TextArea,
911
953
  {
912
954
  id,
913
- name: id,
955
+ name: htmlName || id,
914
956
  label: utils.labelValue(label || void 0, hideLabel, false),
915
957
  placeholder,
916
958
  autoFocus: autofocus,
@@ -1,4 +1,5 @@
1
- import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { SemanticIconButtonProps } from '../IconButton/index.js';
2
3
  /** The `AddButton` renders a button that represent the `Add` action on a form
3
4
  */
4
- export default function AddButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ uiSchema, registry, color, ...props }: IconButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
5
+ export default function AddButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ uiSchema, registry, color, ...props }: SemanticIconButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
@@ -5,6 +5,6 @@ import { TranslatableString } from '@rjsf/utils';
5
5
  */
6
6
  export default function AddButton({ uiSchema, registry, color, ...props }) {
7
7
  const { translateString } = registry;
8
- return (_jsx(Button, { title: translateString(TranslatableString.AddItemButton), color: color, ...props, icon: true, size: 'tiny', children: _jsx(Icon, { name: 'plus' }) }));
8
+ return (_jsx(Button, { title: translateString(TranslatableString.AddItemButton), color: color, size: 'tiny', ...props, icon: true, children: _jsx(Icon, { name: 'plus' }) }));
9
9
  }
10
10
  //# sourceMappingURL=AddButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AddButton.js","sourceRoot":"","sources":["../../src/AddButton/AddButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAkE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjH;GACG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAoF,EACnH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACiB;IACzB,MAAM,EAAE,eAAe,EAAE,GAAG,QAAQ,CAAC;IACrC,OAAO,CACL,KAAC,MAAM,IACL,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,aAAa,CAAC,EACxD,KAAK,EAAE,KAA6B,KAChC,KAAK,EACT,IAAI,QACJ,IAAI,EAAC,MAAM,YAEX,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,GACb,CACV,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"AddButton.js","sourceRoot":"","sources":["../../src/AddButton/AddButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAiD,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIhG;GACG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAoF,EACnH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACyB;IACjC,MAAM,EAAE,eAAe,EAAE,GAAG,QAAQ,CAAC;IACrC,OAAO,CACL,KAAC,MAAM,IACL,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,aAAa,CAAC,EACxD,KAAK,EAAE,KAA6B,EACpC,IAAI,EAAC,MAAM,KACP,KAAK,EACT,IAAI,kBAEJ,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,GACb,CACV,CAAC;AACJ,CAAC"}
@@ -1,6 +1,6 @@
1
- import { ArrayFieldItemTemplateType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
  /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
3
3
  *
4
- * @param props - The `ArrayFieldItemTemplateType` props for the component
4
+ * @param props - The `ArrayFieldItemTemplateProps` props for the component
5
5
  */
6
- export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldItemTemplateType<T, S, F>): import("react/jsx-runtime").JSX.Element;
6
+ export default function ArrayFieldItemTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ArrayFieldItemTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
@@ -1,21 +1,25 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { getUiOptions, getTemplate, } from '@rjsf/utils';
3
3
  import { Button, Grid, Segment } from 'semantic-ui-react';
4
- import { MaybeWrap } from '../util.js';
4
+ import { getSemanticProps, MaybeWrap } from '../util.js';
5
5
  const gridStyle = (vertical) => ({
6
6
  display: 'grid',
7
7
  gridTemplateColumns: `1fr ${vertical ? 65 : 150}px`,
8
8
  });
9
9
  /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
10
10
  *
11
- * @param props - The `ArrayFieldItemTemplateType` props for the component
11
+ * @param props - The `ArrayFieldItemTemplateProps` props for the component
12
12
  */
13
13
  export default function ArrayFieldItemTemplate(props) {
14
- const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
14
+ const { children, buttonsProps, hasToolbar, uiSchema, registry, parentUiSchema } = props;
15
15
  const uiOptions = getUiOptions(uiSchema);
16
16
  const ArrayFieldItemButtonsTemplate = getTemplate('ArrayFieldItemButtonsTemplate', registry, uiOptions);
17
- // Pull the semantic props out of the uiOptions that were put in via the ArrayFieldTemplate
18
- const { horizontalButtons = true, wrapItem = false } = uiOptions.semantic;
17
+ const semanticProps = getSemanticProps({
18
+ uiSchema: parentUiSchema,
19
+ formContext: registry.formContext,
20
+ defaultSchemaProps: { horizontalButtons: true, wrapItem: false },
21
+ });
22
+ const { horizontalButtons = true, wrapItem = false } = semanticProps;
19
23
  return (_jsx("div", { className: 'rjsf-array-item', children: _jsx(MaybeWrap, { wrap: wrapItem, component: Segment, children: _jsxs(Grid, { style: { ...gridStyle(!horizontalButtons), alignItems: 'center' }, children: [_jsx(Grid.Column, { width: 16, verticalAlign: 'middle', children: children }), hasToolbar && (_jsx(Grid.Column, { children: _jsx(Button.Group, { size: 'mini', vertical: !horizontalButtons, children: _jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps }) }) }))] }) }) }));
20
24
  }
21
25
  //# sourceMappingURL=ArrayFieldItemTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAML,YAAY,EACZ,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,SAAS,GAAG,CAAC,QAAiB,EAAE,EAAE,CAAC,CAAC;IACxC,OAAO,EAAE,MAAM;IACf,mBAAmB,EAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI;CACpD,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAI5C,KAA0C;IAC1C,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACzE,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,6BAA6B,GAAG,WAAW,CAC/C,+BAA+B,EAC/B,QAAQ,EACR,SAAS,CACV,CAAC;IACF,2FAA2F;IAC3F,MAAM,EAAE,iBAAiB,GAAG,IAAI,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,SAAS,CAAC,QAA6B,CAAC;IAC/F,OAAO,CACL,cAAK,SAAS,EAAC,iBAAiB,YAC9B,KAAC,SAAS,IAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,YAC3C,MAAC,IAAI,IAAC,KAAK,EAAE,EAAE,GAAG,SAAS,CAAC,CAAC,iBAAiB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,aACrE,KAAC,IAAI,CAAC,MAAM,IAAC,KAAK,EAAE,EAAE,EAAE,aAAa,EAAC,QAAQ,YAC3C,QAAQ,GACG,EACb,UAAU,IAAI,CACb,KAAC,IAAI,CAAC,MAAM,cACV,KAAC,MAAM,CAAC,KAAK,IAAC,IAAI,EAAC,MAAM,EAAC,QAAQ,EAAE,CAAC,iBAAiB,YACpD,KAAC,6BAA6B,OAAK,YAAY,GAAI,GACtC,GACH,CACf,IACI,GACG,GACR,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,YAAY,EACZ,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,SAAS,GAAG,CAAC,QAAiB,EAAE,EAAE,CAAC,CAAC;IACxC,OAAO,EAAE,MAAM;IACf,mBAAmB,EAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI;CACpD,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAI5C,KAA2C;IAC3C,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACzF,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,6BAA6B,GAAG,WAAW,CAC/C,+BAA+B,EAC/B,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,aAAa,GAAG,gBAAgB,CAAU;QAC9C,QAAQ,EAAE,cAAc;QACxB,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,kBAAkB,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE;KACjE,CAAC,CAAC;IACH,MAAM,EAAE,iBAAiB,GAAG,IAAI,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,aAAa,CAAC;IACrE,OAAO,CACL,cAAK,SAAS,EAAC,iBAAiB,YAC9B,KAAC,SAAS,IAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,YAC3C,MAAC,IAAI,IAAC,KAAK,EAAE,EAAE,GAAG,SAAS,CAAC,CAAC,iBAAiB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,aACrE,KAAC,IAAI,CAAC,MAAM,IAAC,KAAK,EAAE,EAAE,EAAE,aAAa,EAAC,QAAQ,YAC3C,QAAQ,GACG,EACb,UAAU,IAAI,CACb,KAAC,IAAI,CAAC,MAAM,cACV,KAAC,MAAM,CAAC,KAAK,IAAC,IAAI,EAAC,MAAM,EAAC,QAAQ,EAAE,CAAC,iBAAiB,YACpD,KAAC,6BAA6B,OAAK,YAAY,GAAI,GACtC,GACH,CACf,IACI,GACG,GACR,CACP,CAAC;AACJ,CAAC"}