Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

GDGT-2555 Replace deprecated CheckBox with metabase/ui Checkbox (#75372)

Egor Grushin787d9a65be03
diff --git a/e2e/test/scenarios/collections/collections.cy.spec.js b/e2e/test/scenarios/collections/collections.cy.spec.js
index 6dc714ea2a8..79ac3a7933c 100644
--- a/e2e/test/scenarios/collections/collections.cy.spec.js
+++ b/e2e/test/scenarios/collections/collections.cy.spec.js
@@ -709,18 +709,18 @@ describe("scenarios > collection defaults", () => {
selectItemUsingCheckbox("Orders");
// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
cy.findByText("1 item selected").should("be.visible");
- cy.icon("dash").should("exist");
- cy.icon("check").should("exist");
+ assertSelectAllIsIndeterminate(true);
+ getRowCheckbox("Orders").should("be.checked");
// Select all
cy.findByLabelText("Select all items").click();
- cy.icon("dash").should("not.exist");
+ assertSelectAllIsIndeterminate(false);
cy.findByTestId("toast-card").findByText(/\d+ items selected/);
// Deselect all
cy.findByLabelText("Select all items").click();
- cy.icon("check").should("not.exist");
+ cy.findAllByRole("checkbox").should("not.be.checked");
// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
cy.findByText(/item(s)? selected/).should("not.exist");
});
@@ -1287,10 +1287,20 @@ function openEllipsisMenuFor(item) {
.click({ force: true });
}
-function selectItemUsingCheckbox(item, icon = "table") {
- cy.findByText(item)
- .closest("tr")
- .within(() => cy.findByRole("checkbox").click());
+function getRowCheckbox(item) {
+ return cy.findByText(item).closest("tr").findByRole("checkbox");
+}
+
+function selectItemUsingCheckbox(item) {
+ getRowCheckbox(item).closest("button").click();
+}
+
+function assertSelectAllIsIndeterminate(isIndeterminate) {
+ cy.findByLabelText("Select all items").should(
+ "have.prop",
+ "indeterminate",
+ isIndeterminate,
+ );
}
function visitRootCollection() {
diff --git a/e2e/test/scenarios/collections/trash.cy.spec.js b/e2e/test/scenarios/collections/trash.cy.spec.js
index c0e4d68bc8a..dcf1e4db103 100644
--- a/e2e/test/scenarios/collections/trash.cy.spec.js
+++ b/e2e/test/scenarios/collections/trash.cy.spec.js
@@ -979,14 +979,18 @@ function ensureCanRestoreFromPage(name) {
}
function selectItem(name) {
- cy.findByText(name).closest("tr").findByRole("checkbox").check();
+ cy.findByText(name)
+ .closest("tr")
+ .findByRole("checkbox")
+ .closest("button")
+ .click();
}
function assertChecked(name, checked = true) {
cy.findByText(name)
.closest("tr")
.findByRole("checkbox")
- .should(checked ? "have.attr" : "not.have.attr", "checked");
+ .should(checked ? "be.checked" : "not.be.checked");
}
function assertTrashSelectedInNavigationSidebar() {
diff --git a/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js
index f4486629578..28fc5050781 100644
--- a/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js
+++ b/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js
@@ -1328,5 +1328,6 @@ function selectCollectionItem(name) {
.parent()
.parent()
.findByRole("checkbox")
+ .closest("button")
.click();
}
diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.jsx b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.jsx
index b584e7ba64f..efbe7609109 100644
--- a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.jsx
+++ b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.jsx
@@ -5,11 +5,10 @@ import { t } from "ttag";
import _ from "underscore";
import NoResults from "assets/img/no_results.svg";
-import { CheckBox } from "metabase/common/components/CheckBox";
import { EmptyState } from "metabase/common/components/EmptyState";
import AdminS from "metabase/css/admin.module.css";
import CS from "metabase/css/core/index.css";
-import { Box, Icon } from "metabase/ui";
+import { Box, Checkbox, Icon } from "metabase/ui";
import { displayNameForColumn } from "metabase/utils/formatting";
import { registerVisualization } from "metabase/visualizations/index";
import { formatValue } from "metabase/visualizations/lib/formatting";
@@ -125,7 +124,8 @@ export class AuditTableVisualization extends Component {
<tr>
{isSelectable && (
<th>
- <CheckBox
+ <Checkbox
+ size="sm"
checked={Object.values(rowChecked).some((elem) => elem)}
onChange={(e) => this.handleAllSelectClick(e, rows)}
/>
@@ -165,7 +165,8 @@ export class AuditTableVisualization extends Component {
<tr key={rowIndex}>
{isSelectable && (
<td>
- <CheckBox
+ <Checkbox
+ size="sm"
checked={rowChecked[row[ROW_ID_IDX]] || false}
onChange={(e) =>
this.handleRowSelectClick(
diff --git a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.tsx b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.tsx
index 888bd971d6d..0c07fd19487 100644
--- a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.tsx
+++ b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.tsx
@@ -7,8 +7,8 @@ import { ActionFormFieldWidget } from "metabase/actions/components/ActionFormFie
import { getFieldTypes, getInputTypes } from "metabase/actions/constants";
import type { ActionFormFieldProps } from "metabase/actions/types";
import { inputTypeHasOptions } from "metabase/actions/utils";
-import { CheckBox } from "metabase/common/components/CheckBox";
import { Radio } from "metabase/common/components/Radio";
+import { Checkbox } from "metabase/ui";
import { isNotNull } from "metabase/utils/types";
import type {
FieldSettings,
@@ -146,7 +146,14 @@ function FormFieldEditor({
<ActionFormFieldWidget
hidden={hidden}
actions={
- <CheckBox
+ <Checkbox
+ size="sm"
+ styles={{
+ label: {
+ fontSize: "12px",
+ color: "var(--mb-color-text-secondary)",
+ },
+ }}
onChange={() => {
onChange({
...fieldSettings,
diff --git a/frontend/src/metabase/common/components/CheckBox/CheckBox.stories.tsx b/frontend/src/metabase/common/components/CheckBox/CheckBox.stories.tsx
deleted file mode 100644
index c9c6ca52d35..00000000000
--- a/frontend/src/metabase/common/components/CheckBox/CheckBox.stories.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import { useArgs } from "@storybook/preview-api";
-import type { StoryFn } from "@storybook/react";
-import type { ChangeEvent } from "react";
-
-import { CheckBox } from "./CheckBox";
-
-export default {
- title: "Deprecated/Components/CheckBox",
- component: CheckBox,
-};
-
-const Template: StoryFn<typeof CheckBox> = (args) => {
- const [{ checked }, updateArgs] = useArgs();
-
- const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
- updateArgs({ checked: event.currentTarget.checked });
- };
-
- return <CheckBox {...args} checked={checked} onChange={handleChange} />;
-};
-
-export const Default = {
- render: Template,
-
- args: {
- checked: false,
- },
-};
-
-export const WithLabel = {
- render: Template,
-
- args: {
- checked: false,
- label: "Label",
- },
-};
-
-export const WithCustomLabel = {
- render: Template,
-
- args: {
- checked: false,
- label: <strong style={{ marginLeft: "8px" }}>Label</strong>,
- },
-};
diff --git a/frontend/src/metabase/common/components/CheckBox/CheckBox.styled.tsx b/frontend/src/metabase/common/components/CheckBox/CheckBox.styled.tsx
deleted file mode 100644
index 40c7702f8ff..00000000000
--- a/frontend/src/metabase/common/components/CheckBox/CheckBox.styled.tsx
+++ /dev/null
@@ -1,90 +0,0 @@
-// eslint-disable-next-line no-restricted-imports
-import styled from "@emotion/styled";
-
-import { Icon } from "metabase/ui";
-import { color } from "metabase/ui/utils/colors";
-
-import { DEFAULT_ICON_PADDING } from "./constants";
-import type {
- CheckBoxContainerProps,
- CheckBoxIconContainerProps,
- CheckBoxIconProps,
- CheckBoxInputProps,
- CheckBoxLabelProps,
-} from "./types";
-
-export const CheckBoxRoot = styled.label`
- display: block;
- position: relative;
-`;
-
-export const CheckBoxInput = styled.input<CheckBoxInputProps>`
- appearance: none;
- display: block;
- position: absolute;
- left: 0;
- right: 0;
- width: ${(props) => `${props.size}px`};
- height: 100%;
- margin: 0;
- padding: 0;
- cursor: ${(props) => (props.disabled ? "" : "pointer")};
- opacity: 0;
- z-index: 1;
-`;
-
-export const CheckBoxContainer = styled.span<CheckBoxContainerProps>`
- display: inline-flex;
- align-items: center;
- cursor: ${(props) => (props.disabled ? "" : "pointer")};
- max-width: 100%;
- opacity: ${(props) => (props.disabled ? "0.4" : "")};
-
- ${CheckBoxInput}:focus + & {
- outline: 2px solid var(--mb-color-focus);
- }
-
- ${CheckBoxInput}:focus:not(:focus-visible) + & {
- outline: none;
- }
-`;
-
-export const CheckBoxIcon = styled(Icon, {
- shouldForwardProp: (propName: string) => propName !== "uncheckedColor",
-})<CheckBoxIconProps>`
- display: block;
- padding: ${DEFAULT_ICON_PADDING / 2}px;
- color: ${(props) => color(props.checked ? "white" : props.uncheckedColor)};
- width: ${(props) => `${props.size}px`};
- height: ${(props) => `${props.size}px`};
-`;
-
-export const CheckBoxIconContainer = styled.span<CheckBoxIconContainerProps>`
- display: flex;
- justify-content: center;
- align-items: center;
- min-width: ${(props) => `${props.size}px`};
- width: ${(props) => `${props.size}px`};
- height: ${(props) => `${props.size}px`};
- border: 0.125rem solid
- ${(props) =>
- color(props.checked ? props.checkedColor : props.uncheckedColor)};
- border-radius: 0.25rem;
- background-color: ${(props) =>
- props.checked
- ? color(props.checkedColor)
- : "var(--mb-color-background-primary)"};
-`;
-
-export const CheckBoxLabel = styled.span<CheckBoxLabelProps>`
- display: block;
- margin-left: 0.5rem;
- ${({ labelEllipsis }) =>
- labelEllipsis
- ? `;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- `
- : ""}
-`;
diff --git a/frontend/src/metabase/common/components/CheckBox/CheckBox.tsx b/frontend/src/metabase/common/components/CheckBox/CheckBox.tsx
deleted file mode 100644
index ea6af2b6748..00000000000
--- a/frontend/src/metabase/common/components/CheckBox/CheckBox.tsx
+++ /dev/null
@@ -1,156 +0,0 @@
-import type {
- ChangeEvent,
- FocusEvent,
- HTMLAttributes,
- ReactElement,
- ReactNode,
- Ref,
-} from "react";
-import { forwardRef, isValidElement, useRef } from "react";
-
-import { Flex, Tooltip } from "metabase/ui";
-import type { ColorName } from "metabase/ui/colors/types";
-
-import {
- CheckBoxContainer,
- CheckBoxIcon,
- CheckBoxIconContainer,
- CheckBoxInput,
- CheckBoxLabel,
- CheckBoxRoot,
-} from "./CheckBox.styled";
-import {
- DEFAULT_CHECKED_COLOR,
- DEFAULT_ICON_PADDING,
- DEFAULT_SIZE,
- DEFAULT_UNCHECKED_COLOR,
-} from "./constants";
-import { isEllipsisActive } from "./utils";
-
-export interface CheckBoxProps extends Omit<
- HTMLAttributes<HTMLElement>,
- "onChange" | "onFocus" | "onBlur"
-> {
- name?: string;
- label?: ReactNode;
- labelEllipsis?: boolean;
- checked?: boolean;
- indeterminate?: boolean;
- disabled?: boolean;
- size?: number;
- checkedColor?: ColorName;
- uncheckedColor?: ColorName;
- autoFocus?: boolean;
- onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
- onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
- onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
-}
-
-interface CheckboxTooltipProps {
- hasTooltip: boolean;
- tooltipLabel: ReactNode;
- /**
- * The child element must be a single element as mantine Tooltip doesn't accept fragment or array as children
- */
- children: ReactElement;
-}
-
-const BaseCheckBox = forwardRef<HTMLLabelElement, CheckBoxProps>(
- function Checkbox(
- {
- name,
- id,
- label,
- labelEllipsis = false,
- checked,
- indeterminate,
- disabled = false,
- size = DEFAULT_SIZE,
- checkedColor = DEFAULT_CHECKED_COLOR,
- uncheckedColor = DEFAULT_UNCHECKED_COLOR,
- autoFocus,
- onClick,
- onChange,
- onFocus,
- onBlur,
- ...props
- }: CheckBoxProps,
- ref: Ref<HTMLLabelElement>,
- ): JSX.Element {
- const isControlledCheckBoxInput = !!onChange;
- const labelRef = useRef<HTMLSpanElement>(null);
- const hasLabelEllipsis =
- labelRef.current && isEllipsisActive(labelRef.current);
-
- return (
- <CheckBoxRoot ref={ref} {...props}>
- <CheckboxTooltip
- hasTooltip={!!(labelEllipsis && hasLabelEllipsis)}
- tooltipLabel={label}
- >
- <Flex>
- {/* the div is needed because CheckTooltip requires 1 child when hasTooltip is true */}
- <CheckBoxInput
- id={id ?? name}
- name={name}
- type="checkbox"
- checked={isControlledCheckBoxInput ? !!checked : undefined}
- defaultChecked={isControlledCheckBoxInput ? undefined : !!checked}
- size={size}
- disabled={disabled}
- autoFocus={autoFocus}
- onClick={onClick}
- onChange={isControlledCheckBoxInput ? onChange : undefined}
- onFocus={onFocus}
- onBlur={onBlur}
- />
- <CheckBoxContainer disabled={disabled}>
- <CheckBoxIconContainer
- checked={checked}
- size={size}
- checkedColor={checkedColor}
- uncheckedColor={uncheckedColor}
- >
- {(checked || indeterminate) && (
- <CheckBoxIcon
- name={indeterminate ? "dash" : "check"}
- checked={!!checked}
- size={size - DEFAULT_ICON_PADDING}
- uncheckedColor={uncheckedColor}
- />
- )}
- </CheckBoxIconContainer>
- {label &&
- (isValidElement(label) ? (
- label
- ) : (
- <CheckBoxLabel labelEllipsis={labelEllipsis} ref={labelRef}>
- {label}
- </CheckBoxLabel>
- ))}
- </CheckBoxContainer>
- </Flex>
- </CheckboxTooltip>
- </CheckBoxRoot>
- );
- },
-);
-
-function CheckboxTooltip({
- hasTooltip,
- tooltipLabel,
- children,
-}: CheckboxTooltipProps): ReactElement {
- return hasTooltip ? (
- <Tooltip label={tooltipLabel}>{children}</Tooltip>
- ) : (
- <>{children}</>
- );
-}
-
-/**
- * @deprecated: use Checkbox from "metabase/ui"
- */
-export const CheckBox = Object.assign(BaseCheckBox, {
- Label: CheckBoxLabel,
-});
diff --git a/frontend/src/metabase/common/components/CheckBox/CheckBox.unit.spec.tsx b/frontend/src/metabase/common/components/CheckBox/CheckBox.unit.spec.tsx
deleted file mode 100644
index b9d6f051d36..00000000000
--- a/frontend/src/metabase/common/components/CheckBox/CheckBox.unit.spec.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import userEvent from "@testing-library/user-event";
-
-import { render, screen } from "__support__/ui";
-
-import { CheckBox } from "./CheckBox";
-
-describe("CheckBox", () => {
- it("should receive focus on tab", async () => {
- const onChange = jest.fn();
-
- render(<CheckBox checked={false} onChange={onChange} />);
-
- const checkbox = screen.getByRole("checkbox");
- await userEvent.tab();
-
- expect(checkbox).toHaveFocus();
- });
-
- it("should change on enter", async () => {
- const onChange = jest.fn();
-
- render(<CheckBox checked={false} onChange={onChange} />);
-
- const checkbox = screen.getByRole("checkbox");
- await userEvent.tab();
- await userEvent.type(checkbox, "{Enter}");
-
- expect(onChange).toHaveBeenCalled();
- });
-
- it("should change on space", async () => {
- const onChange = jest.fn();
-
- render(<CheckBox checked={false} onChange={onChange} />);
-
- const checkbox = screen.getByRole("checkbox");
- await userEvent.tab();
- await userEvent.type(checkbox, "Space");
-
- expect(onChange).toHaveBeenCalled();
- });
-
- it("should change on click", async () => {
- const onChange = jest.fn();
-
- render(<CheckBox checked={false} onChange={onChange} />);
-
- const checkbox = screen.getByRole("checkbox");
- await userEvent.click(checkbox);
-
- expect(checkbox).toHaveFocus();
- expect(onChange).toHaveBeenCalled();
- });
-});
diff --git a/frontend/src/metabase/common/components/CheckBox/constants.ts b/frontend/src/metabase/common/components/CheckBox/constants.ts
deleted file mode 100644
index 2745bd505aa..00000000000
--- a/frontend/src/metabase/common/components/CheckBox/constants.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export const DEFAULT_SIZE = 16;
-export const DEFAULT_ICON_PADDING = 4;
-export const DEFAULT_CHECKED_COLOR = "brand";
-export const DEFAULT_UNCHECKED_COLOR = "text-tertiary";
diff --git a/frontend/src/metabase/common/components/CheckBox/index.ts b/frontend/src/metabase/common/components/CheckBox/index.ts
deleted file mode 100644
index 6b3b2cc3fb7..00000000000
--- a/frontend/src/metabase/common/components/CheckBox/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { CheckBox } from "./CheckBox";
-export type { CheckBoxProps } from "./CheckBox";
diff --git a/frontend/src/metabase/common/components/CheckBox/types.ts b/frontend/src/metabase/common/components/CheckBox/types.ts
deleted file mode 100644
index 1cf58fdd5e5..00000000000
--- a/frontend/src/metabase/common/components/CheckBox/types.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import type { ColorName } from "metabase/ui/colors/types";
-
-export interface CheckBoxInputProps {
- size: number;
-}
-
-export interface CheckBoxContainerProps {
- disabled: boolean | undefined;
-}
-
-export interface CheckBoxIconProps {
- checked: boolean;
- uncheckedColor: ColorName;
-}
-
-export interface CheckBoxIconContainerProps {
- checked: boolean | undefined;
- size: number;
- checkedColor: ColorName;
- uncheckedColor: ColorName;
-}
-
-export interface CheckBoxLabelProps {
- labelEllipsis?: boolean;
-}
diff --git a/frontend/src/metabase/common/components/CheckBox/utils.ts b/frontend/src/metabase/common/components/CheckBox/utils.ts
deleted file mode 100644
index d8499bf3df6..00000000000
--- a/frontend/src/metabase/common/components/CheckBox/utils.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export function isEllipsisActive(node: HTMLElement): boolean {
- return node.offsetWidth < node.scrollWidth;
-}
diff --git a/frontend/src/metabase/common/components/EntityItem/EntityItem.tsx b/frontend/src/metabase/common/components/EntityItem/EntityItem.tsx
index 6d66ccdb0f2..6ad111967a8 100644
--- a/frontend/src/metabase/common/components/EntityItem/EntityItem.tsx
+++ b/frontend/src/metabase/common/components/EntityItem/EntityItem.tsx
@@ -21,14 +21,13 @@ import {
isItemPinned,
isPreviewShown,
} from "metabase/collections/utils";
-import { CheckBox } from "metabase/common/components/CheckBox";
import { EntityIcon } from "metabase/common/components/EntityIcon";
import { EntityMenu } from "metabase/common/components/EntityMenu";
import { Swapper } from "metabase/common/components/Swapper";
import type { IconData } from "metabase/common/utils/icon";
import CS from "metabase/css/core/index.css";
import type { IconProps } from "metabase/ui";
-import { Ellipsified } from "metabase/ui";
+import { Checkbox, Ellipsified } from "metabase/ui";
import * as Urls from "metabase/urls";
import type { CollectionItem, IconName } from "metabase-types/api";
@@ -86,7 +85,14 @@ const EntityIconCheckBox = ({
size={iconSize}
/>
}
- swappedElement={<CheckBox checked={selected} size={iconSize} />}
+ swappedElement={
+ <Checkbox
+ checked={selected}
+ size={iconSize === 12 ? "xs" : "sm"}
+ // Visual-only; clicks are handled by the wrapping button.
+ style={{ pointerEvents: "none" }}
+ />
+ }
isSwapped={selected || showCheckbox}
/>
) : (
diff --git a/frontend/src/metabase/common/components/FormInput/FormInput.stories.tsx b/frontend/src/metabase/common/components/FormInput/FormInput.stories.tsx
index 42c8825ba4f..e95c4ec2aa6 100644
--- a/frontend/src/metabase/common/components/FormInput/FormInput.stories.tsx
+++ b/frontend/src/metabase/common/components/FormInput/FormInput.stories.tsx
@@ -2,15 +2,15 @@ import type { StoryFn } from "@storybook/react";
import { useState } from "react";
import { Form, FormProvider } from "metabase/forms";
-
-import { CheckBox } from "../CheckBox";
+import { Checkbox } from "metabase/ui";
import { FormInput } from "./FormInput";
const TitleActions = () => {
const [checked, setChecked] = useState(true);
return (
- <CheckBox
+ <Checkbox
+ size="sm"
onChange={() => setChecked((checked) => !checked)}
checked={checked}
label="Show field"
diff --git a/frontend/src/metabase/common/components/ItemsTable/Columns.tsx b/frontend/src/metabase/common/components/ItemsTable/Columns.tsx
index 1363ca6149c..40ee3cd6bb2 100644
--- a/frontend/src/metabase/common/components/ItemsTable/Columns.tsx
+++ b/frontend/src/metabase/common/components/ItemsTable/Columns.tsx
@@ -3,7 +3,6 @@ import { c, t } from "ttag";
import type { ActionMenuProps } from "metabase/collections/components/ActionMenu";
import ActionMenu from "metabase/collections/components/ActionMenu";
-import { CheckBox } from "metabase/common/components/CheckBox";
import { DateTime } from "metabase/common/components/DateTime";
import { EntityItem } from "metabase/common/components/EntityItem";
import { Markdown } from "metabase/common/components/Markdown";
@@ -11,7 +10,7 @@ import { ArchiveButton } from "metabase/embedding/components/ArchiveButton";
import { isEmbeddingSdk } from "metabase/embedding-sdk/config";
import { useTranslateContent } from "metabase/i18n/hooks";
import { PLUGIN_MODERATION } from "metabase/plugins";
-import { Ellipsified, type IconProps, Tooltip } from "metabase/ui";
+import { Checkbox, Ellipsified, type IconProps, Tooltip } from "metabase/ui";
import { modelToUrl } from "metabase/urls";
import { isTouchDevice } from "metabase/utils/browser";
import { getUserName } from "metabase/utils/user";
@@ -76,7 +75,8 @@ export const Columns = {
}) => (
<ColumnHeader>
<BulkSelectWrapper>
- <CheckBox
+ <Checkbox
+ size="sm"
checked={!!selectedItems?.length}
indeterminate={!!selectedItems?.length && !!hasUnselected}
onChange={hasUnselected ? onSelectAll : onSelectNone}
diff --git a/frontend/src/metabase/timelines/questions/components/EventCard/EventCard.tsx b/frontend/src/metabase/timelines/questions/components/EventCard/EventCard.tsx
index 394653b3218..c834a4ef042 100644
--- a/frontend/src/metabase/timelines/questions/components/EventCard/EventCard.tsx
+++ b/frontend/src/metabase/timelines/questions/components/EventCard/EventCard.tsx
@@ -2,9 +2,8 @@ import type { ChangeEvent, SyntheticEvent } from "react";
import { memo, useCallback } from "react";
import { t } from "ttag";
-import { CheckBox as Checkbox } from "metabase/common/components/CheckBox/CheckBox";
import { useScrollOnMount } from "metabase/common/hooks/use-scroll-on-mount";
-import { ActionIcon, Icon, Menu } from "metabase/ui";
+import { ActionIcon, Checkbox, Icon, Menu } from "metabase/ui";
import Settings from "metabase/utils/settings";
import { formatDateTimeWithUnit } from "metabase/visualizations/lib/formatting";
import type { IconName, Timeline, TimelineEvent } from "metabase-types/api";
@@ -82,6 +81,7 @@ const EventCard = ({
>
<CardCheckboxContainer>
<Checkbox
+ size="sm"
checked={isVisible}
onChange={handleChangeVisibility}
onClick={handleAsideClick}
diff --git a/frontend/src/metabase/timelines/questions/components/TimelineCard/TimelineCard.styled.tsx b/frontend/src/metabase/timelines/questions/components/TimelineCard/TimelineCard.styled.tsx
index 4c51244eeab..c54e994a182 100644
--- a/frontend/src/metabase/timelines/questions/components/TimelineCard/TimelineCard.styled.tsx
+++ b/frontend/src/metabase/timelines/questions/components/TimelineCard/TimelineCard.styled.tsx
@@ -1,7 +1,6 @@
// eslint-disable-next-line no-restricted-imports
import styled from "@emotion/styled";
-import { CheckBox } from "metabase/common/components/CheckBox";
import { Icon } from "metabase/ui";
export const CardRoot = styled.div`
@@ -16,10 +15,6 @@ export const CardHeader = styled.div`
cursor: pointer;
`;
-export const CardCheckbox = styled(CheckBox)`
- height: 1rem;
-`;
-
export const CardLabel = styled.span`
flex: 1 1 auto;
margin: 0 0.5rem;
diff --git a/frontend/src/metabase/timelines/questions/components/TimelineCard/TimelineCard.tsx b/frontend/src/metabase/timelines/questions/components/TimelineCard/TimelineCard.tsx
index b16ce39ba5b..91c0dae86b1 100644
--- a/frontend/src/metabase/timelines/questions/components/TimelineCard/TimelineCard.tsx
+++ b/frontend/src/metabase/timelines/questions/components/TimelineCard/TimelineCard.tsx
@@ -4,13 +4,12 @@ import { t } from "ttag";
import _ from "underscore";
import { getTimelineName } from "metabase/common/utils/timelines";
-import { Ellipsified } from "metabase/ui";
+import { Checkbox, Ellipsified } from "metabase/ui";
import type { Timeline, TimelineEvent } from "metabase-types/api";
import EventCard from "../EventCard";
import {
- CardCheckbox,
CardContent,
CardHeader,
CardIcon,
@@ -90,7 +89,8 @@ const TimelineCard = ({
onClick={handleHeaderClick}
aria-label={t`Timeline card header`}
>
- <CardCheckbox
+ <Checkbox
+ size="sm"
checked={anyEventVisible}
indeterminate={anyEventVisible && !allEventsVisible}
onClick={handleCheckboxClick}