PageSourceSearch

https://dz.diesel.com/on/demandware.static/Sites-DieselWW-Site/-/e…/js/component-AccordionNew.chunks.js

js diesel.com collected 2026-09-24 08:41:31 UTC 9,270 bytes, 2 lines download raw bytes

1/*! For license information please see component-AccordionNew.chunks.js.LICENSE.txt */
2(self.webpackChunkapp_project=self.webpackChunkapp_project||[]).push([[2683],{68171:e=>{"use strict";var t,n,s;t=window,n=0,s=function e(t,s){var i=this,o=this,r=!1;if(Array.isArray(t))return!!t.length&&t.map((function(t){return new e(t,s)}));var a={init:function(){var e=this;this.options=Object.assign({duration:600,ariaEnabled:!0,collapse:!0,showMultiple:!1,openOnInit:[],elementClass:"ac",triggerClass:"ac-trigger",panelClass:"ac-panel",activeClass:"is-active",beforeOpen:function(){},onOpen:function(){},beforeClose:function(){},onClose:function(){}},s);var i=this.options,r=i.elementClass,a=i.openOnInit,c="string"==typeof t;this.container=c?document.querySelector(t):t,this.elements=Array.from(this.container.childNodes).filter((function(e){return e.classList&&e.classList.contains(r)})),this.firstElement=this.elements[0],this.lastElement=this.elements[this.elements.length-1],this.currFocusedIdx=0,this.elements.map((function(t,s){return t.classList.add("js-enabled"),e.generateIDs(t),e.setARIA(t),e.setTransition(t),n++,a.includes(s)?e.showElement(t,!1):e.closeElement(t,!1)})),o.attachEvents()},setTransition:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.options,s=n.duration,i=n.panelClass,o=e.querySelector(".".concat(i)),r=c("transitionDuration");o.style[r]=t?null:"".concat(s,"ms")},generateIDs:function(e){var t=this.options,s=t.triggerClass,i=t.panelClass,o=e.querySelector(".".concat(s)),r=e.querySelector(".".concat(i));e.setAttribute("id","ac-".concat(n)),o.setAttribute("id","ac-trigger-".concat(n)),r.setAttribute("id","ac-panel-".concat(n))},removeIDs:function(e){var t=this.options,n=t.triggerClass,s=t.panelClass,i=e.querySelector(".".concat(n)),o=e.querySelector(".".concat(s));e.removeAttribute("id"),i.removeAttribute("id"),o.removeAttribute("id")},setARIA:function(e){var t=this.options,s=t.ariaEnabled,i=t.triggerClass,o=t.panelClass;if(s){var r=e.querySelector(".".concat(i)),a=e.querySelector(".".concat(o));r.setAttribute("role","button"),r.setAttribute("aria-controls","ac-panel-".concat(n)),r.setAttribute("aria-disabled",!1),r.setAttribute("aria-expanded",!1),a.setAttribute("role","region"),a.setAttribute("aria-labelledby","ac-trigger-".concat(n))}},updateARIA:function(e,t){var n=t.ariaExpanded,s=t.ariaDisabled,i=this.options,o=i.ariaEnabled,r=i.triggerClass;if(o){var a=e.querySelector(".".concat(r));a.setAttribute("aria-expanded",n),a.setAttribute("aria-disabled",s)}},removeARIA:function(e){var t=this.options,n=t.ariaEnabled,s=t.triggerClass,i=t.panelClass;if(n){var o=e.querySelector(".".concat(s)),r=e.querySelector(".".concat(i));o.removeAttribute("role"),o.removeAttribute("aria-controls"),o.removeAttribute("aria-disabled"),o.removeAttribute("aria-expanded"),r.removeAttribute("role"),r.removeAttribute("aria-labelledby")}},focus:function(e,t){e.preventDefault();var n=this.options.triggerClass;t.querySelector(".".concat(n)).focus()},focusFirstElement:function(e){this.focus(e,this.firstElement),this.currFocusedIdx=0},focusLastElement:function(e){this.focus(e,this.lastElement),this.currFocusedIdx=this.elements.length-1},focusNextElement:function(e){var t=this.currFocusedIdx+1;if(t>this.elements.length-1)return this.focusFirstElement(e);this.focus(e,this.elements[t]),this.currFocusedIdx=t},focusPrevElement:function(e){var t=this.currFocusedIdx-1;if(t<0)return this.focusLastElement(e);this.focus(e,this.elements[t]),this.currFocusedIdx=t},showElement:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.options,s=n.panelClass,i=n.activeClass,o=n.collapse,r=n.beforeOpen,a=e.querySelector(".".concat(s)),c=a.scrollHeight;e.classList.add(i),t&&r(e),requestAnimationFrame((function(){requestAnimationFrame((function(){a.style.height=t?"".concat(c,"px"):"auto"}))})),this.updateARIA(e,{ariaExpanded:!0,ariaDisabled:!o})},closeElement:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.options,s=n.panelClass,i=n.activeClass,o=n.beforeClose,r=e.querySelector(".".concat(s)),a=r.scrollHeight;e.classList.remove(i),t?(o(e),requestAnimationFrame((function(){r.style.height="".concat(a,"px"),requestAnimationFrame((function(){r.style.height=0}))})),this.updateARIA(e,{ariaExpanded:!1,ariaDisabled:!1})):r.style.height=0},toggleElement:function(e){var t=this.options,n=t.activeClass,s=t.collapse,i=e.classList.contains(n);if(!i||s)return i?this.closeElement(e):this.showElement(e)},closeElements:function(){var e=this,t=this.options,n=t.activeClass;t.showMultiple||this.elements.map((function(t,s){t.classList.contains(n)&&s!=e.currFocusedIdx&&e.closeElement(t)}))},handleClick:function(e){var t=this,n=e.currentTarget;this.elements.map((function(s,i){s.contains(n)&&"A"!==e.target.nodeName&&(t.currFocusedIdx=i,t.closeElements(),t.focus(e,s),t.toggleElement(s))}))},handleKeydown:function(e){switch(e.keyCode){case 38:return this.focusPrevElement(e);case 40:return this.focusNextElement(e);case 36:return this.focusFirstElement(e);case 35:return this.focusLastElement(e);default:return null}},handleTransitionEnd:function(e){if("height"===e.propertyName){var t=this.options,n=t.onOpen,s=t.onClose,i=e.currentTarget,o=parseInt(i.style.height),r=this.elements.find((function(e){return e.contains(i)}));o>0?(i.style.height="auto",n(r)):s(r)}}};this.attachEvents=function(){if(!r){var e=a.options,t=e.triggerClass,n=e.panelClass;a.handleClick=a.handleClick.bind(a),a.handleKeydown=a.handleKeydown.bind(a),a.handleTransitionEnd=a.handleTransitionEnd.bind(a),a.elements.map((function(e){var s=e.querySelector(".".concat(t)),i=e.querySelector(".".concat(n));s.addEventListener("click",a.handleClick),s.addEventListener("keydown",a.handleKeydown),i.addEventListener("webkitTransitionEnd",a.handleTransitionEnd),i.addEventListener("transitionend",a.handleTransitionEnd)})),r=!0}},this.detachEvents=function(){if(r){var e=a.options,t=e.triggerClass,n=e.panelClass;a.elements.map((function(e){var s=e.querySelector(".".concat(t)),i=e.querySelector(".".concat(n));s.removeEventListener("click",a.handleClick),s.removeEventListener("keydown",a.handleKeydown),i.removeEventListener("webkitTransitionEnd",a.handleTransitionEnd),i.removeEventListener("transitionend",a.handleTransitionEnd)})),r=!1}},this.toggle=function(e){var t=a.elements.find((function(t,n){return n===e}));t&&a.toggleElement(t)},this.open=function(e){var t=a.elements.find((function(t,n){return n===e}));t&&a.showElement(t)},this.openAll=function(){a.elements.map((function(e){return a.showElement(e,!1)}))},this.close=function(e){var t=a.elements.find((function(t,n){return n===e}));t&&a.closeElement(t)},this.closeAll=function(){a.elements.map((function(e){return a.closeElement(e,!1)}))},this.destroy=function(){i.detachEvents(),i.openAll(),a.elements.map((function(e){a.removeIDs(e),a.removeARIA(e),a.setTransition(e,!0)})),r=!0};var c=function(e){return"string"==typeof document.documentElement.style[e]?e:(e=l(e),e="webkit".concat(e))},l=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};a.init()},void 0!==e.exports?e.exports=s:t.Accordion=s}
2,34364:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});const s=n(68171),i=n(38302).default;class o extends i{constructor(e){super(e),this.open=this.element.dataset.open&&"true"===this.element.dataset.open,this.focusInside=this.element.dataset.focus&&"true"===this.element.dataset.focus,this.multipleElements=this.element.dataset.multiple&&"true"===this.element.dataset.multiple,this.openFromPreference="true"===this.element.dataset.openFromPreference,this.limit=parseInt(this.element.dataset.limit),this.resizeHandler(),this.focusTrap(),this.eventHandler()}eventHandler(){this.element.addEventListener("openAccordion",(()=>{this.accordionSystem&&this.accordionSystem.open(0)})),this.element.addEventListener("closeAccordion",(()=>{this.accordionSystem&&this.accordionSystem.close(0)}))}resizeHandler(){const e=[...this.element.querySelectorAll(":scope > .ac")].map(((e,t)=>"true"===e.dataset.openOnInit?t:null)).filter((e=>null!==e));this.accordionSystem=new s(this.element,{onOpen:e=>{this.focusTrap()},showMultiple:this.multipleElements,openOnInit:e}),this.open&&this.accordionSystem.open(0),this.openFromPreference&&this.limit&&this.openAccordions(),document.querySelector(".js-delivery-returns")&&document.querySelector(".js-delivery-returns").addEventListener("click",(e=>{var t=document.querySelector(".delivery-returns");t&&(t.classList.add("is-active"),t.querySelector(".ac-panel").style.height="auto")}))}openAccordions(){const e=[...this.element.querySelectorAll(":scope > .ac")],t=window.innerWidth<992;let n=0;e.forEach(t?(e,t)=>{e.dataset.openMobile&&"true"===e.dataset.openMobile&&n<this.limit&&(this.accordionSystem.open(t),n+=1)}:(e,t)=>{e.dataset.openDesktop&&"true"===e.dataset.openDesktop&&n<this.limit&&(this.accordionSystem.open(t),n+=1)})}focusTrap(){if(!this.focusInside)return;const e=this.element.querySelector(".ac-panel").querySelector('button:not([tabindex="-1"], [href]:not([tabindex="-1"], input:not([tabindex="-1"], select:not([tabindex="-1"], textarea:not([tabindex="-1"], [tabindex]:not([tabindex="-1"]), [role="button"]:not([tabindex="-1"]');e&&setTimeout((()=>{e.focus()}),200)}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.