geno/wp-content/plugins/elementor/assets/js/tabs.c2af5be7f9cb3cdcf3d5.bundle.min.js

2 lines
3.6 KiB
JavaScript
Raw Permalink Normal View History

2024-02-01 17:24:18 +05:30
/*! elementor - v3.18.0 - 20-12-2023 */
"use strict";(self.webpackChunkelementor=self.webpackChunkelementor||[]).push([[520],{9728:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class baseTabs extends elementorModules.frontend.handlers.Base{getDefaultSettings(){return{selectors:{tablist:'[role="tablist"]',tabTitle:".elementor-tab-title",tabContent:".elementor-tab-content"},classes:{active:"elementor-active"},showTabFn:"show",hideTabFn:"hide",toggleSelf:!0,hidePrevious:!0,autoExpand:!0,keyDirection:{ArrowLeft:elementorFrontendConfig.is_rtl?1:-1,ArrowUp:-1,ArrowRight:elementorFrontendConfig.is_rtl?-1:1,ArrowDown:1}}}getDefaultElements(){const e=this.getSettings("selectors");return{$tabTitles:this.findElement(e.tabTitle),$tabContents:this.findElement(e.tabContent)}}activateDefaultTab(){const e=this.getSettings();if(!e.autoExpand||"editor"===e.autoExpand&&!this.isEdit)return;const t=this.getEditSettings("activeItemIndex")||1,a={showTabFn:e.showTabFn,hideTabFn:e.hideTabFn};this.setSettings({showTabFn:"show",hideTabFn:"hide"}),this.changeActiveTab(t),this.setSettings(a)}handleKeyboardNavigation(e){const t=e.currentTarget,a=jQuery(t.closest(this.getSettings("selectors").tablist)),s=a.find(this.getSettings("selectors").tabTitle),i="vertical"===a.attr("aria-orientation");switch(e.key){case"ArrowLeft":case"ArrowRight":if(i)return;break;case"ArrowUp":case"ArrowDown":if(!i)return;e.preventDefault();break;case"Home":return e.preventDefault(),void s.first().trigger("focus");case"End":return e.preventDefault(),void s.last().trigger("focus");default:return}const n=t.getAttribute("data-tab")-1,r=this.getSettings("keyDirection")[e.key],o=s[n+r];o?o.focus():-1===n+r?s.last().trigger("focus"):s.first().trigger("focus")}deactivateActiveTab(e){const t=this.getSettings(),a=t.classes.active,s=e?'[data-tab="'+e+'"]':"."+a,i=this.elements.$tabTitles.filter(s),n=this.elements.$tabContents.filter(s);i.add(n).removeClass(a),i.attr({tabindex:"-1","aria-selected":"false","aria-expanded":"false"}),n[t.hideTabFn](),n.attr("hidden","hidden")}activateTab(e){const t=this.getSettings(),a=t.classes.active,s=this.elements.$tabTitles.filter('[data-tab="'+e+'"]'),i=this.elements.$tabContents.filter('[data-tab="'+e+'"]'),n="show"===t.showTabFn?0:400;s.add(i).addClass(a),s.attr({tabindex:"0","aria-selected":"true","aria-expanded":"true"}),i[t.showTabFn](n,(()=>elementorFrontend.elements.$window.trigger("elementor-pro/motion-fx/recalc"))),i.removeAttr("hidden")}isActiveTab(e){return this.elements.$tabTitles.filter('[data-tab="'+e+'"]').hasClass(this.getSettings("classes.active"))}bindEvents(){this.elements.$tabTitles.on({keydown:e=>{jQuery(e.target).is("a")&&"Enter"===e.key&&e.preventDefault(),["End","Home","ArrowUp","ArrowDown"].includes(e.key)&&this.handleKeyboardNavigation(e)},keyup:e=>{switch(e.code){case"ArrowLeft":case"ArrowRight":this.handleKeyboardNavigation(e);break;case"Enter":case"Space":e.preventDefault(),this.changeActiveTab(e.currentTarget.getAttribute("data-tab"))}},click:e=>{e.preventDefault(),this.changeActiveTab(e.currentTarget.getAttribute("data-tab"))}})}onInit(){super.onInit(...arguments),this.activateDefaultTab()}onEditSettingsChange(e){"activeItemIndex"===e&&this.activateDefaultTab()}changeActiveTab(e){const t=this.isActiveTab(e),a=this.getSettings();!a.toggleSelf&&t||!a.hidePrevious||this.deactivateActiveTab(),!a.hidePrevious&&t&&this.deactivateActiveTab(e),t||this.activateTab(e)}}t.default=baseTabs},9459:(e,t,a)=>{var s=a(3203);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=s(a(9728));class Tabs extends i.default{getDefaultSettings(){return{...super.getDefaultSettings(),toggleSelf:!1}}}t.default=Tabs}}]);