diff --git a/web/libs/editor/src/components/BottomBar/__tests__/CurrentTask.test.tsx b/web/libs/editor/src/components/BottomBar/__tests__/CurrentTask.test.tsx index 7b28bf0a3498..77c8c4df96d5 100644 --- a/web/libs/editor/src/components/BottomBar/__tests__/CurrentTask.test.tsx +++ b/web/libs/editor/src/components/BottomBar/__tests__/CurrentTask.test.tsx @@ -1,6 +1,5 @@ import { render } from "@testing-library/react"; import { CurrentTask } from "../CurrentTask"; -import { BlockContext, cn } from "../../../utils/bem.ts"; import { FF_LEAP_1173 } from "../../../utils/feature-flags"; import { mockFF } from "../../../../__mocks__/global"; @@ -53,11 +52,7 @@ describe("CurrentTask", () => { ["skip", "postpone", "topbar:prevnext", "topbar:task-counter"].includes(interfaceName), ); - const { rerender, getByTestId } = render( - - - , - ); + const { rerender, getByTestId } = render(); expect(getByTestId("next-task").disabled).toBe(false); @@ -71,11 +66,7 @@ describe("CurrentTask", () => { ), }; - rerender( - - - , - ); + rerender(); expect(getByTestId("next-task").disabled).toBe(true); @@ -89,11 +80,7 @@ describe("CurrentTask", () => { ), }; - rerender( - - - , - ); + rerender(); expect(getByTestId("next-task").disabled).toBe(true); @@ -107,11 +94,7 @@ describe("CurrentTask", () => { ), }; - rerender( - - - , - ); + rerender(); expect(getByTestId("next-task").disabled).toBe(true); @@ -125,11 +108,7 @@ describe("CurrentTask", () => { ), }; - rerender( - - - , - ); + rerender(); expect(getByTestId("next-task").disabled).toBe(true); }); diff --git a/web/libs/editor/src/components/Label/Label.jsx b/web/libs/editor/src/components/Label/Label.jsx index e4995ffd52b4..115906538bc9 100644 --- a/web/libs/editor/src/components/Label/Label.jsx +++ b/web/libs/editor/src/components/Label/Label.jsx @@ -1,6 +1,6 @@ import chroma from "chroma-js"; import React, { useMemo } from "react"; -import { Block, Elem } from "../../utils/bem"; +import { cn } from "../../utils/bem"; import { asVars } from "../../utils/styles"; import "./Label.scss"; @@ -36,25 +36,19 @@ export const Label = React.forwardRef( }, [color]); return ( - - - {children} - - {hotkey ? ( - - {hotkey} - - ) : null} - + {children} + {hotkey ? {hotkey} : null} + ); }, ); diff --git a/web/libs/editor/src/components/TopBar/__tests__/CurrentTask.test.tsx b/web/libs/editor/src/components/TopBar/__tests__/CurrentTask.test.tsx index 7b28bf0a3498..77c8c4df96d5 100644 --- a/web/libs/editor/src/components/TopBar/__tests__/CurrentTask.test.tsx +++ b/web/libs/editor/src/components/TopBar/__tests__/CurrentTask.test.tsx @@ -1,6 +1,5 @@ import { render } from "@testing-library/react"; import { CurrentTask } from "../CurrentTask"; -import { BlockContext, cn } from "../../../utils/bem.ts"; import { FF_LEAP_1173 } from "../../../utils/feature-flags"; import { mockFF } from "../../../../__mocks__/global"; @@ -53,11 +52,7 @@ describe("CurrentTask", () => { ["skip", "postpone", "topbar:prevnext", "topbar:task-counter"].includes(interfaceName), ); - const { rerender, getByTestId } = render( - - - , - ); + const { rerender, getByTestId } = render(); expect(getByTestId("next-task").disabled).toBe(false); @@ -71,11 +66,7 @@ describe("CurrentTask", () => { ), }; - rerender( - - - , - ); + rerender(); expect(getByTestId("next-task").disabled).toBe(true); @@ -89,11 +80,7 @@ describe("CurrentTask", () => { ), }; - rerender( - - - , - ); + rerender(); expect(getByTestId("next-task").disabled).toBe(true); @@ -107,11 +94,7 @@ describe("CurrentTask", () => { ), }; - rerender( - - - , - ); + rerender(); expect(getByTestId("next-task").disabled).toBe(true); @@ -125,11 +108,7 @@ describe("CurrentTask", () => { ), }; - rerender( - - - , - ); + rerender(); expect(getByTestId("next-task").disabled).toBe(true); }); diff --git a/web/libs/editor/src/tags/control/Choice.jsx b/web/libs/editor/src/tags/control/Choice.jsx index 6df286ee3c82..580afd2350cf 100644 --- a/web/libs/editor/src/tags/control/Choice.jsx +++ b/web/libs/editor/src/tags/control/Choice.jsx @@ -11,7 +11,7 @@ import Types from "../../core/Types"; import { AnnotationMixin } from "../../mixins/AnnotationMixin"; import { TagParentMixin } from "../../mixins/TagParentMixin"; import { FF_DEV_3391, isFF } from "../../utils/feature-flags"; -import { Block, Elem } from "../../utils/bem"; +import { cn } from "../../utils/bem"; import "./Choice/Choice.scss"; import { IconChevron } from "@humansignal/ui"; import { HintTooltip } from "../../components/Taxonomy/Taxonomy"; @@ -194,16 +194,17 @@ const HtxNewChoiceView = ({ item, store }) => { const [collapsed, setCollapsed] = useState(false); const toogleCollapsed = useCallback(() => setCollapsed((collapsed) => !collapsed), []); + const CheckboxComponent = nameWrapper(item.isCheckbox ? Checkbox : Radio, item._value); + return ( - - - + { {item.html ? : item._value} {showHotkey && [{item.hotkey}]} - + {!item.isLeaf ? ( - + ) : ( false )} - + {item.nestedResults && item.children?.length ? ( - +
{Tree.renderChildren(item, item.annotation)} - +
) : null} -
+ ); }; diff --git a/web/libs/editor/src/tags/control/Choices.jsx b/web/libs/editor/src/tags/control/Choices.jsx index 321ed80b4a4c..964c7d9e476b 100644 --- a/web/libs/editor/src/tags/control/Choices.jsx +++ b/web/libs/editor/src/tags/control/Choices.jsx @@ -12,7 +12,7 @@ import Types from "../../core/Types"; import { guidGenerator } from "../../core/Helpers"; import ControlBase from "./Base"; import { AnnotationMixin } from "../../mixins/AnnotationMixin"; -import { Block } from "../../utils/bem"; +import { cn } from "../../utils/bem"; import "./Choices/Choices.scss"; import "./Choice"; @@ -292,13 +292,14 @@ const ChoicesSelectLayout = observer(({ item }) => { const HtxChoices = observer(({ item }) => { return ( - {item.layout === "select" ? : Tree.renderChildren(item, item.annotation)} - + ); }); diff --git a/web/libs/editor/src/tags/control/Labels/Labels.jsx b/web/libs/editor/src/tags/control/Labels/Labels.jsx index a70c27449145..0c28f2e50c38 100644 --- a/web/libs/editor/src/tags/control/Labels/Labels.jsx +++ b/web/libs/editor/src/tags/control/Labels/Labels.jsx @@ -11,7 +11,7 @@ import { AnnotationMixin } from "../../../mixins/AnnotationMixin"; import DynamicChildrenMixin from "../../../mixins/DynamicChildrenMixin"; import LabelMixin from "../../../mixins/LabelMixin"; import SelectedModelMixin from "../../../mixins/SelectedModel"; -import { Block } from "../../../utils/bem"; +import { cn } from "../../../utils/bem"; import ControlBase from "../Base"; import "../Label"; import "./Labels.scss"; @@ -146,9 +146,9 @@ const LabelsModel = types.compose( const HtxLabels = observer(({ item }) => { return ( - +
{Tree.renderChildren(item, item.annotation)} - +
); }); diff --git a/web/libs/editor/src/tags/control/TextArea/TextAreaRegionView.jsx b/web/libs/editor/src/tags/control/TextArea/TextAreaRegionView.jsx index 43f67ff74d82..09e452fa7c45 100644 --- a/web/libs/editor/src/tags/control/TextArea/TextAreaRegionView.jsx +++ b/web/libs/editor/src/tags/control/TextArea/TextAreaRegionView.jsx @@ -8,7 +8,7 @@ import { IconTrash } from "@humansignal/icons"; import styles from "../../../components/HtxTextBox/HtxTextBox.module.scss"; import Registry from "../../../core/Registry"; import { PER_REGION_MODES } from "../../../mixins/PerRegion"; -import { Block, Elem } from "../../../utils/bem"; +import { cn } from "../../../utils/bem"; import "./TextArea.scss"; @@ -52,7 +52,7 @@ const HtxTextAreaResultLine = forwardRef( ); const inputProps = { - className: `ant-input ${styles.input}`, + className: `ant-input ${styles.input} ${cn("textarea-tag").elem("input").toClassName()}`, value: displayValue, autoSize: isTextarea ? { minRows: 1 } : null, onChange: changeHandler, @@ -70,23 +70,27 @@ const HtxTextAreaResultLine = forwardRef( } }; + return ( - - +
+ {isTextarea ? ( +