import {memo} from "@wordpress/element"; import * as Switch from '@radix-ui/react-switch'; import { isRTL } from '@wordpress/i18n'; // @ts-ignore import Icon from '@/utils/Icon'; interface SwitchInputProps { label: string; value: boolean; id: string; onChange: (value: boolean) => void; required?: boolean; disabled?: boolean; } const SwitchInput = ({ label, value, id, onChange, disabled }:SwitchInputProps) => { const rtl = isRTL(); const thumbClassRTLPart = rtl ? "translate-x-[-15px] data-[state=checked]:translate-x-[0px]" : "translate-x-[0px] data-[state=checked]:translate-x-[15px]"; return ( {disabled && ( )} ); }; export default memo(SwitchInput);