@rjsf/semantic-ui 6.0.0-beta.1 → 6.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -64,9 +64,11 @@ Exports `semantic-ui` theme, fields and widgets for `react-jsonschema-form`.
64
64
 
65
65
  ### Prerequisites
66
66
 
67
- - `@semantic-ui-react >= 0.87.0`
68
- - `@semantic-ui-css >= 2.4.1` ([default theme for semantic-ui](https://github.com/Semantic-Org/Semantic-UI-CSS)); see [theming guide](https://react.semantic-ui.com/theming) if you wish to customize
69
- - `@rjsf/core >= 2.0.0`
67
+ - `@semantic-ui-react >= 2`
68
+ - `@semantic-ui-css >= 2` ([default theme for semantic-ui](https://github.com/Semantic-Org/Semantic-UI-CSS)); see [theming guide](https://react.semantic-ui.com/theming) if you wish to customize
69
+ - `@rjsf/core >= 6`
70
+ - `@rjsf/utils >= 6`
71
+ - `@rjsf/validator-ajv8 >= 6`
70
72
 
71
73
  ```sh
72
74
  yarn add semantic-ui-css semantic-ui-react @rjsf/core
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ __export(index_exports, {
43
43
  module.exports = __toCommonJS(index_exports);
44
44
 
45
45
  // src/SemanticUIForm/SemanticUIForm.ts
46
- var import_core = require("@rjsf/core");
46
+ var import_core2 = require("@rjsf/core");
47
47
 
48
48
  // src/Theme/Theme.ts
49
49
  var import_semantic_ui_react20 = require("semantic-ui-react");
@@ -309,13 +309,14 @@ function BaseInputTemplate(props) {
309
309
  }
310
310
 
311
311
  // src/DescriptionField/DescriptionField.tsx
312
+ var import_core = require("@rjsf/core");
312
313
  var import_jsx_runtime6 = require("react/jsx-runtime");
313
314
  function DescriptionField(props) {
314
- const { id, description } = props;
315
+ const { id, description, registry, uiSchema } = props;
315
316
  if (!description) {
316
317
  return null;
317
318
  }
318
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { id, className: "sui-description", children: description });
319
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { id, className: "sui-description", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core.RichDescription, { description, registry, uiSchema }) });
319
320
  }
320
321
 
321
322
  // src/ErrorList/ErrorList.tsx
@@ -479,10 +480,20 @@ function GridTemplate(props) {
479
480
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_semantic_ui_react9.Grid, { ...rest, children });
480
481
  }
481
482
 
483
+ // src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
484
+ var import_jsx_runtime13 = require("react/jsx-runtime");
485
+ function MultiSchemaFieldTemplate(props) {
486
+ const { selector, optionSchemaField } = props;
487
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
488
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: selector }),
489
+ optionSchemaField
490
+ ] });
491
+ }
492
+
482
493
  // src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
483
494
  var import_semantic_ui_react10 = require("semantic-ui-react");
484
495
  var import_utils11 = require("@rjsf/utils");
485
- var import_jsx_runtime13 = require("react/jsx-runtime");
496
+ var import_jsx_runtime14 = require("react/jsx-runtime");
486
497
  function ObjectFieldTemplate(props) {
487
498
  const {
488
499
  description,
@@ -508,8 +519,8 @@ function ObjectFieldTemplate(props) {
508
519
  const {
509
520
  ButtonTemplates: { AddButton: AddButton2 }
510
521
  } = registry.templates;
511
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
512
- title && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
522
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
523
+ title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
513
524
  TitleFieldTemplate,
514
525
  {
515
526
  id: (0, import_utils11.titleId)(idSchema),
@@ -520,7 +531,7 @@ function ObjectFieldTemplate(props) {
520
531
  registry
521
532
  }
522
533
  ),
523
- description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
534
+ description && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
524
535
  DescriptionFieldTemplate,
525
536
  {
526
537
  id: (0, import_utils11.descriptionId)(idSchema),
@@ -531,7 +542,7 @@ function ObjectFieldTemplate(props) {
531
542
  }
532
543
  ),
533
544
  properties.map((prop) => prop.content),
534
- (0, import_utils11.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_semantic_ui_react10.Grid.Column, { width: 16, verticalAlign: "middle", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_semantic_ui_react10.Grid.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
545
+ (0, import_utils11.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_semantic_ui_react10.Grid.Column, { width: 16, verticalAlign: "middle", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_semantic_ui_react10.Grid.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
535
546
  "div",
536
547
  {
537
548
  style: {
@@ -539,7 +550,7 @@ function ObjectFieldTemplate(props) {
539
550
  position: "relative",
540
551
  textAlign: "right"
541
552
  },
542
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
553
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
543
554
  AddButton2,
544
555
  {
545
556
  id: (0, import_utils11.buttonId)(idSchema, "add"),
@@ -558,18 +569,18 @@ function ObjectFieldTemplate(props) {
558
569
  // src/SubmitButton/SubmitButton.tsx
559
570
  var import_semantic_ui_react11 = require("semantic-ui-react");
560
571
  var import_utils12 = require("@rjsf/utils");
561
- var import_jsx_runtime14 = require("react/jsx-runtime");
572
+ var import_jsx_runtime15 = require("react/jsx-runtime");
562
573
  function SubmitButton({ uiSchema }) {
563
574
  const { submitText, norender, props: submitButtonProps = {} } = (0, import_utils12.getSubmitButtonOptions)(uiSchema);
564
575
  if (norender) {
565
576
  return null;
566
577
  }
567
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_semantic_ui_react11.Button, { type: "submit", primary: true, ...submitButtonProps, children: submitText });
578
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_semantic_ui_react11.Button, { type: "submit", primary: true, ...submitButtonProps, children: submitText });
568
579
  }
569
580
 
570
581
  // src/TitleField/TitleField.tsx
571
582
  var import_semantic_ui_react12 = require("semantic-ui-react");
572
- var import_jsx_runtime15 = require("react/jsx-runtime");
583
+ var import_jsx_runtime16 = require("react/jsx-runtime");
573
584
  var DEFAULT_OPTIONS2 = {
574
585
  inverted: false,
575
586
  dividing: true
@@ -586,13 +597,13 @@ function TitleField({
586
597
  if (!title) {
587
598
  return null;
588
599
  }
589
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_semantic_ui_react12.Header, { id, ...semanticProps, as: "h5", children: title });
600
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_semantic_ui_react12.Header, { id, ...semanticProps, as: "h5", children: title });
590
601
  }
591
602
 
592
603
  // src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
593
604
  var import_utils13 = require("@rjsf/utils");
594
605
  var import_semantic_ui_react13 = require("semantic-ui-react");
595
- var import_jsx_runtime16 = require("react/jsx-runtime");
606
+ var import_jsx_runtime17 = require("react/jsx-runtime");
596
607
  function WrapIfAdditionalTemplate(props) {
597
608
  const {
598
609
  children,
@@ -615,11 +626,11 @@ function WrapIfAdditionalTemplate(props) {
615
626
  const { readonlyAsDisabled = true, wrapperStyle } = registry.formContext;
616
627
  const additional = import_utils13.ADDITIONAL_PROPERTY_FLAG in schema;
617
628
  if (!additional) {
618
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: classNames, style, children });
629
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: classNames, style, children });
619
630
  }
620
631
  const handleBlur = ({ target }) => onKeyChange(target.value);
621
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: classNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_semantic_ui_react13.Grid, { columns: "equal", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_semantic_ui_react13.Grid.Row, { children: [
622
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_semantic_ui_react13.Grid.Column, { className: "form-additional", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_semantic_ui_react13.Form.Group, { widths: "equal", grouped: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
632
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: classNames, style, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_semantic_ui_react13.Grid, { columns: "equal", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_semantic_ui_react13.Grid.Row, { children: [
633
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_semantic_ui_react13.Grid.Column, { className: "form-additional", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_semantic_ui_react13.Form.Group, { widths: "equal", grouped: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
623
634
  import_semantic_ui_react13.Form.Input,
624
635
  {
625
636
  className: "form-group",
@@ -637,8 +648,8 @@ function WrapIfAdditionalTemplate(props) {
637
648
  type: "text"
638
649
  }
639
650
  ) }) }),
640
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_semantic_ui_react13.Grid.Column, { className: "form-additional", verticalAlign: "middle", children }),
641
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_semantic_ui_react13.Grid.Column, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
651
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_semantic_ui_react13.Grid.Column, { className: "form-additional", verticalAlign: "middle", children }),
652
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_semantic_ui_react13.Grid.Column, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
642
653
  RemoveButton2,
643
654
  {
644
655
  id: (0, import_utils13.buttonId)(id, "remove"),
@@ -673,6 +684,7 @@ function generateTemplates() {
673
684
  FieldHelpTemplate,
674
685
  FieldTemplate,
675
686
  GridTemplate,
687
+ MultiSchemaFieldTemplate,
676
688
  ObjectFieldTemplate,
677
689
  TitleFieldTemplate: TitleField,
678
690
  WrapIfAdditionalTemplate
@@ -683,7 +695,7 @@ var Templates_default = generateTemplates();
683
695
  // src/CheckboxWidget/CheckboxWidget.tsx
684
696
  var import_utils14 = require("@rjsf/utils");
685
697
  var import_semantic_ui_react14 = require("semantic-ui-react");
686
- var import_jsx_runtime17 = require("react/jsx-runtime");
698
+ var import_jsx_runtime18 = require("react/jsx-runtime");
687
699
  function CheckboxWidget(props) {
688
700
  const {
689
701
  id,
@@ -722,8 +734,8 @@ function CheckboxWidget(props) {
722
734
  const _onFocus = () => onFocus && onFocus(id, value);
723
735
  const checked = value == "true" || value == true;
724
736
  const description = options.description ?? schema.description;
725
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
726
- !hideLabel && !!description && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
737
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
738
+ !hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
727
739
  DescriptionFieldTemplate,
728
740
  {
729
741
  id: (0, import_utils14.descriptionId)(id),
@@ -733,7 +745,7 @@ function CheckboxWidget(props) {
733
745
  registry
734
746
  }
735
747
  ),
736
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
748
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
737
749
  import_semantic_ui_react14.Form.Checkbox,
738
750
  {
739
751
  id,
@@ -757,7 +769,7 @@ function CheckboxWidget(props) {
757
769
  // src/CheckboxesWidget/CheckboxesWidget.tsx
758
770
  var import_semantic_ui_react15 = require("semantic-ui-react");
759
771
  var import_utils15 = require("@rjsf/utils");
760
- var import_jsx_runtime18 = require("react/jsx-runtime");
772
+ var import_jsx_runtime19 = require("react/jsx-runtime");
761
773
  function CheckboxesWidget(props) {
762
774
  const {
763
775
  id,
@@ -798,12 +810,12 @@ function CheckboxesWidget(props) {
798
810
  const _onBlur = () => onBlur(id, value);
799
811
  const _onFocus = () => onFocus(id, value);
800
812
  const inlineOption = inline ? { inline: true } : { grouped: true };
801
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
802
- !hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TitleFieldTemplate, { id: (0, import_utils15.titleId)(id), title: label, schema, uiSchema, registry }),
803
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_semantic_ui_react15.Form.Group, { id, name: id, ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
813
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
814
+ !hideLabel && !!label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TitleFieldTemplate, { id: (0, import_utils15.titleId)(id), title: label, schema, uiSchema, registry }),
815
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_semantic_ui_react15.Form.Group, { id, name: id, ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
804
816
  const checked = (0, import_utils15.enumOptionsIsSelected)(option.value, checkboxesValues);
805
817
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
806
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
818
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
807
819
  import_semantic_ui_react15.Form.Checkbox,
808
820
  {
809
821
  id: (0, import_utils15.optionId)(id, index),
@@ -828,7 +840,7 @@ function CheckboxesWidget(props) {
828
840
  // src/RadioWidget/RadioWidget.tsx
829
841
  var import_utils16 = require("@rjsf/utils");
830
842
  var import_semantic_ui_react16 = require("semantic-ui-react");
831
- var import_jsx_runtime19 = require("react/jsx-runtime");
843
+ var import_jsx_runtime20 = require("react/jsx-runtime");
832
844
  var import_react = require("react");
833
845
  function RadioWidget(props) {
834
846
  const {
@@ -857,7 +869,7 @@ function RadioWidget(props) {
857
869
  const _onBlur = () => onBlur(id, value);
858
870
  const _onFocus = () => onFocus(id, value);
859
871
  const inlineOption = options.inline ? { inline: true } : { grouped: true };
860
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_semantic_ui_react16.Form.Group, { ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
872
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_semantic_ui_react16.Form.Group, { ...inlineOption, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
861
873
  const checked = (0, import_utils16.enumOptionsIsSelected)(option.value, value);
862
874
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
863
875
  return /* @__PURE__ */ (0, import_react.createElement)(
@@ -886,7 +898,7 @@ function RadioWidget(props) {
886
898
  // src/RangeWidget/RangeWidget.tsx
887
899
  var import_semantic_ui_react17 = require("semantic-ui-react");
888
900
  var import_utils17 = require("@rjsf/utils");
889
- var import_jsx_runtime20 = require("react/jsx-runtime");
901
+ var import_jsx_runtime21 = require("react/jsx-runtime");
890
902
  function RangeWidget(props) {
891
903
  const {
892
904
  id,
@@ -914,8 +926,8 @@ function RangeWidget(props) {
914
926
  const _onChange = ({ target: { value: value2 } }) => onChange && onChange(value2 === "" ? options.emptyValue : value2);
915
927
  const _onBlur = () => onBlur && onBlur(id, value);
916
928
  const _onFocus = () => onFocus && onFocus(id, value);
917
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
918
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
929
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
930
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
919
931
  import_semantic_ui_react17.Input,
920
932
  {
921
933
  id,
@@ -934,7 +946,7 @@ function RangeWidget(props) {
934
946
  },
935
947
  id
936
948
  ),
937
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: value })
949
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: value })
938
950
  ] });
939
951
  }
940
952
 
@@ -942,7 +954,7 @@ function RangeWidget(props) {
942
954
  var import_utils18 = require("@rjsf/utils");
943
955
  var import_map = __toESM(require("lodash/map"), 1);
944
956
  var import_semantic_ui_react18 = require("semantic-ui-react");
945
- var import_jsx_runtime21 = require("react/jsx-runtime");
957
+ var import_jsx_runtime22 = require("react/jsx-runtime");
946
958
  function createDefaultValueOptionsForDropDown(enumOptions, enumDisabled, showPlaceholderOption, placeholder) {
947
959
  const disabledOptions = enumDisabled || [];
948
960
  const options = (0, import_map.default)(enumOptions, ({ label, value }, index) => ({
@@ -1002,7 +1014,7 @@ function SelectWidget(props) {
1002
1014
  const _onBlur = (_, { target }) => onBlur(id, (0, import_utils18.enumOptionsValueForIndex)(target && target.value, enumOptions, optEmptyVal));
1003
1015
  const _onFocus = (_, { target }) => onFocus(id, (0, import_utils18.enumOptionsValueForIndex)(target && target.value, enumOptions, optEmptyVal));
1004
1016
  const selectedIndexes = (0, import_utils18.enumOptionsIndexForValue)(value, enumOptions, multiple);
1005
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1017
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1006
1018
  import_semantic_ui_react18.Form.Dropdown,
1007
1019
  {
1008
1020
  id,
@@ -1030,7 +1042,7 @@ function SelectWidget(props) {
1030
1042
  // src/TextareaWidget/TextareaWidget.tsx
1031
1043
  var import_utils19 = require("@rjsf/utils");
1032
1044
  var import_semantic_ui_react19 = require("semantic-ui-react");
1033
- var import_jsx_runtime22 = require("react/jsx-runtime");
1045
+ var import_jsx_runtime23 = require("react/jsx-runtime");
1034
1046
  function TextareaWidget(props) {
1035
1047
  const {
1036
1048
  id,
@@ -1057,7 +1069,7 @@ function TextareaWidget(props) {
1057
1069
  const _onChange = ({ target: { value: value2 } }) => onChange && onChange(value2 === "" ? options.emptyValue : value2);
1058
1070
  const _onBlur = () => onBlur && onBlur(id, value);
1059
1071
  const _onFocus = () => onFocus && onFocus(id, value);
1060
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1072
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1061
1073
  import_semantic_ui_react19.Form.TextArea,
1062
1074
  {
1063
1075
  id,
@@ -1105,7 +1117,7 @@ var Theme_default = generateTheme();
1105
1117
 
1106
1118
  // src/SemanticUIForm/SemanticUIForm.ts
1107
1119
  function generateForm() {
1108
- return (0, import_core.withTheme)(generateTheme());
1120
+ return (0, import_core2.withTheme)(generateTheme());
1109
1121
  }
1110
1122
  var SemanticUIForm_default = generateForm();
1111
1123