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