4 lines
2.4 KiB
JavaScript
4 lines
2.4 KiB
JavaScript
|
/*! DSFR v1.11.2 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */
|
||
|
!function(){"use strict";var e=window.dsfr,t={SEGMENTED:e.internals.ns.selector("segmented"),SEGMENTED_ELEMENTS:e.internals.ns.selector("segmented__elements"),SEGMENTED_ELEMENT:e.internals.ns.selector("segmented__element input"),SEGMENTED_LEGEND:e.internals.ns.selector("segmented__legend")},n={ADDED:e.internals.ns.emission("segmented","added"),REMOVED:e.internals.ns.emission("segmented","removed")},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 o={instanceClassName:{configurable:!0}};return o.instanceClassName.get=function(){return"Segmented"},i.prototype.init=function(){this.elements=this.node.querySelector(t.SEGMENTED_ELEMENTS),this.legend=this.node.querySelector(t.SEGMENTED_LEGEND),this.addAscent(n.ADDED,this.resize.bind(this)),this.addAscent(n.REMOVED,this.resize.bind(this)),this._isLegendInline=this.legend&&this.legend.classList.contains(e.prefix+"-segmented__legend--inline"),this.isResizing=!0},i.prototype.resize=function(){var t=e.prefix+"-segmented--vertical",n=e.prefix+"-segmented__legend--inline";this.removeClass(t),this._isLegendInline&&(this.legend.classList.add(n),(this.node.offsetWidth>this.node.parentNode.offsetWidth||this.elements.scrollWidth+this.legend.offsetWidth+16>this.node.parentNode.offsetWidth)&&this.legend.classList.remove(n)),this.elements.offsetWidth>this.node.parentNode.offsetWidth||this.elements.scrollWidth>this.node.parentNode.offsetWidth?this.addClass(t):this.removeClass(t)},Object.defineProperties(i,o),i}(e.core.Instance),i=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var s={instanceClassName:{configurable:!0}};return s.instanceClassName.get=function(){return"SegmentedElement"},t.prototype.init=function(){this.ascend(n.ADDED)},t.prototype.dispose=function(){this.ascend(n.REMOVED)},Object.defineProperties(t,s),t}(e.core.Instance);e.segmented={SegmentedSelector:t,SegmentedEmission:n,SegmentedElement:i,Segmented:s},e.internals.register(e.segmented.SegmentedSelector.SEGMENTED,e.segmented.Segmented),e.internals.register(e.segmented.SegmentedSelector.SEGMENTED_ELEMENT,e.segmented.SegmentedElement)}();
|
||
|
//# sourceMappingURL=segmented.nomodule.min.js.map
|