Skip to content

refactor: Consolidate input-like component style utilities#4146

Open
TrevorBurnham wants to merge 10 commits intocloudscape-design:mainfrom
TrevorBurnham:refactor-style-modules
Open

refactor: Consolidate input-like component style utilities#4146
TrevorBurnham wants to merge 10 commits intocloudscape-design:mainfrom
TrevorBurnham:refactor-style-modules

Conversation

@TrevorBurnham
Copy link
Contributor

Description

This PR refactors the style utilities used by the Input, Textarea, and TextFilter to reduce duplicated logic. This should make maintenance easier while also reducing bundle size: If all three components are used, this cuts down the amount of JS served to the browser by ~10KB.

How has this been tested?

I'm not sure how best to test this change.

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@TrevorBurnham TrevorBurnham requested a review from a team as a code owner January 1, 2026 16:01
@TrevorBurnham TrevorBurnham requested review from Who-is-PS and removed request for a team January 1, 2026 16:01
Extract shared getInputStylesCss() utility from input, textarea, and
text-filter components to reduce code duplication and bundle size.

- Create src/internal/utils/input-styles.ts with shared style mapping
- Update input, textarea, and text-filter to use shared utility
- Add comprehensive unit tests for the new utility

Bundle size reduction: ~10.6 KB (58%) when multiple components are used.
@TrevorBurnham TrevorBurnham force-pushed the refactor-style-modules branch from 6721e6c to 7def754 Compare January 2, 2026 15:15
@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.30%. Comparing base (406ec7f) to head (54d2f32).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4146      +/-   ##
==========================================
+ Coverage   97.19%   97.30%   +0.11%     
==========================================
  Files         886      887       +1     
  Lines       26029    25990      -39     
  Branches     9437     9403      -34     
==========================================
- Hits        25299    25290       -9     
+ Misses        724      653      -71     
- Partials        6       47      +41     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Who-is-PS Who-is-PS enabled auto-merge February 13, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants