// Copyright 1999-2025. WebPros International GmbH. All rights reserved.

import { useContext, useState } from 'react';
import ResponsiveContext from '../ResponsiveContext';
export const useResponsive = () => {
  const isResponsive = useContext(ResponsiveContext);
  const isInResponsiveContext = typeof isResponsive === 'boolean';
  const [isResponsiveInternal, setIsResponsiveInternal] = useState(false);
  return {
    isResponsive: isInResponsiveContext ? isResponsive : isResponsiveInternal,
    isInResponsiveContext,
    compact: () => {
      setIsResponsiveInternal(true);
      return false;
    },
    expand: () => {
      setIsResponsiveInternal(false);
      return false;
    }
  };
};