3 lines
2 KiB
JavaScript
3 lines
2 KiB
JavaScript
/*! DSFR v1.11.2 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */
|
|
!function(){"use strict";var t=window.dsfr,e=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var o={isChecked:{configurable:!0}},n={instanceClassName:{configurable:!0}};return n.instanceClassName.get=function(){return"ToggleInput"},o.isChecked.get=function(){return this.node.checked},Object.defineProperties(e.prototype,o),Object.defineProperties(e,n),e}(t.core.Instance),o=function(t){function o(){t.apply(this,arguments)}t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o;var n={proxy:{configurable:!0},input:{configurable:!0}},r={instanceClassName:{configurable:!0}};return r.instanceClassName.get=function(){return"ToggleStatusLabel"},o.prototype.init=function(){this.register('input[id="'+this.getAttribute("for")+'"]',e),this.update(),this.isSwappingFont=!0},n.proxy.get=function(){return Object.assign.call(this,t.prototype.proxy,{update:this.update.bind(this)})},n.input.get=function(){return this.getRegisteredInstances("ToggleInput")[0]},o.prototype.update=function(){this.node.style.removeProperty("--toggle-status-width");var t=this.input.isChecked,e=getComputedStyle(this.node,":before"),o=parseFloat(e.width);this.input.node.checked=!t;var n=getComputedStyle(this.node,":before"),r=parseFloat(n.width);r>o&&(o=r),this.input.node.checked=t,this.node.style.setProperty("--toggle-status-width",o/16+"rem")},o.prototype.swapFont=function(t){this.update()},Object.defineProperties(o.prototype,n),Object.defineProperties(o,r),o}(t.core.Instance),n={STATUS_LABEL:""+t.internals.ns.selector("toggle__label")+t.internals.ns.attr.selector("checked-label")+t.internals.ns.attr.selector("unchecked-label")};t.toggle={ToggleStatusLabel:o,ToggleSelector:n},t.internals.register(t.toggle.ToggleSelector.STATUS_LABEL,t.toggle.ToggleStatusLabel)}();
|
|
//# sourceMappingURL=toggle.nomodule.min.js.map
|