@rjsf/react-bootstrap 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.
@@ -188,12 +188,13 @@ function BaseInputTemplate({
188
188
  }
189
189
 
190
190
  // src/DescriptionField/DescriptionField.tsx
191
+ import { RichDescription } from "@rjsf/core";
191
192
  import { jsx as jsx5 } from "react/jsx-runtime";
192
- function DescriptionField({ id, description }) {
193
- if (description) {
194
- return /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5("div", { id, className: "mb-3", children: description }) });
193
+ function DescriptionField({ id, description, registry, uiSchema }) {
194
+ if (!description) {
195
+ return null;
195
196
  }
196
- return null;
197
+ return /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5("div", { id, className: "mb-3", children: /* @__PURE__ */ jsx5(RichDescription, { description, registry, uiSchema }) }) });
197
198
  }
198
199
 
199
200
  // src/ErrorList/ErrorList.tsx
@@ -366,6 +367,16 @@ function GridTemplate(props) {
366
367
  return /* @__PURE__ */ jsx11(Row3, { ...rest, children });
367
368
  }
368
369
 
370
+ // src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
371
+ import Card2 from "react-bootstrap/Card";
372
+ import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
373
+ function MultiSchemaFieldTemplate({ selector, optionSchemaField }) {
374
+ return /* @__PURE__ */ jsxs6(Card2, { style: { marginBottom: "1rem" }, children: [
375
+ /* @__PURE__ */ jsx12(Card2.Body, { children: selector }),
376
+ /* @__PURE__ */ jsx12(Card2.Body, { children: optionSchemaField })
377
+ ] });
378
+ }
379
+
369
380
  // src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
370
381
  import Row4 from "react-bootstrap/Row";
371
382
  import Col4 from "react-bootstrap/Col";
@@ -378,7 +389,7 @@ import {
378
389
  getUiOptions as getUiOptions4,
379
390
  titleId
380
391
  } from "@rjsf/utils";
381
- import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
392
+ import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
382
393
  function ObjectFieldTemplate({
383
394
  description,
384
395
  title,
@@ -403,8 +414,8 @@ function ObjectFieldTemplate({
403
414
  const {
404
415
  ButtonTemplates: { AddButton: AddButton2 }
405
416
  } = registry.templates;
406
- return /* @__PURE__ */ jsxs6(Fragment2, { children: [
407
- title && /* @__PURE__ */ jsx12(
417
+ return /* @__PURE__ */ jsxs7(Fragment2, { children: [
418
+ title && /* @__PURE__ */ jsx13(
408
419
  TitleFieldTemplate,
409
420
  {
410
421
  id: titleId(idSchema),
@@ -415,7 +426,7 @@ function ObjectFieldTemplate({
415
426
  registry
416
427
  }
417
428
  ),
418
- description && /* @__PURE__ */ jsx12(
429
+ description && /* @__PURE__ */ jsx13(
419
430
  DescriptionFieldTemplate,
420
431
  {
421
432
  id: descriptionId(idSchema),
@@ -425,12 +436,12 @@ function ObjectFieldTemplate({
425
436
  registry
426
437
  }
427
438
  ),
428
- /* @__PURE__ */ jsxs6(Container2, { fluid: true, className: "p-0", children: [
429
- properties.map((element, index) => /* @__PURE__ */ jsx12(Row4, { style: { marginBottom: "10px" }, className: element.hidden ? "d-none" : void 0, children: /* @__PURE__ */ jsxs6(Col4, { xs: 12, children: [
439
+ /* @__PURE__ */ jsxs7(Container2, { fluid: true, className: "p-0", children: [
440
+ properties.map((element, index) => /* @__PURE__ */ jsx13(Row4, { style: { marginBottom: "10px" }, className: element.hidden ? "d-none" : void 0, children: /* @__PURE__ */ jsxs7(Col4, { xs: 12, children: [
430
441
  " ",
431
442
  element.content
432
443
  ] }) }, index)),
433
- canExpand(schema, uiSchema, formData) ? /* @__PURE__ */ jsx12(Row4, { children: /* @__PURE__ */ jsx12(Col4, { xs: { offset: 9, span: 3 }, className: "py-4", children: /* @__PURE__ */ jsx12(
444
+ canExpand(schema, uiSchema, formData) ? /* @__PURE__ */ jsx13(Row4, { children: /* @__PURE__ */ jsx13(Col4, { xs: { offset: 9, span: 3 }, className: "py-4", children: /* @__PURE__ */ jsx13(
434
445
  AddButton2,
435
446
  {
436
447
  id: buttonId2(idSchema, "add"),
@@ -448,27 +459,27 @@ function ObjectFieldTemplate({
448
459
  // src/SubmitButton/SubmitButton.tsx
449
460
  import Button3 from "react-bootstrap/Button";
450
461
  import { getSubmitButtonOptions } from "@rjsf/utils";
451
- import { jsx as jsx13 } from "react/jsx-runtime";
462
+ import { jsx as jsx14 } from "react/jsx-runtime";
452
463
  function SubmitButton(props) {
453
464
  const { submitText, norender, props: submitButtonProps } = getSubmitButtonOptions(props.uiSchema);
454
465
  if (norender) {
455
466
  return null;
456
467
  }
457
- return /* @__PURE__ */ jsx13("div", { children: /* @__PURE__ */ jsx13(Button3, { variant: "primary", type: "submit", ...submitButtonProps, children: submitText }) });
468
+ return /* @__PURE__ */ jsx14("div", { children: /* @__PURE__ */ jsx14(Button3, { variant: "primary", type: "submit", ...submitButtonProps, children: submitText }) });
458
469
  }
459
470
 
460
471
  // src/TitleField/TitleField.tsx
461
472
  import { getUiOptions as getUiOptions5 } from "@rjsf/utils";
462
- import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
473
+ import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
463
474
  function TitleField({
464
475
  id,
465
476
  title,
466
477
  uiSchema
467
478
  }) {
468
479
  const uiOptions = getUiOptions5(uiSchema);
469
- return /* @__PURE__ */ jsxs7("div", { id, className: "my-1", children: [
470
- /* @__PURE__ */ jsx14("h5", { children: uiOptions.title || title }),
471
- /* @__PURE__ */ jsx14("hr", { className: "border-0 bg-secondary", style: { height: "1px" } })
480
+ return /* @__PURE__ */ jsxs8("div", { id, className: "my-1", children: [
481
+ /* @__PURE__ */ jsx15("h5", { children: uiOptions.title || title }),
482
+ /* @__PURE__ */ jsx15("hr", { className: "border-0 bg-secondary", style: { height: "1px" } })
472
483
  ] });
473
484
  }
474
485
 
@@ -481,7 +492,7 @@ import {
481
492
  import Row5 from "react-bootstrap/Row";
482
493
  import Col5 from "react-bootstrap/Col";
483
494
  import Form4 from "react-bootstrap/Form";
484
- import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
495
+ import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
485
496
  function WrapIfAdditionalTemplate({
486
497
  classNames,
487
498
  style,
@@ -502,14 +513,14 @@ function WrapIfAdditionalTemplate({
502
513
  const keyLabel = translateString(TranslatableString4.KeyLabel, [label]);
503
514
  const additional = ADDITIONAL_PROPERTY_FLAG in schema;
504
515
  if (!additional) {
505
- return /* @__PURE__ */ jsx15("div", { className: classNames, style, children });
516
+ return /* @__PURE__ */ jsx16("div", { className: classNames, style, children });
506
517
  }
507
518
  const handleBlur = ({ target }) => onKeyChange(target.value);
508
519
  const keyId = `${id}-key`;
509
- return /* @__PURE__ */ jsxs8(Row5, { className: classNames, style, children: [
510
- /* @__PURE__ */ jsx15(Col5, { xs: 5, children: /* @__PURE__ */ jsxs8(Form4.Group, { children: [
511
- /* @__PURE__ */ jsx15(Form4.Label, { htmlFor: keyId, children: keyLabel }),
512
- /* @__PURE__ */ jsx15(
520
+ return /* @__PURE__ */ jsxs9(Row5, { className: classNames, style, children: [
521
+ /* @__PURE__ */ jsx16(Col5, { xs: 5, children: /* @__PURE__ */ jsxs9(Form4.Group, { children: [
522
+ /* @__PURE__ */ jsx16(Form4.Label, { htmlFor: keyId, children: keyLabel }),
523
+ /* @__PURE__ */ jsx16(
513
524
  Form4.Control,
514
525
  {
515
526
  required,
@@ -522,8 +533,8 @@ function WrapIfAdditionalTemplate({
522
533
  }
523
534
  )
524
535
  ] }) }),
525
- /* @__PURE__ */ jsx15(Col5, { xs: 5, children }),
526
- /* @__PURE__ */ jsx15(Col5, { xs: 2, className: "py-4 d-grid gap-2", children: /* @__PURE__ */ jsx15(
536
+ /* @__PURE__ */ jsx16(Col5, { xs: 5, children }),
537
+ /* @__PURE__ */ jsx16(Col5, { xs: 2, className: "py-4 d-grid gap-2", children: /* @__PURE__ */ jsx16(
527
538
  RemoveButton2,
528
539
  {
529
540
  id: buttonId3(id, "remove"),
@@ -557,6 +568,7 @@ function generateTemplates() {
557
568
  FieldHelpTemplate,
558
569
  FieldTemplate,
559
570
  GridTemplate,
571
+ MultiSchemaFieldTemplate,
560
572
  ObjectFieldTemplate,
561
573
  TitleFieldTemplate: TitleField,
562
574
  WrapIfAdditionalTemplate
@@ -573,7 +585,7 @@ import {
573
585
  schemaRequiresTrueValue
574
586
  } from "@rjsf/utils";
575
587
  import Form5 from "react-bootstrap/Form";
576
- import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
588
+ import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
577
589
  function CheckboxWidget(props) {
578
590
  const {
579
591
  id,
@@ -601,41 +613,34 @@ function CheckboxWidget(props) {
601
613
  const _onBlur = ({ target }) => onBlur(id, target && target.checked);
602
614
  const _onFocus = ({ target }) => onFocus(id, target && target.checked);
603
615
  const description = options.description || schema.description;
604
- return /* @__PURE__ */ jsxs9(
605
- Form5.Group,
606
- {
607
- className: `checkbox ${disabled || readonly ? "disabled" : ""}`,
608
- "aria-describedby": ariaDescribedByIds2(id),
609
- children: [
610
- !hideLabel && !!description && /* @__PURE__ */ jsx16(
611
- DescriptionFieldTemplate,
612
- {
613
- id: descriptionId2(id),
614
- description,
615
- schema,
616
- uiSchema,
617
- registry
618
- }
619
- ),
620
- /* @__PURE__ */ jsx16(
621
- Form5.Check,
622
- {
623
- id,
624
- name: id,
625
- label: labelValue(label, hideLabel || !label),
626
- checked: typeof value === "undefined" ? false : value,
627
- required,
628
- disabled: disabled || readonly,
629
- autoFocus: autofocus,
630
- onChange: _onChange,
631
- type: "checkbox",
632
- onBlur: _onBlur,
633
- onFocus: _onFocus
634
- }
635
- )
636
- ]
637
- }
638
- );
616
+ return /* @__PURE__ */ jsxs10(Form5.Group, { className: disabled || readonly ? "disabled" : "", "aria-describedby": ariaDescribedByIds2(id), children: [
617
+ !hideLabel && description && /* @__PURE__ */ jsx17(
618
+ DescriptionFieldTemplate,
619
+ {
620
+ id: descriptionId2(id),
621
+ description,
622
+ schema,
623
+ uiSchema,
624
+ registry
625
+ }
626
+ ),
627
+ /* @__PURE__ */ jsx17(
628
+ Form5.Check,
629
+ {
630
+ id,
631
+ name: id,
632
+ label: labelValue(label, hideLabel || !label),
633
+ checked: typeof value === "undefined" ? false : value,
634
+ required,
635
+ disabled: disabled || readonly,
636
+ autoFocus: autofocus,
637
+ onChange: _onChange,
638
+ type: "checkbox",
639
+ onBlur: _onBlur,
640
+ onFocus: _onFocus
641
+ }
642
+ )
643
+ ] });
639
644
  }
640
645
 
641
646
  // src/CheckboxesWidget/CheckboxesWidget.tsx
@@ -648,7 +653,7 @@ import {
648
653
  enumOptionsValueForIndex,
649
654
  optionId
650
655
  } from "@rjsf/utils";
651
- import { jsx as jsx17 } from "react/jsx-runtime";
656
+ import { jsx as jsx18 } from "react/jsx-runtime";
652
657
  function CheckboxesWidget({ id, disabled, options, value, autofocus, readonly, required, onChange, onBlur, onFocus }) {
653
658
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
654
659
  const checkboxesValues = Array.isArray(value) ? value : [value];
@@ -661,10 +666,10 @@ function CheckboxesWidget({ id, disabled, options, value, autofocus, readonly, r
661
666
  };
662
667
  const _onBlur = ({ target }) => onBlur(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
663
668
  const _onFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
664
- return /* @__PURE__ */ jsx17(Form6.Group, { children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
669
+ return /* @__PURE__ */ jsx18(Form6.Group, { children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
665
670
  const checked = enumOptionsIsSelected(option.value, checkboxesValues);
666
671
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
667
- return /* @__PURE__ */ jsx17(
672
+ return /* @__PURE__ */ jsx18(
668
673
  Form6.Check,
669
674
  {
670
675
  inline,
@@ -695,7 +700,7 @@ import {
695
700
  enumOptionsValueForIndex as enumOptionsValueForIndex2,
696
701
  optionId as optionId2
697
702
  } from "@rjsf/utils";
698
- import { jsx as jsx18 } from "react/jsx-runtime";
703
+ import { jsx as jsx19 } from "react/jsx-runtime";
699
704
  function RadioWidget({
700
705
  id,
701
706
  options,
@@ -712,10 +717,10 @@ function RadioWidget({
712
717
  const _onBlur = ({ target }) => onBlur(id, enumOptionsValueForIndex2(target && target.value, enumOptions, emptyValue));
713
718
  const _onFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex2(target && target.value, enumOptions, emptyValue));
714
719
  const inline = Boolean(options && options.inline);
715
- return /* @__PURE__ */ jsx18(Form7.Group, { className: "mb-0", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
720
+ return /* @__PURE__ */ jsx19(Form7.Group, { className: "mb-0", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
716
721
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
717
722
  const checked = enumOptionsIsSelected2(option.value, value);
718
- const radio = /* @__PURE__ */ jsx18(
723
+ const radio = /* @__PURE__ */ jsx19(
719
724
  Form7.Check,
720
725
  {
721
726
  inline,
@@ -741,7 +746,7 @@ function RadioWidget({
741
746
  // src/RangeWidget/RangeWidget.tsx
742
747
  import { rangeSpec } from "@rjsf/utils";
743
748
  import FormRange from "react-bootstrap/FormRange";
744
- import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
749
+ import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
745
750
  function RangeWidget(props) {
746
751
  const { id, value, disabled, onChange, onBlur, onFocus, schema } = props;
747
752
  const _onChange = ({ target: { value: value2 } }) => onChange(value2);
@@ -757,9 +762,9 @@ function RangeWidget(props) {
757
762
  onFocus: _onFocus,
758
763
  ...rangeSpec(schema)
759
764
  };
760
- return /* @__PURE__ */ jsxs10(Fragment3, { children: [
761
- /* @__PURE__ */ jsx19(FormRange, { ...rangeProps }),
762
- /* @__PURE__ */ jsx19("span", { className: "range-view", children: value })
765
+ return /* @__PURE__ */ jsxs11(Fragment3, { children: [
766
+ /* @__PURE__ */ jsx20(FormRange, { ...rangeProps }),
767
+ /* @__PURE__ */ jsx20("span", { className: "range-view", children: value })
763
768
  ] });
764
769
  }
765
770
 
@@ -770,7 +775,7 @@ import {
770
775
  enumOptionsIndexForValue,
771
776
  enumOptionsValueForIndex as enumOptionsValueForIndex3
772
777
  } from "@rjsf/utils";
773
- import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
778
+ import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
774
779
  function SelectWidget({
775
780
  schema,
776
781
  id,
@@ -798,7 +803,7 @@ function SelectWidget({
798
803
  }
799
804
  const selectedIndexes = enumOptionsIndexForValue(value, enumOptions, multiple);
800
805
  const showPlaceholderOption = !multiple && schema.default === void 0;
801
- return /* @__PURE__ */ jsxs11(
806
+ return /* @__PURE__ */ jsxs12(
802
807
  FormSelect,
803
808
  {
804
809
  id,
@@ -823,10 +828,10 @@ function SelectWidget({
823
828
  },
824
829
  "aria-describedby": ariaDescribedByIds5(id),
825
830
  children: [
826
- showPlaceholderOption && /* @__PURE__ */ jsx20("option", { value: "", children: placeholder }),
831
+ showPlaceholderOption && /* @__PURE__ */ jsx21("option", { value: "", children: placeholder }),
827
832
  enumOptions.map(({ value: value2, label }, i) => {
828
833
  const disabled2 = Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) != -1;
829
- return /* @__PURE__ */ jsx20("option", { id: label, value: String(i), disabled: disabled2, children: label }, i);
834
+ return /* @__PURE__ */ jsx21("option", { id: label, value: String(i), disabled: disabled2, children: label }, i);
830
835
  })
831
836
  ]
832
837
  }
@@ -837,7 +842,7 @@ function SelectWidget({
837
842
  import { ariaDescribedByIds as ariaDescribedByIds6 } from "@rjsf/utils";
838
843
  import FormControl from "react-bootstrap/FormControl";
839
844
  import InputGroup from "react-bootstrap/InputGroup";
840
- import { jsx as jsx21 } from "react/jsx-runtime";
845
+ import { jsx as jsx22 } from "react/jsx-runtime";
841
846
  function TextareaWidget({
842
847
  id,
843
848
  placeholder,
@@ -854,7 +859,7 @@ function TextareaWidget({
854
859
  const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
855
860
  const _onBlur = ({ target }) => onBlur(id, target && target.value);
856
861
  const _onFocus = ({ target }) => onFocus(id, target && target.value);
857
- return /* @__PURE__ */ jsx21(InputGroup, { children: /* @__PURE__ */ jsx21(
862
+ return /* @__PURE__ */ jsx22(InputGroup, { children: /* @__PURE__ */ jsx22(
858
863
  FormControl,
859
864
  {
860
865
  id,