Skip to content

Commit f368515

Browse files
committed
adds refactored props tested linted still WIP
1 parent 0acfa0f commit f368515

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1346
-1910
lines changed

CHANGELOG_v6.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ should change the heading of the (upcoming) version to include a major version b
2525
- BREAKING CHANGE: Removed support for version 4 of `antd`
2626
- Updated `ArrayFieldItemTemplate` to replace `Button.Group` with `Space.Compact` since `Button.Group` is deprecated in `antd` version 5
2727
- Upgraded to `@ant-design/icon@5`
28+
- fix: Ensure peer dependencies align with v6 beta versions.
2829

2930
## @rjsf/chakra-ui
3031

@@ -33,6 +34,7 @@ should change the heading of the (upcoming) version to include a major version b
3334
- BREAKING CHANGE: Refactored `ArrayFieldItemTemplate` to use the new `ArrayFieldItemButtonsTemplate`
3435
- Updated the `ArrayFieldTemplate`, `ObjectFieldTemplate`, and `WrapIfAdditionalTemplate` to a unique id using the `buttonId()` function and adding consistent marker classes
3536
- Implemented the `GridTemplate` component, adding it to the `templates` for the theme
37+
- fix: Ensure peer dependencies align with v6 beta versions.
3638

3739
## @rjsf/core
3840

@@ -47,6 +49,8 @@ should change the heading of the (upcoming) version to include a major version b
4749
## @rjsf/daisyui
4850

4951
- Added new theme!
52+
- fix: Ensure peer dependencies align with v6 beta versions.
53+
- fix: Remove unused FontAwesome dependency causing build issues.
5054

5155
## @rjsf/fluent-ui
5256

@@ -57,33 +61,54 @@ should change the heading of the (upcoming) version to include a major version b
5761
- BREAKING CHANGE: Refactored `ArrayFieldItemTemplate` to use the new `ArrayFieldItemButtonsTemplate`
5862
- Updated the `ArrayFieldTemplate`, `ObjectFieldTemplate`, and `WrapIfAdditionalTemplate` to a unique id using the `buttonId()` function and adding consistent marker classes
5963
- Implemented the `GridTemplate` component, adding it to the `templates` for the theme
64+
- fix: Ensure peer dependencies align with v6 beta versions.
6065

6166
## @rjsf/mui
6267

6368
- BREAKING CHANGE: Refactored `ArrayFieldItemTemplate` to use the new `ArrayFieldItemButtonsTemplate`
6469
- Updated the `ArrayFieldTemplate`, `ObjectFieldTemplate`, and `WrapIfAdditionalTemplate` to a unique id using the `buttonId()` function and adding consistent marker classes
6570
- Updated the theme to use `Grid2` instead of the deprecated `Grid`
6671
- Implemented the `GridTemplate` component, adding it to the `templates` for the theme
72+
- fix: Ensure peer dependencies align with v6 beta versions.
73+
74+
## @rjsf/react-bootstrap
75+
76+
- Added new package to replace `@rjsf/bootstrap-4`
77+
- `react-bootstrap` peer dependency bumped to `^2.0.0`, corresponding to Bootstrap 5
78+
- CheckboxesWidget: Remove deprecated prop `custom`
79+
- IconButton: Remove deprecated `block` prop
80+
- RangeWidget: Use `FormRange` component
81+
- SelectWidget: Use new FormSelect component, remove `bsPrefix` prop to achieve correct styling
82+
- fix: Ensure peer dependencies align with v6 beta versions.
6783

6884
## @rjsf/semantic-ui
6985

7086
- BREAKING CHANGE: Refactored `ArrayFieldItemTemplate` to use the new `ArrayFieldItemButtonsTemplate`
7187
- Updated the `ArrayFieldTemplate`, `ObjectFieldTemplate`, and `WrapIfAdditionalTemplate` to a unique id using the `buttonId()` function and adding consistent marker classes
7288
- Implemented the `GridTemplate` component, adding it to the `templates` for the theme
89+
- fix: Ensure peer dependencies align with v6 beta versions.
7390

7491
## @rjsf/shadcn
7592

7693
- Added new theme!
94+
- fix: Ensure peer dependencies align with v6 beta versions.
7795

7896
## @rjsf/uswds
7997

8098
- BREAKING: Initial release of the USWDS theme package (`@rjsf/uswds`).
8199
- BREAKING: Uses components from `@trussworks/react-uswds` library for core form elements, templates, and buttons.
82100
- feat: Implemented `GridTemplate` using `@trussworks/react-uswds` Grid components.
83-
- fix: Extensible for custom props `@rjsf/uswds` *if needed but defaults to `@trussworks/react-uswds` components (`FormGroup`, `Label`, `TextInput`, `Grid`).
101+
- fix: Refactored `WrapIfAdditionalTemplate` to use `@trussworks/react-uswds` components (`FormGroup`, `Label`, `TextInput`, `Grid`).
84102
- fix: Refactored all Widgets to use components from `@trussworks/react-uswds`.
85-
- fix: Refactored all Templates (Field, ErrorList, Buttons, etc.) to use components from `@trussworks/react-uswds`.
86-
- test: Uses standard `@rjsf/snapshot-tests` tests for `@rjsf/uswds`.
103+
- fix: Refactored all Templates (Field, ErrorList, Buttons, ArrayField*, ObjectField*, TitleField*, etc.) to use components from `@trussworks/react-uswds`.
104+
- fix: Removed unused `BaseInputTemplate` and `Templates.tsx`.
105+
- fix: Updated `GridTemplate` to accept `className` and `style` props for consistency.
106+
- fix: Ensure `Widgets/index.ts` correctly exports `generateWidgets`.
107+
- fix: Remove unused FontAwesome dependency causing build issues.
108+
- fix: Remove deprecated `defaultProps` from `TextareaWidget`.
109+
- fix: Ensure peer dependencies align with v6 beta versions.
110+
- test: Uses standard snapshot tests for `@rjsf/uswds`.
111+
- test: Added `@testing-library/react` for testing components.
87112

88113
## @rjsf/utils
89114

@@ -126,6 +151,9 @@ should change the heading of the (upcoming) version to include a major version b
126151
- Added the `v6.x upgrade guide.md` documentation
127152
- Updated the `playground` to add a `Layout Grid` example and made the selected example now be part of the shared export
128153
- Replaced Lerna with Nx, updated all lerna commands to use the Nx CLI
154+
- fix(playground): Update dependencies to use `workspace:` protocol for local linking.
155+
- fix(playground): Update `index.tsx` to use React 18 `createRoot` API.
156+
- fix(docs): Update theme table for v6 changes (add USWDS, remove deprecated).
129157
- BREAKING CHANGE: Updated all `peerDependencies` to change minimal `React` support to `>=18`
130158

131159
# 6.0.0-alpha.0

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"eslint-plugin-prettier": "5.2.6",
5656
"eslint-plugin-react": "7.37.5",
5757
"eslint-plugin-react-hooks": "5.2.0",
58-
"husky": "9.1.7",
58+
"husky": "^9.1.7",
5959
"jest-environment-jsdom": "^29.7.0",
6060
"lint-staged": "15.5.1",
6161
"move-file-cli": "^3.0.0",

packages/uswds/.eslintrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": [
3+
"../../.eslintrc"
4+
],
5+
"rules": {
6+
"prettier/prettier": ["error", {
7+
"singleQuote": true,
8+
"trailingComma": "all",
9+
"arrowParens": "always"
10+
}]
11+
}
12+
}

packages/uswds/.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"arrowParens": "always",
5+
"printWidth": 100
6+
}

packages/uswds/babel.config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../../babel.config.json"
3+
}

packages/uswds/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

packages/uswds/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
"cs-check": "prettier -l \"{src,test}/**/*.ts?(x)\"",
1111
"cs-format": "prettier \"{src,test}/**/*.ts?(x)\" --write",
1212
"lint": "eslint src test",
13+
"lint:fix": "eslint src test --fix",
14+
"prettier:fix": "prettier \"{src,test}/**/*.ts?(x)\" --write",
1315
"test": "jest",
14-
"test:update": "jest --u"
16+
"test:update": "jest --u",
17+
"test:clean": "jest --clearCache"
1518
},
1619
"dependencies": {},
1720
"devDependencies": {
@@ -26,6 +29,7 @@
2629
"@testing-library/jest-dom": "^6.4.2",
2730
"@testing-library/react": "^14.2.1",
2831
"@testing-library/user-event": "^14.5.2",
32+
"@trussworks/react-uswds": "^6.1.0",
2933
"@types/jest": "^29.5.3",
3034
"@types/react": "^18.2.14",
3135
"@types/react-dom": "^18.2.6",
@@ -36,8 +40,7 @@
3640
"react": "^18.2.0",
3741
"react-dom": "^18.2.0",
3842
"react-test-renderer": "^18.2.0",
39-
"typescript": "^5.1.6",
40-
"@trussworks/react-uswds": "^6.1.0"
43+
"typescript": "^5.1.6"
4144
},
4245
"peerDependencies": {
4346
"@rjsf/core": "^6",

packages/uswds/schemaTests.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from 'react';
2+
import renderer from 'react-test-renderer';
3+
import { RJSFSchema, UiSchema, ValidatorType } from '@rjsf/utils';
4+
5+
export interface SchemaTestOptions {
6+
name?: string;
7+
schema: RJSFSchema;
8+
uiSchema?: UiSchema;
9+
formData?: any;
10+
validator?: ValidatorType;
11+
}
12+
13+
export function createSchemaTest(
14+
Form: React.ComponentType<any>,
15+
opts: SchemaTestOptions
16+
) {
17+
const testName = opts.name || JSON.stringify(opts.schema);
18+
test(testName, () => {
19+
const tree = renderer
20+
.create(
21+
<Form
22+
schema={opts.schema}
23+
uiSchema={opts.uiSchema}
24+
formData={opts.formData}
25+
validator={opts.validator}
26+
/>
27+
)
28+
.toJSON();
29+
expect(tree).toMatchSnapshot();
30+
});
31+
}

packages/uswds/src/Form/Form.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import { ComponentType } from 'react';
2-
import { FormProps, withTheme, ThemeProps } from '@rjsf/core';
1+
import { withTheme, ThemeProps } from '@rjsf/core';
32
import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
43

54
import Theme from '../Theme';
65

76
export function generateForm<
87
T = any,
98
S extends StrictRJSFSchema = RJSFSchema,
10-
F extends FormContextType = any
11-
>(): ComponentType<FormProps<T, S, F>> {
9+
F extends FormContextType = any,
10+
>() {
1211
return withTheme<T, S, F>(Theme as ThemeProps<T, S, F>);
1312
}
1413

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
1-
import React from "react";
1+
import React from 'react';
22
import {
3-
DescriptionFieldProps,
43
FormContextType,
54
RJSFSchema,
65
StrictRJSFSchema,
7-
} from "@rjsf/utils";
6+
ArrayFieldDescriptionProps,
7+
} from '@rjsf/utils';
88

9-
/** The `ArrayFieldDescriptionTemplate` component renders a description for an array field.
9+
/** The `ArrayFieldDescriptionTemplate` component renders the description for an array field
1010
*
11-
* @param props - The `DescriptionFieldProps` for the component
11+
* @param props - The `ArrayFieldDescriptionProps` for this component
1212
*/
13-
const ArrayFieldDescriptionTemplate = <
13+
export default function ArrayFieldDescriptionTemplate<
1414
T = any,
1515
S extends StrictRJSFSchema = RJSFSchema,
1616
F extends FormContextType = any,
17-
>({
18-
description,
19-
idSchema,
20-
}: DescriptionFieldProps<T, S, F>) => {
17+
>({ description, id }: ArrayFieldDescriptionProps<T, S, F>) {
2118
if (!description) {
2219
return null;
2320
}
2421

25-
const id = `${idSchema.$id}__description`;
2622
return (
27-
<span id={id} className="usa-hint">
23+
<div id={id} className="field-description">
2824
{description}
29-
</span>
25+
</div>
3026
);
31-
};
32-
33-
export default ArrayFieldDescriptionTemplate;
27+
}

0 commit comments

Comments
 (0)