@aurodesignsystem-dev/auro-tabs 0.0.0-pr91.1 → 0.0.0-pr95.0
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/custom-elements.json +30 -6
- package/demo/api.md +13 -17
- package/demo/auro-tabpanel.min.js +5 -5
- package/demo/generatedTabExample.min.js +6 -6
- package/demo/lit-element.min.js +5 -5
- package/dist/auro-tabpanel-BOxEbwY9.js +23 -0
- package/dist/index.d.ts +420 -29
- package/dist/index.js +1 -1
- package/dist/registered.js +1 -1
- package/package.json +1 -1
- package/dist/auro-tabpanel-CmN2vp5_.js +0 -23
package/custom-elements.json
CHANGED
|
@@ -243,6 +243,9 @@
|
|
|
243
243
|
"inheritedFrom": {
|
|
244
244
|
"name": "AuroTab",
|
|
245
245
|
"module": "src/auro-tab.js"
|
|
246
|
+
},
|
|
247
|
+
"type": {
|
|
248
|
+
"text": "register(name?: string = \"auro-tab\") => void"
|
|
246
249
|
}
|
|
247
250
|
},
|
|
248
251
|
{
|
|
@@ -342,7 +345,9 @@
|
|
|
342
345
|
"module": "src/auro-tab.js"
|
|
343
346
|
}
|
|
344
347
|
}
|
|
345
|
-
]
|
|
348
|
+
],
|
|
349
|
+
"modulePath": "scripts/wca/auro-tab.js",
|
|
350
|
+
"definitionPath": "scripts/wca/auro-tab.js"
|
|
346
351
|
}
|
|
347
352
|
],
|
|
348
353
|
"exports": [
|
|
@@ -817,6 +822,9 @@
|
|
|
817
822
|
"inheritedFrom": {
|
|
818
823
|
"name": "AuroTabgroup",
|
|
819
824
|
"module": "src/auro-tabgroup.js"
|
|
825
|
+
},
|
|
826
|
+
"type": {
|
|
827
|
+
"text": "register(name?: string = \"auro-tabgroup\") => void"
|
|
820
828
|
}
|
|
821
829
|
},
|
|
822
830
|
{
|
|
@@ -918,6 +926,9 @@
|
|
|
918
926
|
"inheritedFrom": {
|
|
919
927
|
"name": "AuroTabgroup",
|
|
920
928
|
"module": "src/auro-tabgroup.js"
|
|
929
|
+
},
|
|
930
|
+
"type": {
|
|
931
|
+
"text": "selectTab(newTab: HTMLElement) => void"
|
|
921
932
|
}
|
|
922
933
|
},
|
|
923
934
|
{
|
|
@@ -935,6 +946,9 @@
|
|
|
935
946
|
"inheritedFrom": {
|
|
936
947
|
"name": "AuroTabgroup",
|
|
937
948
|
"module": "src/auro-tabgroup.js"
|
|
949
|
+
},
|
|
950
|
+
"type": {
|
|
951
|
+
"text": "selectTabByIndex(index: number) => void"
|
|
938
952
|
}
|
|
939
953
|
},
|
|
940
954
|
{
|
|
@@ -1005,7 +1019,9 @@
|
|
|
1005
1019
|
"module": "src/auro-tabgroup.js"
|
|
1006
1020
|
}
|
|
1007
1021
|
}
|
|
1008
|
-
]
|
|
1022
|
+
],
|
|
1023
|
+
"modulePath": "scripts/wca/auro-tabgroup.js",
|
|
1024
|
+
"definitionPath": "scripts/wca/auro-tabgroup.js"
|
|
1009
1025
|
}
|
|
1010
1026
|
],
|
|
1011
1027
|
"exports": [
|
|
@@ -1113,6 +1129,9 @@
|
|
|
1113
1129
|
"inheritedFrom": {
|
|
1114
1130
|
"name": "AuroTabpanel",
|
|
1115
1131
|
"module": "src/auro-tabpanel.js"
|
|
1132
|
+
},
|
|
1133
|
+
"type": {
|
|
1134
|
+
"text": "register(name?: string = \"auro-tabpanel\") => void"
|
|
1116
1135
|
}
|
|
1117
1136
|
},
|
|
1118
1137
|
{
|
|
@@ -1143,7 +1162,9 @@
|
|
|
1143
1162
|
"module": "src/auro-tabpanel.js"
|
|
1144
1163
|
}
|
|
1145
1164
|
}
|
|
1146
|
-
]
|
|
1165
|
+
],
|
|
1166
|
+
"modulePath": "scripts/wca/auro-tabpanel.js",
|
|
1167
|
+
"definitionPath": "scripts/wca/auro-tabpanel.js"
|
|
1147
1168
|
}
|
|
1148
1169
|
],
|
|
1149
1170
|
"exports": [
|
|
@@ -1408,7 +1429,8 @@
|
|
|
1408
1429
|
"name": "LitElement",
|
|
1409
1430
|
"package": "lit"
|
|
1410
1431
|
},
|
|
1411
|
-
"customElement": true
|
|
1432
|
+
"customElement": true,
|
|
1433
|
+
"modulePath": "src/auro-tab.js"
|
|
1412
1434
|
}
|
|
1413
1435
|
],
|
|
1414
1436
|
"exports": [
|
|
@@ -1874,7 +1896,8 @@
|
|
|
1874
1896
|
"name": "LitElement",
|
|
1875
1897
|
"package": "lit"
|
|
1876
1898
|
},
|
|
1877
|
-
"customElement": true
|
|
1899
|
+
"customElement": true,
|
|
1900
|
+
"modulePath": "src/auro-tabgroup.js"
|
|
1878
1901
|
}
|
|
1879
1902
|
],
|
|
1880
1903
|
"exports": [
|
|
@@ -1983,7 +2006,8 @@
|
|
|
1983
2006
|
"name": "LitElement",
|
|
1984
2007
|
"package": "lit"
|
|
1985
2008
|
},
|
|
1986
|
-
"customElement": true
|
|
2009
|
+
"customElement": true,
|
|
2010
|
+
"modulePath": "src/auro-tabpanel.js"
|
|
1987
2011
|
}
|
|
1988
2012
|
],
|
|
1989
2013
|
"exports": [
|
package/demo/api.md
CHANGED
|
@@ -8,13 +8,13 @@ The auro-tabpanel element should only be used inside an AuroTabgroup element.
|
|
|
8
8
|
|
|
9
9
|
### Properties & Attributes
|
|
10
10
|
|
|
11
|
-
| Properties | Attributes | Type | Default | Description |
|
|
12
|
-
| ---------- | ---------- | --------------------------------- | --------- | ----------------------------------------------------------------------- |
|
|
13
|
-
| appearance | appearance | "default" \| "inverse" \| string |
|
|
14
|
-
| disabled | disabled | boolean | false
|
|
15
|
-
| selected | selected | boolean | false
|
|
16
|
-
| variant | variant | "default" \| "unstyled" \| string |
|
|
17
|
-
| | focused | boolean | false
|
|
11
|
+
| Properties | Attributes | Modifiers | Type | Default | Description |
|
|
12
|
+
| ---------- | ---------- | --------- | --------------------------------- | --------- | ----------------------------------------------------------------------- |
|
|
13
|
+
| appearance | appearance | | "default" \| "inverse" \| string | `default` | Defines whether the component will be on lighter or darker backgrounds. |
|
|
14
|
+
| disabled | disabled | | boolean | `false` | Indicates whether the tab is disabled. |
|
|
15
|
+
| selected | selected | | boolean | `false` | Indicates whether the tab is selected. |
|
|
16
|
+
| variant | variant | | "default" \| "unstyled" \| string | `default` | The variant of the tab. |
|
|
17
|
+
| | focused | | boolean | `false` | Indicates whether the tab is focused. |
|
|
18
18
|
|
|
19
19
|
### Methods
|
|
20
20
|
|
|
@@ -22,8 +22,6 @@ The auro-tabpanel element should only be used inside an AuroTabgroup element.
|
|
|
22
22
|
| -------- | ------------------------------------------------------------------- | ------ | ------------------------------------------------- |
|
|
23
23
|
| register | `name` (string) - The name of element that you want to register to. | | This will register this element with the browser. |
|
|
24
24
|
|
|
25
|
-
---
|
|
26
|
-
|
|
27
25
|
# auro-tabgroup
|
|
28
26
|
|
|
29
27
|
The auro-tabgroup element is a container element for tabs and panels.
|
|
@@ -33,9 +31,9 @@ cached and therefore, changes during runtime work.
|
|
|
33
31
|
|
|
34
32
|
### Properties & Attributes
|
|
35
33
|
|
|
36
|
-
| Properties | Attributes | Type | Default | Description |
|
|
37
|
-
| ---------- | ---------- | -------------------------------- | --------- | ----------------------------------------------------------------------- |
|
|
38
|
-
| appearance | appearance | "default" \| "inverse" \| string |
|
|
34
|
+
| Properties | Attributes | Modifiers | Type | Default | Description |
|
|
35
|
+
| ---------- | ---------- | --------- | -------------------------------- | --------- | ----------------------------------------------------------------------- |
|
|
36
|
+
| appearance | appearance | | "default" \| "inverse" \| string | `default` | Defines whether the component will be on lighter or darker backgrounds. |
|
|
39
37
|
|
|
40
38
|
### Methods
|
|
41
39
|
|
|
@@ -60,8 +58,6 @@ cached and therefore, changes during runtime work.
|
|
|
60
58
|
| tabgroup__root | The root element of the tab group. |
|
|
61
59
|
| tabgroup__tabs | The "tabs list" internal wrapper element. |
|
|
62
60
|
|
|
63
|
-
---
|
|
64
|
-
|
|
65
61
|
# auro-tabpanel
|
|
66
62
|
|
|
67
63
|
Represents a panel to be displayed when the corresponding tab is selected in an AuroTabgroup element.
|
|
@@ -69,9 +65,9 @@ The auro-tabpanel element should only be used inside an AuroTabgroup element.
|
|
|
69
65
|
|
|
70
66
|
### Properties & Attributes
|
|
71
67
|
|
|
72
|
-
| Properties | Attributes | Type | Default | Description |
|
|
73
|
-
| ---------- | ---------- | ------- | ------- | -------------------------------------- |
|
|
74
|
-
| hidden | hidden | boolean | false
|
|
68
|
+
| Properties | Attributes | Modifiers | Type | Default | Description |
|
|
69
|
+
| ---------- | ---------- | --------- | ------- | ------- | -------------------------------------- |
|
|
70
|
+
| hidden | hidden | | boolean | `false` | Indicates whether the panel is hidden. |
|
|
75
71
|
|
|
76
72
|
### Methods
|
|
77
73
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b, a as i$2, i as i$3, E } from './lit-element.min.js';
|
|
2
2
|
|
|
3
3
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
4
4
|
// See LICENSE in the project root for license information.
|
|
@@ -88,7 +88,7 @@ class AuroLibraryRuntimeUtils {
|
|
|
88
88
|
* Copyright 2020 Google LLC
|
|
89
89
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
90
90
|
*/
|
|
91
|
-
const a=Symbol.for(""),o$1=t=>{if(t?.r===a)return t?._$litStatic$},l=new Map,n$1=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o$1(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l.get(t))&&(n.raw=n,l.set(t,r=n)),e=u;}return t(r,...e)},u=n$1(
|
|
91
|
+
const a=Symbol.for(""),o$1=t=>{if(t?.r===a)return t?._$litStatic$},l=new Map,n$1=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o$1(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l.get(t))&&(n.raw=n,l.set(t,r=n)),e=u;}return t(r,...e)},u=n$1(b);
|
|
92
92
|
|
|
93
93
|
var styleCss$2 = i$2`: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)}
|
|
94
94
|
`;
|
|
@@ -357,7 +357,7 @@ const t={ATTRIBUTE:1},e=t=>(...e)=>({_$litDirective$:t,values:e});let i$1 = clas
|
|
|
357
357
|
* @license
|
|
358
358
|
* Copyright 2018 Google LLC
|
|
359
359
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
360
|
-
*/const n="important",i=" !"+n,o=e(class extends i$1{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"style"!==t$1.name||t$1.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((
|
|
360
|
+
*/const n="important",i=" !"+n,o=e(class extends i$1{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"style"!==t$1.name||t$1.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(r)),this.render(r);for(const t of this.ft)null==r[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in r){const e=r[t];if(null!=e){this.ft.add(t);const r="string"==typeof e&&e.endsWith(i);t.includes("-")||r?s.setProperty(t,r?e.slice(0,-11):e,r?n:""):s[t]=e;}}return E}});
|
|
361
361
|
|
|
362
362
|
/**
|
|
363
363
|
* @class ChildItemService
|
|
@@ -1264,7 +1264,7 @@ class AuroTabgroup extends i$3 {
|
|
|
1264
1264
|
render() {
|
|
1265
1265
|
const sliderStyles = o(this.sliderStyles);
|
|
1266
1266
|
|
|
1267
|
-
return
|
|
1267
|
+
return b`
|
|
1268
1268
|
<div part="tabgroup__root" class="tabgroupContainer">
|
|
1269
1269
|
<div part="tabgroup__tabs" class="tabgroup" role="tablist">
|
|
1270
1270
|
<slot name="tabs" @slotchange="${this.#onSlotChange}"></slot>
|
|
@@ -1385,7 +1385,7 @@ class AuroTabpanel extends i$3 {
|
|
|
1385
1385
|
}
|
|
1386
1386
|
|
|
1387
1387
|
render() {
|
|
1388
|
-
return
|
|
1388
|
+
return b`
|
|
1389
1389
|
<slot></slot>
|
|
1390
1390
|
`;
|
|
1391
1391
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i,
|
|
1
|
+
import { i, b } from './lit-element.min.js';
|
|
2
2
|
|
|
3
3
|
class ExampleTabGroup extends i {
|
|
4
4
|
/**
|
|
@@ -10,7 +10,7 @@ class ExampleTabGroup extends i {
|
|
|
10
10
|
/** @type {TemplateResult[]} */
|
|
11
11
|
const tabs = [];
|
|
12
12
|
for (let i = 0; i <= tabCount; i++) {
|
|
13
|
-
tabs.push(
|
|
13
|
+
tabs.push(b`<auro-tab>Auto-generated ${i}</auro-tab>`);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
return tabs;
|
|
@@ -25,26 +25,26 @@ class ExampleTabGroup extends i {
|
|
|
25
25
|
/** @type {TemplateResult[]} */
|
|
26
26
|
const panels = [];
|
|
27
27
|
for (let i = 0; i <= tabCount; i++) {
|
|
28
|
-
panels.push(
|
|
28
|
+
panels.push(b`<auro-tabpanel>Auto-generated ${i}</auro-tabpanel>`);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
return panels;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
renderTabContent() {
|
|
35
|
-
return
|
|
35
|
+
return b`
|
|
36
36
|
<span>some content</span>
|
|
37
37
|
`;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
renderPanelContent() {
|
|
41
|
-
return
|
|
41
|
+
return b`
|
|
42
42
|
<span>some content</span>
|
|
43
43
|
`;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
render() {
|
|
47
|
-
return
|
|
47
|
+
return b`
|
|
48
48
|
<auro-tabgroup>
|
|
49
49
|
<div slot="tabs">
|
|
50
50
|
${this.generateTabs(5)}
|
package/demo/lit-element.min.js
CHANGED
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const t$1=globalThis,e$2=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$3=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$2&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$3.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$2("string"==typeof t?t:t+"",void 0,s$2),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((
|
|
6
|
+
const t$1=globalThis,e$2=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$3=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$2&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$3.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$2("string"==typeof t?t:t+"",void 0,s$2),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$2(o,t,s$2)},S$1=(s,o)=>{if(e$2)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$1.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$2?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Copyright 2017 Google LLC
|
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
-
*/const{is:i$2,defineProperty:e$1,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$2,getPrototypeOf:n$1}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),b={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$1(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$1(t),...o$2(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(
|
|
12
|
+
*/const{is:i$2,defineProperty:e$1,getOwnPropertyDescriptor:h$1,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$2,getPrototypeOf:n$1}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),b$1={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b$1){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$1(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$1(t),...o$2(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.2");
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @license
|
|
16
16
|
* Copyright 2017 Google LLC
|
|
17
17
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
18
18
|
*/
|
|
19
|
-
const t=globalThis,i$1=t
|
|
19
|
+
const t=globalThis,i$1=t=>t,s$1=t.trustedTypes,e=s$1?s$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,h="$lit$",o$1=`lit$${Math.random().toFixed(9).slice(2)}$`,n="?"+o$1,r=`<${n}>`,l=document,c=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u=Array.isArray,d=t=>u(t)||"function"==typeof t?.[Symbol.iterator],f="[ \t\n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e?e.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v?"!--"===u[1]?c=_:void 0!==u[1]?c=m:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p):void 0!==u[3]&&(c=p):c===p?">"===u[0]?(c=n??v,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p:'"'===u[3]?$:g):c===$||c===g?c=p:c===_||c===m?c=v:(c=p,n=void 0);const x=c===p&&t[i+1].startsWith("/>")?" ":"";l+=c===v?s+r:d>=0?(e.push(a),s.slice(0,d)+h+s.slice(d)+o$1+x):s+o$1+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h)){const i=v[a++],s=r.getAttribute(t).split(o$1),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t);}else t.startsWith(o$1)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o$1),i=t.length-1;if(i>0){r.textContent=s$1?s$1.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c());}}}else if(8===r.nodeType)if(r.data===n)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$1,t+1));)d.push({type:7,index:l}),t+=o$1.length-1;}l++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function M(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(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=M(t,h._$AS(t,i.values),h,e)),i}class R{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??l).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l,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 k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,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=M(this,t,i),a(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(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!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.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=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u(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 k(this.O(c()),this.O(c()),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,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$1(t).nextSibling;i$1(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,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=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||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){M(this,t);}}const B=t.litHtmlPolyfillSupport;B?.(S,k),(t.litHtmlVersions??=[]).push("3.3.2");const D=(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 k(i.insertBefore(c(),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=
|
|
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=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}}i._$litElement$=true,i["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i});const o=s.litElementPolyfillSupport;o?.({LitElement:i});(s.litElementVersions??=[]).push("4.2.2");
|
|
26
26
|
|
|
27
|
-
export {
|
|
27
|
+
export { E, i$3 as a, b, i };
|
|
@@ -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
|
@@ -1,29 +1,420 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import type { AuroTabWCA } from "scripts/wca/auro-tab.js";
|
|
2
|
+
import type { AuroTabgroupWCA } from "scripts/wca/auro-tabgroup.js";
|
|
3
|
+
import type { AuroTabpanelWCA } from "scripts/wca/auro-tabpanel.js";
|
|
4
|
+
import type { AuroTab } from "src/auro-tab.js";
|
|
5
|
+
import type { AuroTabgroup } from "src/auro-tabgroup.js";
|
|
6
|
+
import type { AuroTabpanel } from "src/auro-tabpanel.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This type can be used to create scoped tags for your components.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* import type { ScopedElements } from "path/to/library/jsx-integration";
|
|
15
|
+
*
|
|
16
|
+
* declare module "my-library" {
|
|
17
|
+
* namespace JSX {
|
|
18
|
+
* interface IntrinsicElements
|
|
19
|
+
* extends ScopedElements<'test-', ''> {}
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @deprecated Runtime scoped elements result in duplicate types and can confusing for developers. It is recommended to use the `prefix` and `suffix` options to generate new types instead.
|
|
25
|
+
*/
|
|
26
|
+
export type ScopedElements<
|
|
27
|
+
Prefix extends string = "",
|
|
28
|
+
Suffix extends string = "",
|
|
29
|
+
> = {
|
|
30
|
+
[Key in keyof CustomElements as `${Prefix}${Key}${Suffix}`]: CustomElements[Key];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type BaseProps<T extends HTMLElement> = {
|
|
34
|
+
/** Content added between the opening and closing tags of the element */
|
|
35
|
+
children?: any;
|
|
36
|
+
/** Used for declaratively styling one or more elements using CSS (Cascading Stylesheets) */
|
|
37
|
+
class?: string;
|
|
38
|
+
/** Used for declaratively styling one or more elements using CSS (Cascading Stylesheets) */
|
|
39
|
+
className?: string;
|
|
40
|
+
/** Takes an object where the key is the class name(s) and the value is a boolean expression. When true, the class is applied, and when false, it is removed. */
|
|
41
|
+
classList?: Record<string, boolean | undefined>;
|
|
42
|
+
/** Specifies the text direction of the element. */
|
|
43
|
+
dir?: "ltr" | "rtl";
|
|
44
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
45
|
+
exportparts?: string;
|
|
46
|
+
/** For <label> and <output>, lets you associate the label with some control. */
|
|
47
|
+
htmlFor?: string;
|
|
48
|
+
/** Specifies whether the element should be hidden. */
|
|
49
|
+
hidden?: boolean | string;
|
|
50
|
+
/** A unique identifier for the element. */
|
|
51
|
+
id?: string;
|
|
52
|
+
/** Keys tell React which array item each component corresponds to */
|
|
53
|
+
key?: string | number;
|
|
54
|
+
/** Specifies the language of the element. */
|
|
55
|
+
lang?: string;
|
|
56
|
+
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
57
|
+
part?: string;
|
|
58
|
+
/** Use the ref attribute with a variable to assign a DOM element to the variable once the element is rendered. */
|
|
59
|
+
ref?: T | ((e: T) => void);
|
|
60
|
+
/** Adds a reference for a custom element slot */
|
|
61
|
+
slot?: string;
|
|
62
|
+
/** Prop for setting inline styles */
|
|
63
|
+
style?: Record<string, string | number>;
|
|
64
|
+
/** Overrides the default Tab button behavior. Avoid using values other than -1 and 0. */
|
|
65
|
+
tabIndex?: number;
|
|
66
|
+
/** Specifies the tooltip text for the element. */
|
|
67
|
+
title?: string;
|
|
68
|
+
/** Passing 'no' excludes the element content from being translated. */
|
|
69
|
+
translate?: "yes" | "no";
|
|
70
|
+
/** The popover global attribute is used to designate an element as a popover element. */
|
|
71
|
+
popover?: "auto" | "hint" | "manual";
|
|
72
|
+
/** Turns an element element into a popover control button; takes the ID of the popover element to control as its value. */
|
|
73
|
+
popovertarget?: "top" | "bottom" | "left" | "right" | "auto";
|
|
74
|
+
/** Specifies the action to be performed on a popover element being controlled by a control element. */
|
|
75
|
+
popovertargetaction?: "show" | "hide" | "toggle";
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type BaseEvents = {};
|
|
79
|
+
|
|
80
|
+
export type AuroTabWCAProps = {
|
|
81
|
+
/** Defines whether the component will be on lighter or darker backgrounds. */
|
|
82
|
+
appearance?: AuroTabWCA["appearance"];
|
|
83
|
+
/** Indicates whether the tab is disabled. */
|
|
84
|
+
disabled?: AuroTabWCA["disabled"];
|
|
85
|
+
/** Indicates whether the tab is focused. */
|
|
86
|
+
focused?: AuroTabWCA["focused"];
|
|
87
|
+
/** Indicates whether the tab is selected. */
|
|
88
|
+
selected?: AuroTabWCA["selected"];
|
|
89
|
+
/** The variant of the tab. */
|
|
90
|
+
variant?: AuroTabWCA["variant"];
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type AuroTabWCASolidJsProps = {
|
|
94
|
+
/** Defines whether the component will be on lighter or darker backgrounds. */
|
|
95
|
+
"prop:appearance"?: AuroTabWCA["appearance"];
|
|
96
|
+
/** Indicates whether the tab is disabled. */
|
|
97
|
+
"prop:disabled"?: AuroTabWCA["disabled"];
|
|
98
|
+
/** Indicates whether the tab is focused. */
|
|
99
|
+
"prop:focused"?: AuroTabWCA["focused"];
|
|
100
|
+
/** Indicates whether the tab is selected. */
|
|
101
|
+
"prop:selected"?: AuroTabWCA["selected"];
|
|
102
|
+
/** The variant of the tab. */
|
|
103
|
+
"prop:variant"?: AuroTabWCA["variant"];
|
|
104
|
+
|
|
105
|
+
/** Set the innerHTML of the element */
|
|
106
|
+
innerHTML?: string;
|
|
107
|
+
/** Set the textContent of the element */
|
|
108
|
+
textContent?: string | number;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export type AuroTabgroupWCAProps = {
|
|
112
|
+
/** Defines whether the component will be on lighter or darker backgrounds. */
|
|
113
|
+
appearance?: AuroTabgroupWCA["appearance"];
|
|
114
|
+
/** DEPRECATED - use `appearance` instead. */
|
|
115
|
+
ondark?: AuroTabgroupWCA["ondark"];
|
|
116
|
+
/** */
|
|
117
|
+
scrollPosition?: AuroTabgroupWCA["scrollPosition"];
|
|
118
|
+
/** */
|
|
119
|
+
selectOnFocus?: AuroTabgroupWCA["selectOnFocus"];
|
|
120
|
+
/** */
|
|
121
|
+
sliderStyles?: AuroTabgroupWCA["sliderStyles"];
|
|
122
|
+
/** */
|
|
123
|
+
busy?: AuroTabgroupWCA["busy"];
|
|
124
|
+
/** */
|
|
125
|
+
panels?: AuroTabgroupWCA["panels"];
|
|
126
|
+
/** */
|
|
127
|
+
tabs?: AuroTabgroupWCA["tabs"];
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export type AuroTabgroupWCASolidJsProps = {
|
|
131
|
+
/** Defines whether the component will be on lighter or darker backgrounds. */
|
|
132
|
+
"prop:appearance"?: AuroTabgroupWCA["appearance"];
|
|
133
|
+
/** DEPRECATED - use `appearance` instead. */
|
|
134
|
+
"prop:ondark"?: AuroTabgroupWCA["ondark"];
|
|
135
|
+
/** */
|
|
136
|
+
"prop:scrollPosition"?: AuroTabgroupWCA["scrollPosition"];
|
|
137
|
+
/** */
|
|
138
|
+
"prop:selectOnFocus"?: AuroTabgroupWCA["selectOnFocus"];
|
|
139
|
+
/** */
|
|
140
|
+
"prop:sliderStyles"?: AuroTabgroupWCA["sliderStyles"];
|
|
141
|
+
/** */
|
|
142
|
+
"prop:busy"?: AuroTabgroupWCA["busy"];
|
|
143
|
+
/** */
|
|
144
|
+
"prop:panels"?: AuroTabgroupWCA["panels"];
|
|
145
|
+
/** */
|
|
146
|
+
"prop:tabs"?: AuroTabgroupWCA["tabs"];
|
|
147
|
+
|
|
148
|
+
/** Set the innerHTML of the element */
|
|
149
|
+
innerHTML?: string;
|
|
150
|
+
/** Set the textContent of the element */
|
|
151
|
+
textContent?: string | number;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export type AuroTabpanelWCAProps = {
|
|
155
|
+
/** Indicates whether the panel is hidden. */
|
|
156
|
+
hidden?: AuroTabpanelWCA["hidden"];
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export type AuroTabpanelWCASolidJsProps = {
|
|
160
|
+
/** Indicates whether the panel is hidden. */
|
|
161
|
+
"prop:hidden"?: AuroTabpanelWCA["hidden"];
|
|
162
|
+
|
|
163
|
+
/** Set the innerHTML of the element */
|
|
164
|
+
innerHTML?: string;
|
|
165
|
+
/** Set the textContent of the element */
|
|
166
|
+
textContent?: string | number;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export type CustomElements = {
|
|
170
|
+
/**
|
|
171
|
+
* Represents a tab within an auro-tabgroup element. When selected, displays the corresponding AuroTabpanel.
|
|
172
|
+
* The auro-tabpanel element should only be used inside an AuroTabgroup element.
|
|
173
|
+
*
|
|
174
|
+
* ## Attributes & Properties
|
|
175
|
+
*
|
|
176
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
177
|
+
*
|
|
178
|
+
* - `appearance`: Defines whether the component will be on lighter or darker backgrounds.
|
|
179
|
+
* - `disabled`: Indicates whether the tab is disabled.
|
|
180
|
+
* - `focused`: Indicates whether the tab is focused.
|
|
181
|
+
* - `selected`: Indicates whether the tab is selected.
|
|
182
|
+
* - `variant`: The variant of the tab.
|
|
183
|
+
*
|
|
184
|
+
* ## Methods
|
|
185
|
+
*
|
|
186
|
+
* Methods that can be called to access component functionality.
|
|
187
|
+
*
|
|
188
|
+
* - `register(name?: string = "auro-tab") => void`: This will register this element with the browser.
|
|
189
|
+
*/
|
|
190
|
+
"auro-tab": Partial<AuroTabWCAProps & BaseProps<AuroTabWCA> & BaseEvents>;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The auro-tabgroup element is a container element for tabs and panels.
|
|
194
|
+
* All children of `<auro-tabgroup>` should be either `<auro-tab>` or
|
|
195
|
+
* `<auro-tabpanel>`. This element is stateless, meaning that no values are
|
|
196
|
+
* cached and therefore, changes during runtime work.
|
|
197
|
+
*
|
|
198
|
+
* ## Attributes & Properties
|
|
199
|
+
*
|
|
200
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
201
|
+
*
|
|
202
|
+
* - `appearance`: Defines whether the component will be on lighter or darker backgrounds.
|
|
203
|
+
* - `ondark`: DEPRECATED - use `appearance` instead.
|
|
204
|
+
* - `scrollPosition`: undefined
|
|
205
|
+
* - `selectOnFocus`: undefined
|
|
206
|
+
* - `sliderStyles`: undefined
|
|
207
|
+
* - `busy`: undefined (property only)
|
|
208
|
+
* - `panels`: undefined (property only)
|
|
209
|
+
* - `tabs`: undefined (property only)
|
|
210
|
+
*
|
|
211
|
+
* ## Slots
|
|
212
|
+
*
|
|
213
|
+
* Areas where markup can be added to the component.
|
|
214
|
+
*
|
|
215
|
+
* - `panel`: Slot component named for auro-tabpanel.
|
|
216
|
+
* - `tab`: Slot component named for auro-tab.
|
|
217
|
+
*
|
|
218
|
+
* ## Methods
|
|
219
|
+
*
|
|
220
|
+
* Methods that can be called to access component functionality.
|
|
221
|
+
*
|
|
222
|
+
* - `register(name?: string = "auro-tabgroup") => void`: This will register this element with the browser.
|
|
223
|
+
* - `selectTab(newTab: HTMLElement) => void`: undefined
|
|
224
|
+
* - `selectTabByIndex(index: number) => void`: undefined
|
|
225
|
+
*
|
|
226
|
+
* ## CSS Parts
|
|
227
|
+
*
|
|
228
|
+
* Custom selectors for styling elements within the component.
|
|
229
|
+
*
|
|
230
|
+
* - `slider`: The slider element.
|
|
231
|
+
* - `slider-positioner`: The slider positioner element (non-visual, only used to center slider on tab).
|
|
232
|
+
* - `tabgroup__panels`: The panel wrapper element.
|
|
233
|
+
* - `tabgroup__root`: The root element of the tab group.
|
|
234
|
+
* - `tabgroup__tabs`: The "tabs list" internal wrapper element.
|
|
235
|
+
*/
|
|
236
|
+
"auro-tabgroup": Partial<
|
|
237
|
+
AuroTabgroupWCAProps & BaseProps<AuroTabgroupWCA> & BaseEvents
|
|
238
|
+
>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Represents a panel to be displayed when the corresponding tab is selected in an AuroTabgroup element.
|
|
242
|
+
* The auro-tabpanel element should only be used inside an AuroTabgroup element.
|
|
243
|
+
*
|
|
244
|
+
* ## Attributes & Properties
|
|
245
|
+
*
|
|
246
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
247
|
+
*
|
|
248
|
+
* - `hidden`: Indicates whether the panel is hidden.
|
|
249
|
+
*
|
|
250
|
+
* ## Methods
|
|
251
|
+
*
|
|
252
|
+
* Methods that can be called to access component functionality.
|
|
253
|
+
*
|
|
254
|
+
* - `register(name?: string = "auro-tabpanel") => void`: This will register this element with the browser.
|
|
255
|
+
*/
|
|
256
|
+
"auro-tabpanel": Partial<
|
|
257
|
+
AuroTabpanelWCAProps & BaseProps<AuroTabpanelWCA> & BaseEvents
|
|
258
|
+
>;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export type CustomElementsSolidJs = {
|
|
262
|
+
/**
|
|
263
|
+
* Represents a tab within an auro-tabgroup element. When selected, displays the corresponding AuroTabpanel.
|
|
264
|
+
* The auro-tabpanel element should only be used inside an AuroTabgroup element.
|
|
265
|
+
*
|
|
266
|
+
* ## Attributes & Properties
|
|
267
|
+
*
|
|
268
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
269
|
+
*
|
|
270
|
+
* - `appearance`: Defines whether the component will be on lighter or darker backgrounds.
|
|
271
|
+
* - `disabled`: Indicates whether the tab is disabled.
|
|
272
|
+
* - `focused`: Indicates whether the tab is focused.
|
|
273
|
+
* - `selected`: Indicates whether the tab is selected.
|
|
274
|
+
* - `variant`: The variant of the tab.
|
|
275
|
+
*
|
|
276
|
+
* ## Methods
|
|
277
|
+
*
|
|
278
|
+
* Methods that can be called to access component functionality.
|
|
279
|
+
*
|
|
280
|
+
* - `register(name?: string = "auro-tab") => void`: This will register this element with the browser.
|
|
281
|
+
*/
|
|
282
|
+
"auro-tab": Partial<
|
|
283
|
+
AuroTabWCAProps &
|
|
284
|
+
AuroTabWCASolidJsProps &
|
|
285
|
+
BaseProps<AuroTabWCA> &
|
|
286
|
+
BaseEvents
|
|
287
|
+
>;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* The auro-tabgroup element is a container element for tabs and panels.
|
|
291
|
+
* All children of `<auro-tabgroup>` should be either `<auro-tab>` or
|
|
292
|
+
* `<auro-tabpanel>`. This element is stateless, meaning that no values are
|
|
293
|
+
* cached and therefore, changes during runtime work.
|
|
294
|
+
*
|
|
295
|
+
* ## Attributes & Properties
|
|
296
|
+
*
|
|
297
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
298
|
+
*
|
|
299
|
+
* - `appearance`: Defines whether the component will be on lighter or darker backgrounds.
|
|
300
|
+
* - `ondark`: DEPRECATED - use `appearance` instead.
|
|
301
|
+
* - `scrollPosition`: undefined
|
|
302
|
+
* - `selectOnFocus`: undefined
|
|
303
|
+
* - `sliderStyles`: undefined
|
|
304
|
+
* - `busy`: undefined (property only)
|
|
305
|
+
* - `panels`: undefined (property only)
|
|
306
|
+
* - `tabs`: undefined (property only)
|
|
307
|
+
*
|
|
308
|
+
* ## Slots
|
|
309
|
+
*
|
|
310
|
+
* Areas where markup can be added to the component.
|
|
311
|
+
*
|
|
312
|
+
* - `panel`: Slot component named for auro-tabpanel.
|
|
313
|
+
* - `tab`: Slot component named for auro-tab.
|
|
314
|
+
*
|
|
315
|
+
* ## Methods
|
|
316
|
+
*
|
|
317
|
+
* Methods that can be called to access component functionality.
|
|
318
|
+
*
|
|
319
|
+
* - `register(name?: string = "auro-tabgroup") => void`: This will register this element with the browser.
|
|
320
|
+
* - `selectTab(newTab: HTMLElement) => void`: undefined
|
|
321
|
+
* - `selectTabByIndex(index: number) => void`: undefined
|
|
322
|
+
*
|
|
323
|
+
* ## CSS Parts
|
|
324
|
+
*
|
|
325
|
+
* Custom selectors for styling elements within the component.
|
|
326
|
+
*
|
|
327
|
+
* - `slider`: The slider element.
|
|
328
|
+
* - `slider-positioner`: The slider positioner element (non-visual, only used to center slider on tab).
|
|
329
|
+
* - `tabgroup__panels`: The panel wrapper element.
|
|
330
|
+
* - `tabgroup__root`: The root element of the tab group.
|
|
331
|
+
* - `tabgroup__tabs`: The "tabs list" internal wrapper element.
|
|
332
|
+
*/
|
|
333
|
+
"auro-tabgroup": Partial<
|
|
334
|
+
AuroTabgroupWCAProps &
|
|
335
|
+
AuroTabgroupWCASolidJsProps &
|
|
336
|
+
BaseProps<AuroTabgroupWCA> &
|
|
337
|
+
BaseEvents
|
|
338
|
+
>;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Represents a panel to be displayed when the corresponding tab is selected in an AuroTabgroup element.
|
|
342
|
+
* The auro-tabpanel element should only be used inside an AuroTabgroup element.
|
|
343
|
+
*
|
|
344
|
+
* ## Attributes & Properties
|
|
345
|
+
*
|
|
346
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
347
|
+
*
|
|
348
|
+
* - `hidden`: Indicates whether the panel is hidden.
|
|
349
|
+
*
|
|
350
|
+
* ## Methods
|
|
351
|
+
*
|
|
352
|
+
* Methods that can be called to access component functionality.
|
|
353
|
+
*
|
|
354
|
+
* - `register(name?: string = "auro-tabpanel") => void`: This will register this element with the browser.
|
|
355
|
+
*/
|
|
356
|
+
"auro-tabpanel": Partial<
|
|
357
|
+
AuroTabpanelWCAProps &
|
|
358
|
+
AuroTabpanelWCASolidJsProps &
|
|
359
|
+
BaseProps<AuroTabpanelWCA> &
|
|
360
|
+
BaseEvents
|
|
361
|
+
>;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
export type CustomCssProperties = {};
|
|
365
|
+
|
|
366
|
+
declare module "react" {
|
|
367
|
+
namespace JSX {
|
|
368
|
+
interface IntrinsicElements extends CustomElements {}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
declare module "preact" {
|
|
373
|
+
namespace JSX {
|
|
374
|
+
interface IntrinsicElements extends CustomElements {}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
declare module "@builder.io/qwik" {
|
|
379
|
+
namespace JSX {
|
|
380
|
+
interface IntrinsicElements extends CustomElements {}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
declare module "@stencil/core" {
|
|
385
|
+
namespace JSX {
|
|
386
|
+
interface IntrinsicElements extends CustomElements {}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
declare module "hono/jsx" {
|
|
391
|
+
namespace JSX {
|
|
392
|
+
interface IntrinsicElements extends CustomElements {}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
declare module "react-native" {
|
|
397
|
+
namespace JSX {
|
|
398
|
+
interface IntrinsicElements extends CustomElements {}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
declare module "solid-js" {
|
|
403
|
+
namespace JSX {
|
|
404
|
+
interface IntrinsicElements extends CustomElementsSolidJs {}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
declare global {
|
|
409
|
+
namespace JSX {
|
|
410
|
+
interface IntrinsicElements extends CustomElements {}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
declare global {
|
|
414
|
+
namespace svelteHTML {
|
|
415
|
+
interface IntrinsicElements extends CustomElements {}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
export { AuroTab, AuroTabgroup, AuroTabpanel } from "./index.js";
|
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-BOxEbwY9.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-BOxEbwY9.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-
|
|
10
|
+
"version": "0.0.0-pr95.0",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "https://github.com/AlaskaAirlines/auro-tabs"
|
|
@@ -1,23 +0,0 @@
|
|
|
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};
|