UNPKG

@codegouvfr/react-dsfr

Version:

French State Design System React integration library

4 lines (3 loc) 1.42 kB
/*! DSFR v1.13.2 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */ !function(){"use strict";var e=window.dsfr,t={DISMISS:e.internals.ns.event("dismiss")},s=function(s){function i(){s.apply(this,arguments)}s&&(i.__proto__=s),i.prototype=Object.create(s&&s.prototype),i.prototype.constructor=i;var n={instanceClassName:{configurable:!0}};return n.instanceClassName.get=function(){return"TagDismissible"},i.prototype.init=function(){this.listenClick()},i.prototype.handleClick=function(){switch(this.focusClosest(),e.mode){case e.Modes.ANGULAR:case e.Modes.REACT:case e.Modes.VUE:this.request(this.verify.bind(this));break;default:this.remove()}this.dispatch(t.DISMISS)},i.prototype.verify=function(){document.body.contains(this.node)&&this.warn("a TagDismissible has just been dismissed and should be removed from the dom. In "+e.mode+" mode, the api doesn't handle dom modification. An event "+t.DISMISS+" is dispatched by the element to trigger the removal")},Object.defineProperties(i,n),i}(e.core.Instance),i={PRESSABLE:e.internals.ns.selector("tag")+"[aria-pressed]",DISMISSIBLE:""+e.internals.ns.selector("tag--dismiss")};e.tag={TagDismissible:s,TagSelector:i,TagEvent:t},e.internals.register(e.tag.TagSelector.PRESSABLE,e.core.Toggle),e.internals.register(e.tag.TagSelector.DISMISSIBLE,e.tag.TagDismissible)}(); //# sourceMappingURL=tag.nomodule.min.js.map