-
Notifications
You must be signed in to change notification settings - Fork 3.3k
refactor: ECHO-421: remove bem from lso #8765
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
Conversation
Migrated EmptyState component from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="empty-state-default" to cn("empty-state-default")
- Converted all Elem components (icon, title, description, action, footer) to div with cn().elem()
- Preserved all props and conditional rendering
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 1: Leaf components)
Migrated ErrorWrapper component from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="error-message" to cn("error-message")
- Converted all Elem components with various tags (img, div, ul, li, Button)
- Preserved all props, handlers, and conditional rendering
- Maintained semantic HTML (img, ul, li tags)
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 1: Leaf components)
Migrated HeidiTip and HeidiLink components from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="heidy-tip" to cn("heidy-tip")
- Converted all Elem components (content, header, title, text, heidi, link)
- Maintained semantic HTML (a tag for link)
- Preserved all props, handlers, and conditional rendering
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 1: Leaf components)
Migrated Counter and CounterButton components from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="counter" with mod and mix to cn("counter").mod().mix()
- Converted Elem name="input" (input tag) to input with cn().elem()
- Converted Elem name="btn" (a tag) in CounterButton to a with cn().elem().mod()
- Preserved all props, refs, handlers, and state management
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 1: Leaf components)
Migrated VersionNotifier component from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block tag="li" name="version-notifier" to li with cn("version-notifier")
- Converted Block tag={Link} name="current-version" to Link with cn("current-version")
- Converted all Elem components (icon, content, title, description) to div with cn().elem()
- Preserved all props, handlers, and conditional rendering
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 1: Leaf components)
Migrated SelectedUser and UserProjectsLinks components from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="user-info" to cn("user-info")
- Converted all Elem components (header, info-wrapper, full-name, email, section, section-title, links-list, project-link, last-active)
- Converted Elem tag={NavLink} to NavLink with className in UserProjectsLinks
- Maintained semantic HTML (p tags) where appropriate
- Preserved all props, handlers, and conditional rendering
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 1: Leaf components)
Migrated EmptyList component from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="empty-models-list" to cn("empty-models-list")
- Converted all Elem components (content, heidy, title, caption) to div with cn().elem()
- Preserved all props and structure
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 1: Leaf components)
Completed migration of MachineLearningList from Block/Elem to cn() helper. - Removed Block import (file was already partially using cn()) - Converted Block name="backend-card" to div with rootClass.toClassName() - File already used cn() for all Elem components via rootClass pattern - Preserved all props, handlers, and structure - No behavior change, equivalent class strings Part of Label Studio BEM migration (Phase 1: Leaf components)
Completed migration of PredictionsList from Block/Elem to cn() helper. - Removed Block import (file was already partially using cn()) - Converted Block name="prediction-card" to div with rootClass.toClassName() - File already used cn() for all Elem components via rootClass pattern - Preserved all props, handlers, and structure - No behavior change, equivalent class strings Part of Label Studio BEM migration (Phase 1: Leaf components)
Migrated DataManager page from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="crash" to div with cn("crash")
- Converted Elem name="info" to div with cn("crash").elem("info")
- Converted Block ref={root} name="datamanager" to div with ref and cn("datamanager")
- Preserved all props, refs, and conditional rendering
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 1: Leaf components)
Migrated InlineError component from Block/Elem to cn() helper. - Replaced Block import with cn import - Converted Block name="inline-error" with mix and style to div with cn().mix() - Preserved all props, handlers, and ErrorWrapper integration - No behavior change, equivalent class strings Part of Label Studio BEM migration (Phase 2: Mid-level components)
Migrated Pagination and NavigationButton components from Block/Elem to cn() helper. - Replaced Block/Elem imports with cn import - Converted Block name="pagination-ls" with mod to div with cn().mod() - Converted all Elem components (label, navigation, input, page-indicator, divider, btn, page-size) to div with cn().elem() - Preserved all props, handlers, state management, and complex pagination logic - Maintained TypeScript types and interfaces - No behavior change, equivalent class strings Part of Label Studio BEM migration (Phase 2: Mid-level components)
Completed migration of DropdownComponent from Block/Elem to cn() helper.
- Removed Block import (file was already partially using cn())
- Converted Block name="dropdown-ls" with mix to div with rootName.mix()
- File already used cn() for rootName and elem("menu") via rootName pattern
- Preserved all props, refs, handlers, animation logic, and portal rendering
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 2: Mid-level components - COMPLETE!)
Migrated Form.Indicator subcomponent from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="form-indicator" to div with cn("form-indicator")
- Converted Elem tag="span" with mod to span with cn().elem().mod()
- Preserved all props, state context, and Oneof integration
- No behavior change, equivalent class strings
CRITICAL PATH: This component is used by 5 other files (StorageForm, AnnotationSettings, GeneralSettings, Config, etc.)
Part of Label Studio BEM migration (Phase 3: Critical path component - COMPLETE!)
Migrated ImportModal component from Elem to cn() helper.
- Replaced Elem import with cn import
- Converted Elem block="modal" name="title" to div with cn("modal").elem("title")
- Preserved all props, Modal integration, and handlers
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 4: Mid-level pages)
Migrated PeopleList component from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="people-list" to div with cn("people-list")
- Converted all Elem components (wrapper, users, header, column, body, user, field, loading) to div with cn().elem()
- Preserved all props, handlers, Pagination integration, and table-like structure
- Maintained mix modifiers for avatar, email, name, last-activity
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 4: Mid-level pages)
✅ 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-docs-new-theme canceled.
|
✅ Deploy Preview for label-studio-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Migrated ModelsPage from Block to cn() helper.
- Replaced Block import with cn import
- Converted Block name="prompter" to div with cn("prompter")
- Preserved all props and EmptyList integration
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 4: Mid-level pages)
Migrated ProjectsList, EmptyProjectsList, and ProjectCard components from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted ProjectsList Elems to use parent Block "projects-page" (list, pages)
- Converted EmptyProjectsList Block "empty-projects-page" to div with cn()
- Converted ProjectCard nested structure:
- Elem tag={NavLink} to NavLink with cn("projects-page").elem("link")
- Block "project-card" with all nested Elems (header, title, menu, summary, annotation, etc.)
- Converted Icon Elem tags to Icon components with className
- Preserved all props, handlers, styles, mods, and complex nested structure
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 4: Mid-level pages - COMPLETE!)
Migrated PeoplePage from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="people" to div with cn("people")
- Converted Elem components (controls, content) to div with cn().elem()
- Preserved all props, handlers, PeopleList/SelectedUser integration, and feature flags
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 5: Top-level pages)
Migrated ProjectsPage from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="projects-page" to div with cn("projects-page")
- Converted Elem components (loading, content) to div with cn().elem()
- Preserved all props, handlers, Oneof integration, and ProjectsList/EmptyProjectsList rendering
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 5: Top-level pages)
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## develop #8765 +/- ##
===========================================
- Coverage 67.33% 59.45% -7.89%
===========================================
Files 806 553 -253
Lines 62467 39360 -23107
Branches 10419 10419
===========================================
- Hits 42060 23400 -18660
+ Misses 20404 15957 -4447
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:
|
Migrated Config component's form indicator from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn only
- Converted inline Block name="form-indicator" to div with cn("form-indicator")
- Converted Elem tag="span" with mod to span with cn().elem().mod()
- Preserved all props and saved state indicator
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 5: Top-level pages)
Migrated StorageForm component's form indicator from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="form-indicator" to div with cn("form-indicator")
- Converted Elem tag="span" with mod to span with cn().elem().mod()
- Preserved all props, Oneof integration, and connection validation states
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 5: Top-level pages)
6d14168 to
c1a4821
Compare
Migrated AnnotationSettings from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="annotation-settings" to div with cn("annotation-settings")
- Converted Block name="settings-wrapper" to div with cn("settings-wrapper")
- Converted Elem name="wrapper" and name="header" to div with cn().elem()
- Preserved all props, handlers, Form integration, and nested structure
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 5: Top-level pages)
Migrated GeneralSettings from Block/Elem to cn() helper.
- Replaced Block/Elem imports with cn import
- Converted Block name="general-settings" to div with cn("general-settings")
- Converted Block name="settings-wrapper" to div with cn("settings-wrapper")
- Converted Block name="workspace-placeholder" with nested Elems to div structure
- Converted Block name="color" to div with cn("color")
- Converted all Elem components (wrapper, badge-wrapper, title) to div with cn().elem()
- Preserved all props, handlers, Form integration, RadioGroup, and feature flags
- No behavior change, equivalent class strings
Part of Label Studio BEM migration (Phase 5: Top-level pages - COMPLETE!)
🎉 ALL 24 FILES MIGRATED! Label Studio is now 100% using cn() helper!
Label Studio has been fully migrated to use the modern cn() helper. Removed unused exports from bem.tsx: - Block (no longer used in LSO) - Elem (no longer used in LSO) - BemWithSpecificContext (no longer used) - BlockContext (no longer used) - useBEM (no longer used) - type CN (not used) - type CNTagName (not used) - type BemComponent (not used) Only cn() is now exported for Label Studio. Note: LSE may still use Block/Elem and should import directly from @HumanSignal/core if needed. Part of Label Studio BEM migration cleanup.
c1a4821 to
44b5ec2
Compare
| return ( | ||
| <Block name="backend-card"> | ||
| <div className={rootClass.toClassName()}> | ||
| <div className={rootClass.elem("title-container")}> |
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.
could we add .toClassName() here - this'll clean up the output by not dropping all the object params in the DOM
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.
I will definitely check if I can implement a more holistic solution for this. Since these aren't the only instances and this involves preexisting code, I might run a script to localize this element or even use a plugin in Biome.
I will create a pr fixing those if you are ok with that.
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.
sounds good to me
| <Block name="prediction-card"> | ||
| <div className={rootClass.toClassName()}> | ||
| <div> | ||
| <div className={rootClass.elem("title")}> |
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.
same here
| type CNTagName, | ||
| type BemComponent, | ||
| } from "@humansignal/core/lib/utils/bem"; | ||
| export { cnb as cn } from "@humansignal/core/lib/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.
much cleaner 😎
|
/git merge
|
Completes the BEM migration for Label Studio application by replacing all legacy
<Block/>and<Elem/>components with the moderncn()helper function.This is the final phase of the organization-wide BEM modernization:
libs/editor/) - 70+ fileslibs/datamanager/) - 25 filesapps/labelstudio/) - 24 files ← This PRChanges
Files migrated: 24
Files skipped: 0
Breaking changes: 0
CSS impact: None (same class strings generated)
Migrated Components
Components (13 files):
Pages (11 files):
Cleanup
Removed unused exports from
apps/labelstudio/src/utils/bem.tsx:Block,Elem,BemWithSpecificContext,BlockContext,useBEM, typescn(only export needed)Migration Details
All transformations follow the standard pattern:
Before:
After:
Key Implementation Details
settings-wrappercreates new context for child Elems)as anyin .jsx filesPreserved
Statistics
Notes
cn- LSE should import Block/Elem from@humansignal/coreif needed