@aurodesignsystem-dev/auro-tabs 0.0.0-pr87.1 → 0.0.0-pr87.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/custom-elements.json +2300 -0
- package/demo/api.html +12 -6
- package/demo/api.md +123 -42
- package/demo/auro-tabpanel.min.js +88 -12
- package/demo/index.html +13 -19
- package/demo/index.md +53 -46
- package/demo/lit-element.min.js +2 -2
- package/dist/auro-tabpanel-CmN2vp5_.js +23 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1 -1
- package/dist/registered.js +1 -1
- package/package.json +10 -9
- package/demo/demo.md +0 -608
- package/dist/auro-tabpanel-CbLgu51a.js +0 -23
package/demo/lit-element.min.js
CHANGED
|
@@ -16,12 +16,12 @@ const t$1=globalThis,e$2=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.na
|
|
|
16
16
|
* Copyright 2017 Google LLC
|
|
17
17
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
18
18
|
*/
|
|
19
|
-
const t=globalThis,i$1=t.trustedTypes,s$1=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$1="?"+h,n=`<${o$1}>`,r=document,l=()=>r.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r.createTreeWalker(r,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n:d>=0?(o.push(a),s.slice(0,d)+e+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$1)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r).importNode(i,true);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(false,true,i);t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t.litHtmlPolyfillSupport;j?.(N,R),(t.litHtmlVersions??=[]).push("3.3.
|
|
19
|
+
const t=globalThis,i$1=t.trustedTypes,s$1=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$1="?"+h,n=`<${o$1}>`,r=document,l=()=>r.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r.createTreeWalker(r,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n:d>=0?(o.push(a),s.slice(0,d)+e+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$1)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r).importNode(i,true);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(false,true,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t.litHtmlPolyfillSupport;j?.(N,R),(t.litHtmlVersions??=[]).push("3.3.0");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @license
|
|
23
23
|
* Copyright 2017 Google LLC
|
|
24
24
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
-
*/const s=globalThis;class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T}}i._$litElement$=true,i["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i});const o=s.litElementPolyfillSupport;o?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.
|
|
25
|
+
*/const s=globalThis;class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T}}i._$litElement$=true,i["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i});const o=s.litElementPolyfillSupport;o?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.0");
|
|
26
26
|
|
|
27
27
|
export { T, i$3 as a, i, x };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{css as t,LitElement as e,html as s}from"lit";import{html as i}from"lit/static-html.js";import{styleMap as r}from"lit/directives/style-map.js";class o{registerComponent(t,e){customElements.get(t)||customElements.define(t,class extends e{})}closestElement(t,e=this,s=(e,i=e&&e.closest(t))=>e&&e!==document&&e!==window?i||s(e.getRootNode().host):null){return s(e)}handleComponentTagRename(t,e){const s=e.toLowerCase();t.tagName.toLowerCase()!==s&&t.setAttribute(s,!0)}elementMatch(t,e){const s=e.toLowerCase();return t.tagName.toLowerCase()===s||t.hasAttribute(s)}getSlotText(t,e){const s=t.shadowRoot?.querySelector(`slot[name="${e}"]`);return(s?.assignedNodes({flatten:!0})||[]).map((t=>t.textContent?.trim())).join(" ").trim()||null}}var a=t`:host #tab-root{cursor:pointer;white-space:nowrap}:host([disabled]){pointer-events:none}:host(:focus-within),:host(:focus:not(:focus-visible)){position:relative;outline-color:unset;outline-style:none;outline-width:unset}:host(:focus-within):before,:host(:focus:not(:focus-visible)):before{position:absolute;top:0;left:50%;display:inline-block;width:100%;height:calc(100% + var(--ds-size-50, .25rem));border:1px solid var(--ds-color-border-active-default, #0074c8);border-radius:var(--ds-border-radius, .375rem);content:"";transform:translate(-50%)}:host([onDark]:focus-within):before,:host([onDark]:focus:not(:focus-visible)):before,:host([appearance=inverse]:focus-within):before,:host([appearance=inverse]:focus:not(:focus-visible)):before{border-color:var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host(:not([onDark]):focus-within):before,:host(:not([onDark]):focus:not(:focus-visible)):before,:host(:not([appearance=inverse]):focus-within):before,:host(:not([appearance=inverse]):focus:not(:focus-visible)):before{border-color:var(--ds-advanced-color-state-focused, #01426a)}
|
|
2
|
+
`;class n extends e{static get properties(){return{appearance:{type:String,reflect:!0,default:"default"},selected:{type:Boolean,reflect:!0},focused:{type:Boolean,state:!0},disabled:{type:Boolean,reflect:!0},variant:{type:String,reflect:!0}}}static get styles(){return[a]}constructor(){super(),n.incrementInstanceCount(),this.handleTagName(),this.setId(),this.setInitialValues(),this.setAttributes(),this.addEventListeners()}static incrementInstanceCount(){n.instanceCount=(n.instanceCount||0)+1}addEventListeners(){this.addEventListener("keydown",this.onKeyDown)}onKeyDown=t=>{"Enter"!==t.key&&" "!==t.key||(this.selected=!0,t.preventDefault())};setFocused(t){t&&this.focus(),this.focused=t,this.setAttribute("tabindex",t?0:-1),this.dispatchCustomEvent(t?"tab-focused":"tab-blurred",this)}setId(){this.id=this.id||`auro-tab-${n.instanceCount}`}setInitialValues(){this.disabled=!1,this.appearance="default",this.panel=null}setAttributes(){this.setAttribute("role","tab")}handleTagName(){o.prototype.handleComponentTagRename(this,"auro-tab")}applyA11y(){const t=this.shadowRoot.querySelector("a");t&&t.setAttribute("role","none")}updateSelected(){this.setAttribute("tabindex",this.selected||this.focused?0:-1),this.setAttribute("aria-selected",this.selected?"true":"false"),this.selected&&this.dispatchCustomEvent("tab-selected",this)}dispatchCustomEvent(t,e){const s=new CustomEvent(t,{bubbles:!0,composed:!0,detail:e});this.dispatchEvent(s)}static register(t="auro-tab"){o.prototype.registerComponent(t,n)}firstUpdated(){this.applyA11y()}updated(t){t.has("selected")&&this.updateSelected()}render(){return i`
|
|
3
|
+
<div part="tab-root" id="tab-root">
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</div>
|
|
6
|
+
`}}class l{#t=[];#e=[];#s=[];get current(){return this.#t}subscribe(t){if("function"!=typeof t)throw new Error("AuroTabService | subscribe: Callback must be a function");return this.#s.push(t),()=>this.unsubscribe(t)}unsubscribe(t){if("function"!=typeof t)throw new Error("AuroTabService | unsubscribe: Callback must be a function");return this.#s=this.#s.filter((e=>e!==t)),!0}#i(){for(const t of this.#s)t(this.#t,this.#e)}add(t){if("object"!=typeof t||null===t)throw new Error("AuroTabService | addItem: Item must be an object");this.#e=this.#r(),this.#t.push(t),this.#i()}addMany(t){if(!t||"function"!=typeof t[Symbol.iterator]||"string"==typeof t)throw new Error("AuroTabService | addMany: Items must be iterable (array, etc.)");this.#e=this.#r(),this.#t.push(...t),this.#i()}remove(t){if("object"!=typeof t||null===t)throw new Error("AuroTabService | removeItem: Item must be an object");this.#e=this.#r(),this.#t=this.#t.filter((e=>e!==t)),this.#i()}clear(){this.#e=this.#r(),this.#t=[],this.#i()}getItemByIndex(t){return this.#t[t]}getItemByNumber(t){if(0===this.#t.length||"number"!=typeof t||t<0||t>this.#t.length)throw new Error("AuroTabService | getItemByNumber: Number must be a valid index within the range of items.");return this.#t[t-1]}getPreviousItem(t){if("number"!=typeof t||t<1||t>this.#t.length)throw new Error("AuroTabService | getPreviousItem: Index must be a valid number within the range of previous items.");let e=t-2;return e=e<0?this.#t.length-1:e,this.#t[e]}getNextItem(t){if("number"!=typeof t||t<1||t>this.#t.length)throw new Error("AuroTabService | getNextItem: Index must be a valid number within the range of previous items.");let e=t;return e=e>=this.#t.length?0:e,this.#t[e]}#r(){return[...this.#t]}}var h=t`::slotted(auro-tabpanel){flex-basis:100%}:host{position:relative;display:block}.tabgroupContainer{display:flex;flex-direction:column;transition:scroll .5s ease-in-out}.tabgroup{position:relative;padding-bottom:0}.tabgroup ::slotted([slot=tabs]){display:flex;overflow:unset;width:fit-content;flex-wrap:nowrap}.sliderPositioner{position:absolute;bottom:-1px;left:0;display:flex;width:0;height:calc(var(--ds-size-25, .125rem) + 1px);align-items:center;justify-content:center;transition:all .25s}.slider{width:100%;height:100%}:host(:not([onDark])) .slider,:host(:not([appearance=inverse])) .slider{background-color:var(--ds-advanced-color-state-focused, #01426a)}:host([onDark]) .slider,:host([appearance=inverse]) .slider{background-color:var(--ds-advanced-color-state-focused-inverse, #ffffff)}
|
|
7
|
+
`;class c{static getPreviousNotDisabledIndex(t,e){let s=t;const i=()=>{0===s?s=e.length-1:s-=1};for(i();e[s].hasAttribute("disabled");)i();return s}static findNextNotDisabledIndex(t,e){let s=t;const i=()=>{s===e.length-1?s=0:s+=1};for(i();e[s].hasAttribute("disabled");)i();return s}}const d="ArrowLeft",u="ArrowRight",b="Home",p="End";class f extends e{static get properties(){return{appearance:{type:String,reflect:!0},scrollPosition:{type:Number},selectOnFocus:{type:Boolean,reflect:!0},sliderStyles:{type:Object},rightChevronIsVisible:{type:Boolean,attribute:!1,reflect:!1,default:!0},leftChevronIsVisible:{type:Boolean,attribute:!1,reflect:!1},ondark:{type:Boolean,reflect:!0}}}get allTabs(){return this.tabs.current}get allPanels(){return this.panels.current}get currentTabIndex(){return this.focusedTabIdx}get currentTab(){return this.allTabs[this.focusedTabIdx]}get scrollSize(){return this.tabGroupContainer?this.tabGroupContainer.scrollWidth-this.tabGroupContainer.clientWidth:0}get busy(){return"true"===this.getAttribute("aria-busy")}set busy(t){this.setAttribute("aria-busy",String(t))}static get styles(){return[h]}constructor(){super(),this.handleTagName(),this.setInitialValues(),this.bindMethods(),this.tabs=new l,this.panels=new l,this.tabs.subscribe(this.#o),this.panels.subscribe(this.#o)}handleTagName(){o.prototype.handleComponentTagRename(this,"auro-tabgroup")}setInitialValues(){this.scrollPosition=0,this.sliderStyles={},this.selectOnFocus=!1,this.appearance="default",this.focusedTabIdx=-1,this.resizeObserver=void 0}bindMethods(){this.handleTabSelected=this.handleTabSelected.bind(this),this.handleTabFocused=this.handleTabFocused.bind(this)}static register(t="auro-tabgroup"){o.prototype.registerComponent(t,f)}propagateOnDarkToTabs(){this.allTabs.forEach((t=>{this.ondark?t.setAttribute("ondark",""):t.removeAttribute("ondark"),t.setAttribute("appearance",this.appearance)}))}#a(){this.allTabs.forEach(((t,e)=>{const s=this.panels.getItemByIndex(e);s&&(s.hidden=!0,t.panel=s,t.setAttribute("aria-controls",s.id),s.setAttribute("aria-labelledby",t.id),t.selected&&this.selectTab(t))}))}addEventListeners(){this.addEventListener("tab-selected",this.handleTabSelected),this.addEventListener("tab-focused",this.handleTabFocused),this.addEventListener("keydown",this.onKeyDown),this.addEventListener("click",this.onClick)}removeEventListeners(){this.removeEventListener("keydown",this.onKeyDown),this.removeEventListener("click",this.onClick),this.resizeObserver?.disconnect()}#o=()=>{this.busy=!0,this.#a(),this.propagateOnDarkToTabs(),-1===this.focusedTabIdx&&this.allTabs[0]?.panel&&this.selectTab(this.allTabs[0]),this.busy=!1};selectTab(t){const e=this.allTabs;this.focusedTabIdx=-1;for(let s=0;s<e.length;s++){const i=e[s];i===t&&(this.focusedTabIdx=s),i.selected=i===t,i.panel&&(i.panel.hidden=i!==t)}if(this.scrollSize>0){const e=t.getBoundingClientRect(),s=this.tabGroupContainer.clientWidth/2;this.tabGroupContainer.scrollBy({left:e.x-s,behavior:"smooth"})}t.panel||console.warn(`No panel with id ${t.id}`)}selectTabByIndex(t){const e=this.tabs.current[t];e&&this.selectTab(e)}onKeyDown(t){if(t.altKey)return;const e=t.target.getAttribute("role");if("tab"!==e&&"tablist"!==e)return;const s=this.allTabs;let i=0;switch(t.key){case d:i=c.getPreviousNotDisabledIndex(this.focusedTabIdx,s);break;case u:i=c.findNextNotDisabledIndex(this.focusedTabIdx,s);break;case b:i=0;break;case p:i=s.length-1;break;default:return}this.focusedTabIdx=i,t.preventDefault();const r=s[i];r&&(this.tabs.current.forEach(((t,e)=>{t.setFocused(t===r)})),this.selectOnFocus&&this.selectTab(r))}onClick(t){const e="tab"!==t.target.getAttribute("role"),s=t.target.closest("[role=tab]");e&&!s&&"auro-tab"!==t.target.localName||(s?this.selectTab(s):this.selectTab(t.target))}handleTabSelected(t){this.sliderStyles.width=0;const e=t.target;e&&(this.selectTab(e),this.sliderStyles={width:`${e.clientWidth}px`,left:e.offsetLeft-.5+"px"})}handleTabFocused(t){const e=t.target;this.focusedTabIdx=this.tabs.current.indexOf(e)||0}generateIcon(t){return(new DOMParser).parseFromString(t.svg,"text/html").body.firstChild}onTabGroupScroll(){this.scrollPosition=this.tabGroupContainer.scrollLeft}scrollTab(t){if(this.tabGroupContainer)switch(t){case"prev":this.tabGroupContainer.scrollLeft>0&&this.tabGroupContainer.scrollBy({left:-this.tabGroupContainer.clientWidth,behavior:"smooth"});break;case"next":this.tabGroupContainer.scrollLeft<this.scrollSize&&this.tabGroupContainer.scrollBy({left:this.tabGroupContainer.clientWidth,behavior:"smooth"})}}setResizeObserver(t){this.resizeObserver=new ResizeObserver((()=>{this.handleTabSelected({target:this.currentTab})}));const e=t.querySelector(".tabgroup");this.resizeObserver.observe(e,{box:"border-box"})}setupTabGroupContainer(){this.tabGroupContainer=this.shadowRoot.querySelector(".tabgroupContainer"),this.tabGroupContainer.addEventListener("scroll",(()=>this.onTabGroupScroll()))}updateChevronVisibility(){this.leftChevronIsVisible=(this.scrollPosition>=this.scrollSize||0!==this.scrollPosition)&&this.scrollSize>0,this.rightChevronIsVisible=(0===this.scrollPosition||this.scrollPosition<this.scrollSize)&&this.scrollSize>0}firstUpdated(){this.setupTabGroupContainer(),this.setResizeObserver(this.tabGroupContainer)}updated(t){this.updateChevronVisibility(),(t.has("appearance")||t.has("ondark"))&&this.propagateOnDarkToTabs()}connectedCallback(){super.connectedCallback(),this.addEventListeners()}disconnectedCallback(){this.removeEventListeners()}#n=()=>{const t=this.querySelectorAll("auro-tab, [auro-tab]"),e=this.querySelectorAll("auro-tabpanel, [auro-tabpanel]");this.tabs.clear(),this.panels.clear(),this.tabs.addMany(t),this.panels.addMany(e),this.#o()};render(){const t=r(this.sliderStyles);return s`
|
|
8
|
+
<div part="tabgroup__root" class="tabgroupContainer">
|
|
9
|
+
<div part="tabgroup__tabs" class="tabgroup" role="tablist">
|
|
10
|
+
<slot name="tabs" @slotchange="${this.#n}"></slot>
|
|
11
|
+
<div part="slider-positioner" class="sliderPositioner" style=${t}>
|
|
12
|
+
<div part="slider" class="slider"></div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div part="tabgroup__panels">
|
|
17
|
+
<slot name="panels" @slotchange="${this.#n}"></slot>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
`}}var m=t`:host{display:block;width:100%}:host([hidden]){display:none}
|
|
21
|
+
`;class v extends e{static get properties(){return{hidden:{type:Boolean,reflect:!0}}}static get styles(){return[m]}constructor(){super(),v.incrementInstanceCount(),this.handleTagName(),this.setId(),this.setAttributes()}static incrementInstanceCount(){v.instanceCount=(v.instanceCount||0)+1}static register(t="auro-tabpanel"){o.prototype.registerComponent(t,v)}handleTagName(){o.prototype.handleComponentTagRename(this,"auro-tabpanel")}setId(){this.id=this.id||`auro-tabpanel-${v.instanceCount}`}setAttributes(){this.setAttribute("role","tabpanel"),this.setAttribute("tabindex",0)}updated(t){t.has("hidden")&&this.setAttribute("tabindex",this.hidden?-1:0)}render(){return s`
|
|
22
|
+
<slot></slot>
|
|
23
|
+
`}}export{n as A,f as a,v as b};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { css, LitElement, html as html$1 } from 'lit';
|
|
|
2
2
|
import { html } from 'lit/static-html.js';
|
|
3
3
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
4
4
|
|
|
5
|
-
class o{registerComponent(t,e){customElements.get(t)||customElements.define(t,class extends e{});}closestElement(t,e=this,s=(e,i=e&&e.closest(t))=>e&&e!==document&&e!==window?i||s(e.getRootNode().host):null){return s(e)}handleComponentTagRename(t,e){const s=e.toLowerCase();t.tagName.toLowerCase()!==s&&t.setAttribute(s,true);}elementMatch(t,e){const s=e.toLowerCase();return t.tagName.toLowerCase()===s||t.hasAttribute(s)}}var a=css`:host #tab-root{cursor:pointer;white-space:nowrap}:host([disabled]){pointer-events:none}:host(:focus-within),:host(:focus:not(:focus-visible)){position:relative;outline:none}:host(:focus-within):before,:host(:focus:not(:focus-visible)):before{position:absolute;top:0;left:50%;display:inline-block;width:100%;height:calc(100% + var(--ds-size-50, .25rem));border:1px solid var(--ds-color-border-active-default, #0074c8);border-radius:var(--ds-border-radius, .375rem);content:"";transform:translate(-50%)}
|
|
6
|
-
`;class n extends LitElement{static get properties(){return {selected:{type:Boolean,reflect:true},focused:{type:Boolean,state:true},disabled:{type:Boolean,reflect:true},variant:{type:String,reflect:true}}}static get styles(){return [a]}constructor(){super(),n.incrementInstanceCount(),this.handleTagName(),this.setId(),this.setInitialValues(),this.setAttributes(),this.addEventListeners();}static incrementInstanceCount(){n.instanceCount=(n.instanceCount||0)+1;}addEventListeners(){this.addEventListener("keydown",this.onKeyDown);}onKeyDown=t=>{"Enter"!==t.key&&" "!==t.key||(this.selected=true,t.preventDefault());};setFocused(t){t&&this.focus(),this.focused=t,this.setAttribute("tabindex",t?0:-1),this.dispatchCustomEvent(t?"tab-focused":"tab-blurred",this);}setId(){this.id=this.id||`auro-tab-${n.instanceCount}`;}setInitialValues(){this.disabled=false,this.panel=null;}setAttributes(){this.setAttribute("role","tab");}handleTagName(){o.prototype.handleComponentTagRename(this,"auro-tab");}applyA11y(){const t=this.shadowRoot.querySelector("a");t&&t.setAttribute("role","none");}updateSelected(){this.setAttribute("tabindex",this.selected||this.focused?0:-1),this.setAttribute("aria-selected",this.selected?"true":"false"),this.selected&&this.dispatchCustomEvent("tab-selected",this);}dispatchCustomEvent(t,e){const s=new CustomEvent(t,{bubbles:true,composed:true,detail:e});this.dispatchEvent(s);}static register(t="auro-tab"){o.prototype.registerComponent(t,n);}firstUpdated(){this.applyA11y();}updated(t){t.has("selected")&&this.updateSelected();}render(){return html`
|
|
5
|
+
class o{registerComponent(t,e){customElements.get(t)||customElements.define(t,class extends e{});}closestElement(t,e=this,s=(e,i=e&&e.closest(t))=>e&&e!==document&&e!==window?i||s(e.getRootNode().host):null){return s(e)}handleComponentTagRename(t,e){const s=e.toLowerCase();t.tagName.toLowerCase()!==s&&t.setAttribute(s,true);}elementMatch(t,e){const s=e.toLowerCase();return t.tagName.toLowerCase()===s||t.hasAttribute(s)}getSlotText(t,e){const s=t.shadowRoot?.querySelector(`slot[name="${e}"]`);return (s?.assignedNodes({flatten:true})||[]).map((t=>t.textContent?.trim())).join(" ").trim()||null}}var a=css`:host #tab-root{cursor:pointer;white-space:nowrap}:host([disabled]){pointer-events:none}:host(:focus-within),:host(:focus:not(:focus-visible)){position:relative;outline-color:unset;outline-style:none;outline-width:unset}:host(:focus-within):before,:host(:focus:not(:focus-visible)):before{position:absolute;top:0;left:50%;display:inline-block;width:100%;height:calc(100% + var(--ds-size-50, .25rem));border:1px solid var(--ds-color-border-active-default, #0074c8);border-radius:var(--ds-border-radius, .375rem);content:"";transform:translate(-50%)}:host([onDark]:focus-within):before,:host([onDark]:focus:not(:focus-visible)):before,:host([appearance=inverse]:focus-within):before,:host([appearance=inverse]:focus:not(:focus-visible)):before{border-color:var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host(:not([onDark]):focus-within):before,:host(:not([onDark]):focus:not(:focus-visible)):before,:host(:not([appearance=inverse]):focus-within):before,:host(:not([appearance=inverse]):focus:not(:focus-visible)):before{border-color:var(--ds-advanced-color-state-focused, #01426a)}
|
|
6
|
+
`;class n extends LitElement{static get properties(){return {appearance:{type:String,reflect:true,default:"default"},selected:{type:Boolean,reflect:true},focused:{type:Boolean,state:true},disabled:{type:Boolean,reflect:true},variant:{type:String,reflect:true}}}static get styles(){return [a]}constructor(){super(),n.incrementInstanceCount(),this.handleTagName(),this.setId(),this.setInitialValues(),this.setAttributes(),this.addEventListeners();}static incrementInstanceCount(){n.instanceCount=(n.instanceCount||0)+1;}addEventListeners(){this.addEventListener("keydown",this.onKeyDown);}onKeyDown=t=>{"Enter"!==t.key&&" "!==t.key||(this.selected=true,t.preventDefault());};setFocused(t){t&&this.focus(),this.focused=t,this.setAttribute("tabindex",t?0:-1),this.dispatchCustomEvent(t?"tab-focused":"tab-blurred",this);}setId(){this.id=this.id||`auro-tab-${n.instanceCount}`;}setInitialValues(){this.disabled=false,this.appearance="default",this.panel=null;}setAttributes(){this.setAttribute("role","tab");}handleTagName(){o.prototype.handleComponentTagRename(this,"auro-tab");}applyA11y(){const t=this.shadowRoot.querySelector("a");t&&t.setAttribute("role","none");}updateSelected(){this.setAttribute("tabindex",this.selected||this.focused?0:-1),this.setAttribute("aria-selected",this.selected?"true":"false"),this.selected&&this.dispatchCustomEvent("tab-selected",this);}dispatchCustomEvent(t,e){const s=new CustomEvent(t,{bubbles:true,composed:true,detail:e});this.dispatchEvent(s);}static register(t="auro-tab"){o.prototype.registerComponent(t,n);}firstUpdated(){this.applyA11y();}updated(t){t.has("selected")&&this.updateSelected();}render(){return html`
|
|
7
7
|
<div part="tab-root" id="tab-root">
|
|
8
8
|
<slot></slot>
|
|
9
9
|
</div>
|
|
10
|
-
`}}class l{#t=[];#e=[];#s=[];get current(){return this.#t}subscribe(t){if("function"!=typeof t)throw new Error("AuroTabService | subscribe: Callback must be a function");return this.#s.push(t),()=>this.unsubscribe(t)}unsubscribe(t){if("function"!=typeof t)throw new Error("AuroTabService | unsubscribe: Callback must be a function");return this.#s=this.#s.filter(e=>e!==t),true}#i(){for(const t of this.#s)t(this.#t,this.#e);}add(t){if("object"!=typeof t||null===t)throw new Error("AuroTabService | addItem: Item must be an object");this.#e=this.#r(),this.#t.push(t),this.#i();}addMany(t){if(!t||"function"!=typeof t[Symbol.iterator]||"string"==typeof t)throw new Error("AuroTabService | addMany: Items must be iterable (array, etc.)");this.#e=this.#r(),this.#t.push(...t),this.#i();}remove(t){if("object"!=typeof t||null===t)throw new Error("AuroTabService | removeItem: Item must be an object");this.#e=this.#r(),this.#t=this.#t.filter(e=>e!==t),this.#i();}clear(){this.#e=this.#r(),this.#t=[],this.#i();}getItemByIndex(t){return this.#t[t]}getItemByNumber(t){if(0===this.#t.length||"number"!=typeof t||t<0||t>this.#t.length)throw new Error("AuroTabService | getItemByNumber: Number must be a valid index within the range of items.");return this.#t[t-1]}getPreviousItem(t){if("number"!=typeof t||t<1||t>this.#t.length)throw new Error("AuroTabService | getPreviousItem: Index must be a valid number within the range of previous items.");let e=t-2;return e=e<0?this.#t.length-1:e,this.#t[e]}getNextItem(t){if("number"!=typeof t||t<1||t>this.#t.length)throw new Error("AuroTabService | getNextItem: Index must be a valid number within the range of previous items.");let e=t;return e=e>=this.#t.length?0:e,this.#t[e]}#r(){return [...this.#t]}}var h=css`::slotted(auro-tabpanel){flex-basis:100%}:host{position:relative;display:block}.tabgroupContainer{display:flex;flex-direction:column;transition:scroll .5s ease-in-out}.tabgroup{position:relative;padding-bottom:0}.tabgroup ::slotted([slot=tabs]){display:flex;overflow:unset;width:fit-content;flex-wrap:nowrap}.sliderPositioner{position:absolute;bottom:-1px;left:0;display:flex;width:0;height:calc(var(--ds-size-25, .125rem) + 1px);align-items:center;justify-content:center;transition:all .25s}.slider{width:100%;height:100
|
|
11
|
-
`;class c{static getPreviousNotDisabledIndex(t,e){let s=t;const i=()=>{0===s?s=e.length-1:s-=1;};for(i();e[s].hasAttribute("disabled");)i();return s}static findNextNotDisabledIndex(t,e){let s=t;const i=()=>{s===e.length-1?s=0:s+=1;};for(i();e[s].hasAttribute("disabled");)i();return s}}const
|
|
10
|
+
`}}class l{#t=[];#e=[];#s=[];get current(){return this.#t}subscribe(t){if("function"!=typeof t)throw new Error("AuroTabService | subscribe: Callback must be a function");return this.#s.push(t),()=>this.unsubscribe(t)}unsubscribe(t){if("function"!=typeof t)throw new Error("AuroTabService | unsubscribe: Callback must be a function");return this.#s=this.#s.filter((e=>e!==t)),true}#i(){for(const t of this.#s)t(this.#t,this.#e);}add(t){if("object"!=typeof t||null===t)throw new Error("AuroTabService | addItem: Item must be an object");this.#e=this.#r(),this.#t.push(t),this.#i();}addMany(t){if(!t||"function"!=typeof t[Symbol.iterator]||"string"==typeof t)throw new Error("AuroTabService | addMany: Items must be iterable (array, etc.)");this.#e=this.#r(),this.#t.push(...t),this.#i();}remove(t){if("object"!=typeof t||null===t)throw new Error("AuroTabService | removeItem: Item must be an object");this.#e=this.#r(),this.#t=this.#t.filter((e=>e!==t)),this.#i();}clear(){this.#e=this.#r(),this.#t=[],this.#i();}getItemByIndex(t){return this.#t[t]}getItemByNumber(t){if(0===this.#t.length||"number"!=typeof t||t<0||t>this.#t.length)throw new Error("AuroTabService | getItemByNumber: Number must be a valid index within the range of items.");return this.#t[t-1]}getPreviousItem(t){if("number"!=typeof t||t<1||t>this.#t.length)throw new Error("AuroTabService | getPreviousItem: Index must be a valid number within the range of previous items.");let e=t-2;return e=e<0?this.#t.length-1:e,this.#t[e]}getNextItem(t){if("number"!=typeof t||t<1||t>this.#t.length)throw new Error("AuroTabService | getNextItem: Index must be a valid number within the range of previous items.");let e=t;return e=e>=this.#t.length?0:e,this.#t[e]}#r(){return [...this.#t]}}var h=css`::slotted(auro-tabpanel){flex-basis:100%}:host{position:relative;display:block}.tabgroupContainer{display:flex;flex-direction:column;transition:scroll .5s ease-in-out}.tabgroup{position:relative;padding-bottom:0}.tabgroup ::slotted([slot=tabs]){display:flex;overflow:unset;width:fit-content;flex-wrap:nowrap}.sliderPositioner{position:absolute;bottom:-1px;left:0;display:flex;width:0;height:calc(var(--ds-size-25, .125rem) + 1px);align-items:center;justify-content:center;transition:all .25s}.slider{width:100%;height:100%}:host(:not([onDark])) .slider,:host(:not([appearance=inverse])) .slider{background-color:var(--ds-advanced-color-state-focused, #01426a)}:host([onDark]) .slider,:host([appearance=inverse]) .slider{background-color:var(--ds-advanced-color-state-focused-inverse, #ffffff)}
|
|
11
|
+
`;class c{static getPreviousNotDisabledIndex(t,e){let s=t;const i=()=>{0===s?s=e.length-1:s-=1;};for(i();e[s].hasAttribute("disabled");)i();return s}static findNextNotDisabledIndex(t,e){let s=t;const i=()=>{s===e.length-1?s=0:s+=1;};for(i();e[s].hasAttribute("disabled");)i();return s}}const d="ArrowLeft",u="ArrowRight",b="Home",p="End";class f extends LitElement{static get properties(){return {appearance:{type:String,reflect:true},scrollPosition:{type:Number},selectOnFocus:{type:Boolean,reflect:true},sliderStyles:{type:Object},rightChevronIsVisible:{type:Boolean,attribute:false,reflect:false,default:true},leftChevronIsVisible:{type:Boolean,attribute:false,reflect:false},ondark:{type:Boolean,reflect:true}}}get allTabs(){return this.tabs.current}get allPanels(){return this.panels.current}get currentTabIndex(){return this.focusedTabIdx}get currentTab(){return this.allTabs[this.focusedTabIdx]}get scrollSize(){return this.tabGroupContainer?this.tabGroupContainer.scrollWidth-this.tabGroupContainer.clientWidth:0}get busy(){return "true"===this.getAttribute("aria-busy")}set busy(t){this.setAttribute("aria-busy",String(t));}static get styles(){return [h]}constructor(){super(),this.handleTagName(),this.setInitialValues(),this.bindMethods(),this.tabs=new l,this.panels=new l,this.tabs.subscribe(this.#o),this.panels.subscribe(this.#o);}handleTagName(){o.prototype.handleComponentTagRename(this,"auro-tabgroup");}setInitialValues(){this.scrollPosition=0,this.sliderStyles={},this.selectOnFocus=false,this.appearance="default",this.focusedTabIdx=-1,this.resizeObserver=void 0;}bindMethods(){this.handleTabSelected=this.handleTabSelected.bind(this),this.handleTabFocused=this.handleTabFocused.bind(this);}static register(t="auro-tabgroup"){o.prototype.registerComponent(t,f);}propagateOnDarkToTabs(){this.allTabs.forEach((t=>{this.ondark?t.setAttribute("ondark",""):t.removeAttribute("ondark"),t.setAttribute("appearance",this.appearance);}));}#a(){this.allTabs.forEach(((t,e)=>{const s=this.panels.getItemByIndex(e);s&&(s.hidden=true,t.panel=s,t.setAttribute("aria-controls",s.id),s.setAttribute("aria-labelledby",t.id),t.selected&&this.selectTab(t));}));}addEventListeners(){this.addEventListener("tab-selected",this.handleTabSelected),this.addEventListener("tab-focused",this.handleTabFocused),this.addEventListener("keydown",this.onKeyDown),this.addEventListener("click",this.onClick);}removeEventListeners(){this.removeEventListener("keydown",this.onKeyDown),this.removeEventListener("click",this.onClick),this.resizeObserver?.disconnect();}#o=()=>{this.busy=true,this.#a(),this.propagateOnDarkToTabs(),-1===this.focusedTabIdx&&this.allTabs[0]?.panel&&this.selectTab(this.allTabs[0]),this.busy=false;};selectTab(t){const e=this.allTabs;this.focusedTabIdx=-1;for(let s=0;s<e.length;s++){const i=e[s];i===t&&(this.focusedTabIdx=s),i.selected=i===t,i.panel&&(i.panel.hidden=i!==t);}if(this.scrollSize>0){const e=t.getBoundingClientRect(),s=this.tabGroupContainer.clientWidth/2;this.tabGroupContainer.scrollBy({left:e.x-s,behavior:"smooth"});}t.panel||console.warn(`No panel with id ${t.id}`);}selectTabByIndex(t){const e=this.tabs.current[t];e&&this.selectTab(e);}onKeyDown(t){if(t.altKey)return;const e=t.target.getAttribute("role");if("tab"!==e&&"tablist"!==e)return;const s=this.allTabs;let i=0;switch(t.key){case d:i=c.getPreviousNotDisabledIndex(this.focusedTabIdx,s);break;case u:i=c.findNextNotDisabledIndex(this.focusedTabIdx,s);break;case b:i=0;break;case p:i=s.length-1;break;default:return}this.focusedTabIdx=i,t.preventDefault();const r=s[i];r&&(this.tabs.current.forEach(((t,e)=>{t.setFocused(t===r);})),this.selectOnFocus&&this.selectTab(r));}onClick(t){const e="tab"!==t.target.getAttribute("role"),s=t.target.closest("[role=tab]");e&&!s&&"auro-tab"!==t.target.localName||(s?this.selectTab(s):this.selectTab(t.target));}handleTabSelected(t){this.sliderStyles.width=0;const e=t.target;e&&(this.selectTab(e),this.sliderStyles={width:`${e.clientWidth}px`,left:e.offsetLeft-.5+"px"});}handleTabFocused(t){const e=t.target;this.focusedTabIdx=this.tabs.current.indexOf(e)||0;}generateIcon(t){return (new DOMParser).parseFromString(t.svg,"text/html").body.firstChild}onTabGroupScroll(){this.scrollPosition=this.tabGroupContainer.scrollLeft;}scrollTab(t){if(this.tabGroupContainer)switch(t){case "prev":this.tabGroupContainer.scrollLeft>0&&this.tabGroupContainer.scrollBy({left:-this.tabGroupContainer.clientWidth,behavior:"smooth"});break;case "next":this.tabGroupContainer.scrollLeft<this.scrollSize&&this.tabGroupContainer.scrollBy({left:this.tabGroupContainer.clientWidth,behavior:"smooth"});}}setResizeObserver(t){this.resizeObserver=new ResizeObserver((()=>{this.handleTabSelected({target:this.currentTab});}));const e=t.querySelector(".tabgroup");this.resizeObserver.observe(e,{box:"border-box"});}setupTabGroupContainer(){this.tabGroupContainer=this.shadowRoot.querySelector(".tabgroupContainer"),this.tabGroupContainer.addEventListener("scroll",(()=>this.onTabGroupScroll()));}updateChevronVisibility(){this.leftChevronIsVisible=(this.scrollPosition>=this.scrollSize||0!==this.scrollPosition)&&this.scrollSize>0,this.rightChevronIsVisible=(0===this.scrollPosition||this.scrollPosition<this.scrollSize)&&this.scrollSize>0;}firstUpdated(){this.setupTabGroupContainer(),this.setResizeObserver(this.tabGroupContainer);}updated(t){this.updateChevronVisibility(),(t.has("appearance")||t.has("ondark"))&&this.propagateOnDarkToTabs();}connectedCallback(){super.connectedCallback(),this.addEventListeners();}disconnectedCallback(){this.removeEventListeners();}#n=()=>{const t=this.querySelectorAll("auro-tab, [auro-tab]"),e=this.querySelectorAll("auro-tabpanel, [auro-tabpanel]");this.tabs.clear(),this.panels.clear(),this.tabs.addMany(t),this.panels.addMany(e),this.#o();};render(){const t=styleMap(this.sliderStyles);return html$1`
|
|
12
12
|
<div part="tabgroup__root" class="tabgroupContainer">
|
|
13
13
|
<div part="tabgroup__tabs" class="tabgroup" role="tablist">
|
|
14
14
|
<slot name="tabs" @slotchange="${this.#n}"></slot>
|
|
@@ -21,9 +21,9 @@ class o{registerComponent(t,e){customElements.get(t)||customElements.define(t,cl
|
|
|
21
21
|
<slot name="panels" @slotchange="${this.#n}"></slot>
|
|
22
22
|
</div>
|
|
23
23
|
</div>
|
|
24
|
-
`}}var
|
|
25
|
-
`;class
|
|
24
|
+
`}}var m=css`:host{display:block;width:100%}:host([hidden]){display:none}
|
|
25
|
+
`;class v extends LitElement{static get properties(){return {hidden:{type:Boolean,reflect:true}}}static get styles(){return [m]}constructor(){super(),v.incrementInstanceCount(),this.handleTagName(),this.setId(),this.setAttributes();}static incrementInstanceCount(){v.instanceCount=(v.instanceCount||0)+1;}static register(t="auro-tabpanel"){o.prototype.registerComponent(t,v);}handleTagName(){o.prototype.handleComponentTagRename(this,"auro-tabpanel");}setId(){this.id=this.id||`auro-tabpanel-${v.instanceCount}`;}setAttributes(){this.setAttribute("role","tabpanel"),this.setAttribute("tabindex",0);}updated(t){t.has("hidden")&&this.setAttribute("tabindex",this.hidden?-1:0);}render(){return html$1`
|
|
26
26
|
<slot></slot>
|
|
27
27
|
`}}
|
|
28
28
|
|
|
29
|
-
export { n as AuroTab,
|
|
29
|
+
export { n as AuroTab, f as AuroTabgroup, v as AuroTabpanel };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{A as AuroTab,a as AuroTabgroup,b as AuroTabpanel}from"./auro-tabpanel-
|
|
1
|
+
export{A as AuroTab,a as AuroTabgroup,b as AuroTabpanel}from"./auro-tabpanel-CmN2vp5_.js";import"lit";import"lit/static-html.js";import"lit/directives/style-map.js";
|
package/dist/registered.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t,A as i,b as r}from"./auro-tabpanel-
|
|
1
|
+
import{a as t,A as i,b as r}from"./auro-tabpanel-CmN2vp5_.js";import"lit";import"lit/static-html.js";import"lit/directives/style-map.js";t.register(),i.register(),r.register();
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"================================================================================"
|
|
8
8
|
],
|
|
9
9
|
"name": "@aurodesignsystem-dev/auro-tabs",
|
|
10
|
-
"version": "0.0.0-pr87.
|
|
10
|
+
"version": "0.0.0-pr87.2",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "https://github.com/AlaskaAirlines/auro-tabs"
|
|
@@ -21,17 +21,15 @@
|
|
|
21
21
|
"node": "^20.x || ^22.x"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@lit/reactive-element": "^2.
|
|
25
|
-
"lit": "^3.3.
|
|
24
|
+
"@lit/reactive-element": "^2.1.1",
|
|
25
|
+
"lit": "^3.3.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@aurodesignsystem/auro-cli": "^3.
|
|
28
|
+
"@aurodesignsystem/auro-cli": "^3.1.1",
|
|
29
29
|
"@aurodesignsystem/auro-config": "^1.3.0",
|
|
30
|
-
"@aurodesignsystem/auro-library": "^5.5.
|
|
30
|
+
"@aurodesignsystem/auro-library": "^5.5.4",
|
|
31
31
|
"@aurodesignsystem/design-tokens": "^8.5.0",
|
|
32
|
-
"@aurodesignsystem/webcorestylesheets": "^10.1.
|
|
33
|
-
"@open-wc/testing": "^4.0.0",
|
|
34
|
-
"@web/test-runner-commands": "^0.9.0",
|
|
32
|
+
"@aurodesignsystem/webcorestylesheets": "^10.1.4",
|
|
35
33
|
"husky": "^9.1.7"
|
|
36
34
|
},
|
|
37
35
|
"browserslist": [
|
|
@@ -63,6 +61,7 @@
|
|
|
63
61
|
},
|
|
64
62
|
"exports": {
|
|
65
63
|
"./package.json": "./package.json",
|
|
64
|
+
"./custom-elements.json": "./custom-elements.json",
|
|
66
65
|
"./readme.md": "./README.md",
|
|
67
66
|
".": "./dist/registered.js",
|
|
68
67
|
"./demo/*.md": "./demo/*.md",
|
|
@@ -74,11 +73,13 @@
|
|
|
74
73
|
}
|
|
75
74
|
},
|
|
76
75
|
"files": [
|
|
76
|
+
"custom-elements.json",
|
|
77
77
|
"dist/**/*",
|
|
78
78
|
"demo/**/*",
|
|
79
79
|
"CHANGELOG.md",
|
|
80
80
|
"README.md",
|
|
81
81
|
"LICENSE",
|
|
82
82
|
"NOTICE"
|
|
83
|
-
]
|
|
83
|
+
],
|
|
84
|
+
"customElements": "custom-elements.json"
|
|
84
85
|
}
|