Move MUI form components to core library as pure components #24971
+175
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes:
Migrated MUI form components from
openmetadata-uitoopenmetadata-ui-core-componentsas pure, reusable components without custom business logic.Created in
@openmetadata/ui-core-components:MUITextField- Pure MUI TextField wrapper (no sanitization, memoized)MUIForm- HTML form wrapper using MUI Box (properly typed with ComponentProps)MUIFormItem- FormControl wrapper for labels/helper textUpdated
openmetadata-ui:formUtils.tsxto import MUITextField from core libraryMUITextFieldcomponentBefore:
After:
Type Safety:
ComponentProps<'form'>for event handlersas anytype casts, following ESLint rulesSanitization preserved in formUtils for security. Form.Item retained for Ant Design state management. No breaking changes.
Type of change:
Checklist:
Original prompt
Objective
Move MUI components used in form utils from
openmetadata-uitoopenmetadata-ui-core-componentsas pure components without custom logic. Start with TextField and create new MUI wrappers for Form and FormItem (not using Ant Design wrappers).Tasks
1. Create Pure MUI Components in openmetadata-ui-core-components
Create the following components in
openmetadata-ui-core-components/src/main/resources/ui/src/components/:A. MUITextField Component
Path:
openmetadata-ui-core-components/src/main/resources/ui/src/components/MUITextField/MUITextField.tsx@mui/material/TextFieldgetSanitizeContent)variant?: 'outlined' | 'filled' | 'standard'size?: 'small' | 'medium'sizeto'small'memofor optimizationTextFieldPropsfrom@mui/materialExample structure:
B. MUIForm Component
Path:
openmetadata-ui-core-components/src/main/resources/ui/src/components/MUIForm/MUIForm.tsx<form>element with MUI stylingonSubmitonResetchildrenclassNameidExample structure:
C. MUIFormItem Component
Path:
openmetadata-ui-core-components/src/main/resources/ui/src/components/MUIFormItem/MUIFormItem.tsxExample structure:
2. Export Components from Core Library
Update
openmetadata-ui-core-components/src/main/resources/ui/src/components/index.ts:3. Update openmetadata-ui to Use Core Components
A. Update MUITextField import in formUtils
File:
openmetadata-ui/src/main/resources/ui/src/utils/formUtils.tsxChange line 53 from:
To:
B. Create a wrapper component (optional) for sanitization
Path:
openmetadata-ui/src/main/resources/ui/src/components/common/MUITextField/MUITextFieldWithSanitization.tsxIf sanitization is still needed in specific places: