Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Refactor Field components into the base component's package #25593

Merged
merged 28 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
76fff3d
chore: Clean up Field tests and story imports in preparation of movin…
behowell Nov 9, 2022
68abc4a
Rename FieldComponent to FieldControl
behowell Nov 9, 2022
8b2be4b
Inline fieldConformanceTestOptions, and remove export
behowell Nov 9, 2022
2342d0f
chore: Move field components out of react-field and into their base c…
behowell Nov 9, 2022
21f96ac
Inline fieldConformanceTestOptions and remove export
behowell Nov 9, 2022
d305fc0
Merge branch 'field/cleanup-tests-stories' of https://github.com/beho…
behowell Nov 9, 2022
61559e9
Rename FieldComponent to FieldControl
behowell Nov 9, 2022
663bded
Merge branch 'field/cleanup-tests-stories' of https://github.com/beho…
behowell Nov 9, 2022
bf1a5ba
yarn change
behowell Nov 9, 2022
e43e330
.api.md
behowell Nov 9, 2022
a75a77c
Merge branch 'field/cleanup-tests-stories' of https://github.com/beho…
behowell Nov 9, 2022
6e7a2ac
Remove isConformant.ts, since it is not currently used in react-field
behowell Nov 9, 2022
f96f312
Rename FieldComponent to FieldControl in VR tests
behowell Nov 9, 2022
b768b3f
Merge branch 'master' of https://github.com/microsoft/fluentui into f…
behowell Nov 9, 2022
ab8aafb
Merge branch 'field/cleanup-tests-stories' of https://github.com/beho…
behowell Nov 9, 2022
873fc8a
Fix VR test imports
behowell Nov 9, 2022
c3fae68
Organize imports
behowell Nov 9, 2022
0aafaea
Merge branch 'field/cleanup-tests-stories' of https://github.com/beho…
behowell Nov 9, 2022
ea43904
Fix package version build error
behowell Nov 9, 2022
cc9316e
Fix capitalization in import
behowell Nov 9, 2022
90b99a9
.api.md
behowell Nov 9, 2022
e217aef
Fix SliderField.test.tsx
behowell Nov 9, 2022
e9b8ba8
Fix capitalization in import
behowell Nov 10, 2022
15e9476
Merge branch 'master' of https://github.com/microsoft/fluentui into f…
behowell Nov 10, 2022
301b50a
yarn change
behowell Nov 10, 2022
426be97
Fix vr-test imports
behowell Nov 10, 2022
797915a
Add missing FieldControl export
behowell Nov 10, 2022
8f5f3b7
Merge branch 'master' of https://github.com/microsoft/fluentui into f…
behowell Nov 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/vr-tests-react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@fluentui/react-button": "^9.1.7",
"@fluentui/react-card": "9.0.0-beta.31",
"@fluentui/react-checkbox": "^9.0.11",
"@fluentui/react-combobox": "^9.0.0-beta.14",
"@fluentui/react-dialog": "^9.1.0",
"@fluentui/react-divider": "^9.1.3",
"@fluentui/react-field": "9.0.0-alpha.7",
Expand Down
25 changes: 11 additions & 14 deletions apps/vr-tests-react-components/src/stories/Field.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import * as React from 'react';
import Screener, { Steps } from 'screener-storybook/src/screener';
import { storiesOf } from '@storybook/react';
import { Radio } from '@fluentui/react-radio';
import {
CheckboxField,
ComboboxField,
InputField,
ProgressField,
RadioGroupField,
SelectField,
SliderField,
SpinButtonField,
SwitchField,
TextareaField,
} from '@fluentui/react-field';
import { SparkleFilled } from '@fluentui/react-icons';
import { CheckboxField_unstable as CheckboxField } from '@fluentui/react-checkbox';
import { ComboboxField_unstable as ComboboxField } from '@fluentui/react-combobox';
import { FieldControl, FieldPropsWithOptionalComponentProps } from '@fluentui/react-field/src/Field';
Copy link
Contributor

@sopranopillow sopranopillow Nov 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore if this isn't an issue for vr-tests

Suggested change
import { FieldControl, FieldPropsWithOptionalComponentProps } from '@fluentui/react-field/src/Field';
import { FieldControl } from '@fluentui/react-field/src/Field';
import type { FieldPropsWithOptionalComponentProps } from '@fluentui/react-field/src/Field';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out this import caused a build failure anyways, so I removed it, and am using InputFieldProps instead.

import type { InputFieldProps_unstable as InputFieldProps } from '@fluentui/react-input';

import { SparkleFilled } from '@fluentui/react-icons';
import { InputField_unstable as InputField } from '@fluentui/react-input';
import { ProgressField_unstable as ProgressField } from '@fluentui/react-progress';
import { Radio, RadioGroupField_unstable as RadioGroupField } from '@fluentui/react-radio';
import { SelectField_unstable as SelectField } from '@fluentui/react-select';
import { SliderField_unstable as SliderField } from '@fluentui/react-slider';
import { SpinButtonField_unstable as SpinButtonField } from '@fluentui/react-spinbutton';
import { SwitchField_unstable as SwitchField } from '@fluentui/react-switch';
import { TextareaField_unstable as TextareaField } from '@fluentui/react-textarea';

type FieldControlProps = Pick<
FieldPropsWithOptionalComponentProps<FieldControl>,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: Move CheckboxField into the @fluentui/react-checkbox package and export as _unstable",
"packageName": "@fluentui/react-checkbox",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "chore: Move InputField into the @fluentui/react-input package and export as _unstable",
"packageName": "@fluentui/react-combobox",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: Update exports for field components from @fluentui/react-components/unstable",
"packageName": "@fluentui/react-components",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: Move InputField into the @fluentui/react-input package and export as _unstable",
"packageName": "@fluentui/react-input",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "chore: Move ProgressField into the @fluentui/react-progress package and export as _unstable",
"packageName": "@fluentui/react-progress",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: Move RadioGroupField into the @fluentui/react-radio package and export as _unstable",
"packageName": "@fluentui/react-radio",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "chore: Move SelectField into the @fluentui/react-select package and export as _unstable",
"packageName": "@fluentui/react-select",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: Move SliderField into the @fluentui/react-slider package and export as _unstable",
"packageName": "@fluentui/react-slider",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: Move SpinButtonField into the @fluentui/react-spinbutton package and export as _unstable",
"packageName": "@fluentui/react-spinbutton",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: Move SwitchField into the @fluentui/react-switch package and export as _unstable",
"packageName": "@fluentui/react-switch",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: Move TextareaField into the @fluentui/react-textarea package and export as _unstable",
"packageName": "@fluentui/react-textarea",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,32 @@

import { ComponentProps } from '@fluentui/react-utilities';
import { ComponentState } from '@fluentui/react-utilities';
import type { ForwardRefComponent } from '@fluentui/react-utilities';
import type { FieldProps } from '@fluentui/react-field';
import { FieldSlots } from '@fluentui/react-field';
import { ForwardRefComponent } from '@fluentui/react-utilities';
import { Label } from '@fluentui/react-label';
import * as React_2 from 'react';
import { Slot } from '@fluentui/react-utilities';
import type { SlotClassNames } from '@fluentui/react-utilities';
import { SlotClassNames } from '@fluentui/react-utilities';

// @public
export const Checkbox: ForwardRefComponent<CheckboxProps>;

// @public (undocumented)
export const checkboxClassNames: SlotClassNames<CheckboxSlots>;

// @public (undocumented)
export const CheckboxField_unstable: ForwardRefComponent<CheckboxFieldProps_unstable>;

// @public (undocumented)
export const checkboxFieldClassNames: SlotClassNames<FieldSlots<React_2.VoidFunctionComponent<Pick<React_2.HTMLAttributes<HTMLElement>, "style" | "className" | "id" | "aria-describedby" | "aria-errormessage" | "aria-invalid" | "aria-labelledby">>>>;

// @public (undocumented)
export type CheckboxFieldProps_unstable = Omit<FieldProps<typeof Checkbox>, 'label'> & {
label?: CheckboxProps['label'];
fieldLabel?: FieldProps<typeof Checkbox>['label'];
};

// @public
export interface CheckboxOnChangeData {
// (undocumented)
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/react-checkbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@fluentui/scripts": "^1.0.0"
},
"dependencies": {
"@fluentui/react-field": "9.0.0-alpha.7",
"@fluentui/react-icons": "^2.0.175",
"@fluentui/react-label": "^9.0.9",
"@fluentui/react-tabster": "^9.2.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';
import { CheckboxField } from './CheckboxField';

describe('CheckboxField', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import * as React from 'react';
import type { CheckboxProps } from '@fluentui/react-checkbox';
import { Checkbox } from '@fluentui/react-checkbox';
import type { FieldProps } from '@fluentui/react-field';
import {
getFieldClassNames,
renderField_unstable,
useFieldStyles_unstable,
useField_unstable,
} from '@fluentui/react-field';
import { ForwardRefComponent } from '@fluentui/react-utilities';
import type { FieldProps } from '../../Field';
import { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';
import type { CheckboxProps } from '../../Checkbox';
import { Checkbox } from '../../Checkbox';

export type CheckboxFieldProps = Omit<FieldProps<typeof Checkbox>, 'label'> & {
/**
Expand Down
3 changes: 3 additions & 0 deletions packages/react-components/react-checkbox/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ export {
useCheckbox_unstable,
} from './Checkbox';
export type { CheckboxOnChangeData, CheckboxProps, CheckboxSlots, CheckboxState } from './Checkbox';

export { CheckboxField as CheckboxField_unstable, checkboxFieldClassNames } from './CheckboxField';
export type { CheckboxFieldProps as CheckboxFieldProps_unstable } from './CheckboxField';
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import type { ComponentProps } from '@fluentui/react-utilities';
import type { ComponentState } from '@fluentui/react-utilities';
import { FC } from 'react';
import type { FieldProps } from '@fluentui/react-field';
import { FieldSlots } from '@fluentui/react-field';
import type { ForwardRefComponent } from '@fluentui/react-utilities';
import type { PositioningShorthand } from '@fluentui/react-positioning';
import { Provider } from 'react';
Expand All @@ -29,6 +31,15 @@ export type ComboboxContextValue = Pick<ComboboxState, 'activeOption' | 'appeara
// @public (undocumented)
export type ComboboxContextValues = ComboboxBaseContextValues;

// @public (undocumented)
export const ComboboxField_unstable: ForwardRefComponent<ComboboxFieldProps_unstable>;

// @public (undocumented)
export const comboboxFieldClassNames: SlotClassNames<FieldSlots<React_2.VoidFunctionComponent<Pick<React_2.HTMLAttributes<HTMLElement>, "style" | "className" | "id" | "aria-describedby" | "aria-errormessage" | "aria-invalid" | "aria-labelledby">>>>;

// @public (undocumented)
export type ComboboxFieldProps_unstable = FieldProps<typeof Combobox>;

// @public (undocumented)
export type ComboboxOpenChangeData = ComboboxBaseOpenChangeData;

Expand Down
1 change: 1 addition & 0 deletions packages/react-components/react-combobox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"dependencies": {
"@fluentui/keyboard-keys": "^9.0.0",
"@fluentui/react-context-selector": "^9.1.0",
"@fluentui/react-field": "9.0.0-alpha.7",
"@fluentui/react-icons": "^2.0.175",
"@fluentui/react-portal": "^9.0.9",
"@fluentui/react-positioning": "^9.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import * as React from 'react';
import { Combobox } from '@fluentui/react-combobox';
import type { FieldProps } from '@fluentui/react-field';
import {
getFieldClassNames,
renderField_unstable,
useFieldStyles_unstable,
useField_unstable,
} from '@fluentui/react-field';
import type { ForwardRefComponent } from '@fluentui/react-utilities';
import type { FieldProps } from '../../Field';
import { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';
import { Combobox } from '../../Combobox';

export type ComboboxFieldProps = FieldProps<typeof Combobox>;

Expand Down
3 changes: 3 additions & 0 deletions packages/react-components/react-combobox/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ export {
useOptionGroup_unstable,
} from './OptionGroup';
export type { OptionGroupProps, OptionGroupSlots, OptionGroupState } from './OptionGroup';

export { ComboboxField as ComboboxField_unstable, comboboxFieldClassNames } from './ComboboxField';
export type { ComboboxFieldProps as ComboboxFieldProps_unstable } from './ComboboxField';
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ import { CardPreviewState } from '@fluentui/react-card';
import { CardProps } from '@fluentui/react-card';
import { CardSlots } from '@fluentui/react-card';
import { CardState } from '@fluentui/react-card';
import { CheckboxField } from '@fluentui/react-field';
import { checkboxFieldClassNames } from '@fluentui/react-field';
import { CheckboxFieldProps } from '@fluentui/react-field';
import { CheckboxField_unstable as CheckboxField } from '@fluentui/react-checkbox';
import { checkboxFieldClassNames } from '@fluentui/react-checkbox';
import { CheckboxFieldProps_unstable as CheckboxFieldProps } from '@fluentui/react-checkbox';
import { ColumnDefinition } from '@fluentui/react-table';
import { ColumnId } from '@fluentui/react-table';
import { Combobox } from '@fluentui/react-combobox';
import { comboboxClassNames } from '@fluentui/react-combobox';
import { ComboboxContextValues } from '@fluentui/react-combobox';
import { ComboboxField } from '@fluentui/react-field';
import { comboboxFieldClassNames } from '@fluentui/react-field';
import { ComboboxFieldProps } from '@fluentui/react-field';
import { ComboboxField_unstable as ComboboxField } from '@fluentui/react-combobox';
import { comboboxFieldClassNames } from '@fluentui/react-combobox';
import { ComboboxFieldProps_unstable as ComboboxFieldProps } from '@fluentui/react-combobox';
import { ComboboxOpenChangeData } from '@fluentui/react-combobox';
import { ComboboxOpenEvents } from '@fluentui/react-combobox';
import { ComboboxProps } from '@fluentui/react-combobox';
Expand All @@ -81,9 +81,9 @@ import { FieldProps } from '@fluentui/react-field';
import { FieldSlots } from '@fluentui/react-field';
import { FieldState } from '@fluentui/react-field';
import { getFieldClassNames } from '@fluentui/react-field';
import { InputField } from '@fluentui/react-field';
import { inputFieldClassNames } from '@fluentui/react-field';
import { InputFieldProps } from '@fluentui/react-field';
import { InputField_unstable as InputField } from '@fluentui/react-input';
import { inputFieldClassNames } from '@fluentui/react-input';
import { InputFieldProps_unstable as InputFieldProps } from '@fluentui/react-input';
import { Listbox } from '@fluentui/react-combobox';
import { listboxClassNames } from '@fluentui/react-combobox';
import { ListboxContextValues } from '@fluentui/react-combobox';
Expand Down Expand Up @@ -114,15 +114,15 @@ import { PersonaSlots } from '@fluentui/react-persona';
import { PersonaState } from '@fluentui/react-persona';
import { Progress } from '@fluentui/react-progress';
import { progressClassNames } from '@fluentui/react-progress';
import { ProgressField } from '@fluentui/react-field';
import { progressFieldClassNames } from '@fluentui/react-field';
import { ProgressFieldProps } from '@fluentui/react-field';
import { ProgressField_unstable as ProgressField } from '@fluentui/react-progress';
import { progressFieldClassNames } from '@fluentui/react-progress';
import { ProgressFieldProps_unstable as ProgressFieldProps } from '@fluentui/react-progress';
import { ProgressProps } from '@fluentui/react-progress';
import { ProgressSlots } from '@fluentui/react-progress';
import { ProgressState } from '@fluentui/react-progress';
import { RadioGroupField } from '@fluentui/react-field';
import { radioGroupFieldClassNames } from '@fluentui/react-field';
import { RadioGroupFieldProps } from '@fluentui/react-field';
import { RadioGroupField_unstable as RadioGroupField } from '@fluentui/react-radio';
import { radioGroupFieldClassNames } from '@fluentui/react-radio';
import { RadioGroupFieldProps_unstable as RadioGroupFieldProps } from '@fluentui/react-radio';
import { renderAlert_unstable } from '@fluentui/react-alert';
import { renderAvatarGroup_unstable } from '@fluentui/react-avatar';
import { renderAvatarGroupItem_unstable } from '@fluentui/react-avatar';
Expand Down Expand Up @@ -154,22 +154,22 @@ import { RowId } from '@fluentui/react-table';
import { RowState } from '@fluentui/react-table';
import { Select } from '@fluentui/react-select';
import { selectClassNames } from '@fluentui/react-select';
import { SelectField } from '@fluentui/react-field';
import { selectFieldClassNames } from '@fluentui/react-field';
import { SelectFieldProps } from '@fluentui/react-field';
import { SelectField_unstable as SelectField } from '@fluentui/react-select';
import { selectFieldClassNames } from '@fluentui/react-select';
import { SelectFieldProps_unstable as SelectFieldProps } from '@fluentui/react-select';
import { SelectProps } from '@fluentui/react-select';
import { SelectSlots } from '@fluentui/react-select';
import { SelectState } from '@fluentui/react-select';
import { SliderField } from '@fluentui/react-field';
import { sliderFieldClassNames } from '@fluentui/react-field';
import { SliderFieldProps } from '@fluentui/react-field';
import { SliderField_unstable as SliderField } from '@fluentui/react-slider';
import { sliderFieldClassNames } from '@fluentui/react-slider';
import { SliderFieldProps_unstable as SliderFieldProps } from '@fluentui/react-slider';
import { SortDirection } from '@fluentui/react-table';
import { SpinButtonField } from '@fluentui/react-field';
import { spinButtonFieldClassNames } from '@fluentui/react-field';
import { SpinButtonFieldProps } from '@fluentui/react-field';
import { SwitchField } from '@fluentui/react-field';
import { switchFieldClassNames } from '@fluentui/react-field';
import { SwitchFieldProps } from '@fluentui/react-field';
import { SpinButtonField_unstable as SpinButtonField } from '@fluentui/react-spinbutton';
import { spinButtonFieldClassNames } from '@fluentui/react-spinbutton';
import { SpinButtonFieldProps_unstable as SpinButtonFieldProps } from '@fluentui/react-spinbutton';
import { SwitchField_unstable as SwitchField } from '@fluentui/react-switch';
import { switchFieldClassNames } from '@fluentui/react-switch';
import { SwitchFieldProps_unstable as SwitchFieldProps } from '@fluentui/react-switch';
import { Table } from '@fluentui/react-table';
import { TableBody } from '@fluentui/react-table';
import { tableBodyClassName } from '@fluentui/react-table';
Expand Down Expand Up @@ -224,9 +224,9 @@ import { TableSlots } from '@fluentui/react-table';
import { TableSortState } from '@fluentui/react-table';
import { TableState } from '@fluentui/react-table';
import { TableStatePlugin } from '@fluentui/react-table';
import { TextareaField } from '@fluentui/react-field';
import { textareaFieldClassNames } from '@fluentui/react-field';
import { TextareaFieldProps } from '@fluentui/react-field';
import { TextareaField_unstable as TextareaField } from '@fluentui/react-textarea';
import { textareaFieldClassNames } from '@fluentui/react-textarea';
import { TextareaFieldProps_unstable as TextareaFieldProps } from '@fluentui/react-textarea';
import { Toolbar } from '@fluentui/react-toolbar';
import { ToolbarButton } from '@fluentui/react-toolbar';
import { ToolbarButtonProps } from '@fluentui/react-toolbar';
Expand Down
Loading