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

refactor: Replace Textfield and Textarea with StudioTextfield and StudioTextarea #14711

Merged

Conversation

mlqn
Copy link
Contributor

@mlqn mlqn commented Feb 18, 2025

Description

  • Replace Textfield and Textarea with StudioTextfield and StudioTextarea

Related Issue(s)

  • PR itself

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)

Summary by CodeRabbit

  • Style
    • Updated text input and textarea components across the application for a consistent, modern look.
    • Enhanced error display and default input behaviors, providing smoother form interactions and more reliable validation feedback for publishing, editing, and configuration workflows.

Copy link
Contributor

coderabbitai bot commented Feb 18, 2025

📝 Walkthrough

Walkthrough

The changes update several tests and UI components by replacing design system elements. Multiple files have been updated to replace components from the @digdir/designsystemet-react library with those from @studio/components. In addition, some components have had properties adjusted (for example, renaming errorAfterBlur to error and adding a defaultValue prop) and the size prop has been removed where it was used. A test has also been enhanced by wrapping a blur event in a wait function to ensure DOM stability. No changes to business logic or state management have been introduced.

Changes

File(s) Change Summary
frontend/app-development/features/appPublish/components/CreateRelease.test.tsx Updated the blur event to await waitFor(() => inputVersionNumber.blur()); to ensure DOM updates are stable.
frontend/app-development/features/appPublish/components/CreateRelease.tsx
frontend/app-development/layout/PageHeader/SubHeader/SettingsModalButton/SettingsModal/components/Tabs/AboutTab/InputFields/InputFields.tsx
frontend/dashboard/components/RepoNameInput/RepoNameInput.tsx
frontend/packages/schema-editor/src/components/SchemaInspector/ItemRestrictions/EnumList/EnumField/EnumField.tsx
frontend/packages/schema-editor/src/components/SchemaInspector/ItemRestrictions/RestrictionField/RestrictionField.tsx
frontend/packages/schema-editor/src/components/SchemaInspector/ItemRestrictions/StringRestrictions/StringRestrictions.tsx
frontend/packages/schema-editor/src/components/SchemaInspector/NameField.tsx
frontend/packages/shared/src/components/GiteaHeader/ThreeDotsMenu/LocalChangesModal/DeleteModal/DeleteModal.tsx
frontend/packages/text-editor/src/TextRow.tsx
frontend/packages/text-editor/src/TextEntry.tsx
frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/FileUpload/FileUploadComponent.tsx
frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/Image/ImageComponent.tsx
frontend/packages/ux-editor-v3/src/components/config/editModal/EditCodeList.tsx
frontend/packages/ux-editor-v3/src/components/config/editModal/EditComponentId.tsx
frontend/packages/ux-editor-v3/src/components/config/editModal/EditOptions.tsx
frontend/packages/ux-editor-v3/src/components/config/editModal/EditPreselectedIndex.tsx
frontend/packages/ux-editor-v3/src/components/config/editModal/EditStringValue.tsx
frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/NavigationMenu/InputPopover/InputPopover.tsx
frontend/packages/ux-editor/src/components/config/componentSpecificContent/Image/ImageComponent.tsx
frontend/packages/ux-editor/src/components/config/editModal/EditStringValue.tsx
Replaced Textfield/Textarea from @digdir/designsystemet-react with StudioTextfield/StudioTextarea from @studio/components, removed the size prop, and updated associated type signatures where necessary.
frontend/libs/studio-components/src/components/StudioDecimalInput/StudioDecimalInput.tsx
frontend/libs/studio-components/src/components/StudioExpression/ManualEditor/ManualEditor.tsx
frontend/libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx
frontend/libs/studio-components/src/hooks/useTextInputProps.tsx
Updated error handling by replacing the prop errorAfterBlur with error and added a new defaultValue prop along with changes in state initialization and effect dependencies.

Possibly related PRs

Suggested labels

skip-manual-testing

Suggested reviewers

  • TomasEng
  • Jondyr

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

frontend/libs/studio-components/src/components/StudioDecimalInput/StudioDecimalInput.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-storybook".

(The package "eslint-plugin-storybook" was not found when loaded as a Node module from the directory "/frontend/libs/studio-components".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-storybook@latest --save-dev

The plugin "eslint-plugin-storybook" was referenced from the config file in "frontend/libs/studio-components/.eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

frontend/libs/studio-components/src/components/StudioExpression/SimplifiedEditor/LogicalExpressionEditor/SubExpression/SubExpressionValueSelector/SubExpressionValueContentInput/StringInput.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-storybook".

(The package "eslint-plugin-storybook" was not found when loaded as a Node module from the directory "/frontend/libs/studio-components".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-storybook@latest --save-dev

The plugin "eslint-plugin-storybook" was referenced from the config file in "frontend/libs/studio-components/.eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

frontend/libs/studio-components/src/components/StudioExpression/ManualEditor/ManualEditor.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-storybook".

(The package "eslint-plugin-storybook" was not found when loaded as a Node module from the directory "/frontend/libs/studio-components".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-storybook@latest --save-dev

The plugin "eslint-plugin-storybook" was referenced from the config file in "frontend/libs/studio-components/.eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

  • 2 others
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added area/data-modeling Area: Related to data models - e.g. create, edit, use data models. area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. area/text-editor Area: Related to creating, translating and editing texts. area/dashboard Area: Related to the dashboard application area/app-deploy Area: Related to deploying apps from Altinn Studio to Altinn Apps. solution/studio/designer Issues related to the Altinn Studio Designer solution. area/version-control Area: Related to version control for files in apps. frontend labels Feb 18, 2025
@mlqn mlqn self-assigned this Feb 18, 2025
@mlqn mlqn changed the title refactor: Replace Textfield and Textarea components with StudioTextfield and StudioTextarea refactor: Replace Textfield and Textarea components with StudioTextfield and StudioTextarea Feb 18, 2025
@mlqn mlqn changed the title refactor: Replace Textfield and Textarea components with StudioTextfield and StudioTextarea refactor: Replace Textfield and Textarea with StudioTextfield and StudioTextarea Feb 18, 2025
Base automatically changed from refactor/text-field-default-size to main February 18, 2025 16:06
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.77%. Comparing base (21f546a) to head (da6d385).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14711      +/-   ##
==========================================
- Coverage   95.77%   95.77%   -0.01%     
==========================================
  Files        1923     1923              
  Lines       25082    25081       -1     
  Branches     2867     2868       +1     
==========================================
- Hits        24023    24022       -1     
  Misses        799      799              
  Partials      260      260              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mlqn mlqn marked this pull request as ready for review February 25, 2025 13:04
@mlqn mlqn assigned mlqn and unassigned mlqn Feb 25, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
frontend/libs/studio-components/src/hooks/useTextInputProps.tsx (1)

12-14: Added support for uncontrolled components.

The hook now properly destructures value and defaultValue separately, enabling support for both controlled and uncontrolled input components.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2104d9 and 2afe8fd.

📒 Files selected for processing (26)
  • frontend/app-development/features/appPublish/components/CreateRelease.test.tsx (1 hunks)
  • frontend/app-development/features/appPublish/components/CreateRelease.tsx (2 hunks)
  • frontend/app-development/layout/PageHeader/SubHeader/SettingsModalButton/SettingsModal/components/Tabs/AboutTab/InputFields/InputFields.tsx (2 hunks)
  • frontend/dashboard/components/RepoNameInput/RepoNameInput.tsx (1 hunks)
  • frontend/libs/studio-components/src/components/StudioDecimalInput/StudioDecimalInput.tsx (1 hunks)
  • frontend/libs/studio-components/src/components/StudioExpression/ManualEditor/ManualEditor.tsx (1 hunks)
  • frontend/libs/studio-components/src/components/StudioExpression/SimplifiedEditor/LogicalExpressionEditor/SubExpression/SubExpressionValueSelector/SubExpressionValueContentInput/StringInput.tsx (1 hunks)
  • frontend/libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx (3 hunks)
  • frontend/libs/studio-components/src/hooks/useTextInputProps.tsx (2 hunks)
  • frontend/packages/schema-editor/src/components/SchemaInspector/ItemRestrictions/EnumList/EnumField/EnumField.tsx (2 hunks)
  • frontend/packages/schema-editor/src/components/SchemaInspector/ItemRestrictions/RestrictionField/RestrictionField.tsx (2 hunks)
  • frontend/packages/schema-editor/src/components/SchemaInspector/ItemRestrictions/StringRestrictions/StringRestrictions.tsx (3 hunks)
  • frontend/packages/schema-editor/src/components/SchemaInspector/NameField.tsx (1 hunks)
  • frontend/packages/shared/src/components/GiteaHeader/ThreeDotsMenu/LocalChangesModal/DeleteModal/DeleteModal.tsx (2 hunks)
  • frontend/packages/text-editor/src/TextEntry.tsx (2 hunks)
  • frontend/packages/text-editor/src/TextRow.tsx (2 hunks)
  • frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/FileUpload/FileUploadComponent.tsx (2 hunks)
  • frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/Image/ImageComponent.tsx (3 hunks)
  • frontend/packages/ux-editor-v3/src/components/config/editModal/EditCodeList.tsx (2 hunks)
  • frontend/packages/ux-editor-v3/src/components/config/editModal/EditComponentId.tsx (2 hunks)
  • frontend/packages/ux-editor-v3/src/components/config/editModal/EditOptions.tsx (3 hunks)
  • frontend/packages/ux-editor-v3/src/components/config/editModal/EditPreselectedIndex.tsx (2 hunks)
  • frontend/packages/ux-editor-v3/src/components/config/editModal/EditStringValue.tsx (2 hunks)
  • frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/NavigationMenu/InputPopover/InputPopover.tsx (3 hunks)
  • frontend/packages/ux-editor/src/components/config/componentSpecificContent/Image/ImageComponent.tsx (2 hunks)
  • frontend/packages/ux-editor/src/components/config/editModal/EditStringValue.tsx (2 hunks)
🔇 Additional comments (53)
frontend/packages/ux-editor/src/components/config/editModal/EditStringValue.tsx (2)

5-8: Import statements updated to support new component structure.

The import statements have been adjusted to replace the Textfield component with StudioTextfield. This aligns with the PR's objective of transitioning from the designsystemet components to studio components.


86-91: Textfield replaced with StudioTextfield component.

The component substitution has been implemented correctly. All the required props are maintained, and the event handler logic remains unchanged.

frontend/libs/studio-components/src/components/StudioExpression/ManualEditor/ManualEditor.tsx (1)

46-46: Property change from errorAfterBlur to error

The change from errorAfterBlur to error prop aligns with the PR objective to standardize components. This likely changes when or how error messages are displayed, so ensure the error display behavior still meets requirements.

frontend/packages/schema-editor/src/components/SchemaInspector/ItemRestrictions/EnumList/EnumField/EnumField.tsx (2)

6-6: Import updated to use StudioTextfield

The import statement has been updated to use StudioTextfield from @studio/components instead of Textfield from the previous design system.


47-55: Component replaced with StudioTextfield

The Textfield component has been replaced with StudioTextfield, and the size property has been removed. Ensure the sizing/styling still meets design requirements without the size property.

frontend/libs/studio-components/src/components/StudioExpression/SimplifiedEditor/LogicalExpressionEditor/SubExpression/SubExpressionValueSelector/SubExpressionValueContentInput/StringInput.tsx (2)

6-6: Import updated to use StudioTextfield

The import statement has been updated to use StudioTextfield from @studio/components instead of Textfield from the previous design system.


14-14: Component replaced with StudioTextfield and size prop removed

The Textfield component has been replaced with StudioTextfield, and the size property previously set to 'small' has been removed. Verify that the component appearance is still appropriate without the size property.

frontend/packages/ux-editor-v3/src/components/config/editModal/EditComponentId.tsx (2)

7-7: Import updated to use StudioTextfield

The import statement has been updated to use StudioTextfield from @studio/components instead of Textfield from the previous design system.


52-56: Component replaced with StudioTextfield

The Textfield component has been replaced with StudioTextfield while maintaining the same props and event handling. This change aligns with the PR objective to standardize components.

frontend/app-development/features/appPublish/components/CreateRelease.test.tsx (1)

121-121: Improved test reliability with waitFor

The change from direct blur to using waitFor enhances test stability by ensuring the DOM is completely updated before triggering the blur event. This prevents flaky tests that might fail due to race conditions between rendering and event handling.

frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/FileUpload/FileUploadComponent.tsx (1)

2-2: Consistent component library usage

The replacement of Textfield from @digdir/designsystemet-react with StudioTextfield from @studio/components aligns with the PR objective to standardize the text input components across the application.

Also applies to: 12-12, 98-99

frontend/libs/studio-components/src/components/StudioDecimalInput/StudioDecimalInput.tsx (1)

54-54: Updated prop from errorAfterBlur to error

The property name has been updated from errorAfterBlur to error, maintaining the same functionality but following a more standardized naming convention for error handling across components.

frontend/packages/shared/src/components/GiteaHeader/ThreeDotsMenu/LocalChangesModal/DeleteModal/DeleteModal.tsx (1)

4-5: Updated import structure and component usage

The changes properly replace Textfield with StudioTextfield and update the import structure. The removal of the size='small' prop suggests that sizing might be handled differently in the new component implementation.

Also applies to: 9-9, 60-61

frontend/libs/studio-components/src/components/StudioToggleableTextfield/StudioToggleableTextfield.tsx (3)

29-29: Good addition of defaultValue prop to support fallback values

Adding the defaultValue prop to the component's parameters enhances its flexibility by providing a fallback mechanism.


81-81: Good implementation of fallback logic

Using the nullish coalescing operator (value ?? defaultValue) is a clean way to provide a fallback when the value is null or undefined.


97-97: Properly passing defaultValue to child component

Correctly passing the defaultValue prop to the StudioIconTextfield component ensures consistent behavior in both view and edit modes.

frontend/packages/text-editor/src/TextEntry.tsx (1)

9-9: Successfully replaced Textarea with StudioTextarea

The implementation correctly replaces the Textarea component from @digdir/designsystemet-react with StudioTextarea from @studio/components as intended in the PR objective.

Could you confirm that the removal of the size="small" prop (which was likely on the original Textarea) is intentional? Does StudioTextarea have a different default size or is sizing handled differently?

Also applies to: 50-51

frontend/packages/schema-editor/src/components/SchemaInspector/ItemRestrictions/RestrictionField/RestrictionField.tsx (2)

4-4: Successfully replaced Textfield with StudioTextfield

The implementation correctly replaces the Textfield component from @digdir/designsystemet-react with StudioTextfield from @studio/components as intended in the PR objective.

Also applies to: 35-36


27-27: Improved type safety with explicit HTMLInputElement typing

The explicit type annotation for the event parameter improves type safety by ensuring that target is correctly recognized as an HTMLInputElement.

frontend/packages/ux-editor-v3/src/components/config/editModal/EditPreselectedIndex.tsx (1)

10-10: Successfully replaced Textfield with StudioTextfield

The implementation correctly replaces the Textfield component from @digdir/designsystemet-react with StudioTextfield from @studio/components as intended in the PR objective.

Also applies to: 45-46

frontend/packages/ux-editor-v3/src/components/config/editModal/EditCodeList.tsx (2)

2-11: Import changes align with the component replacement pattern

The replacement of Textfield with StudioTextfield is reflected in the imports, ensuring consistent usage of the Studio component library.


78-83: Component replacement looks good

Successfully replaced Textfield with StudioTextfield while maintaining all the required props. This change is consistent with the PR objective to standardize on Studio components.

frontend/app-development/features/appPublish/components/CreateRelease.tsx (3)

10-10: Import change for Studio components looks good

Properly replaced the imports from @digdir/designsystemet-react with the Studio components from @studio/components.


56-60: TextField replacement is correct

Successfully replaced Textfield with StudioTextfield. Note that the size prop has been removed, which is appropriate if the Studio component has different default styling.


67-73: Textarea replacement is correct

Successfully replaced Textarea with StudioTextarea while maintaining all necessary props. The size prop removal is consistent with the component library migration.

frontend/app-development/layout/PageHeader/SubHeader/SettingsModalButton/SettingsModal/components/Tabs/AboutTab/InputFields/InputFields.tsx (4)

6-6: Import change for StudioTextfield looks good

Properly updated the import statement to use the new component from @studio/components.


42-47: Textfield replacement for repo field is correct

Successfully replaced the first Textfield with StudioTextfield while maintaining all needed props. The size prop has been removed as it's not needed in the Studio component.


48-54: Textfield replacement for name field is correct

Successfully replaced the second Textfield with StudioTextfield while maintaining the error handling capability.


55-60: Textfield replacement for alt_id field is correct

The third Textfield has been properly replaced with StudioTextfield, maintaining all necessary props.

frontend/packages/ux-editor-v3/src/components/config/editModal/EditStringValue.tsx (2)

1-1: Import statement updated correctly

The import statement has been properly updated to include StudioTextfield from @studio/components.


60-64: Textfield replacement in conditional rendering block is correct

Successfully replaced Textfield with StudioTextfield in the conditional rendering section, maintaining all the required props and event handlers.

frontend/packages/schema-editor/src/components/SchemaInspector/ItemRestrictions/StringRestrictions/StringRestrictions.tsx (2)

97-103: Component replacement looks good.

The Textfield component has been successfully replaced with StudioTextfield, and the unnecessary size prop has been removed. This matches the PR objectives.


117-123: Component replacement looks good.

The second Textfield instance has also been successfully replaced with StudioTextfield with the size prop removed, maintaining consistency.

frontend/packages/schema-editor/src/components/SchemaInspector/NameField.tsx (2)

3-3: Import statement updated correctly.

The import statement has been updated to use StudioTextfieldProps from @studio/components instead of TextfieldProps from @digdir/designsystemet-react.


11-11: Type definition updated correctly.

The NameFieldProps type now extends StudioTextfieldProps instead of TextfieldProps, ensuring type safety with the new component.

frontend/libs/studio-components/src/hooks/useTextInputProps.tsx (2)

24-25: Improved initialization logic.

The initialization logic has been enhanced to create a proper fallback chain from value to defaultValue to empty string, improving component flexibility.


31-34: Updated effect dependencies.

The useEffect hook now correctly depends on initialValue instead of just value, ensuring the component responds properly to changes in both controlled and uncontrolled modes.

frontend/packages/text-editor/src/TextRow.tsx (3)

6-7: Import statement cleaned up.

The import statement now only includes Table from @digdir/designsystemet-react, removing the no-longer-needed Textfield.


12-12: Added StudioTextfield import.

The import for StudioTextfield has been added to replace the removed Textfield component.


113-119: Component replacement looks good.

The Textfield component has been successfully replaced with StudioTextfield. The size prop has been removed as it's not needed with the new component.

frontend/packages/ux-editor-v3/src/components/config/componentSpecificContent/Image/ImageComponent.tsx (3)

2-2: Updated imports align with the refactoring strategy.

The import changes correctly set up the new dependencies, importing only the still-needed Fieldset from @digdir/designsystemet-react while adding the new StudioTextfield from @studio/components.

Also applies to: 8-8


77-82: Successfully replaced Textfield with StudioTextfield.

The component replacement maintains all the required props and functionality from the original implementation, ensuring that the form field logic for image source inputs continues to work as expected.


106-110: Successfully replaced Textfield with StudioTextfield for width input.

The implementation correctly preserves all necessary functionality including the onChange handler and value propagation.

frontend/dashboard/components/RepoNameInput/RepoNameInput.tsx (2)

3-6: Updated imports and type definitions for StudioTextfield.

The changes correctly update the component imports and properly extend the component props from StudioTextfieldProps instead of the previous TextfieldProps.

Also applies to: 11-11


18-25: Properly migrated to StudioTextfield with API adjustments.

The implementation correctly adapts to the API differences of the new component:

  1. Removed the size prop which is not supported in the new component
  2. Changed from value to defaultValue for the repo name
  3. Changed from errorAfterBlur to error for error message display

These changes ensure that the component behavior remains consistent while using the new design system.

frontend/packages/ux-editor-v3/src/components/config/editModal/EditOptions.tsx (2)

3-3: Updated imports for StudioTextfield.

The import changes correctly remove Textfield from @digdir/designsystemet-react and add StudioTextfield from @studio/components.

Also applies to: 16-16


155-160: Successfully replaced Textfield with StudioTextfield.

The implementation correctly preserves all the necessary props from the original component, maintaining functionality for option value inputs.

frontend/packages/ux-editor-v3/src/containers/DesignView/PageAccordion/NavigationMenu/InputPopover/InputPopover.tsx (3)

4-4: Updated imports for StudioTextfield and related components.

The import changes correctly remove Textfield from @digdir/designsystemet-react and add the necessary Studio components including StudioTextfield.

Also applies to: 8-8


51-56: Simplified event type to match the StudioTextfield component.

The event handler now correctly specifies ChangeEvent<HTMLInputElement> instead of the previous union type, which better aligns with the actual events that will be dispatched from the StudioTextfield component.


83-89: Properly migrated to StudioTextfield with API adjustments.

The implementation correctly adapts to the API differences of the new component:

  1. Removed the size prop which is not supported in the new component
  2. Changed the error handling from errorAfterBlur to error with a boolean value

These changes ensure that the input popover functionality remains consistent while using the new design system.

frontend/packages/ux-editor/src/components/config/componentSpecificContent/Image/ImageComponent.tsx (3)

2-2: Import changes look good.

The changes correctly remove the Textfield import from @digdir/designsystemet-react and add StudioTextfield from @studio/components.

Also applies to: 8-8


60-66: Component replacement correctly implemented.

The Textfield component has been successfully replaced with StudioTextfield while maintaining the same props and functionality.


2-2:

❓ Verification inconclusive

Consider whether Fieldset should also be replaced.

Since this PR aims to replace design system components with studio components, it might be worth considering whether Fieldset should also be replaced with a potential StudioFieldset component for consistency. This might be planned for a future PR but is worth noting.


🏁 Script executed:

#!/bin/bash
# Check if a StudioFieldset component exists in the codebase
rg "export.*StudioFieldset" --type ts

Length of output: 741


Action: Evaluate Consistency of Fieldset Component Usage

The import of Fieldset from @digdir/designsystemet-react in this file is still referencing our older design system. Since a replacement—StudioFieldset—is already available (see, for example, frontend/libs/studio-components/src/components/StudioFieldset/StudioFieldset.tsx), please assess whether it makes sense to update this import for consistency with our ongoing migration to studio components. If a direct replacement is not feasible in this PR, consider documenting the decision and tracking it for a future update.

@mlqn mlqn removed their assignment Feb 25, 2025
Copy link
Contributor

@JamalAlabdullah JamalAlabdullah left a comment

Choose a reason for hiding this comment

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

Tested ok in dev 👍

@JamalAlabdullah JamalAlabdullah merged commit 085d2c5 into main Feb 27, 2025
11 checks passed
@JamalAlabdullah JamalAlabdullah deleted the refactor/replace-designsystemet-components-with-studio branch February 27, 2025 08:27
@JamalAlabdullah JamalAlabdullah removed their assignment Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/app-deploy Area: Related to deploying apps from Altinn Studio to Altinn Apps. area/dashboard Area: Related to the dashboard application area/data-modeling Area: Related to data models - e.g. create, edit, use data models. area/text-editor Area: Related to creating, translating and editing texts. area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. area/version-control Area: Related to version control for files in apps. frontend solution/studio/designer Issues related to the Altinn Studio Designer solution. team/studio-core team/studio-domain1 team/studio-domain2
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants