( function ( mw, $ ) { /** * Secondary menu item * * @class * @extends OO.ui.Widget * * @constructor * @param {Object} [config] Configuration object * @cfg {string} [description] An optional description for the item * @cfg {string} [icon] An optional icon for the item * @cfg {boolean} [prioritized] The item is prioritized outside the * popup menu. */ mw.echo.ui.MenuItemWidget = function MwEchoUiMenuItemWidget( config ) { config = config || {}; // Parent constructor mw.echo.ui.MenuItemWidget.parent.call( this, config ); // Mixin constructors OO.ui.mixin.IconElement.call( this, config ); this.prioritized = !!config.prioritized; // Optional description this.descriptionLabel = new OO.ui.LabelWidget( { classes: [ 'mw-echo-ui-menuItemWidget-content-description' ], label: config.description || '' } ); this.descriptionLabel.toggle( !this.prioritized ); // Build the option this.$element .addClass( 'mw-echo-ui-menuItemWidget' ) .toggleClass( 'mw-echo-ui-menuItemWidget-prioritized', this.prioritized ) .append( this.$icon .addClass( 'mw-echo-ui-menuItemWidget-icon' ), $( '