packages
1 year ago
152486453d0e39071cdb.bundle.js
1 year ago
294b4bf3066815c5927f.bundle.min.js
1 year ago
2f08057553c95b827d30.bundle.min.js
1 year ago
4748df03726015eef04f.bundle.min.js
1 year ago
49d9a23b08ff2c138b03.bundle.min.js
1 year ago
49d9a23b08ff2c138b03.bundle.min.js.LICENSE.txt
1 year ago
7b18c3f2f2bfffda289f.bundle.js
1 year ago
9c42cff515a6191fddaf.bundle.min.js
1 year ago
a730ee9caa710006b307.bundle.js
1 year ago
accordion.8799675460c73eb48972.bundle.min.js
1 year ago
accordion.c16b88b2e8a0c50189bc.bundle.js
1 year ago
admin-feedback.js
1 year ago
admin-feedback.min.js
1 year ago
admin-modules.js
1 year ago
admin-modules.min.js
1 year ago
admin-modules.min.js.LICENSE.txt
3 years ago
admin-notifications.js
1 year ago
admin-notifications.min.js
1 year ago
admin-notifications.min.js.LICENSE.txt
1 year ago
admin-top-bar.js
1 year ago
admin-top-bar.min.js
1 year ago
admin.js
1 year ago
admin.min.js
1 year ago
admin.min.js.LICENSE.txt
3 years ago
ai-admin.js
1 year ago
ai-admin.min.js
1 year ago
ai-admin.min.js.LICENSE.txt
2 years ago
ai-gutenberg.js
1 year ago
ai-gutenberg.min.js
1 year ago
ai-gutenberg.min.js.LICENSE.txt
2 years ago
ai-layout.js
1 year ago
ai-layout.min.js
1 year ago
ai-layout.min.js.LICENSE.txt
2 years ago
ai-media-library.js
1 year ago
ai-media-library.min.js
1 year ago
ai-media-library.min.js.LICENSE.txt
2 years ago
ai.js
1 year ago
ai.min.js
1 year ago
ai.min.js.LICENSE.txt
1 year ago
alert.c3c6a3fdf4745bd26b7f.bundle.js
1 year ago
alert.cbc2a0fee74ee3ed0419.bundle.min.js
1 year ago
announcements-app.js
1 year ago
announcements-app.min.js
1 year ago
announcements-app.min.js.LICENSE.txt
3 years ago
app-loader.js
1 year ago
app-loader.min.js
1 year ago
app-packages.js
1 year ago
app-packages.min.js
1 year ago
app-packages.min.js.LICENSE.txt
3 years ago
app.js
1 year ago
app.min.js
1 year ago
app.min.js.LICENSE.txt
3 years ago
atomic-widgets-editor.js
1 year ago
atomic-widgets-editor.min.js
1 year ago
b7931adecb98651a09c7.bundle.min.js
1 year ago
bdd4030576f6a94a4f0d.bundle.js
1 year ago
beta-tester.js
1 year ago
beta-tester.min.js
1 year ago
c96bb3445f3bc9de7d26.bundle.min.js
1 year ago
checklist.js
1 year ago
checklist.min.js
1 year ago
checklist.min.js.LICENSE.txt
1 year ago
common-modules.js
1 year ago
common-modules.min.js
1 year ago
common.js
1 year ago
common.min.js
1 year ago
common.min.js.LICENSE.txt
3 years ago
contact-buttons.31aad77620f461830ce9.bundle.min.js
1 year ago
contact-buttons.a5e2cc7274ba4c94eb66.bundle.js
1 year ago
container-converter.js
1 year ago
container-converter.min.js
1 year ago
container.a7f0a15dfa05df34e1f7.bundle.js
1 year ago
container.c65a2a923085e1120e75.bundle.min.js
1 year ago
counter.02cef29c589e742d4c8c.bundle.min.js
1 year ago
counter.3f74a246dff765f39aea.bundle.js
1 year ago
d91e4d7f57d57af2aab9.bundle.min.js
1 year ago
d9299811bc70ddb82fbf.bundle.js
1 year ago
dev-tools.js
1 year ago
dev-tools.min.js
1 year ago
e-home-screen.js
1 year ago
e-home-screen.min.js
1 year ago
e-wc-product-editor.js
1 year ago
e-wc-product-editor.min.js
1 year ago
e-wc-product-editor.min.js.LICENSE.txt
1 year ago
e3f753621bf9be55ec4d.bundle.js
1 year ago
editor-document.js
1 year ago
editor-document.min.js
1 year ago
editor-environment-v2.js
1 year ago
editor-environment-v2.min.js
1 year ago
editor-loader-v1.js
1 year ago
editor-loader-v1.min.js
1 year ago
editor-loader-v2.js
1 year ago
editor-loader-v2.min.js
1 year ago
editor-modules.js
1 year ago
editor-modules.min.js
1 year ago
editor-modules.min.js.LICENSE.txt
3 years ago
editor-notifications.js
1 year ago
editor-notifications.min.js
1 year ago
editor-notifications.min.js.LICENSE.txt
1 year ago
editor.js
1 year ago
editor.min.js
1 year ago
editor.min.js.LICENSE.txt
1 year ago
element-manager-admin.js
1 year ago
element-manager-admin.min.js
1 year ago
element-manager-admin.min.js.LICENSE.txt
2 years ago
elementor-admin-bar.js
1 year ago
elementor-admin-bar.min.js
1 year ago
f634673e5824ceb13f3d.bundle.js
1 year ago
fa0cbd4c7b6a8ad83224.bundle.js
1 year ago
fd6a00ae23a1bc2c6190.bundle.js
1 year ago
floating-bars.1ebb83f158244b35bda6.bundle.js
1 year ago
floating-bars.e4547b87bc6fb09381ca.bundle.min.js
1 year ago
floating-elements-modal.js
1 year ago
floating-elements-modal.min.js
1 year ago
frontend-modules.js
1 year ago
frontend-modules.min.js
1 year ago
frontend.js
1 year ago
frontend.min.js
1 year ago
gutenberg.js
1 year ago
gutenberg.min.js
1 year ago
image-carousel.4455c6362492d9067512.bundle.min.js
1 year ago
image-carousel.9399f19d95d7300cbc2e.bundle.js
1 year ago
import-export-admin.js
1 year ago
import-export-admin.min.js
1 year ago
kit-elements-defaults-editor.js
1 year ago
kit-elements-defaults-editor.min.js
1 year ago
kit-elements-defaults-editor.min.js.LICENSE.txt
3 years ago
kit-library.1f8d31888dc9d19dd031.bundle.min.js
1 year ago
kit-library.ac1a4cd5deae5526ce49.bundle.js
1 year ago
lightbox.01a419d1fcdd47a75a77.bundle.min.js
1 year ago
lightbox.2c9ae19597fcd2a76c3a.bundle.js
1 year ago
media-hints.js
1 year ago
media-hints.min.js
1 year ago
nested-accordion.82e5c4e9017e457a5f2e.bundle.js
1 year ago
nested-accordion.c3b109b714293a16bd95.bundle.min.js
1 year ago
nested-accordion.js
1 year ago
nested-accordion.min.js
1 year ago
nested-accordion.min.js.LICENSE.txt
3 years ago
nested-elements.js
1 year ago
nested-elements.min.js
1 year ago
nested-tabs.js
1 year ago
nested-tabs.min.js
1 year ago
nested-tabs.min.js.LICENSE.txt
3 years ago
nested-title-keyboard-handler.0b608656da2be746fb80.bundle.min.js
1 year ago
nested-title-keyboard-handler.92a73d7a8a75bcb8cd67.bundle.js
1 year ago
new-template.js
1 year ago
new-template.min.js
1 year ago
notes.js
1 year ago
notes.min.js
1 year ago
onboarding.4a4002ff7ea58bfa166e.bundle.min.js
1 year ago
onboarding.5ceee1b219b66e943cb0.bundle.js
1 year ago
progress.6d15c16f0f5c4792940f.bundle.js
1 year ago
progress.985f012a6336ab21cb44.bundle.min.js
1 year ago
responsive-bar.js
1 year ago
responsive-bar.min.js
1 year ago
styleguide-app-initiator.js
1 year ago
styleguide-app-initiator.min.js
1 year ago
styleguide-app-initiator.min.js.LICENSE.txt
3 years ago
styleguide.js
1 year ago
styleguide.min.js
1 year ago
tabs.520bc2ed4560c561029e.bundle.js
1 year ago
tabs.c2af5be7f9cb3cdcf3d5.bundle.min.js
1 year ago
text-editor.2c35aafbe5bf0e127950.bundle.min.js
1 year ago
text-editor.2f2f7e0ea1e16387a004.bundle.js
1 year ago
text-path.39fb59e43970222f5a3e.bundle.min.js
1 year ago
text-path.39fb59e43970222f5a3e.bundle.min.js.LICENSE.txt
1 year ago
text-path.a20877e832db83423958.bundle.js
1 year ago
toggle.31881477c45ff5cf9d4d.bundle.min.js
1 year ago
toggle.d79746a764407a0828ee.bundle.js
1 year ago
video.78c625e89ab767d621c5.bundle.min.js
1 year ago
video.817bd6a65a1542503aac.bundle.js
1 year ago
web-cli.js
1 year ago
web-cli.min.js
1 year ago
web-cli.min.js.LICENSE.txt
3 years ago
webpack.runtime.js
1 year ago
webpack.runtime.min.js
1 year ago
wp-audio.75f0ced143febb8cd31a.bundle.min.js
1 year ago
wp-audio.b8efdc046bc9df72a075.bundle.js
1 year ago
nested-accordion.82e5c4e9017e457a5f2e.bundle.js
477 lines
| 1 | /*! elementor - v3.25.0 - 16-10-2024 */ |
| 2 | "use strict"; |
| 3 | (self["webpackChunkelementor"] = self["webpackChunkelementor"] || []).push([["nested-accordion"],{ |
| 4 | |
| 5 | /***/ "../assets/dev/js/frontend/handlers/accessibility/nested-title-keyboard-handler.js": |
| 6 | /*!*****************************************************************************************!*\ |
| 7 | !*** ../assets/dev/js/frontend/handlers/accessibility/nested-title-keyboard-handler.js ***! |
| 8 | \*****************************************************************************************/ |
| 9 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => { |
| 10 | |
| 11 | |
| 12 | |
| 13 | var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 14 | Object.defineProperty(exports, "__esModule", ({ |
| 15 | value: true |
| 16 | })); |
| 17 | exports["default"] = void 0; |
| 18 | var _base = _interopRequireDefault(__webpack_require__(/*! ../base */ "../assets/dev/js/frontend/handlers/base.js")); |
| 19 | class NestedTitleKeyboardHandler extends _base.default { |
| 20 | __construct(settings) { |
| 21 | super.__construct(settings); |
| 22 | this.directionNext = 'next'; |
| 23 | this.directionPrevious = 'previous'; |
| 24 | this.focusableElementSelector = 'audio, button, canvas, details, iframe, input, select, summary, textarea, video, [accesskey], [contenteditable], [href], [tabindex]:not([tabindex="-1"])'; |
| 25 | } |
| 26 | getWidgetNumber() { |
| 27 | return this.$element.find('> .elementor-widget-container > .e-n-tabs, > .e-n-tabs').attr('data-widget-number'); |
| 28 | } |
| 29 | getDefaultSettings() { |
| 30 | return { |
| 31 | selectors: { |
| 32 | itemTitle: `[id*="e-n-tab-title-${this.getWidgetNumber()}"]`, |
| 33 | itemContainer: `[id*="e-n-tab-content-${this.getWidgetNumber()}"]` |
| 34 | }, |
| 35 | ariaAttributes: { |
| 36 | titleStateAttribute: 'aria-selected', |
| 37 | activeTitleSelector: '[aria-selected="true"]' |
| 38 | }, |
| 39 | datasets: { |
| 40 | titleIndex: 'data-tab-index' |
| 41 | }, |
| 42 | keyDirection: { |
| 43 | ArrowLeft: elementorFrontendConfig.is_rtl ? this.directionNext : this.directionPrevious, |
| 44 | ArrowUp: this.directionPrevious, |
| 45 | ArrowRight: elementorFrontendConfig.is_rtl ? this.directionPrevious : this.directionNext, |
| 46 | ArrowDown: this.directionNext |
| 47 | } |
| 48 | }; |
| 49 | } |
| 50 | getDefaultElements() { |
| 51 | const selectors = this.getSettings('selectors'); |
| 52 | return { |
| 53 | $itemTitles: this.findElement(selectors.itemTitle), |
| 54 | $itemContainers: this.findElement(selectors.itemContainer), |
| 55 | $focusableContainerElements: this.getFocusableElements(this.findElement(selectors.itemContainer)) |
| 56 | }; |
| 57 | } |
| 58 | getFocusableElements($elements) { |
| 59 | return $elements.find(this.focusableElementSelector).not('[disabled], [inert]'); |
| 60 | } |
| 61 | getKeyDirectionValue(event) { |
| 62 | const direction = this.getSettings('keyDirection')[event.key]; |
| 63 | return this.directionNext === direction ? 1 : -1; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * @param {HTMLElement} itemTitleElement |
| 68 | * |
| 69 | * @return {string} |
| 70 | */ |
| 71 | getTitleIndex(itemTitleElement) { |
| 72 | const { |
| 73 | titleIndex: indexAttribute |
| 74 | } = this.getSettings('datasets'); |
| 75 | return itemTitleElement.getAttribute(indexAttribute); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * @param {string|number} titleIndex |
| 80 | * |
| 81 | * @return {string} |
| 82 | */ |
| 83 | getTitleFilterSelector(titleIndex) { |
| 84 | const { |
| 85 | titleIndex: indexAttribute |
| 86 | } = this.getSettings('datasets'); |
| 87 | return `[${indexAttribute}="${titleIndex}"]`; |
| 88 | } |
| 89 | getActiveTitleElement() { |
| 90 | const activeTitleFilter = this.getSettings('ariaAttributes').activeTitleSelector; |
| 91 | return this.elements.$itemTitles.filter(activeTitleFilter); |
| 92 | } |
| 93 | onInit() { |
| 94 | super.onInit(...arguments); |
| 95 | } |
| 96 | bindEvents() { |
| 97 | this.elements.$itemTitles.on(this.getTitleEvents()); |
| 98 | this.elements.$focusableContainerElements.on(this.getContentElementEvents()); |
| 99 | } |
| 100 | unbindEvents() { |
| 101 | this.elements.$itemTitles.off(this.getTitleEvents()); |
| 102 | this.elements.$focusableContainerElements.children().off(this.getContentElementEvents()); |
| 103 | } |
| 104 | getTitleEvents() { |
| 105 | return { |
| 106 | keydown: this.handleTitleKeyboardNavigation.bind(this) |
| 107 | }; |
| 108 | } |
| 109 | getContentElementEvents() { |
| 110 | return { |
| 111 | keydown: this.handleContentElementKeyboardNavigation.bind(this) |
| 112 | }; |
| 113 | } |
| 114 | isDirectionKey(event) { |
| 115 | const directionKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End']; |
| 116 | return directionKeys.includes(event.key); |
| 117 | } |
| 118 | isActivationKey(event) { |
| 119 | const activationKeys = ['Enter', ' ']; |
| 120 | return activationKeys.includes(event.key); |
| 121 | } |
| 122 | handleTitleKeyboardNavigation(event) { |
| 123 | if (this.isDirectionKey(event)) { |
| 124 | event.preventDefault(); |
| 125 | const currentTitleIndex = parseInt(this.getTitleIndex(event.currentTarget)) || 1, |
| 126 | numberOfTitles = this.elements.$itemTitles.length, |
| 127 | titleIndexUpdated = this.getTitleIndexFocusUpdated(event, currentTitleIndex, numberOfTitles); |
| 128 | this.changeTitleFocus(titleIndexUpdated); |
| 129 | event.stopPropagation(); |
| 130 | } else if (this.isActivationKey(event)) { |
| 131 | event.preventDefault(); |
| 132 | if (this.handeTitleLinkEnterOrSpaceEvent(event)) { |
| 133 | return; |
| 134 | } |
| 135 | const titleIndex = this.getTitleIndex(event.currentTarget); |
| 136 | elementorFrontend.elements.$window.trigger('elementor/nested-elements/activate-by-keyboard', { |
| 137 | widgetId: this.getID(), |
| 138 | titleIndex |
| 139 | }); |
| 140 | } else if ('Escape' === event.key) { |
| 141 | this.handleTitleEscapeKeyEvents(event); |
| 142 | } |
| 143 | } |
| 144 | handeTitleLinkEnterOrSpaceEvent(event) { |
| 145 | const isLinkElement = 'a' === event?.currentTarget?.tagName?.toLowerCase(); |
| 146 | if (!elementorFrontend.isEditMode() && isLinkElement) { |
| 147 | event?.currentTarget?.click(); |
| 148 | event.stopPropagation(); |
| 149 | } |
| 150 | return isLinkElement; |
| 151 | } |
| 152 | getTitleIndexFocusUpdated(event, currentTitleIndex, numberOfTitles) { |
| 153 | let titleIndexUpdated = 0; |
| 154 | switch (event.key) { |
| 155 | case 'Home': |
| 156 | titleIndexUpdated = 1; |
| 157 | break; |
| 158 | case 'End': |
| 159 | titleIndexUpdated = numberOfTitles; |
| 160 | break; |
| 161 | default: |
| 162 | const directionValue = this.getKeyDirectionValue(event), |
| 163 | isEndReached = numberOfTitles < currentTitleIndex + directionValue, |
| 164 | isStartReached = 0 === currentTitleIndex + directionValue; |
| 165 | if (isEndReached) { |
| 166 | titleIndexUpdated = 1; |
| 167 | } else if (isStartReached) { |
| 168 | titleIndexUpdated = numberOfTitles; |
| 169 | } else { |
| 170 | titleIndexUpdated = currentTitleIndex + directionValue; |
| 171 | } |
| 172 | } |
| 173 | return titleIndexUpdated; |
| 174 | } |
| 175 | changeTitleFocus(titleIndexUpdated) { |
| 176 | const $newTitle = this.elements.$itemTitles.filter(this.getTitleFilterSelector(titleIndexUpdated)); |
| 177 | this.setTitleTabindex(titleIndexUpdated); |
| 178 | $newTitle.trigger('focus'); |
| 179 | } |
| 180 | setTitleTabindex(titleIndex) { |
| 181 | this.elements.$itemTitles.attr('tabindex', '-1'); |
| 182 | const $newTitle = this.elements.$itemTitles.filter(this.getTitleFilterSelector(titleIndex)); |
| 183 | $newTitle.attr('tabindex', '0'); |
| 184 | } |
| 185 | handleTitleEscapeKeyEvents() {} |
| 186 | handleContentElementKeyboardNavigation(event) { |
| 187 | if ('Tab' === event.key && !event.shiftKey) { |
| 188 | this.handleContentElementTabEvents(event); |
| 189 | } else if ('Escape' === event.key) { |
| 190 | event.preventDefault(); |
| 191 | event.stopPropagation(); |
| 192 | this.handleContentElementEscapeEvents(event); |
| 193 | } |
| 194 | } |
| 195 | handleContentElementEscapeEvents() { |
| 196 | this.getActiveTitleElement().trigger('focus'); |
| 197 | } |
| 198 | handleContentElementTabEvents() {} |
| 199 | } |
| 200 | exports["default"] = NestedTitleKeyboardHandler; |
| 201 | |
| 202 | /***/ }), |
| 203 | |
| 204 | /***/ "../modules/nested-accordion/assets/js/frontend/handlers/nested-accordion-title-keyboard-handler.js": |
| 205 | /*!**********************************************************************************************************!*\ |
| 206 | !*** ../modules/nested-accordion/assets/js/frontend/handlers/nested-accordion-title-keyboard-handler.js ***! |
| 207 | \**********************************************************************************************************/ |
| 208 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => { |
| 209 | |
| 210 | |
| 211 | |
| 212 | var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 213 | Object.defineProperty(exports, "__esModule", ({ |
| 214 | value: true |
| 215 | })); |
| 216 | exports["default"] = void 0; |
| 217 | var _nestedTitleKeyboardHandler = _interopRequireDefault(__webpack_require__(/*! elementor-frontend/handlers/accessibility/nested-title-keyboard-handler */ "../assets/dev/js/frontend/handlers/accessibility/nested-title-keyboard-handler.js")); |
| 218 | class NestedAccordionTitleKeyboardHandler extends _nestedTitleKeyboardHandler.default { |
| 219 | __construct() { |
| 220 | super.__construct(...arguments); |
| 221 | const config = arguments.length <= 0 ? undefined : arguments[0]; |
| 222 | this.toggleTitle = config.toggleTitle; |
| 223 | } |
| 224 | getDefaultSettings() { |
| 225 | const parentSettings = super.getDefaultSettings(); |
| 226 | return { |
| 227 | ...parentSettings, |
| 228 | selectors: { |
| 229 | itemTitle: '.e-n-accordion-item-title', |
| 230 | itemContainer: '.e-n-accordion-item > .e-con' |
| 231 | }, |
| 232 | ariaAttributes: { |
| 233 | titleStateAttribute: 'aria-expanded', |
| 234 | activeTitleSelector: '[aria-expanded="true"]' |
| 235 | }, |
| 236 | datasets: { |
| 237 | titleIndex: 'data-accordion-index' |
| 238 | } |
| 239 | }; |
| 240 | } |
| 241 | handeTitleLinkEnterOrSpaceEvent(event) { |
| 242 | this.toggleTitle(event); |
| 243 | } |
| 244 | handleContentElementEscapeEvents(event) { |
| 245 | this.getActiveTitleElement().trigger('focus'); |
| 246 | this.toggleTitle(event); |
| 247 | } |
| 248 | handleTitleEscapeKeyEvents(event) { |
| 249 | const detailsNode = event?.currentTarget?.parentElement, |
| 250 | isOpen = detailsNode?.open; |
| 251 | if (isOpen) { |
| 252 | this.toggleTitle(event); |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | exports["default"] = NestedAccordionTitleKeyboardHandler; |
| 257 | |
| 258 | /***/ }), |
| 259 | |
| 260 | /***/ "../modules/nested-accordion/assets/js/frontend/handlers/nested-accordion.js": |
| 261 | /*!***********************************************************************************!*\ |
| 262 | !*** ../modules/nested-accordion/assets/js/frontend/handlers/nested-accordion.js ***! |
| 263 | \***********************************************************************************/ |
| 264 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => { |
| 265 | |
| 266 | |
| 267 | |
| 268 | var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 269 | Object.defineProperty(exports, "__esModule", ({ |
| 270 | value: true |
| 271 | })); |
| 272 | exports["default"] = void 0; |
| 273 | var _base = _interopRequireDefault(__webpack_require__(/*! elementor-frontend/handlers/base */ "../assets/dev/js/frontend/handlers/base.js")); |
| 274 | var _nestedAccordionTitleKeyboardHandler = _interopRequireDefault(__webpack_require__(/*! ./nested-accordion-title-keyboard-handler */ "../modules/nested-accordion/assets/js/frontend/handlers/nested-accordion-title-keyboard-handler.js")); |
| 275 | class NestedAccordion extends _base.default { |
| 276 | constructor() { |
| 277 | super(...arguments); |
| 278 | this.animations = new Map(); |
| 279 | } |
| 280 | getDefaultSettings() { |
| 281 | return { |
| 282 | selectors: { |
| 283 | accordion: '.e-n-accordion', |
| 284 | accordionContentContainers: '.e-n-accordion > .e-con', |
| 285 | accordionItems: '.e-n-accordion-item', |
| 286 | accordionItemTitles: '.e-n-accordion-item-title', |
| 287 | accordionItemTitlesText: '.e-n-accordion-item-title-text', |
| 288 | accordionContent: '.e-n-accordion-item > .e-con', |
| 289 | directAccordionItems: ':scope > .e-n-accordion-item', |
| 290 | directAccordionItemTitles: ':scope > .e-n-accordion-item > .e-n-accordion-item-title' |
| 291 | }, |
| 292 | default_state: 'expanded', |
| 293 | attributes: { |
| 294 | index: 'data-accordion-index', |
| 295 | ariaLabelledBy: 'aria-labelledby' |
| 296 | } |
| 297 | }; |
| 298 | } |
| 299 | getDefaultElements() { |
| 300 | const selectors = this.getSettings('selectors'); |
| 301 | return { |
| 302 | $accordion: this.findElement(selectors.accordion), |
| 303 | $contentContainers: this.findElement(selectors.accordionContentContainers), |
| 304 | $accordionItems: this.findElement(selectors.accordionItems), |
| 305 | $accordionTitles: this.findElement(selectors.accordionItemTitles), |
| 306 | $accordionContent: this.findElement(selectors.accordionContent) |
| 307 | }; |
| 308 | } |
| 309 | onInit() { |
| 310 | super.onInit(...arguments); |
| 311 | if (elementorFrontend.isEditMode() && !elementorCommon.config.experimentalFeatures.e_nested_atomic_repeaters) { |
| 312 | this.interlaceContainers(); |
| 313 | } |
| 314 | this.injectKeyboardHandler(); |
| 315 | } |
| 316 | injectKeyboardHandler() { |
| 317 | if ('nested-accordion.default' === this.getSettings('elementName')) { |
| 318 | new _nestedAccordionTitleKeyboardHandler.default({ |
| 319 | $element: this.$element, |
| 320 | toggleTitle: this.clickListener.bind(this) |
| 321 | }); |
| 322 | } |
| 323 | } |
| 324 | interlaceContainers() { |
| 325 | const { |
| 326 | $contentContainers, |
| 327 | $accordionItems |
| 328 | } = this.getDefaultElements(); |
| 329 | $contentContainers.each((index, element) => { |
| 330 | $accordionItems[index].appendChild(element); |
| 331 | }); |
| 332 | } |
| 333 | linkContainer(event) { |
| 334 | const { |
| 335 | container, |
| 336 | index, |
| 337 | targetContainer, |
| 338 | action: { |
| 339 | type |
| 340 | } |
| 341 | } = event.detail, |
| 342 | view = container.view.$el, |
| 343 | id = container.model.get('id'), |
| 344 | currentId = this.$element.data('id'); |
| 345 | if (id === currentId) { |
| 346 | const { |
| 347 | $accordionItems |
| 348 | } = this.getDefaultElements(); |
| 349 | let accordionItem, contentContainer; |
| 350 | switch (type) { |
| 351 | case 'move': |
| 352 | [accordionItem, contentContainer] = this.move(view, index, targetContainer, $accordionItems); |
| 353 | break; |
| 354 | case 'duplicate': |
| 355 | [accordionItem, contentContainer] = this.duplicate(view, index, targetContainer, $accordionItems); |
| 356 | break; |
| 357 | default: |
| 358 | break; |
| 359 | } |
| 360 | if (undefined !== accordionItem) { |
| 361 | accordionItem.appendChild(contentContainer); |
| 362 | } |
| 363 | this.updateIndexValues(); |
| 364 | this.updateListeners(view); |
| 365 | elementor.$preview[0].contentWindow.dispatchEvent(new CustomEvent('elementor/elements/link-data-bindings')); |
| 366 | } |
| 367 | } |
| 368 | move(view, index, targetContainer, accordionItems) { |
| 369 | return [accordionItems[index], targetContainer.view.$el[0]]; |
| 370 | } |
| 371 | duplicate(view, index, targetContainer, accordionItems) { |
| 372 | return [accordionItems[index + 1], targetContainer.view.$el[0]]; |
| 373 | } |
| 374 | updateIndexValues() { |
| 375 | const { |
| 376 | $accordionContent, |
| 377 | $accordionItems |
| 378 | } = this.getDefaultElements(), |
| 379 | settings = this.getSettings(), |
| 380 | itemIdBase = $accordionItems[0].getAttribute('id').slice(0, -1); |
| 381 | $accordionItems.each((index, element) => { |
| 382 | element.setAttribute('id', `${itemIdBase}${index}`); |
| 383 | element.querySelector(settings.selectors.accordionItemTitles).setAttribute(settings.attributes.index, index + 1); |
| 384 | element.querySelector(settings.selectors.accordionItemTitles).setAttribute('aria-controls', `${itemIdBase}${index}`); |
| 385 | element.querySelector(settings.selectors.accordionItemTitlesText).setAttribute('data-binding-index', index + 1); |
| 386 | $accordionContent[index].setAttribute(settings.attributes.ariaLabelledBy, `${itemIdBase}${index}`); |
| 387 | }); |
| 388 | } |
| 389 | updateListeners(view) { |
| 390 | this.elements.$accordionTitles = view.find(this.getSettings('selectors.accordionItemTitles')); |
| 391 | this.elements.$accordionItems = view.find(this.getSettings('selectors.accordionItems')); |
| 392 | this.elements.$accordionTitles.on('click', this.clickListener.bind(this)); |
| 393 | } |
| 394 | bindEvents() { |
| 395 | this.elements.$accordionTitles.on('click', this.clickListener.bind(this)); |
| 396 | elementorFrontend.elements.$window.on('elementor/nested-container/atomic-repeater', this.linkContainer.bind(this)); |
| 397 | } |
| 398 | unbindEvents() { |
| 399 | this.elements.$accordionTitles.off(); |
| 400 | } |
| 401 | clickListener(event) { |
| 402 | event.preventDefault(); |
| 403 | this.elements = this.getDefaultElements(); |
| 404 | const settings = this.getSettings(), |
| 405 | accordionItem = event?.currentTarget?.closest(settings.selectors.accordionItems), |
| 406 | accordion = event?.currentTarget?.closest(settings.selectors.accordion), |
| 407 | itemSummary = accordionItem.querySelector(settings.selectors.accordionItemTitles), |
| 408 | accordionContent = accordionItem.querySelector(settings.selectors.accordionContent), |
| 409 | { |
| 410 | max_items_expended: maxItemsExpended |
| 411 | } = this.getElementSettings(), |
| 412 | directAccordionItems = accordion.querySelectorAll(settings.selectors.directAccordionItems), |
| 413 | directAccordionItemTitles = accordion.querySelectorAll(settings.selectors.directAccordionItemTitles); |
| 414 | if ('one' === maxItemsExpended) { |
| 415 | this.closeAllItems(directAccordionItems, directAccordionItemTitles); |
| 416 | } |
| 417 | if (!accordionItem.open) { |
| 418 | this.prepareOpenAnimation(accordionItem, itemSummary, accordionContent); |
| 419 | } else { |
| 420 | this.closeAccordionItem(accordionItem, itemSummary); |
| 421 | } |
| 422 | } |
| 423 | animateItem(accordionItem, startHeight, endHeight, isOpen) { |
| 424 | accordionItem.style.overflow = 'hidden'; |
| 425 | let animation = this.animations.get(accordionItem); |
| 426 | if (animation) { |
| 427 | animation.cancel(); |
| 428 | } |
| 429 | animation = accordionItem.animate({ |
| 430 | height: [startHeight, endHeight] |
| 431 | }, { |
| 432 | duration: this.getAnimationDuration() |
| 433 | }); |
| 434 | animation.onfinish = () => this.onAnimationFinish(accordionItem, isOpen); |
| 435 | this.animations.set(accordionItem, animation); |
| 436 | accordionItem.querySelector('summary')?.setAttribute('aria-expanded', isOpen); |
| 437 | } |
| 438 | closeAccordionItem(accordionItem, accordionItemTitle) { |
| 439 | const startHeight = `${accordionItem.offsetHeight}px`, |
| 440 | endHeight = `${accordionItemTitle.offsetHeight}px`; |
| 441 | this.animateItem(accordionItem, startHeight, endHeight, false); |
| 442 | } |
| 443 | prepareOpenAnimation(accordionItem, accordionItemTitle, accordionItemContent) { |
| 444 | accordionItem.style.overflow = 'hidden'; |
| 445 | accordionItem.style.height = `${accordionItem.offsetHeight}px`; |
| 446 | accordionItem.open = true; |
| 447 | window.requestAnimationFrame(() => this.openAccordionItem(accordionItem, accordionItemTitle, accordionItemContent)); |
| 448 | } |
| 449 | openAccordionItem(accordionItem, accordionItemTitle, accordionItemContent) { |
| 450 | const startHeight = `${accordionItem.offsetHeight}px`, |
| 451 | endHeight = `${accordionItemTitle.offsetHeight + accordionItemContent.offsetHeight}px`; |
| 452 | this.animateItem(accordionItem, startHeight, endHeight, true); |
| 453 | } |
| 454 | onAnimationFinish(accordionItem, isOpen) { |
| 455 | accordionItem.open = isOpen; |
| 456 | this.animations.set(accordionItem, null); |
| 457 | accordionItem.style.height = accordionItem.style.overflow = ''; |
| 458 | } |
| 459 | closeAllItems(items, titles) { |
| 460 | titles.forEach((title, index) => { |
| 461 | this.closeAccordionItem(items[index], title); |
| 462 | }); |
| 463 | } |
| 464 | getAnimationDuration() { |
| 465 | const { |
| 466 | size, |
| 467 | unit |
| 468 | } = this.getElementSettings('n_accordion_animation_duration'); |
| 469 | return size * ('ms' === unit ? 1 : 1000); |
| 470 | } |
| 471 | } |
| 472 | exports["default"] = NestedAccordion; |
| 473 | |
| 474 | /***/ }) |
| 475 | |
| 476 | }]); |
| 477 | //# sourceMappingURL=nested-accordion.82e5c4e9017e457a5f2e.bundle.js.map |