button.js revision 79a7949ec943200ad3c7f1c20af065cf8936907d
/**
* A Button Widget
*
* @module button
* @since 3.5.0
*/
/**
* Creates a ButtonWidget
*
* @class ButtonWidget
* @extends Widget
* @param config {Object} Configuration object
* @constructor
*/
function ButtonWidget(config) {
}
/* ButtonWidget extends Widget */
CONTENT_TEMPLATE: null,
/**
* @method initializer
* @description Internal init() handler.
* @param config {Object} Config object.
* @private
*/
initializer: function(config) {
},
/**
* bindUI implementation
*
* @description Hooks up events for the widget
* @method bindUI
*/
bindUI: function() {
var button = this;
},
/**
* @method syncUI
* @description Updates button attributes
*/
syncUI: function() {
var button = this;
},
/**
* @method _afterLabelChange
* @private
*/
_afterLabelChange: function(e) {
this._uiSetLabel(e.newVal);
},
/**
* @method _afterDisabledChange
* @private
*/
_afterDisabledChange: function(e) {
this._uiSetDisabled(e.newVal);
}
}, {
// Y.Button static properties
/**
* The identity of the widget.
*
* @property NAME
* @type String
* @default 'button'
* @readOnly
* @protected
* @static
*/
NAME: 'button',
/**
* Static property used to define the default attribute configuration of
* the Widget.
*
* @property ATTRS
* @type {Object}
* @protected
* @static
*/
ATTRS: {
label: {
},
disabled: {
value: false
}
},
/**
* @property HTML_PARSER
* @type {Object}
* @protected
* @static
*/
HTML_PARSER: {
return this._getLabel();
},
}
},
/**
* List of class names used in the ButtonGroup's DOM
*
* @property CLASS_NAMES
* @type Object
* @static
*/
});
/**
* Creates a ToggleButton
*
* @class ToggleButton
* @extends ButtonWidget
* @param config {Object} Configuration object
* @constructor
*/
function ToggleButton(config) {
}
// TODO: move to ButtonCore subclass to enable toggle plugin, widget, etc.
/* ToggleButton extends ButtonWidget */
trigger: 'click',
selectedAttrName: '',
initializer: function (config) {
var button = this,
});
},
destructor: function () {
delete this.selectedAttrName;
},
/**
* @method bindUI
* @description Hooks up events for the widget
*/
bindUI: function() {
var button = this,
},
/**
* @method bindUI
* @description Syncs the UI for the widget
*/
syncUI: function() {
var button = this,
},
_afterSelectedChange: function(e){
this._uiSetSelected(e.newVal);
},
/**
* @method _uiSetSelected
* @private
*/
_uiSetSelected: function(value) {
var button = this,
},
/**
* @method toggle
* @public
*/
toggle: function() {
var button = this;
}
}, {
/**
* The identity of the widget.
*
* @property NAME
* @type {String}
* @default 'buttongroup'
* @readOnly
* @protected
* @static
*/
NAME: 'toggleButton',
/**
* Static property used to define the default attribute configuration of
* the Widget.
*
* @property ATTRS
* @type {Object}
* @protected
* @static
*/
ATTRS: {
type: {
value: 'toggle',
writeOnce: 'initOnly'
}
},
/**
* @property HTML_PARSER
* @type {Object}
* @protected
* @static
*/
HTML_PARSER: {
},
}
},
/**
* @property ARIA_STATES
* @type {Object}
* @protected
* @static
*/
/**
* @property ARIA_ROLES
* @type {Object}
* @protected
* @static
*/
/**
* List of class names used in the ButtonGroup's DOM
*
* @property CLASS_NAMES
* @type Object
* @static
*/
});
// Export
Y.Button = ButtonWidget;
Y.ToggleButton = ToggleButton;