How to use the @wordpress/compose.compose function in @wordpress/compose

To help you get started, we’ve selected a few @wordpress/compose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gambitph / Stackable / src / block / icon-list / save.js View on Github external
'ugb-icon-list--display-grid': displayAsGrid,
	}, design, props ) )

	return (
		 (
			
				
			
		) } />
	)
}

export default compose(
	withUniqueClass,
	withBlockStyles( createStyles ),
)( save )
github gambitph / Stackable / src / block / button / edit.js View on Github external
/>
				}
				{ showButton3 &&
					
				}
			
		) } />
	)
}

export default compose(
	withUniqueClass,
	withSetAttributeHook,
	withGoogleFont,
	withTabbedInspector(),
	withContentAlignReseter(),
	withBlockStyles( createStyles, { editorMode: true } ),
	withClickOpenInspector( [
		[ '.ugb-button1', 'button1' ],
		[ '.ugb-button2', 'button2' ],
		[ '.ugb-button3', 'button3' ],
	] )
)( edit )
github WordPress / gutenberg / packages / edit-post / src / components / sidebar / post-taxonomies / taxonomy-panel.js View on Github external
if ( ! taxonomyMenuName ) {
		return null;
	}

	return (
		
			{ children }
		
	);
}

export default compose(
	withSelect( ( select, ownProps ) => {
		const slug = get( ownProps.taxonomy, [ 'slug' ] );
		const panelName = slug ? `taxonomy-panel-${ slug }` : '';
		return {
			panelName,
			isEnabled: slug ?
				select( 'core/edit-post' ).isEditorPanelEnabled( panelName ) :
				false,
			isOpened: slug ?
				select( 'core/edit-post' ).isEditorPanelOpened( panelName ) :
				false,
		};
	} ),
	withDispatch( ( dispatch, ownProps ) => ( {
		onTogglePanel: () => {
			dispatch( 'core/edit-post' ).toggleEditorPanelOpened( ownProps.panelName );
github LearnPress / learnpress / assets / src / js / frontend / quiz / components / questions / index.js View on Github external
?  : ''
							);
						} ) }
					
				
			
		);
	}
}

export default compose(
	withSelect( ( select, a, b ) => {
		const {
			getData,
			getQuestions,
		} = select( 'learnpress/quiz' );
		return {
			status: getData( 'status' ),
			currentQuestion: getData( 'currentQuestion' ),
			questions: getQuestions(),
			questionsRendered: getData( 'questionsRendered' ),
			isReviewing: getData( 'mode' ) === 'reviewing',
			numPages: getData( 'numPages' ),
			currentPage: getData( 'currentPage' ),
			questionsPerPage: getData( 'questionsPerPage' ) || 1,
		};
	} ),
github htmlburger / carbon-fields / packages / core / fields / media-gallery / index.js View on Github external
} );
				} );

				break;
		}
	};
}

const applyWithState = withState( {
	attachmentsData: [],
	selectedItem: null
} );

const applyWithEffects = withEffects( aperture, { handler } );

export default compose(
	applyWithState,
	applyWithEffects
)( MediaGalleryField );
github gambitph / Stackable / src / components / blend-mode-control / index.js View on Github external
{ value: 'color', label: __( 'Color', i18n ) },
				{ value: 'luminosity', label: __( 'Luminosity', i18n ) },
				{ value: 'initial', label: __( 'Initial', i18n ) },
				{ value: 'inherit', label: __( 'Inherit', i18n ) },
				{ value: 'unset', label: __( 'Unset', i18n ) },
			] }
		/>
	)
}

BlendModeControl.defaultProps = {
	label: __( 'Mix Blend Mode', i18n ),
	help: __( 'Not supported in all browsers.', i18n ),
}

export default compose(
	withHelpTip( 'background-blend-mode' )
)( BlendModeControl )
github gambitph / Stackable / src / block / notification / edit.js View on Github external
}
				
			
		) } />
	)
}

export default compose(
	withUniqueClass,
	withSetAttributeHook,
	withGoogleFont,
	withTabbedInspector(),
	withContentAlignReseter( [ 'Icon%sAlign', 'Title%sAlign', 'Description%sAlign', 'Button%sAlign' ] ),
	withBlockStyles( createStyles, { editorMode: true } ),
	withClickOpenInspector( [
		[ '.ugb-notification__item', 'column-background' ],
		[ '.ugb-notification__close-button', 'dismissible' ],
		[ '.ugb-notification__icon svg', 'icon' ],
		[ '.ugb-notification__title', 'title' ],
		[ '.ugb-notification__description', 'description' ],
		[ '.ugb-button', 'button' ],
	] ),
)( edit )
github htmlburger / carbon-fields / packages / core / fields / association / index.js View on Github external
addFilter( 'carbon-fields.association.validate', 'carbon-fields/core', ( field, value ) => {
	const { min, required } = field;

	if ( required && isEmpty( value ) ) {
		return __( 'This field is required.', 'carbon-fields-ui' );
	}

	if ( min > 0 && value.length < min ) {
		return sprintf( __( 'Minimum number of items not reached (%s items)', 'carbon-fields-ui' ), [ field.min ] );
	}

	return null;
} );

export default compose(
	applyWithState,
	applyWithEffects
)( AssociationField );
github WordPress / gutenberg / packages / block-editor / src / components / inserter / menu.native.js View on Github external
}
				/>
			
		);
	}
}

export default compose(
	withSelect( ( select, { clientId, isAppender, rootClientId } ) => {
		const {
			getInserterItems,
			getBlockName,
			getBlockRootClientId,
			getBlockSelectionEnd,
		} = select( 'core/block-editor' );
		const {
			getChildBlockNames,
		} = select( 'core/blocks' );

		let destinationRootClientId = rootClientId;
		if ( ! destinationRootClientId && ! clientId && ! isAppender ) {
			const end = getBlockSelectionEnd();
			if ( end ) {
				destinationRootClientId = getBlockRootClientId( end ) || undefined;
github WordPress / gutenberg / packages / edit-post / src / components / layout / index.js View on Github external
{
							isMobileViewport && sidebarIsOpened && 
						}
					
				) }
			
			
			
		
	);
}

export default compose(
	withSelect( ( select ) => ( {
		mode: select( 'core/edit-post' ).getEditorMode(),
		editorSidebarOpened: select( 'core/edit-post' ).isEditorSidebarOpened(),
		pluginSidebarOpened: select( 'core/edit-post' ).isPluginSidebarOpened(),
		publishSidebarOpened: select( 'core/edit-post' ).isPublishSidebarOpened(),
		hasFixedToolbar: select( 'core/edit-post' ).isFeatureActive( 'fixedToolbar' ),
		hasActiveMetaboxes: select( 'core/edit-post' ).hasMetaBoxes(),
		isSaving: select( 'core/edit-post' ).isSavingMetaBoxes(),
		isRichEditingEnabled: select( 'core/editor' ).getEditorSettings().richEditingEnabled,
	} ) ),
	withDispatch( ( dispatch ) => {
		const { closePublishSidebar, togglePublishSidebar } = dispatch( 'core/edit-post' );
		return {
			closePublishSidebar,
			togglePublishSidebar,
		};