4 lines
3.8 KiB
JavaScript
4 lines
3.8 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={TOGGLE:t.internals.ns.emission("password","toggle"),ADJUST:t.internals.ns.emission("password","adjust")},s=function(t){function s(){t.apply(this,arguments)}t&&(s.__proto__=t),s.prototype=Object.create(t&&t.prototype),s.prototype.constructor=s;var o={width:{configurable:!0},isChecked:{configurable:!0}},n={instanceClassName:{configurable:!0}};return n.instanceClassName.get=function(){return"PasswordToggle"},s.prototype.init=function(){this.listenClick(),this.ascend(e.ADJUST,this.width),this.isSwappingFont=!0,this._isChecked=this.isChecked},o.width.get=function(){var t=getComputedStyle(this.node.parentNode);return parseInt(t.width)},o.isChecked.get=function(){return this.node.checked},o.isChecked.set=function(t){this._isChecked=t,this.ascend(e.TOGGLE,t)},s.prototype.handleClick=function(){this.isChecked=!this._isChecked},s.prototype.swapFont=function(t){this.ascend(e.ADJUST,this.width)},Object.defineProperties(s.prototype,o),Object.defineProperties(s,n),s}(t.core.Instance),o=function(t){function s(){t.apply(this,arguments)}t&&(s.__proto__=t),s.prototype=Object.create(t&&t.prototype),s.prototype.constructor=s;var o={instanceClassName:{configurable:!0}};return o.instanceClassName.get=function(){return"Password"},s.prototype.init=function(){this.addAscent(e.TOGGLE,this.toggle.bind(this)),this.addAscent(e.ADJUST,this.adjust.bind(this))},s.prototype.toggle=function(t){this.descend(e.TOGGLE,t)},s.prototype.adjust=function(t){this.descend(e.ADJUST,t)},Object.defineProperties(s,o),s}(t.core.Instance),n={PASSWORD:t.internals.ns.selector("password"),INPUT:t.internals.ns.selector("password__input"),LABEL:t.internals.ns.selector("password__label"),TOOGLE:t.internals.ns.selector("password__checkbox")+' input[type="checkbox"]'},i=function(s){function o(){s.apply(this,arguments)}s&&(o.__proto__=s),o.prototype=Object.create(s&&s.prototype),o.prototype.constructor=o;var n={isRevealed:{configurable:!0}},i={instanceClassName:{configurable:!0}};return i.instanceClassName.get=function(){return"PasswordInput"},o.prototype.init=function(){this.addDescent(e.TOGGLE,this.toggle.bind(this)),this._isRevealed="password"===this.hasAttribute("type"),this.listen("keydown",this.capslock.bind(this)),this.listen("keyup",this.capslock.bind(this))},o.prototype.toggle=function(t){this.isRevealed=t,this.setAttribute("type",t?"text":"password")},n.isRevealed.get=function(){return this._isRevealed},o.prototype.capslock=function(e){e&&"function"!=typeof e.getModifierState||(e.getModifierState("CapsLock")?this.node.parentNode.setAttribute(t.internals.ns.attr("capslock"),""):this.node.parentNode.removeAttribute(t.internals.ns.attr("capslock")))},n.isRevealed.set=function(t){this._isRevealed=t,this.setAttribute("type",t?"text":"password")},Object.defineProperties(o.prototype,n),Object.defineProperties(o,i),o}(t.core.Instance),r=function(t){function s(){t.apply(this,arguments)}t&&(s.__proto__=t),s.prototype=Object.create(t&&t.prototype),s.prototype.constructor=s;var o={instanceClassName:{configurable:!0}};return o.instanceClassName.get=function(){return"PasswordLabel"},s.prototype.init=function(){this.addDescent(e.ADJUST,this.adjust.bind(this))},s.prototype.adjust=function(t){var e=Math.ceil(t/16);this.node.style.paddingRight=e+"rem"},Object.defineProperties(s,o),s}(t.core.Instance);t.password={Password:o,PasswordToggle:s,PasswordSelector:n,PasswordInput:i,PasswordLabel:r},t.internals.register(t.password.PasswordSelector.INPUT,t.password.PasswordInput),t.internals.register(t.password.PasswordSelector.PASSWORD,t.password.Password),t.internals.register(t.password.PasswordSelector.TOOGLE,t.password.PasswordToggle),t.internals.register(t.password.PasswordSelector.LABEL,t.password.PasswordLabel)}();
|
||
|
//# sourceMappingURL=password.nomodule.min.js.map
|