UNPKG

kendo-ui-core

Version:

Kendo UI is everything you need to build sites and apps with HTML5 & JavaScript. Kendo UI Core is the free and open-source version of Kendo UI that provides access to the web's best UI widgets and key framework features, essential for developing great exp

17 lines 2.65 kB
/*! * Copyright 2026 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import"./index.es-iFC2Ux1y.js";import"./core-COCvCZRc.js";import"./kendo.core.js";import"./kendo.button.js";const e={id:`togglebutton`,name:`ToggleButton`,category:`web`,description:`The ToggleButton widget displays styled buttons with selected state.`,depends:[`core`,`button`]};(function(e,t){var n=window.kendo,r=n.ui.Button,i=`click`,a=`toggle`,o=`.kendoToggleButton`,s=`aria-pressed`,c=`k-selected`,l=`data-group`,u=`id`,d=r.extend({init:function(e,t){var i=this;r.fn.init.call(i,e,t),e=i.wrapper=i.element,t=i.options,i._selected=t.selected===!0,i.toggle(i._selected),t.group&&e.attr(l,t.group),n.notify(i)},destroy:function(){var e=this;e.wrapper.off(o),r.fn.destroy.call(e)},events:[i,a],options:{name:`ToggleButton`,group:t,selected:!1,toggleIcon:``,applySelectedState:!0,applyToggleIcon:!1},toggle:function(e){let n=this;e===t&&(e=!this._selected),this._selected=e,e===!0?(this.element.attr(s,!0),this.options.applySelectedState&&this.element.addClass(c),this.options.applyToggleIcon&&this.options.toggleIcon&&n._updateIcon(n.options.toggleIcon)):e===!1&&(this.element.attr(s,!1),this.options.applySelectedState&&this.element.removeClass(c),this.options.applyToggleIcon&&n._updateIcon(n.options.icon))},_updateIcon:function(e){let t=this.element.find(`.k-icon, .k-svg-icon`);t.length&&n.ui.icon(t,{icon:e})},_click:function(e){this.options.enable&&(this.trigger(i,{event:e,id:this.element.attr(u),target:this.element})?e.preventDefault():(this.toggle(),this.trigger(a,{event:e,checked:this._selected,group:this.options.group,id:this.element.attr(u),target:this.element})))}});n.cssProperties.registerPrefix(`ToggleButton`,`k-button-`),n.cssProperties.registerValues(`ToggleButton`,[{prop:`fillMode`,values:n.cssProperties.fillModeValues.concat([`link`])},{prop:`rounded`,values:n.cssProperties.roundedValues.concat([[`full`,`full`]])}]),n.ui.plugin(d)})(window.kendo.jQuery);var t=kendo;export{e as __meta__,t as default}; //# sourceMappingURL=kendo.togglebutton.js.map