From 10c6efddd4171486cecb73cbebe48c3762db49f3 Mon Sep 17 00:00:00 2001 From: Heath Chiavettone Date: Fri, 25 Apr 2025 13:28:11 -0700 Subject: [PATCH 1/4] Fix 2280 by moving the bootstrap 3 marker classes out of SchemaField Fixed #2280 by moving marker classes from `SchemaField` to `WrapIfAdditionalTemplate` - In `@rjsf/utils`, updated `WrapIfAdditionalTemplateProps` to pick up the `hideError` and `rawErrors` props from `FieldTemplateProps` - In `@rjsf/core`, updated `SchemaField` to move the `form-group` and `field` marker classes to the `WrapIfAdditionalTemplate` - Also moved the `field-error`, `has-error` and `has-danger` error marker classes - Updated the grid snapshot due to the change - Updated the snapshots in other themes due to the removed marker classes - Updated the `CHANGELOG_v6.md` and `v6x upgrade guide.md` to reflect these changes --- CHANGELOG_v6.md | 12 ++ .../test/__snapshots__/Array.test.tsx.snap | 92 ++++----- .../test/__snapshots__/Form.test.tsx.snap | 90 ++++----- .../test/__snapshots__/GridSnap.test.tsx.snap | 176 +++++++++--------- .../test/__snapshots__/Object.test.tsx.snap | 66 +++---- .../test/__snapshots__/Array.test.tsx.snap | 92 ++++----- .../test/__snapshots__/Form.test.tsx.snap | 86 ++++----- .../test/__snapshots__/GridSnap.test.tsx.snap | 176 +++++++++--------- .../test/__snapshots__/Object.test.tsx.snap | 66 +++---- .../src/components/fields/SchemaField.tsx | 5 +- .../templates/WrapIfAdditionalTemplate.tsx | 12 +- .../test/__snapshots__/GridSnap.test.tsx.snap | 16 +- .../test/__snapshots__/Array.test.tsx.snap | 92 ++++----- .../test/__snapshots__/Form.test.tsx.snap | 88 ++++----- .../test/__snapshots__/Object.test.tsx.snap | 66 +++---- .../migration-guides/v6.x upgrade guide.md | 10 + .../test/__snapshots__/Array.test.tsx.snap | 92 ++++----- .../test/__snapshots__/Form.test.tsx.snap | 86 ++++----- .../test/__snapshots__/GridSnap.test.tsx.snap | 176 +++++++++--------- .../test/__snapshots__/Object.test.tsx.snap | 66 +++---- .../test/__snapshots__/Array.test.tsx.snap | 92 ++++----- .../mui/test/__snapshots__/Form.test.tsx.snap | 86 ++++----- .../test/__snapshots__/GridSnap.test.tsx.snap | 176 +++++++++--------- .../test/__snapshots__/Object.test.tsx.snap | 66 +++---- .../test/__snapshots__/Array.test.tsx.snap | 92 ++++----- .../test/__snapshots__/Form.test.tsx.snap | 86 ++++----- .../test/__snapshots__/GridSnap.test.tsx.snap | 176 +++++++++--------- .../test/__snapshots__/Object.test.tsx.snap | 66 +++---- .../test/__snapshots__/Array.test.tsx.snap | 92 ++++----- .../test/__snapshots__/Form.test.tsx.snap | 90 ++++----- .../test/__snapshots__/GridSnap.test.tsx.snap | 176 +++++++++--------- .../test/__snapshots__/Object.test.tsx.snap | 66 +++---- .../test/__snapshots__/Array.test.tsx.snap | 92 ++++----- .../test/__snapshots__/Form.test.tsx.snap | 86 ++++----- .../test/__snapshots__/GridSnap.test.tsx.snap | 176 +++++++++--------- .../test/__snapshots__/Object.test.tsx.snap | 66 +++---- packages/utils/src/types.ts | 2 + 37 files changed, 1644 insertions(+), 1607 deletions(-) diff --git a/CHANGELOG_v6.md b/CHANGELOG_v6.md index 5fbe89705c..381bd199aa 100644 --- a/CHANGELOG_v6.md +++ b/CHANGELOG_v6.md @@ -25,6 +25,7 @@ should change the heading of the (upcoming) version to include a major version b - BREAKING CHANGE: Removed support for version 4 of `antd` - Updated `ArrayFieldItemTemplate` to replace `Button.Group` with `Space.Compact` since `Button.Group` is deprecated in `antd` version 5 - Upgraded to `@ant-design/icon@5` +- BREAKING CHANGE: Removed the addition of `Bootstrap 3` marker classes from the `SchemaField`, thereby changing theme `FieldTemplate` className prop output and associated snapshots ## @rjsf/chakra-ui @@ -33,6 +34,7 @@ should change the heading of the (upcoming) version to include a major version b - BREAKING CHANGE: Refactored `ArrayFieldItemTemplate` to use the new `ArrayFieldItemButtonsTemplate` - Updated the `ArrayFieldTemplate`, `ObjectFieldTemplate`, and `WrapIfAdditionalTemplate` to a unique id using the `buttonId()` function and adding consistent marker classes - Implemented the `GridTemplate` component, adding it to the `templates` for the theme +- BREAKING CHANGE: Removed the addition of `Bootstrap 3` marker classes from the `SchemaField`, thereby changing theme `FieldTemplate` className prop output and associated snapshots ## @rjsf/core @@ -43,6 +45,7 @@ should change the heading of the (upcoming) version to include a major version b - Implemented the `GridTemplate` component, adding it to the `templates` for the theme - Implemented the new `LayoutGridField`, `LayoutMultiSchemaField` and `LayoutHeaderField` fields, adding them to the `fields` list - BREAKING CHANGE: Removed support for the deprecated `schema.enumNames` and `uiSchema.classNames` as well as the deprecated `acceptcharset` prop on `Form` +- BREAKING CHANGE: Moved the addition of `Bootstrap 3` marker classes from the `SchemaField` to the `WrapIfAdditionalTemplate`, thereby affecting all of the other themes, fixing [#2280](https://github.com/rjsf-team/react-jsonschema-form/issues/2280) ## @rjsf/daisyui @@ -57,6 +60,11 @@ should change the heading of the (upcoming) version to include a major version b - BREAKING CHANGE: Refactored `ArrayFieldItemTemplate` to use the new `ArrayFieldItemButtonsTemplate` - Updated the `ArrayFieldTemplate`, `ObjectFieldTemplate`, and `WrapIfAdditionalTemplate` to a unique id using the `buttonId()` function and adding consistent marker classes - Implemented the `GridTemplate` component, adding it to the `templates` for the theme +- BREAKING CHANGE: Removed the addition of `Bootstrap 3` marker classes from the `SchemaField`, thereby changing theme `FieldTemplate` className prop output and associated snapshots + +## @rjsf/material-ui + +- BREAKING CHANGE: Deleted this theme in favor of `mui` ## @rjsf/mui @@ -64,12 +72,15 @@ should change the heading of the (upcoming) version to include a major version b - Updated the `ArrayFieldTemplate`, `ObjectFieldTemplate`, and `WrapIfAdditionalTemplate` to a unique id using the `buttonId()` function and adding consistent marker classes - Updated the theme to use `Grid2` instead of the deprecated `Grid` - Implemented the `GridTemplate` component, adding it to the `templates` for the theme +- BREAKING CHANGE: Removed the addition of `Bootstrap 3` marker classes from the `SchemaField`, thereby changing theme `FieldTemplate` className prop output and associated snapshots ## @rjsf/semantic-ui - BREAKING CHANGE: Refactored `ArrayFieldItemTemplate` to use the new `ArrayFieldItemButtonsTemplate` - Updated the `ArrayFieldTemplate`, `ObjectFieldTemplate`, and `WrapIfAdditionalTemplate` to a unique id using the `buttonId()` function and adding consistent marker classes - Implemented the `GridTemplate` component, adding it to the `templates` for the theme +- BREAKING CHANGE: Removed the addition of `Bootstrap 3` marker classes from the `SchemaField`, thereby changing theme `FieldTemplate` className prop output and associated snapshots +- BREAKING CHANGE: Removed the addition of `Bootstrap 3` marker classes from the `SchemaField`, thereby changing theme `FieldTemplate` className prop output and associated snapshots ## @rjsf/shadcn @@ -98,6 +109,7 @@ should change the heading of the (upcoming) version to include a major version b - BREAKING CHANGE: Removed the deprecated `getMatchingOption()` and `mergeValidationData()` from the library export and the `SchemaUtilsType` interface - BREAKING CHANGE: Removed the deprecated `toErrorList()` function from the `ValidatorType` interface - BREAKING CHANGE: Removed the deprecated `RJSF_ADDITONAL_PROPERTIES_FLAG` constant +- Updated the `WrapIfAdditionalTemplateProps` to include `hideError` and `rawErrors` in support of moving `Bootstrap 3` marker classes out of `SchemaField` ## @rjsf/validator-ajv6 diff --git a/packages/antd/test/__snapshots__/Array.test.tsx.snap b/packages/antd/test/__snapshots__/Array.test.tsx.snap index db553e6e20..f3e16d5b80 100644 --- a/packages/antd/test/__snapshots__/Array.test.tsx.snap +++ b/packages/antd/test/__snapshots__/Array.test.tsx.snap @@ -7,7 +7,7 @@ exports[`array fields array 1`] = ` onSubmit={[Function]} >