From 877604f20b1daf7d66ac8adb0b66cc819d2514a3 Mon Sep 17 00:00:00 2001 From: Suyog241005 Date: Sat, 8 Nov 2025 19:58:43 +0530 Subject: [PATCH 01/21] updated core/Fieldhelp, react-bootstrap/fieldHelpTemplate, antd/HelpField --- CHANGELOG.md | 11 + .../src/templates/FieldTemplate/index.tsx | 4 +- .../antd/src/templates/HelpField/index.tsx | 38 + .../test/__snapshots__/Array.test.tsx.snap | 1268 +++++- .../test/__snapshots__/Form.test.tsx.snap | 3676 ++++++++++++++++- .../test/__snapshots__/Grid.test.tsx.snap | 1570 ++++++- .../test/__snapshots__/Object.test.tsx.snap | 1184 +++++- .../FieldHelpTemplate/FieldHelpTemplate.tsx | 13 +- .../templates/FieldHelpTemplate.tsx | 13 +- .../FieldHelpTemplate/FieldHelpTemplate.tsx | 15 +- .../FieldHelpTemplate/FieldHelpTemplate.tsx | 13 +- .../src/templates/FieldHelpTemplate.tsx | 14 +- .../FieldHelpTemplate/FieldHelpTemplate.tsx | 13 +- .../FieldHelpTemplate/FieldHelpTemplate.tsx | 13 +- .../FieldHelpTemplate/FieldHelpTemplate.tsx | 13 +- .../FieldHelpTemplate/FieldHelpTemplate.tsx | 13 +- .../FieldHelpTemplate/FieldHelpTemplate.tsx | 13 +- packages/utils/src/types.ts | 3 + 18 files changed, 7389 insertions(+), 498 deletions(-) create mode 100644 packages/antd/src/templates/HelpField/index.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 7338dff7eb..1e6d959e4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ should change the heading of the (upcoming) version to include a major version b - Modified `CheckboxesWidget` to render the Title, fixing ([#4840](https://github.com/rjsf-team/react-jsonschema-form/issues/4840)) - Updated `CheckboxWidget` to handle label and description rendering consistently, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742)) +- Updated `FieldHelpTemplate` to render markdown when `ui:enableMarkdownInHelp` is true ## @rjsf/core @@ -38,10 +39,16 @@ should change the heading of the (upcoming) version to include a major version b ## @rjsf/fluentui-rc - Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742)) +- Updated `FieldHelpTemplate` to render markdown when `ui:enableMarkdownInHelp` is true + +## @rjsf/daisyui + +- Updated `FieldHelpTemplate` to render markdown when `ui:enableMarkdownInHelp` is true ## @rjsf/mantine - Updated `CheckboxWidget` to handle label and description rendering consistently, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742)) +- Updated `FieldHelpTemplate` to render markdown when `ui:enableMarkdownInHelp` is true ## @rjsf/mui @@ -51,19 +58,23 @@ should change the heading of the (upcoming) version to include a major version b ## @rjsf/primereact - Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742)) +- Updated `FieldHelpTemplate` to render markdown when `ui:enableMarkdownInHelp` is true ## @rjsf/react-bootstrap - Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742)) +- Updated `FieldHelpTemplate` to render markdown when `ui:enableMarkdownInHelp` is true ## @rjsf/semantic-ui - Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742)) +- Updated `FieldHelpTemplate` to render markdown when `ui:enableMarkdownInHelp` is true ## @rjsf/shadcn - Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742)) - Updated the `Command` component to properly handle `forwardRef` +- Updated `FieldHelpTemplate` to render markdown when `ui:enableMarkdownInHelp` is true ## @rjsf/utils diff --git a/packages/antd/src/templates/FieldTemplate/index.tsx b/packages/antd/src/templates/FieldTemplate/index.tsx index 9b32dcdaa0..d10efb721c 100644 --- a/packages/antd/src/templates/FieldTemplate/index.tsx +++ b/packages/antd/src/templates/FieldTemplate/index.tsx @@ -39,7 +39,7 @@ export default function FieldTemplate< onRemoveProperty, rawErrors, rawDescription, - rawHelp, + // rawHelp, readonly, registry, required, @@ -100,7 +100,7 @@ export default function FieldTemplate< (props: FieldHelpProps) { + const { fieldPathId, help, uiSchema = {}, registry } = props; + if (!help) { + return null; + } + const id = helpId(fieldPathId); + const uiOptions = getUiOptions(uiSchema, registry?.globalUiOptions); + if (typeof help === 'string' && uiOptions.enableMarkdownInHelp) { + return ( +
+ {help} +
+ ); + } + if (typeof help === 'string') { + return ( +

+ {help} +

+ ); + } + return ( +
+ {help} +
+ ); +} diff --git a/packages/antd/test/__snapshots__/Array.test.tsx.snap b/packages/antd/test/__snapshots__/Array.test.tsx.snap index aa6d0464bb..a3ab0f0c2e 100644 --- a/packages/antd/test/__snapshots__/Array.test.tsx.snap +++ b/packages/antd/test/__snapshots__/Array.test.tsx.snap @@ -9,7 +9,7 @@ exports[`array fields array 1`] = ` class="rjsf-field rjsf-field-array" >
+
+
+
+
+
+
+ + +`; + +exports[`single fields string field field with markdown help text 1`] = ` + +
+
+
+
+
+ +
+
+
+
+ + + + +
+
+
+
+
+
+ + This is + + markdown + + help text with + + a link + + +
+
+
+
+ + A field with markdown help text + +
+
+
+
+
+
+
+ + + +`; + +exports[`single fields string field field with markdown help text without enabling markdown 1`] = ` + +
+
+
+
+
+ +
+
+
+
+ + + + +
+
+
+
+
+

+ This is **markdown** help text with [a link](https://example.com) +

+
+
+
+ + A field with raw help text + +
+
+
+
+
+
+
+ + + +`; + exports[`single fields string field format data-url 1`] = `
`; +exports[`single fields string field required field with markdown help 1`] = ` + + +
+
+
+
+ +
+
+
+
+ + + + +
+
+
+
+
+
+ + This field is + + required + + . Please provide a value. + +
+
+
+
+ + A required field with markdown help + +
+
+
+
+
+
+
+ + + +`; + exports[`single fields string field with placeholder 1`] = `
@@ -673,7 +673,7 @@ exports[`nameGenerator bracketNameGenerator array of objects 1`] = ` class="rjsf-field rjsf-field-boolean" >