06c1e33a270f80929bf9b9dde81f4061d1949fffDerek GathrightYUI.add('button', function(Y) {
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright/**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* A Button Widget
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright*
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @module button
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @since 3.5.0
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright*/
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathrightvar CLASS_NAMES = Y.ButtonCore.CLASS_NAMES,
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright ARIA_STATES = Y.ButtonCore.ARIA_STATES,
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright ARIA_ROLES = Y.ButtonCore.ARIA_ROLES;
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright/**
a504e2ec9011689b5767651880ff46b5375b1921Derek Gathright* Creates a Button
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright*
a504e2ec9011689b5767651880ff46b5375b1921Derek Gathright* @class Button
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @extends Widget
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @param config {Object} Configuration object
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @constructor
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright*/
a504e2ec9011689b5767651880ff46b5375b1921Derek Gathrightfunction Button(config) {
a504e2ec9011689b5767651880ff46b5375b1921Derek Gathright Button.superclass.constructor.apply(this, arguments);
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright}
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
a504e2ec9011689b5767651880ff46b5375b1921Derek Gathright/* Button extends Widget */
a504e2ec9011689b5767651880ff46b5375b1921Derek GathrightY.extend(Button, Y.Widget, {
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright BOUNDING_TEMPLATE: Y.ButtonCore.prototype.TEMPLATE,
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright CONTENT_TEMPLATE: null,
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright /**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method initializer
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @description Internal init() handler.
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @param config {Object} Config object.
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @private
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright */
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright initializer: function(config) {
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright this._host = this.get('boundingBox');
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright },
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright /**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * bindUI implementation
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright *
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @description Hooks up events for the widget
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method bindUI
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright */
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright bindUI: function() {
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright var button = this;
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright button.after('labelChange', button._afterLabelChange);
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright button.after('disabledChange', button._afterDisabledChange);
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright },
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright /**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method syncUI
acbf78fbb0e5ea3c5353314fcbaa6b7e3b82ad7cDerek Gathright * @description Updates button attributes
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright */
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright syncUI: function() {
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright var button = this;
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright button._uiSetLabel(button.get('label'));
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright button._uiSetDisabled(button.get('disabled'));
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright },
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright /**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method _afterLabelChange
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @private
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright */
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright _afterLabelChange: function(e) {
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright this._uiSetLabel(e.newVal);
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright },
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright /**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method _afterDisabledChange
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @private
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright */
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright _afterDisabledChange: function(e) {
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright this._uiSetDisabled(e.newVal);
d35783d338067103badd5ebbb57676c129f5e563Eric Ferraiuolo }
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright}, {
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright // Y.Button static properties
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright /**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * The identity of the widget.
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright *
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @property NAME
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @type String
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @default 'button'
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @readOnly
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @protected
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @static
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright */
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright NAME: 'button',
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo /**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * Static property used to define the default attribute configuration of
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * the Widget.
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright *
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @property ATTRS
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @type {Object}
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @protected
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @static
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright */
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright ATTRS: {
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright label: {
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright value: Y.ButtonCore.ATTRS.label.value
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright },
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright disabled: {
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright value: false
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright }
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright },
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo /**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @property HTML_PARSER
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @type {Object}
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @protected
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @static
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright */
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright HTML_PARSER: {
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright label: function(node) {
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright this._host = node; // TODO: remove
d0f9ee99aee2d631a24062cd95d30c1d6955fc0fDerek Gathright return this._getLabel();
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright },
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright disabled: function(node) {
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright return node.getDOMNode().disabled;
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright }
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright },
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright /**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * List of class names used in the ButtonGroup's DOM
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright *
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @property CLASS_NAMES
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @type Object
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @static
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright */
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright CLASS_NAMES: CLASS_NAMES
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright});
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
a504e2ec9011689b5767651880ff46b5375b1921Derek GathrightY.mix(Button.prototype, Y.ButtonCore.prototype);
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright/**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* Creates a ToggleButton
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright*
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @class ToggleButton
a504e2ec9011689b5767651880ff46b5375b1921Derek Gathright* @extends Button
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @param config {Object} Configuration object
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright* @constructor
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright*/
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathrightfunction ToggleButton(config) {
a504e2ec9011689b5767651880ff46b5375b1921Derek Gathright Button.superclass.constructor.apply(this, arguments);
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright}
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright// TODO: move to ButtonCore subclass to enable toggle plugin, widget, etc.
a504e2ec9011689b5767651880ff46b5375b1921Derek Gathright/* ToggleButton extends Button */
a504e2ec9011689b5767651880ff46b5375b1921Derek GathrightY.extend(ToggleButton, Button, {
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright trigger: 'click',
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright selectedAttrName: '',
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright initializer: function (config) {
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright var button = this,
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright type = button.get('type'),
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright selectedAttrName = (type === "checkbox" ? 'checked' : 'pressed'),
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright selectedState = config[selectedAttrName] || false;
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright // Create the checked/pressed attribute
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright button.addAttr(selectedAttrName, {
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright value: selectedState
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright });
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright button.selectedAttrName = selectedAttrName;
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright },
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright destructor: function () {
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright delete this.selectedAttrName;
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright },
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright /**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method bindUI
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @description Hooks up events for the widget
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright */
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright bindUI: function() {
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright var button = this,
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright cb = button.get('contentBox');
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright ToggleButton.superclass.bindUI.call(button);
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright cb.on(button.trigger, button.toggle, button);
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright button.after(button.selectedAttrName + 'Change', button._afterSelectedChange);
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright },
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright /**
a504e2ec9011689b5767651880ff46b5375b1921Derek Gathright * @method syncUI
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @description Syncs the UI for the widget
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright */
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright syncUI: function() {
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright var button = this,
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright cb = button.get('contentBox'),
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright type = button.get('type'),
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright ROLES = ToggleButton.ARIA_ROLES,
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright role = (type === 'checkbox' ? ROLES.CHECKBOX : ROLES.TOGGLE),
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright selectedAttrName = button.selectedAttrName;
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright ToggleButton.superclass.syncUI.call(button);
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright cb.set('role', role);
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright button._uiSetSelected(button.get(selectedAttrName));
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright },
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright _afterSelectedChange: function(e){
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright this._uiSetSelected(e.newVal);
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright },
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright /**
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright * @method _uiSetSelected
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @private
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright */
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright _uiSetSelected: function(value) {
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright var button = this,
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright cb = button.get('contentBox'),
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright STATES = ToggleButton.ARIA_STATES,
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright type = button.get('type'),
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright ariaState = (type === 'checkbox' ? STATES.CHECKED : STATES.PRESSED);
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright
a504e2ec9011689b5767651880ff46b5375b1921Derek Gathright cb.toggleClass(Button.CLASS_NAMES.SELECTED, value);
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright cb.set(ariaState, value);
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright },
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright /**
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @method toggle
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @description Toggles the selected/pressed/checked state of a ToggleButton
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright * @public
6ba8d3cf563f904d8a71f8408553c2a10431ea7dDerek Gathright */
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright toggle: function() {
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright var button = this;
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright button._set(button.selectedAttrName, !button.get(button.selectedAttrName));
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright }
78ac1ef5c64e9e95a94bbfe859662da6d21b243aEric Ferraiuolo
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright}, {
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright /**
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * The identity of the widget.
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright *
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @property NAME
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @type {String}
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @default 'buttongroup'
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @readOnly
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @protected
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @static
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright */
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright NAME: 'toggleButton',
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright /**
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * Static property used to define the default attribute configuration of
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * the Widget.
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright *
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @property ATTRS
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @type {Object}
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @protected
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @static
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright */
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright ATTRS: {
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright type: {
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright value: 'toggle',
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright writeOnce: 'initOnly'
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright }
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright },
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright /**
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @property HTML_PARSER
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @type {Object}
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @protected
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @static
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright */
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright HTML_PARSER: {
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright checked: function(node) {
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright return node.hasClass(CLASS_NAMES.SELECTED);
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright },
293b35d70157aeec052a53d4a3ecf875cb7c358bDerek Gathright pressed: function(node) {
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright return node.hasClass(CLASS_NAMES.SELECTED);
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright }
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright },
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright /**
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @property ARIA_STATES
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @type {Object}
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @protected
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @static
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright */
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright ARIA_STATES: ARIA_STATES,
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright /**
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @property ARIA_ROLES
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @type {Object}
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @protected
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @static
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright */
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright ARIA_ROLES: ARIA_ROLES,
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright /**
a504e2ec9011689b5767651880ff46b5375b1921Derek Gathright * Array of static constants used to identify the classnames applied to DOM nodes
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright *
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @property CLASS_NAMES
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @type Object
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright * @static
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright */
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright CLASS_NAMES: CLASS_NAMES
a22e94e50e241a5ae089c072604fec309a0db44eDerek Gathright
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright});
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright// Export
a504e2ec9011689b5767651880ff46b5375b1921Derek GathrightY.Button = Button;
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek GathrightY.ToggleButton = ToggleButton;
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
06c1e33a270f80929bf9b9dde81f4061d1949fffDerek Gathright
d35783d338067103badd5ebbb57676c129f5e563Eric Ferraiuolo}, '@VERSION@' ,{requires:['button-core', 'cssbutton', 'widget']});