removes unused checkbox ref + fixes styles for menu checkbox items

This commit is contained in:
sergeyteleshev
2025-06-04 16:51:18 +02:00
parent 7b8e265f7b
commit 73c870ae94
3 changed files with 3 additions and 17 deletions
@@ -33,7 +33,7 @@
--dbv-kit-checkbox-large-height: 24px;
--dbv-kit-checkbox-xlarge-height: 28px;
--dbv-kit-checkbox-small-font-size: 12px;
--dbv-kit-checkbox-small-font-size: 14px;
--dbv-kit-checkbox-medium-font-size: 14px;
--dbv-kit-checkbox-large-font-size: 16px;
--dbv-kit-checkbox-xlarge-font-size: 18px;
@@ -8,7 +8,6 @@
import { Checkbox as UiKitCheckbox, clsx } from '@dbeaver/ui-kit';
import './CheckboxMarkup.css';
import { useLayoutEffect, useRef } from 'react';
import type { ControlSize } from '@dbeaver/ui-kit/types/controls';
export type CheckboxMod = 'primary' | 'surface' | 'small';
@@ -34,17 +33,9 @@ export const CheckboxMarkup: React.FC<ICheckboxMarkupProps> = function CheckboxM
children,
...rest
}) {
const checkboxRef = useRef<HTMLInputElement>(null);
useLayoutEffect(() => {
if (checkboxRef.current) {
checkboxRef.current.indeterminate = indeterminate || false;
}
});
return (
<div className={clsx('checkboxMarkup', `checkboxMarkup--${variant}`, className)} title={title}>
<UiKitCheckbox ref={checkboxRef} id={id || rest.name} indeterminate={indeterminate} disabled={rest.disabled || readOnly} size={size} {...rest}>
<UiKitCheckbox id={id || rest.name} indeterminate={indeterminate} disabled={rest.disabled || readOnly} size={size} {...rest}>
{label}
{caption && <span className="checkboxCaption">{caption}</span>}
</UiKitCheckbox>
@@ -68,12 +68,7 @@ export const MenuActionElement = observer<IMenuActionElementProps>(function Menu
checked={checked}
onClick={handleClick}
>
<MenuItemElement
label={actionInfo.label}
icon={<Checkbox variant="secondary" checked={checked} size="small" />}
tooltip={actionInfo.tooltip}
loading={loading}
/>
<MenuItemElement label={actionInfo.label} icon={<Checkbox checked={checked} size="small" />} tooltip={actionInfo.tooltip} loading={loading} />
</MenuItemCheckbox>
);
}