3 lines
1.6 KiB
JavaScript
3 lines
1.6 KiB
JavaScript
/*! DSFR v1.11.2 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */
|
|
const s=window.dsfr,e={BREADCRUMB:s.internals.ns.selector("breadcrumb"),BUTTON:s.internals.ns.selector("breadcrumb__button")};class t extends s.core.Instance{constructor(){super(),this.count=0,this.focusing=this.focus.bind(this)}static get instanceClassName(){return"Breadcrumb"}init(){this.getCollapse(),this.isResizing=!0}get proxy(){const s=this;return Object.assign(super.proxy,{focus:s.focus.bind(s),disclose:s.collapse.disclose.bind(s.collapse)})}getCollapse(){const e=this.collapse;e?e.listen(s.core.DisclosureEvent.DISCLOSE,this.focusing):this.addAscent(s.core.DisclosureEmission.ADDED,this.getCollapse.bind(this))}resize(){const e=this.collapse,t=this.links;e&&t.length&&(this.isBreakpoint(s.core.Breakpoints.MD)?e.buttonHasFocus&&t[0].focus():t.indexOf(document.activeElement)>-1&&e.focus())}get links(){return[...this.querySelectorAll("a[href]")]}get collapse(){return this.element.getDescendantInstances(s.core.Collapse.instanceClassName,null,!0)[0]}focus(){this.count=0,this._focus()}_focus(){const s=this.links[0];s&&(s.focus(),this.request(this.verify.bind(this)))}verify(){if(this.count++,this.count>100)return;const s=this.links[0];s&&document.activeElement!==s&&this._focus()}get collapsePrimary(){return this.element.children.map((s=>s.getInstance("CollapseButton"))).filter((s=>null!==s&&s.hasClass(e.BUTTON)))[0]}}s.breadcrumb={BreadcrumbSelector:e,Breadcrumb:t},s.internals.register(s.breadcrumb.BreadcrumbSelector.BREADCRUMB,s.breadcrumb.Breadcrumb);
|
|
//# sourceMappingURL=breadcrumb.module.min.js.map
|