@spectrum-web-components/tabs 0.36.0 → 0.37.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.
@@ -286,6 +286,26 @@
286
286
  "default": "''",
287
287
  "attribute": "value",
288
288
  "reflects": true
289
+ },
290
+ {
291
+ "kind": "method",
292
+ "name": "handleFocusin",
293
+ "privacy": "protected",
294
+ "return": {
295
+ "type": {
296
+ "text": "void"
297
+ }
298
+ }
299
+ },
300
+ {
301
+ "kind": "method",
302
+ "name": "handleFocusout",
303
+ "privacy": "protected",
304
+ "return": {
305
+ "type": {
306
+ "text": "void"
307
+ }
308
+ }
289
309
  }
290
310
  ],
291
311
  "attributes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/tabs",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -86,11 +86,11 @@
86
86
  ],
87
87
  "dependencies": {
88
88
  "@lit-labs/observers": "^2.0.0",
89
- "@spectrum-web-components/base": "^0.36.0",
90
- "@spectrum-web-components/icon": "^0.36.0",
91
- "@spectrum-web-components/icons-ui": "^0.36.0",
92
- "@spectrum-web-components/reactive-controllers": "^0.36.0",
93
- "@spectrum-web-components/shared": "^0.36.0"
89
+ "@spectrum-web-components/base": "^0.37.0",
90
+ "@spectrum-web-components/icon": "^0.37.0",
91
+ "@spectrum-web-components/icons-ui": "^0.37.0",
92
+ "@spectrum-web-components/reactive-controllers": "^0.37.0",
93
+ "@spectrum-web-components/shared": "^0.37.0"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@spectrum-css/tabs": "^4.0.8"
@@ -101,5 +101,5 @@
101
101
  "./sp-*.js",
102
102
  "./**/*.dev.js"
103
103
  ],
104
- "gitHead": "a532ff8a410abeefb54d9638a2316ae82570566e"
104
+ "gitHead": "d771f62f0d8063070af43283bb0fd5e3400bad06"
105
105
  }
package/src/TabPanel.d.ts CHANGED
@@ -12,6 +12,8 @@ export declare class TabPanel extends SpectrumElement {
12
12
  static instanceCount: number;
13
13
  selected: boolean;
14
14
  value: string;
15
+ protected handleFocusin(): void;
16
+ protected handleFocusout(): void;
15
17
  protected render(): TemplateResult;
16
18
  protected firstUpdated(): void;
17
19
  protected updated(changes: PropertyValues<this>): void;
@@ -22,9 +22,18 @@ const _TabPanel = class _TabPanel extends SpectrumElement {
22
22
  this.selected = false;
23
23
  this.value = "";
24
24
  }
25
+ handleFocusin() {
26
+ this.removeAttribute("tabindex");
27
+ }
28
+ handleFocusout() {
29
+ this.tabIndex = this.selected ? 0 : -1;
30
+ }
25
31
  render() {
26
32
  return html`
27
- <slot></slot>
33
+ <slot
34
+ @focusin=${this.handleFocusin}
35
+ @focusout=${this.handleFocusout}
36
+ ></slot>
28
37
  `;
29
38
  }
30
39
  firstUpdated() {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["TabPanel.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport panelStyles from './tab-panel.css.js';\n\n/**\n * @element sp-tab-panel\n *\n * @slot - content of the Tab Panel\n */\nexport class TabPanel extends SpectrumElement {\n static override styles = [panelStyles];\n\n /**\n * @private\n */\n static instanceCount = 0;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ type: String, reflect: true })\n public value = '';\n\n protected override render(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n\n protected override firstUpdated(): void {\n this.slot = 'tab-panel';\n this.setAttribute('role', 'tabpanel');\n this.tabIndex = 0;\n if (!this.hasAttribute('id')) {\n this.id = `sp-tab-panel-${TabPanel.instanceCount++}`;\n }\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (changes.has('selected')) {\n if (this.selected) {\n this.removeAttribute('aria-hidden');\n this.tabIndex = 0;\n } else {\n this.setAttribute('aria-hidden', 'true');\n this.tabIndex = -1;\n }\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;AAYA;AAAA,EACI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,OAAO,iBAAiB;AAOjB,MAAM,YAAN,MAAM,kBAAiB,gBAAgB;AAAA,EAAvC;AAAA;AASH,SAAO,WAAW;AAGlB,SAAO,QAAQ;AAAA;AAAA,EAEI,SAAyB;AACxC,WAAO;AAAA;AAAA;AAAA,EAGX;AAAA,EAEmB,eAAqB;AACpC,SAAK,OAAO;AACZ,SAAK,aAAa,QAAQ,UAAU;AACpC,SAAK,WAAW;AAChB,QAAI,CAAC,KAAK,aAAa,IAAI,GAAG;AAC1B,WAAK,KAAK,gBAAgB,UAAS,eAAe;AAAA,IACtD;AAAA,EACJ;AAAA,EAEmB,QAAQ,SAAqC;AAC5D,QAAI,QAAQ,IAAI,UAAU,GAAG;AACzB,UAAI,KAAK,UAAU;AACf,aAAK,gBAAgB,aAAa;AAClC,aAAK,WAAW;AAAA,MACpB,OAAO;AACH,aAAK,aAAa,eAAe,MAAM;AACvC,aAAK,WAAW;AAAA,MACpB;AAAA,IACJ;AAAA,EACJ;AACJ;AAxCa,UACO,SAAS,CAAC,WAAW;AAAA;AAAA;AAAA;AAD5B,UAMF,gBAAgB;AAGhB;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GARjC,UASF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAXhC,UAYF;AAZJ,WAAM,WAAN;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport panelStyles from './tab-panel.css.js';\n\n/**\n * @element sp-tab-panel\n *\n * @slot - content of the Tab Panel\n */\nexport class TabPanel extends SpectrumElement {\n static override styles = [panelStyles];\n\n /**\n * @private\n */\n static instanceCount = 0;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ type: String, reflect: true })\n public value = '';\n\n protected handleFocusin(): void {\n this.removeAttribute('tabindex');\n }\n\n protected handleFocusout(): void {\n this.tabIndex = this.selected ? 0 : -1;\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot\n @focusin=${this.handleFocusin}\n @focusout=${this.handleFocusout}\n ></slot>\n `;\n }\n\n protected override firstUpdated(): void {\n this.slot = 'tab-panel';\n this.setAttribute('role', 'tabpanel');\n this.tabIndex = 0;\n if (!this.hasAttribute('id')) {\n this.id = `sp-tab-panel-${TabPanel.instanceCount++}`;\n }\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (changes.has('selected')) {\n if (this.selected) {\n this.removeAttribute('aria-hidden');\n this.tabIndex = 0;\n } else {\n this.setAttribute('aria-hidden', 'true');\n this.tabIndex = -1;\n }\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAYA;AAAA,EACI;AAAA,EAEA;AAAA,O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=p.length-1,d;o>=0;o--)(d=p[o])&&(t=(s?d(r,i,t):d(t))||t);return s&&t&&u(r,i,t),t};import{html as h,SpectrumElement as n}from"@spectrum-web-components/base";import{property as a}from"@spectrum-web-components/base/src/decorators.js";import m from"./tab-panel.css.js";const e=class e extends n{constructor(){super(...arguments);this.selected=!1;this.value=""}render(){return h`
2
- <slot></slot>
3
- `}firstUpdated(){this.slot="tab-panel",this.setAttribute("role","tabpanel"),this.tabIndex=0,this.hasAttribute("id")||(this.id=`sp-tab-panel-${e.instanceCount++}`)}updated(i){i.has("selected")&&(this.selected?(this.removeAttribute("aria-hidden"),this.tabIndex=0):(this.setAttribute("aria-hidden","true"),this.tabIndex=-1))}};e.styles=[m],e.instanceCount=0,l([a({type:Boolean,reflect:!0})],e.prototype,"selected",2),l([a({type:String,reflect:!0})],e.prototype,"value",2);export let TabPanel=e;
1
+ "use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=(u,i,s,r)=>{for(var t=r>1?void 0:r?c(i,s):i,o=u.length-1,d;o>=0;o--)(d=u[o])&&(t=(r?d(i,s,t):d(t))||t);return r&&t&&a(i,s,t),t};import{html as h,SpectrumElement as n}from"@spectrum-web-components/base";import{property as p}from"@spectrum-web-components/base/src/decorators.js";import m from"./tab-panel.css.js";const e=class e extends n{constructor(){super(...arguments);this.selected=!1;this.value=""}handleFocusin(){this.removeAttribute("tabindex")}handleFocusout(){this.tabIndex=this.selected?0:-1}render(){return h`
2
+ <slot
3
+ @focusin=${this.handleFocusin}
4
+ @focusout=${this.handleFocusout}
5
+ ></slot>
6
+ `}firstUpdated(){this.slot="tab-panel",this.setAttribute("role","tabpanel"),this.tabIndex=0,this.hasAttribute("id")||(this.id=`sp-tab-panel-${e.instanceCount++}`)}updated(s){s.has("selected")&&(this.selected?(this.removeAttribute("aria-hidden"),this.tabIndex=0):(this.setAttribute("aria-hidden","true"),this.tabIndex=-1))}};e.styles=[m],e.instanceCount=0,l([p({type:Boolean,reflect:!0})],e.prototype,"selected",2),l([p({type:String,reflect:!0})],e.prototype,"value",2);export let TabPanel=e;
4
7
  //# sourceMappingURL=TabPanel.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["TabPanel.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport panelStyles from './tab-panel.css.js';\n\n/**\n * @element sp-tab-panel\n *\n * @slot - content of the Tab Panel\n */\nexport class TabPanel extends SpectrumElement {\n static override styles = [panelStyles];\n\n /**\n * @private\n */\n static instanceCount = 0;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ type: String, reflect: true })\n public value = '';\n\n protected override render(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n\n protected override firstUpdated(): void {\n this.slot = 'tab-panel';\n this.setAttribute('role', 'tabpanel');\n this.tabIndex = 0;\n if (!this.hasAttribute('id')) {\n this.id = `sp-tab-panel-${TabPanel.instanceCount++}`;\n }\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (changes.has('selected')) {\n if (this.selected) {\n this.removeAttribute('aria-hidden');\n this.tabIndex = 0;\n } else {\n this.setAttribute('aria-hidden', 'true');\n this.tabIndex = -1;\n }\n }\n }\n}\n"],
5
- "mappings": "qNAYA,OACI,QAAAA,EAEA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OAAOC,MAAiB,qBAOjB,MAAMC,EAAN,MAAMA,UAAiBH,CAAgB,CAAvC,kCASH,KAAO,SAAW,GAGlB,KAAO,MAAQ,GAEI,QAAyB,CACxC,OAAOD;AAAA;AAAA,SAGX,CAEmB,cAAqB,CACpC,KAAK,KAAO,YACZ,KAAK,aAAa,OAAQ,UAAU,EACpC,KAAK,SAAW,EACX,KAAK,aAAa,IAAI,IACvB,KAAK,GAAK,gBAAgBI,EAAS,eAAe,GAE1D,CAEmB,QAAQC,EAAqC,CACxDA,EAAQ,IAAI,UAAU,IAClB,KAAK,UACL,KAAK,gBAAgB,aAAa,EAClC,KAAK,SAAW,IAEhB,KAAK,aAAa,cAAe,MAAM,EACvC,KAAK,SAAW,IAG5B,CACJ,EAxCaD,EACO,OAAS,CAACD,CAAW,EAD5BC,EAMF,cAAgB,EAGhBE,EAAA,CADNJ,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GARjCE,EASF,wBAGAE,EAAA,CADNJ,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAXhCE,EAYF,qBAZJ,WAAM,SAANA",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport panelStyles from './tab-panel.css.js';\n\n/**\n * @element sp-tab-panel\n *\n * @slot - content of the Tab Panel\n */\nexport class TabPanel extends SpectrumElement {\n static override styles = [panelStyles];\n\n /**\n * @private\n */\n static instanceCount = 0;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ type: String, reflect: true })\n public value = '';\n\n protected handleFocusin(): void {\n this.removeAttribute('tabindex');\n }\n\n protected handleFocusout(): void {\n this.tabIndex = this.selected ? 0 : -1;\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot\n @focusin=${this.handleFocusin}\n @focusout=${this.handleFocusout}\n ></slot>\n `;\n }\n\n protected override firstUpdated(): void {\n this.slot = 'tab-panel';\n this.setAttribute('role', 'tabpanel');\n this.tabIndex = 0;\n if (!this.hasAttribute('id')) {\n this.id = `sp-tab-panel-${TabPanel.instanceCount++}`;\n }\n }\n\n protected override updated(changes: PropertyValues<this>): void {\n if (changes.has('selected')) {\n if (this.selected) {\n this.removeAttribute('aria-hidden');\n this.tabIndex = 0;\n } else {\n this.setAttribute('aria-hidden', 'true');\n this.tabIndex = -1;\n }\n }\n }\n}\n"],
5
+ "mappings": "qNAYA,OACI,QAAAA,EAEA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OAAOC,MAAiB,qBAOjB,MAAMC,EAAN,MAAMA,UAAiBH,CAAgB,CAAvC,kCASH,KAAO,SAAW,GAGlB,KAAO,MAAQ,GAEL,eAAsB,CAC5B,KAAK,gBAAgB,UAAU,CACnC,CAEU,gBAAuB,CAC7B,KAAK,SAAW,KAAK,SAAW,EAAI,EACxC,CAEmB,QAAyB,CACxC,OAAOD;AAAA;AAAA,2BAEY,KAAK,aAAa;AAAA,4BACjB,KAAK,cAAc;AAAA;AAAA,SAG3C,CAEmB,cAAqB,CACpC,KAAK,KAAO,YACZ,KAAK,aAAa,OAAQ,UAAU,EACpC,KAAK,SAAW,EACX,KAAK,aAAa,IAAI,IACvB,KAAK,GAAK,gBAAgBI,EAAS,eAAe,GAE1D,CAEmB,QAAQC,EAAqC,CACxDA,EAAQ,IAAI,UAAU,IAClB,KAAK,UACL,KAAK,gBAAgB,aAAa,EAClC,KAAK,SAAW,IAEhB,KAAK,aAAa,cAAe,MAAM,EACvC,KAAK,SAAW,IAG5B,CACJ,EAnDaD,EACO,OAAS,CAACD,CAAW,EAD5BC,EAMF,cAAgB,EAGhBE,EAAA,CADNJ,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GARjCE,EASF,wBAGAE,EAAA,CADNJ,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAXhCE,EAYF,qBAZJ,WAAM,SAANA",
6
6
  "names": ["html", "SpectrumElement", "property", "panelStyles", "_TabPanel", "changes", "__decorateClass"]
7
7
  }