@rjsf/core 6.0.0-beta.1 → 6.0.0-beta.2

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/dist/core.umd.js CHANGED
@@ -2154,7 +2154,6 @@
2154
2154
  label = utils.ADDITIONAL_PROPERTY_FLAG in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
2155
2155
  }
2156
2156
  const description = uiOptions.description || props.schema.description || schema.description || "";
2157
- const richDescription = uiOptions.enableMarkdownInDescription ? /* @__PURE__ */ jsxRuntime.jsx(Markdown, { options: { disableParsingRawHTML: true }, children: description }) : description;
2158
2157
  const help = uiOptions.help;
2159
2158
  const hidden = uiOptions.widget === "hidden";
2160
2159
  const classNames = ["rjsf-field", `rjsf-field-${utils.getSchemaType(schema)}`];
@@ -2191,7 +2190,7 @@
2191
2190
  DescriptionFieldTemplate,
2192
2191
  {
2193
2192
  id: utils.descriptionId(id),
2194
- description: richDescription,
2193
+ description,
2195
2194
  schema,
2196
2195
  uiSchema,
2197
2196
  registry
@@ -2731,16 +2730,22 @@
2731
2730
  };
2732
2731
  }
2733
2732
  var ButtonTemplates_default = buttonTemplates;
2733
+ var TEST_IDS = utils.getTestIds();
2734
+ function RichDescription({ description, registry, uiSchema = {} }) {
2735
+ const { globalUiOptions } = registry;
2736
+ const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
2737
+ if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
2738
+ return /* @__PURE__ */ jsxRuntime.jsx(Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
2739
+ }
2740
+ return description;
2741
+ }
2742
+ RichDescription.TEST_IDS = TEST_IDS;
2734
2743
  function DescriptionField(props) {
2735
- const { id, description } = props;
2744
+ const { id, description, registry, uiSchema } = props;
2736
2745
  if (!description) {
2737
2746
  return null;
2738
2747
  }
2739
- if (typeof description === "string") {
2740
- return /* @__PURE__ */ jsxRuntime.jsx("p", { id, className: "field-description", children: description });
2741
- } else {
2742
- return /* @__PURE__ */ jsxRuntime.jsx("div", { id, className: "field-description", children: description });
2743
- }
2748
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { id, className: "field-description", children: /* @__PURE__ */ jsxRuntime.jsx(RichDescription, { description, registry, uiSchema }) });
2744
2749
  }
2745
2750
  function ErrorList({
2746
2751
  errors,
@@ -3149,7 +3154,7 @@
3149
3154
  );
3150
3155
  const description = options.description ?? schema.description;
3151
3156
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
3152
- !hideLabel && !!description && /* @__PURE__ */ jsxRuntime.jsx(
3157
+ !hideLabel && description && /* @__PURE__ */ jsxRuntime.jsx(
3153
3158
  DescriptionFieldTemplate,
3154
3159
  {
3155
3160
  id: utils.descriptionId(id),
@@ -4512,6 +4517,7 @@
4512
4517
  // src/index.ts
4513
4518
  var index_default = Form;
4514
4519
 
4520
+ exports.RichDescription = RichDescription;
4515
4521
  exports.default = index_default;
4516
4522
  exports.getDefaultRegistry = getDefaultRegistry;
4517
4523
  exports.withTheme = withTheme;