import{_ as t}from"./tslib.es6-d65164b3.js";import{S as e}from"./single-slot-element-base-bbf951b4.js";import{K as s,F as i,a as r}from"./keyboard-navigation-strategy-0cccb7d5.js";import{T as o}from"./tabs-events-e9793aa0.js";import{tabIdSelector as a}from"./dx-tabs-b1add2a0.js";import{k as d}from"./key-a66127fc.js";import{n as c}from"./property-4ec0b52d.js";import{e as m}from"./custom-element-267f9a21.js";import"./data-qa-utils-8be7c726.js";import"./const-90026e45.js";import"./dx-ui-element-b777832b.js";import"./lit-element-base-b20b52b2.js";import"./dx-license-e00a5bc7.js";import"./lit-element-462e7ad3.js";import"./logicaltreehelper-67db40f1.js";import"./layouthelper-67dd777a.js";import"./point-e4ec110e.js";import"./constants-7c047c0d.js";import"./focushelper-2eea96ca.js";import"./dom-utils-bf33c859.js";import"./dom-4684d8d6.js";import"./_commonjsHelpers-41cdd1e7.js";import"./string-2448bf95.js";import"./browser-3fc721b7.js";import"./css-classes-1103f305.js";import"./custom-events-helper-e7f279d3.js";import"./eventhelper-8bcec49f.js";import"./focus-utils-1fc0087c.js";import"./disposable-d2c2d283.js";import"./devices-17b9ba08.js";import"./scroll-viewer-css-classes-cc34804c.js";import"./toolbar-css-classes-795f4ae0.js";import"./ribbon-utils-8b4ac48a.js";class n extends s{constructor(t,e,s){super(e,s),this.tabs=t}queryItems(){return this.queryItemsBySelector(`:scope.${o.Item}`)}}class l extends s{constructor(t,e,s){super(e,s),this.tabs=t}queryItems(){return this.queryItemsBySelector(`:scope .${o.Item}`)}createItemStrategy(t){return new n(this.tabs,this.navigator,t)}handleKeyDown(t){const e=d.KeyUtils.getEventKeyCode(t);if(this.tabs.isVertical){if(e===d.KeyCode.Down)return this.moveForward(t),!0;if(e===d.KeyCode.Up)return this.moveBackward(t),!0}else{if(e===d.KeyCode.Right)return this.moveForward(t),!0;if(e===d.KeyCode.Left)return this.moveBackward(t),!0}return e===d.KeyCode.Tab?(t.shiftKey?this.leaveBackward():this.leaveForward(),!0):(e===d.KeyCode.Delete&&this.performShortcutEvent(t),!1)}moveForward(t){this.moveToNextItem(!0),this.performShortcutEvent(t)}moveBackward(t){this.moveToPrevItem(!0),this.performShortcutEvent(t)}getShortcutContext(){return{TabId:this.getSelectedTabId()}}focusSelectedItem(){var t;((null===(t=document.activeElement)||void 0===t?void 0:t.classList.contains(o.Prefix))||this.isTabActive())&&i.focusElement(this.selectedItemElement)}isTabActive(){var t;return null===(t=document.activeElement)||void 0===t?void 0:t.classList.contains(o.Item)}getSelectedTabId(){const t=this.getItem(this.selectedItemIndex);return null==t?void 0:t.getAttribute(a)}updateSelectedItemByChildElement(t,e=null){if(t===this.targetElement){const t=this.tabs.getActiveTab(),e=this.items.findIndex((e=>e===t));this.updateSelectedItemByIndex(this.validateItemIndex(e))}else super.updateSelectedItemByChildElement(t,e)}}var b;let h=b=class extends e{constructor(){super(...arguments),this.tabs=null,this.tabId=""}connectedOrContentChanged(){if(this.keyboardNavigator=this.querySelector(`:scope > ${r}`),this.keyboardNavigator&&"initialized"in this.keyboardNavigator&&!this.keyboardNavigator.initialized){this.tabs=document.querySelector(`#${this.tabId}`);const t=new l(this.tabs,this.keyboardNavigator,this);this.keyboardNavigator.initialize(this,t)}}initializeKeyboardNavigator(){if(this.keyboardNavigator=this.querySelector(`:scope > ${r}`),this.keyboardNavigator&&"initialized"in this.keyboardNavigator&&!this.keyboardNavigator.initialized){const t=new l(this.tabs,this.keyboardNavigator,this);this.keyboardNavigator.initialize(this,t)}}};h.TagName="dxbl-tab-list",t([c({attribute:"data-dxtabs-id"})],h.prototype,"tabId",void 0),h=b=t([m(b.TagName)],h);export{h as DxTabList};
