-
Notifications
You must be signed in to change notification settings - Fork 3.2k
refactor: ECHO-421: remove bem from lso left overs #8814
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
base: develop
Are you sure you want to change the base?
Conversation
Migrated Space component from BemWithSpecificContext() to cn() helper.
- Replaced BemWithSpecificContext import with cn import
- Removed const { Block } = BemWithSpecificContext() pattern
- Converted Block name="space-ls" with mod and mix to div with cn().mod().mix()
- Preserved all props, mods (direction, size, spread, stretch, align), and children
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Additional files)
Migrated RadioGroup and RadioButton components from BemWithSpecificContext() to cn() helper.
- Replaced BemWithSpecificContext import with cn import
- Removed const { Block, Elem } = BemWithSpecificContext() pattern
- Converted Block name="radio-group-ls" with mod and mix to div with cn().mod().mix()
- Converted Elem name="buttons" to div with cn().elem()
- Converted Elem name="button" in RadioButton to div with cn().elem().mod()
- Preserved all props, refs, context, handlers, and form integration
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Additional files)
Migrated Breadcrumbs component from BemWithSpecificContext() to cn() helper.
- Replaced BemWithSpecificContext import with cn import
- Removed const { Block, Elem } = BemWithSpecificContext() pattern
- Converted Block name="breadcrumbs" to div with cn("breadcrumbs")
- Converted Elem tag="ul" name="list" to ul with cn().elem()
- Converted Elem tag="span" name="label" to span with cn().elem().mod()
- Converted all Elem tag="li" name="item" variations to li with cn().elem().mod()
- Converted Elem with component={Dropdown.Trigger} to Dropdown.Trigger with component="li"
- Preserved all props, handlers, dropdown integration, and conditional rendering
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Additional files)
Migrated ExportPage and FormatInfo components from BemWithSpecificContext() to cn() helper.
- Replaced BemWithSpecificContext import with cn import
- Removed const { Block, Elem } = BemWithSpecificContext() pattern
- Converted Block name="export-page" to div with cn("export-page")
- Converted Block name="formats" to div with cn("formats")
- Converted all Elem components (footer, recent, actions, info, list, item, name, tag, description, feedback)
- Preserved all props, handlers, modal integration, and format selection logic
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Additional files - FINAL!)
✅ Deploy Preview for label-studio-docs-new-theme canceled.
|
✅ Deploy Preview for heartex-docs canceled.
|
✅ Deploy Preview for label-studio-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for label-studio-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Migrated InviteLink InvitationModal from Block to cn() helper.
- Replaced Block import from MenuContext with cn import
- Converted Block name="invite" to div with cn("invite")
- Preserved all props and Input integration
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Additional files)
Migrated Menu, Menu.Spacer, Menu.Divider, and Menu.Group from Block/Elem to cn() helper.
- Removed Block/Elem imports from MenuContext
- Converted Block tag="ul" name="main-menu" with mod and mix to ul with cn().mod().mix()
- Converted Menu.Spacer Elem to li with cn("main-menu").elem("spacer")
- Converted Menu.Divider Elem to li with cn("main-menu").elem("divider")
- Converted Menu.Group Block and Elems to div/ul structure with cn()
- Preserved all props, refs, handlers, context, and dropdown integration
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Additional files)
Cleaned up MenuContext to remove unused Block/Elem exports. - Removed BemWithSpecificContext import - Removed Block/Elem exports (no longer used after Menu.jsx migration) - Only MenuContext remains (still needed for menu state) - No behavior change Part of Label Studio BEM migration (Additional files)
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## develop #8814 +/- ##
===========================================
- Coverage 67.70% 59.68% -8.03%
===========================================
Files 806 553 -253
Lines 62093 38986 -23107
Branches 10328 10328
===========================================
- Hits 42043 23268 -18775
+ Misses 20047 15715 -4332
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| import { Button, Typography } from "@humansignal/ui"; | ||
| import { Space } from "@humansignal/ui/lib/space/space"; | ||
| import { Block } from "apps/labelstudio/src/components/Menu/MenuContext"; | ||
| import { cn } from "apps/labelstudio/src/utils/bem"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brandon probably can help here to decide If this is correct or should drive from @HumanSignal
refactor(bem): complete BEM migration - remove remaining BemWithSpecificContext usage
Summary
Completes the Label Studio BEM migration by migrating 7 additional files that used
BemWithSpecificContext()pattern, which were not included in PR #8765.Total migrated: 7 files
Pattern:
const { Block, Elem } = BemWithSpecificContext()Result: 100% BEM migration complete for Label Studio
Background
PR #8765 migrated 24 files that used direct
Block/Elemimports. This PR covers the remaining files that used theBemWithSpecificContext()pattern - a different import style that creates isolated BEM contexts.Changes
Migration Pattern
Before:
After:
Files Migrated
Components (6 files):
Cleanup (1 file):
7. MenuContext.js - Removed unused Block/Elem exports
Verification
bem.tsx (final):
Safety Analysis
Why these migrations are safe:
BemWithSpecificContext creates isolated contexts
Each call creates a separate Block/Elem instance - children cannot inherit context from parents in different files.
No cross-repository dependencies
LSE has its own copies of these components (Space, Menu, etc.) and doesn't import from LSO.
Internal children migrated together
Components like
RadioGroup.ButtonandMenu.Spacerare defined in the same file and migrated simultaneously.No external Block/Elem children
Verified that no external code passes
<Block>or<Elem>as children to these components.Statistics
Commits: 7
Lines changed: 67 insertions, 84 deletions
Files modified: 9
Combined with PR #8765: