How to use the @wordpress/element.createElement function in @wordpress/element

To help you get started, we’ve selected a few @wordpress/element 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 Automattic / newspack-plugin / assets / components / src / select-control-wordpress-components-modified / index.js View on Github external
var newValues = selectedOptions.map(function (_ref3) {
        var value = _ref3.value;
        return value;
      });
      onChange(newValues);
      return;
    }

    onChange(event.target.value);
  }; // Disable reason: A select with an onchange throws a warning

  /* eslint-disable jsx-a11y/no-onchange */


  return !isEmpty(options) && createElement(BaseControl, {
    label: label,
    id: id,
    help: help,
    className: className
  }, createElement("select", _extends({
    id: id,
    className: "components-select-control__input",
    onChange: onChangeValue,
    "aria-describedby": !!help ? "".concat(id, "__help") : undefined,
    multiple: multiple
  }, props), options.map(function (option, index) {
    return createElement("option", {
      key: "".concat(option.label, "-").concat(option.value, "-").concat(index),
      value: option.value,
      disabled: option.disabled
    }, option.label);
github WordPress / gutenberg / packages / block-editor / src / components / ignore-nested-events / index.js View on Github external
// Re-map the prop to the local proxy handler to check whether
				// the event has already been handled.
				const proxiedPropName = 'on' + match[ 1 ];
				result[ proxiedPropName ] = this.proxyEvent;

				// Assign event -> propName into an instance variable, so as to
				// avoid re-renders which could be incurred either by setState
				// or in mapping values to a newly created function.
				this.eventMap[ match[ 1 ].toLowerCase() ] = proxiedPropName;
			}

			return result;
		}, {} );

		return createElement( tagName, { ref: forwardedRef, ...props, ...eventHandlers } );
	}
}
github wordpress-mobile / gutenberg-mobile / src / block-management / block-picker.js View on Github external
iconWithUpdatedFillColor( color: string, icon: Object ) {
		if ( 'string' === typeof icon.src ) {
			return (
				
			);
		} else if ( icon.src && ( icon.src.type === 'svg' || icon.src.type === SVG ) ) {
			return (
				<svg color="" style="{" xmlns="{" viewBox="{">
					{ icon.src.props.children }
				</svg>
			);
		} else if ( 'function' === typeof icon.src ) {
			if ( icon.src.prototype instanceof Component ) {
				return createElement( icon.src, { fill: color, size: styles.modalIcon.width } );
			}
			return icon.src( { fill: color, size: styles.modalIcon.width } );
		}
	}
github Automattic / newspack-plugin / assets / wizards / popups / index.js View on Github external
/&gt;
									) }
								/&gt;
								  } /&gt;
								
							
						
					);
				} }
			/&gt;
		);
	}
}

render(
	createElement( withWizard( PopupsWizard, [ 'jetpack', 'newspack-popups' ] ) ),
	document.getElementById( 'newspack-popups-wizard' )
);
github Automattic / sensei / assets / components / course-lessons / index.jsx View on Github external
const lessonElements = lessons.map(( lesson ) => {
            return (
                createElement('tr', {key: lesson.lesson_id},
                    createElement('td', null,
                        createElement('span', null, lesson.order + ' '),
                        createElement('a', {href: lesson.edit_link}, lesson.title )),
                    createElement('td', null,
                        createElement('a', {href:'#', onClick: ( e ) => { this.trashLesson( e, lesson.lesson_id )}}, 'Trash')))

            );
        });
github Automattic / sensei / assets / components / course-lessons / index.jsx View on Github external
return createElement('div', null,
            createElement( 'table', { className: 'wp-list-table widefat fixed striped posts' },
            createElement( 'tbody', null, lessonElements )),
            createElement( 'hr', null ),
            createElement( 'input', {type: 'text', name: 'add-new-lesson', value: this.state.inputText, onChange: (e) => {
                this.setState({inputText: e.target.value } );
                }}),
            createElement('a', {className: 'button button-primary button-large', onClick: ( e ) => { this.createNewLesson(e); }}, 'Add New')
        );
    }
}


ReactDOM.render( createElement(CourseOutline, {courseID: window.senseiLMSAdminEditCourseID}), document.getElementById( 'sensei-component-course-lesson-container' ) );
github WordPress / gutenberg / packages / components / src / primitives / svg / index.js View on Github external
export const Path = ( props ) => createElement( 'path', props );
export const Polygon = ( props ) => createElement( 'polygon', props );
github Automattic / sensei / assets / components / course-lessons / index.jsx View on Github external
const lessonElements = lessons.map(( lesson ) => {
            return (
                createElement('tr', {key: lesson.lesson_id},
                    createElement('td', null,
                        createElement('span', null, lesson.order + ' '),
                        createElement('a', {href: lesson.edit_link}, lesson.title )),
                    createElement('td', null,
                        createElement('a', {href:'#', onClick: ( e ) => { this.trashLesson( e, lesson.lesson_id )}}, 'Trash')))

            );
        });


        return createElement('div', null,
            createElement( 'table', { className: 'wp-list-table widefat fixed striped posts' },
            createElement( 'tbody', null, lessonElements )),
            createElement( 'hr', null ),
            createElement( 'input', {type: 'text', name: 'add-new-lesson', value: this.state.inputText, onChange: (e) => {
                this.setState({inputText: e.target.value } );
                }}),
            createElement('a', {className: 'button button-primary button-large', onClick: ( e ) => { this.createNewLesson(e); }}, 'Add New')
        );
    }
}
github Automattic / newspack-plugin / assets / wizards / seo / index.js View on Github external
headerIcon={  }
									headerText={ __( 'SEO' ) }
									subHeaderText={ __( 'Search engine and social optimization' ) }
								/&gt;
							) }
						/&gt;
						
					
				
			
		);
	}
}

render(
	createElement( withWizard( SEOWizard, [ 'wordpress-seo', 'jetpack' ] ) ),
	document.getElementById( 'newspack-seo-wizard' )
);
github Automattic / sensei / assets / components / course-lessons / index.jsx View on Github external
const lessonElements = lessons.map(( lesson ) => {
            return (
                createElement('tr', {key: lesson.lesson_id},
                    createElement('td', null,
                        createElement('span', null, lesson.order + ' '),
                        createElement('a', {href: lesson.edit_link}, lesson.title )),
                    createElement('td', null,
                        createElement('a', {href:'#', onClick: ( e ) => { this.trashLesson( e, lesson.lesson_id )}}, 'Trash')))

            );
        });