Sha256: d8ab50ea0fab5bb08bf68ac28e097b70be34deff2caf5b5dfa6bd6d11bfbe185

Contents?: true

Size: 1.16 KB

Versions: 90

Compression:

Stored size: 1.16 KB

Contents

import '@github/tab-container-element';
// keep in sync with tab_container_component.rb
const DEFAULT_SELECTED_CLASSES = ['ariadne-border-slate-500', 'ariadne-text-slate-600'];
const DEFAULT_UNSELECTED_CLASSES = [
    'ariadne-text-gray-500',
    'hover:ariadne-text-gray-700',
    'hover:ariadne-border-gray-300',
];
for (const tabContainer of document.getElementsByTagName('tab-container')) {
    tabContainer.addEventListener('tab-container-change', function (event) {
        var _a;
        const newPanel = event.detail.relatedTarget;
        const tabContainer = newPanel.closest('tab-container');
        const tabList = tabContainer.firstElementChild;
        const currentTab = tabList.querySelector('[aria-selected="true"]');
        const tabId = (_a = newPanel.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.split('-').slice(1).join('-');
        const newTab = tabList.querySelector(`#${tabId}`);
        currentTab.classList.remove(...DEFAULT_SELECTED_CLASSES);
        currentTab.classList.add(...DEFAULT_UNSELECTED_CLASSES);
        newTab.classList.add(...DEFAULT_SELECTED_CLASSES);
        newTab.classList.remove(...DEFAULT_UNSELECTED_CLASSES);
    });
}

Version data entries

90 entries across 90 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.55-aarch64-linux app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.55-x86_64-darwin app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.55 app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.55-x64-mingw-ucrt app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.54-x86_64-darwin app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.54-arm64-darwin app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.54 app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.54-aarch64-linux app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.54-x86_64-linux app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.54-x64-mingw-ucrt app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.53-arm64-darwin app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.53-aarch64-linux app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.53 app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.53-x64-mingw-ucrt app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.53-x86_64-darwin app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.53-x86_64-linux app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.52-x86_64-darwin app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.52-x86_64-linux app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.52-aarch64-linux app/components/ariadne/tab_container_component/tab-container-component.js
ariadne_view_components-0.0.52-arm64-darwin app/components/ariadne/tab_container_component/tab-container-component.js