Skip to content
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
53c775e
refactor(bem): replace Block with cn() in Space.tsx
luarmr Oct 16, 2025
a6fe3fe
refactor(bem): replace Block/Elem with cn() in ViewControls.tsx
luarmr Oct 16, 2025
395a69d
refactor(bem): replace Block/Elem with cn() in GroundTruth.jsx
luarmr Oct 16, 2025
c493f9e
refactor(bem): replace Block/Elem with cn() in TimeBox.tsx
luarmr Oct 16, 2025
19d4afd
refactor(bem): replace Block with cn() in TimeDurationControl.tsx
luarmr Oct 16, 2025
352b668
refactor(bem): replace Block/Elem with cn() in Pagination.tsx
luarmr Oct 16, 2025
eb64bb9
refactor(bem): replace Block with cn() in Hint.tsx
luarmr Oct 16, 2025
e26ad61
refactor(bem): replace Block/Elem with cn() in Button.tsx
luarmr Oct 16, 2025
d1ddd85
refactor(bem): replace Block/Elem with cn() in Range.tsx
luarmr Oct 16, 2025
ec7126d
refactor(bem): replace Block with cn() in Icon.jsx
luarmr Oct 16, 2025
80a76fd
refactor(bem): replace Block/Elem with cn() in AnnotationButton.tsx
luarmr Oct 16, 2025
c597898
refactor(bem): replace Block/Elem with cn() in AnnotationsCarousel.tsx
luarmr Oct 16, 2025
6ae6e14
refactor(bem): replace Block/Elem with cn() in Label.jsx
luarmr Oct 16, 2025
684a7c4
refactor(bem): replace Block with cn() in Menu.jsx
luarmr Oct 16, 2025
2bc2f83
refactor(bem): replace Block with cn() in TaxonomySearch.tsx
luarmr Oct 16, 2025
59d1e93
refactor(bem): replace Block/Elem with cn() in RelationsControls.tsx
luarmr Oct 16, 2025
d350deb
refactor(bem): replace Block/Elem with cn() in AutoAcceptToggle.jsx
luarmr Oct 16, 2025
5e51952
refactor(bem): replace Block/Elem with cn() in DynamicPreannotationsT…
luarmr Oct 16, 2025
c55bcb5
refactor(bem): replace Block with cn() in DropdownComponent.tsx
luarmr Oct 16, 2025
e57d73d
refactor(bem): replace Block/Elem with cn() in Tool.jsx
luarmr Oct 16, 2025
aefc2ac
refactor(bem): replace Block/Elem with cn() in OutlinerPanel.tsx
luarmr Oct 16, 2025
4488deb
refactor(bem): replace Block/Elem with cn() in AnnotationHistory.tsx
luarmr Oct 16, 2025
02713be
refactor(bem): replace Block/Elem with cn() in OutlinerTree.tsx
luarmr Oct 16, 2025
804f487
refactor(bem): replace Block/Elem with cn() in RegionLabel.tsx
luarmr Oct 16, 2025
cde33fc
refactor(bem): replace Block/Elem with cn() in Seeker.tsx
luarmr Oct 16, 2025
b58f9c9
refactor(bem): replace Block/Elem with cn() in Slider.tsx
luarmr Oct 16, 2025
cd835bc
refactor(bem): replace Block/Elem with cn() in ConfigControl.tsx
luarmr Oct 16, 2025
d6b4117
refactor(bem): replace Block/Elem with cn() in SpectrogramControl.tsx
luarmr Oct 16, 2025
71ebcb2
refactor(bem): replace Block/Elem with cn() in AudioControl.tsx
luarmr Oct 16, 2025
b4b364a
refactor(bem): replace Block/Elem with cn() in AudioUltra ConfigContr…
luarmr Oct 16, 2025
50f3493
refactor(bem): replace Block with cn() in FramesControl.tsx
luarmr Oct 16, 2025
009ffef
refactor(bem): replace Block/Elem with cn() in Controls.tsx
luarmr Oct 16, 2025
0162ab5
refactor(bem): replace Block/Elem with cn() in Timeline.tsx
luarmr Oct 16, 2025
a83b480
refactor(bem): replace Block/Elem with cn() in TopBar Controls.jsx
luarmr Oct 16, 2025
1d2408c
refactor(bem): replace Block/Elem with cn() in TopBar.jsx
luarmr Oct 16, 2025
95388b4
refactor(bem): replace Elem with cn() in Actions.jsx
luarmr Oct 16, 2025
490b380
refactor(bem): replace Block/Elem with cn() in Annotations.jsx
luarmr Oct 16, 2025
51bf772
refactor(bem): replace Block/Elem with cn() in CurrentTask.jsx
luarmr Oct 16, 2025
43df286
refactor(bem): replace Block with cn() in HistoryActions.jsx
luarmr Oct 16, 2025
505d22f
refactor(bem): replace Block/Elem with cn() in Toolbar.jsx
luarmr Oct 16, 2025
e6fc9ed
refactor(bem): replace Block/Elem with cn() in PanelBase.tsx
luarmr Oct 16, 2025
cc1c746
refactor(bem): replace Block/Elem with cn() in SidePanels.tsx
luarmr Oct 16, 2025
f1ea516
refactor(bem): replace Block/Elem with cn() in Hotkey.ts
luarmr Oct 16, 2025
887e99f
refactor(bem): replace Block/Elem with cn() in FlyoutMenu.jsx
luarmr Oct 16, 2025
d34b772
refactor(bem): replace Block/Elem with cn() in Minimap.tsx
luarmr Oct 16, 2025
43ca8f5
refactor(bem): replace Block/Elem with cn() in Frames.tsx
luarmr Oct 16, 2025
7e064ca
refactor(bem): replace Block/Elem with cn() in Keypoints.tsx
luarmr Oct 16, 2025
e1deb13
refactor(bem): replace Block/Elem with cn() in Tabs.tsx
luarmr Oct 16, 2025
d6cba7c
refactor(bem): replace Block/Elem with cn() in PanelTabsBase.tsx
luarmr Oct 16, 2025
07ae70b
refactor(bem): replace Block/Elem with cn() in SideTabsPanels.tsx
luarmr Oct 16, 2025
7677baa
refactor(bem): replace Block with cn() in RegionLabels.tsx
luarmr Oct 16, 2025
fa89d86
refactor(bem): replace Block/Elem with cn() in RegionDetails.tsx
luarmr Oct 16, 2025
64dcb99
refactor(bem): replace Block/Elem with cn() in Relations.tsx
luarmr Oct 16, 2025
a8dd6c8
refactor(bem): replace Block/Elem with cn() in RegionEditor.tsx
luarmr Oct 16, 2025
0137cb8
refactor(bem): replace Block/Elem with cn() in RegionItem.tsx
luarmr Oct 16, 2025
c8cd118
refactor(bem): replace Block/Elem with cn() in DetailsPanel.tsx
luarmr Oct 16, 2025
d198a40
refactor(bem): replace Block/Elem with cn() in BottomBar.jsx and Acti…
luarmr Oct 16, 2025
5cab075
refactor(bem): replace Block/Elem with cn() in BottomBar Controls.tsx
luarmr Oct 16, 2025
cde427c
refactor(bem): replace Block/Elem with cn() in BottomBar CurrentTask.jsx
luarmr Oct 16, 2025
b65a527
refactor(bem): replace Block/Elem with cn() in VideoCanvas.tsx and Im…
luarmr Oct 16, 2025
d09becc
refactor(bem): replace Block/Elem with cn() in AnnotationTabs.jsx and…
luarmr Oct 16, 2025
f01e20d
biome fixes and add explicit type="button" to Tool component
luarmr Oct 16, 2025
9d8be84
test: update bem mocks to include cn() function in panel tests
luarmr Oct 16, 2025
d5a25ca
test: update test assertions after removing Block/Elem mocks
luarmr Oct 16, 2025
2c121e1
useBem fixes
luarmr Oct 17, 2025
58e7c0f
Merge branch 'develop' into 'fb-bemything'
luarmr Oct 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions web/libs/editor/src/common/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import {
forwardRef,
type ForwardRefExoticComponent,
useMemo,
createElement,
} from "react";
import { Hotkey } from "../../core/Hotkey";
import { useHotkey } from "../../hooks/useHotkey";
import { Block, type CNTagName, Elem } from "../../utils/bem";
import { cn, type CNTagName } from "../../utils/bem";
import { isDefined } from "../../utils/utilities";
import "./Button.scss";

Expand Down Expand Up @@ -107,18 +108,23 @@ export const Button: ButtonType<ButtonProps> = forwardRef(

useHotkey(hotkey, rest.onClick as unknown as Keymaster.KeyHandler, hotkeyScope);

const buttonBody = (
<Block name="button" mod={mods} mix={className} ref={ref} tag={finalTag} type={type} {...rest}>
<>
{iconElem && (
<Elem tag="span" name="icon">
{iconElem}
</Elem>
)}
{iconElem && children ? <span>{children}</span> : children}
{extra !== undefined ? <Elem name="extra">{extra}</Elem> : null}
</>
</Block>
const buttonBody = createElement(
finalTag as any,
{
ref,
type,
...rest,
className: cn("button").mod(mods).mix(className).toClassName(),
},
<>
{iconElem && (
<span className={cn("button").elem("icon").toClassName()}>
{iconElem}
</span>
)}
{iconElem && children ? <span>{children}</span> : children}
{extra !== undefined ? <div className={cn("button").elem("extra").toClassName()}>{extra}</div> : null}
</>,
);

if (
Expand Down Expand Up @@ -148,9 +154,9 @@ Button.displayName = "Button";

const Group: FC<ButtonGroupProps> = ({ className, children, collapsed }) => {
return (
<Block name="button-group" mod={{ collapsed }} mix={className}>
<div className={cn("button-group").mod({ collapsed }).mix(className).toClassName()}>
{children}
</Block>
</div>
);
};

Expand Down
11 changes: 5 additions & 6 deletions web/libs/editor/src/common/Dropdown/DropdownComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from "react";
import { createPortal } from "react-dom";
import { useFullscreen } from "../../hooks/useFullscreen";
import { Block, cn } from "../../utils/bem";
import { cn } from "../../utils/bem";
import { alignElements, type Align } from "@humansignal/core/lib/utils/dom";
import { aroundTransition } from "@humansignal/core/lib/utils/transition";
import "./Dropdown.scss";
Expand Down Expand Up @@ -213,19 +213,18 @@ export const Dropdown = forwardRef<DropdownRef, DropdownProps>(
}, [props.style, dropdownIndex, minIndex, offset]);

const result = (
<Block
ref={dropdown}
name="dropdown"
<div
ref={dropdown as any}
data-testid={props.dataTestId}
mix={[props.className, visibilityClasses]}
className={rootName.mix(props.className, visibilityClasses).toClassName()}
style={{
...compositeStyles,
borderRadius: isFF(FF_DEV_3873) && 4,
}}
onClick={(e: MouseEvent) => e.stopPropagation()}
>
{content}
</Block>
</div>
);

return props.inline === true ? result : createPortal(result, document.body);
Expand Down
6 changes: 3 additions & 3 deletions web/libs/editor/src/common/Icon/Icon.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from "react";
import { Block } from "../../utils/bem";
import { cn } from "../../utils/bem";
import "./Icon.scss";

export const Icon = React.forwardRef(({ icon, ...props }, ref) => {
return (
<Block tag="span" name="icon" ref={ref}>
<span ref={ref} className={cn("icon").toClassName()}>
{React.createElement(icon, props)}
</Block>
</span>
);
});
29 changes: 17 additions & 12 deletions web/libs/editor/src/common/Label/Label.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { forwardRef } from "react";
import { Block, Elem } from "../../utils/bem";
import { createElement, forwardRef } from "react";
import { cn } from "../../utils/bem";
import "./Label.scss";

export const Label = forwardRef(
Expand All @@ -14,16 +14,21 @@ export const Label = forwardRef(
empty: !children,
};

return (
<Block ref={ref} name="field-label" mod={mods} tag={tagName} style={style} data-required={required}>
<Elem name="text">
<Elem name="content">
{text}
{description && <Elem name="description">{description}</Elem>}
</Elem>
</Elem>
<Elem name="field">{children}</Elem>
</Block>
return createElement(
tagName,
{
ref,
style,
"data-required": required,
className: cn("field-label").mod(mods).toClassName(),
},
<div className={cn("field-label").elem("text").toClassName()}>
<div className={cn("field-label").elem("content").toClassName()}>
{text}
{description && <div className={cn("field-label").elem("description").toClassName()}>{description}</div>}
</div>
</div>,
<div className={cn("field-label").elem("field").toClassName()}>{children}</div>,
);
},
);
Expand Down
11 changes: 4 additions & 7 deletions web/libs/editor/src/common/Menu/Menu.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { forwardRef, useCallback, useMemo } from "react";
import { Block, cn } from "../../utils/bem";
import { cn } from "../../utils/bem";
import { useDropdown } from "../Dropdown/DropdownTrigger";
import "./Menu.scss";
import { MenuContext } from "./MenuContext";
Expand Down Expand Up @@ -34,17 +34,14 @@ export const Menu = forwardRef(

return (
<MenuContext.Provider value={contextValue}>
<Block
<ul
ref={ref}
tag="ul"
name="menu"
mod={{ size, collapsed }}
mix={className}
className={cn("menu").mod({ size, collapsed }).mix(className).toClassName()}
style={style}
onClick={clickHandler}
>
{children}
</Block>
</ul>
</MenuContext.Provider>
);
},
Expand Down
30 changes: 15 additions & 15 deletions web/libs/editor/src/common/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type ChangeEvent, type FC, forwardRef, type KeyboardEvent, useCallback, useMemo, useState } from "react";
import { Block, Elem } from "../../utils/bem";
import { cn } from "../../utils/bem";
import { Select } from "@humansignal/ui";
import { WithHotkey } from "../Hotkey/WithHotkey";
import "./Pagination.scss";
Expand Down Expand Up @@ -66,23 +66,23 @@ export const Pagination: FC<PaginationProps> = forwardRef<any, PaginationProps>(
}, [pageSizeOptions]);

return (
<Block name="pagination" mod={{ size, outline, align, noPadding, disabled }}>
<Elem name="navigation">
<div className={cn("pagination").mod({ size, outline, align, noPadding, disabled }).toClassName()}>
<div className={cn("pagination").elem("navigation").toClassName()}>
<>
<NavigationButton
mod={["arrow-left", "arrow-left-double"]}
onClick={() => onChange?.(1)}
disabled={currentPage === 1 || disabled}
/>
<Elem name="divider" />
<div className={cn("pagination").elem("divider").toClassName()} />
</>
<NavigationButton
mod={["arrow-left"]}
onClick={() => onChange?.(currentPage - 1)}
hotkey={hotkey?.prev}
disabled={currentPage === 1 || disabled}
/>
<Elem name="input">
<div className={cn("pagination").elem("input").toClassName()}>
{inputMode ? (
<input
type="text"
Expand Down Expand Up @@ -116,8 +116,8 @@ export const Pagination: FC<PaginationProps> = forwardRef<any, PaginationProps>(
}}
/>
) : (
<Elem
name="page-indicator"
<div
className={cn("pagination").elem("page-indicator").toClassName()}
onClick={() => {
setInputMode(true);
}}
Expand All @@ -128,30 +128,30 @@ export const Pagination: FC<PaginationProps> = forwardRef<any, PaginationProps>(
/* */
}}
/>
</Elem>
</div>
)}
</Elem>
</div>
<NavigationButton
mod={["arrow-right"]}
onClick={() => onChange?.(currentPage + 1)}
disabled={currentPage === totalPages || disabled}
hotkey={hotkey?.next}
/>
<>
<Elem name="divider" />
<div className={cn("pagination").elem("divider").toClassName()} />
<NavigationButton
mod={["arrow-right", "arrow-right-double"]}
onClick={() => onChange?.(totalPages)}
disabled={currentPage === totalPages || disabled}
/>
</>
</Elem>
</div>
{pageSizeSelectable && (
<Elem name="page-size">
<div className={cn("pagination").elem("page-size").toClassName()}>
<Select value={pageSize} onChange={handleChangeSelect} options={options} />
</Elem>
</div>
)}
</Block>
</div>
);
},
);
Expand All @@ -174,7 +174,7 @@ const NavigationButton: FC<NavigationButtonProps> = ({ mod, disabled, hotkey, on

return (
<WithHotkey binging={hotkey as HotkeyList}>
<Elem name="btn" mod={buttonMod} onClick={actionHandler} />
<div className={cn("pagination").elem("btn").mod(buttonMod).toClassName()} onClick={actionHandler} />
</WithHotkey>
);
};
34 changes: 17 additions & 17 deletions web/libs/editor/src/common/Range/Range.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type CSSProperties, type FC, type MouseEvent as RMouseEvent, useCallback } from "react";
import { Block, Elem } from "../../utils/bem";
import { cn } from "../../utils/bem";
import { clamp, isDefined } from "../../utils/utilities";
import { useValueTracker } from "../Utils/useValueTracker";
import "./Range.scss";
Expand Down Expand Up @@ -138,20 +138,20 @@ export const Range: FC<RangeProps> = ({
const sizeProperty = align === "horizontal" ? "minWidth" : "minHeight";

return (
<Block name="range" mod={{ align }} style={{ [sizeProperty]: size }}>
<div className={cn("range").mod({ align }).toClassName()} style={{ [sizeProperty]: size }}>
{reverse
? maxIcon && (
<Elem name="icon" onMouseDown={increase}>
<div className={cn("range").elem("icon").toClassName()} onMouseDown={increase}>
{maxIcon}
</Elem>
</div>
)
: minIcon && (
<Elem name="icon" onMouseDown={decrease}>
<div className={cn("range").elem("icon").toClassName()} onMouseDown={decrease}>
{minIcon}
</Elem>
</div>
)}
<Elem name="body" onClick={onClick}>
<Elem name="line" />
<div className={cn("range").elem("body").toClassName()} onClick={onClick}>
<div className={cn("range").elem("line").toClassName()} />
<RangeIndicator align={align} reverse={reverse} value={currentValue} valueConvert={valueToPercentage} />
{isMultiArray ? (
arrayReverse(currentValue, reverse).map((value, i) => {
Expand Down Expand Up @@ -196,19 +196,19 @@ export const Range: FC<RangeProps> = ({
onChange={(val) => updateValue(val, true, true)}
/>
)}
</Elem>
</div>
{reverse
? minIcon && (
<Elem name="icon" onMouseDown={decrease}>
<div className={cn("range").elem("icon").toClassName()} onMouseDown={decrease}>
{minIcon}
</Elem>
</div>
)
: maxIcon && (
<Elem name="icon" onMouseDown={increase}>
<div className={cn("range").elem("icon").toClassName()} onMouseDown={increase}>
{maxIcon}
</Elem>
</div>
)}
</Block>
</div>
);
};

Expand Down Expand Up @@ -276,8 +276,8 @@ const RangeHandle: FC<RangeHandleProps> = ({
};

return (
<Elem
name="range-handle"
<div
className={cn("range").elem("range-handle").toClassName()}
style={{ [offsetProperty]: `${valueConvert(value)}%` }}
onMouseDownCapture={handleMouseDown}
onDoubleClick={handleDoubleClick}
Expand Down Expand Up @@ -318,5 +318,5 @@ const RangeIndicator: FC<RangeIndicatorProps> = ({ value, valueConvert, align, r
if (reverse && !multi) [style.top, style.bottom] = [style.bottom, style.top];
}

return <Elem name="indicator" style={style} />;
return <div className={cn("range").elem("indicator").toClassName()} style={style} />;
};
16 changes: 8 additions & 8 deletions web/libs/editor/src/common/Space/Space.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { CSSProperties, FC } from "react";
import { BemWithSpecificContext } from "../../utils/bem";
import "./Space.scss";

const { Block } = BemWithSpecificContext();
import { cn } from "../../utils/bem";
import "./Space.scss";

export interface SpaceProps {
direction?: "horizontal" | "vertical";
Expand Down Expand Up @@ -30,14 +29,15 @@ export const Space: FC<SpaceProps> = ({
...rest
}) => {
return (
<Block
name="space"
mod={{ direction, size, spread, stretch, align, collapsed, truncated }}
mix={className}
<div
style={style}
{...rest}
className={cn("space")
.mod({ direction, size, spread, stretch, align, collapsed, truncated })
.mix(className)
.toClassName()}
>
{children}
</Block>
</div>
);
};
Loading