@rjsf/chakra-ui 6.0.2 → 6.1.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.
@@ -355,14 +355,14 @@ function FieldErrorTemplate(props) {
355
355
  // src/FieldHelpTemplate/FieldHelpTemplate.tsx
356
356
  import { Text as Text2 } from "@chakra-ui/react";
357
357
  import { helpId } from "@rjsf/utils";
358
+ import { RichHelp } from "@rjsf/core";
358
359
  import { jsx as jsx13 } from "react/jsx-runtime";
359
360
  function FieldHelpTemplate(props) {
360
- const { fieldPathId, help } = props;
361
+ const { fieldPathId, help, uiSchema, registry } = props;
361
362
  if (!help) {
362
363
  return null;
363
364
  }
364
- const id = helpId(fieldPathId);
365
- return /* @__PURE__ */ jsx13(Text2, { id, children: help });
365
+ return /* @__PURE__ */ jsx13(Text2, { as: "sup", fontSize: "md", id: helpId(fieldPathId), children: /* @__PURE__ */ jsx13(RichHelp, { help, registry, uiSchema }) });
366
366
  }
367
367
 
368
368
  // src/FieldTemplate/FieldTemplate.tsx
@@ -413,6 +413,8 @@ function FieldTemplate(props) {
413
413
  disabled,
414
414
  id,
415
415
  label,
416
+ displayLabel,
417
+ rawDescription,
416
418
  onKeyRename,
417
419
  onKeyRenameBlur,
418
420
  onRemoveProperty,
@@ -618,10 +620,12 @@ function WrapIfAdditionalTemplate(props) {
618
620
  classNames,
619
621
  style,
620
622
  disabled,
623
+ displayLabel,
621
624
  id,
622
625
  label,
623
626
  onRemoveProperty,
624
627
  onKeyRenameBlur,
628
+ rawDescription,
625
629
  readonly,
626
630
  registry,
627
631
  required,
@@ -630,37 +634,50 @@ function WrapIfAdditionalTemplate(props) {
630
634
  } = props;
631
635
  const { templates, translateString } = registry;
632
636
  const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
633
- const keyLabel = translateString(TranslatableString4.KeyLabel, [label]);
637
+ const keyLabel = displayLabel ? translateString(TranslatableString4.KeyLabel, [label]) : void 0;
634
638
  const additional = ADDITIONAL_PROPERTY_FLAG in schema;
639
+ const hasDescription = !!rawDescription;
640
+ const margin = hasDescription ? 58 : 22;
635
641
  if (!additional) {
636
642
  return /* @__PURE__ */ jsx21("div", { className: classNames, style, children });
637
643
  }
638
- return /* @__PURE__ */ jsxs11(Grid4, { className: classNames, style, alignItems: "center", gap: 2, children: [
639
- /* @__PURE__ */ jsx21(GridItem4, { children: /* @__PURE__ */ jsx21(Field, { required, label: keyLabel, children: /* @__PURE__ */ jsx21(
640
- Input2,
641
- {
642
- defaultValue: label,
643
- disabled: disabled || readonly,
644
- id: `${id}-key`,
645
- name: `${id}-key`,
646
- onBlur: !readonly ? onKeyRenameBlur : void 0,
647
- type: "text",
648
- mb: 1
649
- }
650
- ) }) }),
651
- /* @__PURE__ */ jsx21(GridItem4, { children }),
652
- /* @__PURE__ */ jsx21(GridItem4, { children: /* @__PURE__ */ jsx21(
653
- RemoveButton2,
654
- {
655
- id: buttonId3(id, "remove"),
656
- className: "rjsf-object-property-remove",
657
- disabled: disabled || readonly,
658
- onClick: onRemoveProperty,
659
- uiSchema,
660
- registry
661
- }
662
- ) })
663
- ] }, `${id}-key`);
644
+ return /* @__PURE__ */ jsxs11(
645
+ Grid4,
646
+ {
647
+ templateColumns: "repeat(11, 1fr)",
648
+ className: classNames,
649
+ style,
650
+ alignItems: "center",
651
+ gap: 2,
652
+ children: [
653
+ /* @__PURE__ */ jsx21(GridItem4, { colSpan: 5, style: { marginTop: hasDescription ? "36px" : void 0 }, children: /* @__PURE__ */ jsx21(Field, { required, label: keyLabel, children: /* @__PURE__ */ jsx21(
654
+ Input2,
655
+ {
656
+ defaultValue: label,
657
+ disabled: disabled || readonly,
658
+ id: `${id}-key`,
659
+ name: `${id}-key`,
660
+ onBlur: !readonly ? onKeyRenameBlur : void 0,
661
+ type: "text",
662
+ mb: 1
663
+ }
664
+ ) }) }),
665
+ /* @__PURE__ */ jsx21(GridItem4, { colSpan: 5, children }),
666
+ /* @__PURE__ */ jsx21(GridItem4, { justifySelf: "flex-end", style: { marginTop: displayLabel ? `${margin}px` : void 0 }, children: /* @__PURE__ */ jsx21(
667
+ RemoveButton2,
668
+ {
669
+ id: buttonId3(id, "remove"),
670
+ className: "rjsf-object-property-remove",
671
+ disabled: disabled || readonly,
672
+ onClick: onRemoveProperty,
673
+ uiSchema,
674
+ registry
675
+ }
676
+ ) })
677
+ ]
678
+ },
679
+ `${id}-key`
680
+ );
664
681
  }
665
682
 
666
683
  // src/Templates/Templates.ts