button-debug.js revision 78ac1ef5c64e9e95a94bbfe859662da6d21b243a
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* A Button Widget
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @module button
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @since 3.5.0
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* Creates a ButtonWidget
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @class ButtonWidget
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @extends Widget
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @param config {Object} Configuration object
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @constructor
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright ButtonWidget.superclass.constructor.apply(this, arguments);
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright/* ButtonWidget extends Widget */
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright BOUNDING_TEMPLATE: Y.ButtonCore.prototype.TEMPLATE,
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method initializer
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @description Internal init() handler.
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @param config {Object} Config object.
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * bindUI implementation
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @description Hooks up events for the widget
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method bindUI
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright button.after('labelChange', button._afterLabelChange);
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright button.after('disabledChange', button._afterDisabledChange);
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright button.after('selectedChange', button._afterSelectedChange);
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method syncUI
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo * @description
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright button._uiSetDisabled(button.get('disabled'));
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright button._uiSetSelected(button.get('selected'));
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method _uiSetSelected
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo * @description
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright this.get('contentBox').toggleClass(ButtonWidget.CLASS_NAMES.SELECTED, value).set('aria-pressed', value); // TODO should support aria-checked (if applicable)
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method _afterLabelChange
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo * @description
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method _afterDisabledChange
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo * @description
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method _afterSelectedChange
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo * @description
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright // Y.Button static properties
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * The identity of the widget.
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @property NAME
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @type String
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @default 'button'
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * Static property used to define the default attribute configuration of
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * the Widget.
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @property ATTRS
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @type {Object}
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @property HTML_PARSER
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @type {Object}
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright return node.hasClass(ButtonWidget.CLASS_NAMES.SELECTED);
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * List of class names used in the ButtonGroup's DOM
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @property CLASS_NAMES
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @type Object
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek GathrightY.mix(ButtonWidget.prototype, Y.ButtonCore.prototype);
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* Creates a ToggleButton
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @class ToggleButton
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @extends ButtonWidget
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @param config {Object} Configuration object
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @constructor
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright ButtonWidget.superclass.constructor.apply(this, arguments);
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright// TODO: move to ButtonCore subclass to enable toggle plugin, widget, etc.
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright/* ButtonWidget extends ButtonWidget */
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * bindUI implementation
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * Hooks up events for the widget
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method bindUI
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright ToggleButton.superclass.bindUI.call(button);
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright button.get('contentBox').set('role', 'toggle');
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright button.get('contentBox').on(button.trigger, button.toggle, button);
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method select
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @description
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method unselect
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @description
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method toggle
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo * @description
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright button.set('selected', !button.get('selected'));
d35783d338067103badd5ebbb57676c129f5e563Eric Ferraiuolo}, '@VERSION@' ,{requires:['button-core', 'cssbutton', 'widget']});