Skip to content

Commit 4d0315c

Browse files
committed
Upgrade @fluentui/react to 8.x version
1 parent 8d5818c commit 4d0315c

File tree

10 files changed

+1280
-954
lines changed

10 files changed

+1280
-954
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ should change the heading of the (upcoming) version to include a major version b
2222

2323
- Converted the `playground` to use Typescript, including some refactoring of code to make that job easier
2424

25+
## @rjsf/fluent-ui
26+
27+
- Upgraded to `8.x` version of `@fluentui/react`
28+
2529
# 5.4.0
2630

2731
## @rjsf/antd

packages/fluent-ui/package-lock.json

Lines changed: 558 additions & 348 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/fluent-ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"node": ">=14"
2929
},
3030
"peerDependencies": {
31-
"@fluentui/react": "^7.190.3",
31+
"@fluentui/react": "^8.106.9",
3232
"@rjsf/core": "^5.0.0",
3333
"@rjsf/utils": "^5.0.0",
3434
"react": "^16.14.0 || >=17"
@@ -39,7 +39,7 @@
3939
"@babel/plugin-transform-modules-commonjs": "^7.21.2",
4040
"@babel/preset-env": "^7.20.2",
4141
"@babel/preset-react": "^7.18.6",
42-
"@fluentui/react": "^7.190.3",
42+
"@fluentui/react": "^8.106.9",
4343
"@rjsf/core": "^5.4.0",
4444
"@rjsf/utils": "^5.4.0",
4545
"@rjsf/validator-ajv8": "^5.4.0",

packages/fluent-ui/src/CheckboxWidget/CheckboxWidget.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { FocusEvent, useCallback } from 'react';
2-
import { Checkbox } from '@fluentui/react';
1+
import { useCallback } from 'react';
2+
import { Checkbox, ICheckboxProps } from '@fluentui/react';
33
import {
44
ariaDescribedByIds,
55
descriptionId,
@@ -13,7 +13,7 @@ import {
1313
import _pick from 'lodash/pick';
1414

1515
// Keys of ICheckboxProps from @fluentui/react
16-
export const allowedProps = [
16+
export const allowedProps: (keyof ICheckboxProps)[] = [
1717
'ariaDescribedBy',
1818
'ariaLabel',
1919
'ariaPositionInSet',
@@ -28,7 +28,6 @@ export const allowedProps = [
2828
'disabled',
2929
'indeterminate',
3030
'inputProps',
31-
'keytipProps',
3231
'label',
3332
'onChange',
3433
'onRenderLabel',
@@ -50,10 +49,7 @@ export default function CheckboxWidget<
5049
label,
5150
hideLabel,
5251
schema,
53-
autofocus,
5452
onChange,
55-
onBlur,
56-
onFocus,
5753
options,
5854
registry,
5955
uiSchema,
@@ -71,9 +67,6 @@ export default function CheckboxWidget<
7167
[onChange]
7268
);
7369

74-
const _onBlur = ({ target: { value } }: FocusEvent<HTMLButtonElement>) => onBlur(id, value);
75-
const _onFocus = ({ target: { value } }: FocusEvent<HTMLButtonElement>) => onFocus(id, value);
76-
7770
const uiProps = _pick((options.props as object) || {}, allowedProps);
7871
const description = options.description ?? schema.description;
7972

@@ -93,9 +86,6 @@ export default function CheckboxWidget<
9386
name={id}
9487
label={labelValue(label || undefined, hideLabel)}
9588
disabled={disabled || readonly}
96-
autoFocus={autofocus}
97-
onBlur={_onBlur}
98-
onFocus={_onFocus}
9989
checked={typeof value === 'undefined' ? false : value}
10090
onChange={_onChange}
10191
{...uiProps}

packages/fluent-ui/src/CheckboxesWidget/CheckboxesWidget.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { FormEvent, FocusEvent } from 'react';
1+
import { FormEvent } from 'react';
22
import { Checkbox } from '@fluentui/react';
33
import {
44
ariaDescribedByIds,
55
enumOptionsDeselectValue,
66
enumOptionsIsSelected,
77
enumOptionsSelectValue,
8-
enumOptionsValueForIndex,
98
labelValue,
109
optionId,
1110
FormContextType,
@@ -29,15 +28,12 @@ export default function CheckboxesWidget<
2928
disabled,
3029
options,
3130
value,
32-
autofocus,
3331
readonly,
3432
required,
3533
onChange,
36-
onBlur,
37-
onFocus,
3834
rawErrors = [],
3935
}: WidgetProps<T, S, F>) {
40-
const { enumOptions, enumDisabled, emptyValue } = options;
36+
const { enumOptions, enumDisabled } = options;
4137
const checkboxesValues = Array.isArray(value) ? value : [value];
4238

4339
const _onChange = (index: number) => (_ev?: FormEvent<HTMLElement>, checked?: boolean) => {
@@ -48,12 +44,6 @@ export default function CheckboxesWidget<
4844
}
4945
};
5046

51-
const _onBlur = ({ target: { value } }: FocusEvent<HTMLButtonElement>) =>
52-
onBlur(id, enumOptionsValueForIndex<S>(value, enumOptions, emptyValue));
53-
54-
const _onFocus = ({ target: { value } }: FocusEvent<HTMLButtonElement>) =>
55-
onFocus(id, enumOptionsValueForIndex<S>(value, enumOptions, emptyValue));
56-
5747
const uiProps = _pick((options.props as object) || {}, allowedProps);
5848

5949
return (
@@ -70,10 +60,7 @@ export default function CheckboxesWidget<
7060
checked={checked}
7161
label={option.label}
7262
disabled={disabled || itemDisabled || readonly}
73-
autoFocus={autofocus && index === 0}
7463
onChange={_onChange(index)}
75-
onBlur={_onBlur}
76-
onFocus={_onFocus}
7764
key={index}
7865
{...uiProps}
7966
aria-describedby={ariaDescribedByIds<T>(id)}

packages/fluent-ui/src/RadioWidget/RadioWidget.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const allowedProps: (keyof IChoiceGroupProps)[] = [
2020
'selectedKey',
2121
'onChange',
2222
'label',
23-
'onChanged',
2423
'theme',
2524
'styles',
2625
'ariaLabelledBy',

packages/fluent-ui/src/UpDownWidget/UpDownWidget.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ChangeEvent, FocusEvent } from 'react';
2-
import { SpinButton } from '@fluentui/react';
1+
import { FocusEvent, SyntheticEvent } from 'react';
2+
import { ISpinButtonProps, SpinButton } from '@fluentui/react';
33
import {
44
ariaDescribedByIds,
55
FormContextType,
@@ -15,7 +15,7 @@ import _pick from 'lodash/pick';
1515
import FluentLabel from '../FluentLabel/FluentLabel';
1616

1717
// Keys of ISpinButtonProps from @fluentui/react
18-
const allowedProps = [
18+
const allowedProps: (keyof ISpinButtonProps)[] = [
1919
'ariaDescribedBy',
2020
'ariaLabel',
2121
'ariaPositionInSet',
@@ -29,7 +29,6 @@ const allowedProps = [
2929
'defaultValue',
3030
'disabled',
3131
'downArrowButtonStyles',
32-
'getClassNames',
3332
'iconButtonProps',
3433
'iconProps',
3534
'incrementButtonAriaLabel',
@@ -74,7 +73,7 @@ export default function UpDownWidget<
7473
registry,
7574
}: WidgetProps<T, S, F>) {
7675
const { translateString } = registry;
77-
const _onChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) => onChange(Number(value));
76+
const _onChange = (_: SyntheticEvent<HTMLElement>, newValue?: string) => onChange(Number(newValue));
7877

7978
let { min, max, step } = rangeSpec<S>(schema);
8079
if (min === undefined) {

0 commit comments

Comments
 (0)