@digital-realty/ix-tabs 0.0.1
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/LICENSE +21 -0
- package/README.md +86 -0
- package/demo/index.html +63 -0
- package/dist/src/IxPrimaryTab.d.ts +6 -0
- package/dist/src/IxPrimaryTab.js +19 -0
- package/dist/src/IxPrimaryTab.js.map +1 -0
- package/dist/src/IxSecondaryTab.d.ts +6 -0
- package/dist/src/IxSecondaryTab.js +19 -0
- package/dist/src/IxSecondaryTab.js.map +1 -0
- package/dist/src/IxTabs.d.ts +8 -0
- package/dist/src/IxTabs.js +20 -0
- package/dist/src/IxTabs.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/ix-primary-tab.d.ts +1 -0
- package/dist/src/ix-primary-tab.js +3 -0
- package/dist/src/ix-primary-tab.js.map +1 -0
- package/dist/src/ix-secondary-tab.d.ts +1 -0
- package/dist/src/ix-secondary-tab.js +3 -0
- package/dist/src/ix-secondary-tab.js.map +1 -0
- package/dist/src/ix-tabs.d.ts +1 -0
- package/dist/src/ix-tabs.js +3 -0
- package/dist/src/ix-tabs.js.map +1 -0
- package/dist/src/mdtabs/internal/primary-tab.d.ts +20 -0
- package/dist/src/mdtabs/internal/primary-tab.js +30 -0
- package/dist/src/mdtabs/internal/primary-tab.js.map +1 -0
- package/dist/src/mdtabs/internal/secondary-tab.d.ts +12 -0
- package/dist/src/mdtabs/internal/secondary-tab.js +16 -0
- package/dist/src/mdtabs/internal/secondary-tab.js.map +1 -0
- package/dist/src/mdtabs/internal/tab.d.ts +67 -0
- package/dist/src/mdtabs/internal/tab.js +210 -0
- package/dist/src/mdtabs/internal/tab.js.map +1 -0
- package/dist/src/mdtabs/internal/tabs.d.ts +73 -0
- package/dist/src/mdtabs/internal/tabs.js +294 -0
- package/dist/src/mdtabs/internal/tabs.js.map +1 -0
- package/dist/src/mdtabs/primary-tab.d.ts +13 -0
- package/dist/src/mdtabs/primary-tab.js +29 -0
- package/dist/src/mdtabs/primary-tab.js.map +1 -0
- package/dist/src/mdtabs/secondary-tab.d.ts +18 -0
- package/dist/src/mdtabs/secondary-tab.js +24 -0
- package/dist/src/mdtabs/secondary-tab.js.map +1 -0
- package/dist/src/mdtabs/tabs.d.ts +18 -0
- package/dist/src/mdtabs/tabs.js +23 -0
- package/dist/src/mdtabs/tabs.js.map +1 -0
- package/dist/src/react/IxPrimaryTab.d.ts +2 -0
- package/dist/src/react/IxPrimaryTab.js +10 -0
- package/dist/src/react/IxPrimaryTab.js.map +1 -0
- package/dist/src/react/IxSecondaryTab.d.ts +2 -0
- package/dist/src/react/IxSecondaryTab.js +10 -0
- package/dist/src/react/IxSecondaryTab.js.map +1 -0
- package/dist/src/react/IxTabs.d.ts +2 -0
- package/dist/src/react/IxTabs.js +10 -0
- package/dist/src/react/IxTabs.js.map +1 -0
- package/dist/test/ix-tabs.test.d.ts +3 -0
- package/dist/test/ix-tabs.test.js +39 -0
- package/dist/test/ix-tabs.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +96 -0
- package/src/IxPrimaryTab.ts +20 -0
- package/src/IxSecondaryTab.ts +20 -0
- package/src/IxTabs.ts +20 -0
- package/src/index.ts +2 -0
- package/src/ix-primary-tab.ts +3 -0
- package/src/ix-secondary-tab.ts +3 -0
- package/src/ix-tabs.ts +3 -0
- package/src/mdtabs/internal/primary-tab.ts +26 -0
- package/src/mdtabs/internal/secondary-tab.ts +14 -0
- package/src/mdtabs/internal/tab.ts +238 -0
- package/src/mdtabs/internal/tabs.ts +333 -0
- package/src/mdtabs/primary-tab.ts +28 -0
- package/src/mdtabs/secondary-tab.ts +28 -0
- package/src/mdtabs/tabs.ts +27 -0
- package/src/react/IxPrimaryTab.ts +11 -0
- package/src/react/IxSecondaryTab.ts +11 -0
- package/src/react/IxTabs.ts +11 -0
- package/test/ix-tabs.test.ts +53 -0
- package/tsconfig.json +21 -0
- package/web-dev-server.config.mjs +27 -0
- package/web-test-runner.config.mjs +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 ix-tabs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# \<ix-tabs>
|
|
2
|
+
|
|
3
|
+
This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @digital-realty/ix-tabs
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<script type="module">
|
|
15
|
+
import '@digital-realty/ix-tabs/ix-tabs.js';
|
|
16
|
+
import '@digital-realty/ix-tabs/ix-primary-tab.js';
|
|
17
|
+
import '@digital-realty/ix-tabs/ix-secondary-tab.js';
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<ix-tabs>
|
|
21
|
+
<ix-primary-tab>Tab 1</ix-primary-tab>
|
|
22
|
+
<ix-primary-tab>Tab 2</ix-primary-tab>
|
|
23
|
+
<ix-primary-tab>Tab 3</ix-primary-tab>
|
|
24
|
+
<ix-primary-tab>Tab 4</ix-primary-tab>
|
|
25
|
+
</ix-tabs>
|
|
26
|
+
|
|
27
|
+
or
|
|
28
|
+
|
|
29
|
+
<ix-tabs id="secondary">
|
|
30
|
+
<ix-secondary-tab>Tab 1</ix-secondary-tab>
|
|
31
|
+
<ix-secondary-tab>Tab 2</ix-secondary-tab>
|
|
32
|
+
<ix-secondary-tab>Tab 3</ix-secondary-tab>
|
|
33
|
+
</ix-tabs>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### In React
|
|
37
|
+
```html
|
|
38
|
+
<script type="module">
|
|
39
|
+
import { IxTabs } from '@digital-realty/ix-tabs/IxTabs'
|
|
40
|
+
import { IxPrimaryTab } from '@digital-realty/ix-tabs/IxPrimaryTab'
|
|
41
|
+
import { IxSecondaryTab } from '@digital-realty/ix-tabs/IxSecondaryTab'
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Linting and formatting
|
|
46
|
+
|
|
47
|
+
To scan the project for linting and formatting errors, run
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm run lint
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
To automatically fix linting and formatting errors, run
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm run format
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Testing with Web Test Runner
|
|
60
|
+
|
|
61
|
+
To execute a single test run:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm run test
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
To run the tests in interactive watch mode run:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm run test:watch
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Tooling configs
|
|
75
|
+
|
|
76
|
+
For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
|
|
77
|
+
|
|
78
|
+
If you customize the configuration a lot, you can consider moving them to individual files.
|
|
79
|
+
|
|
80
|
+
## Local Demo with `web-dev-server`
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm start
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
To run a local development server that serves the basic demo located in `demo/index.html`
|
package/demo/index.html
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en-GB">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<style>
|
|
6
|
+
body {
|
|
7
|
+
background: #fafafa;
|
|
8
|
+
}
|
|
9
|
+
#content {
|
|
10
|
+
padding: 1rem;
|
|
11
|
+
border: 1px solid;
|
|
12
|
+
}
|
|
13
|
+
</style>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div id="demo"></div>
|
|
17
|
+
|
|
18
|
+
<script type="module">
|
|
19
|
+
import { html, render } from 'lit';
|
|
20
|
+
import '../dist/src/ix-tabs.js';
|
|
21
|
+
import '../dist/src/ix-primary-tab.js';
|
|
22
|
+
import '../dist/src/ix-secondary-tab.js';
|
|
23
|
+
|
|
24
|
+
render(
|
|
25
|
+
html`
|
|
26
|
+
<ix-tabs id="primary">
|
|
27
|
+
<ix-primary-tab>Tab 1</ix-primary-tab>
|
|
28
|
+
<ix-primary-tab>Tab 2</ix-primary-tab>
|
|
29
|
+
<ix-primary-tab>Tab 3</ix-primary-tab>
|
|
30
|
+
<ix-primary-tab>Tab 4</ix-primary-tab>
|
|
31
|
+
</ix-tabs>
|
|
32
|
+
<ix-tabs id="secondary">
|
|
33
|
+
<ix-secondary-tab>Tab 1</ix-secondary-tab>
|
|
34
|
+
<ix-secondary-tab>Tab 2</ix-secondary-tab>
|
|
35
|
+
<ix-secondary-tab>Tab 3</ix-secondary-tab>
|
|
36
|
+
</ix-tabs>
|
|
37
|
+
<div id="content">
|
|
38
|
+
<div role="tabpanel" id="panel-one" aria-labelledby="tab-one">Travel</div>
|
|
39
|
+
<div role="tabpanel" id="panel-two" aria-labelledby="tab-two" hidden>Hotel</div>
|
|
40
|
+
<div role="tabpanel" id="panel-three" aria-labelledby="tab-three" hidden>Activities</div>
|
|
41
|
+
<div role="tabpanel" id="panel-four" aria-labelledby="tab-four" hidden>Food</div>
|
|
42
|
+
</div>
|
|
43
|
+
`,
|
|
44
|
+
document.querySelector('#demo')
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
document.getElementById('primary').addEventListener('change', (event) => {
|
|
48
|
+
document.querySelectorAll('div[role=tabpanel]').forEach(el=>{
|
|
49
|
+
const tab = el;
|
|
50
|
+
tab.hidden=true
|
|
51
|
+
});
|
|
52
|
+
document.querySelectorAll('div[role=tabpanel]')[event.target.activeTabIndex].hidden = false;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
document.getElementById('secondary').addEventListener('change', (event) => {
|
|
56
|
+
console.log("Secondary tab active >>", event.target.activeTabIndex);
|
|
57
|
+
if (event.target.activeTabIndex === 2) {
|
|
58
|
+
// ... perform logic only if index of selected item is 2.
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
</script>
|
|
62
|
+
</body>
|
|
63
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import './mdtabs/primary-tab.js';
|
|
3
|
+
export class IxPrimaryTab extends LitElement {
|
|
4
|
+
render() {
|
|
5
|
+
return html `<md-primary-tab><slot></slot></md-primary-tab> `;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
IxPrimaryTab.styles = css `
|
|
9
|
+
:host {
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
::slotted(*) {
|
|
13
|
+
flex: 1 1 0%;
|
|
14
|
+
}
|
|
15
|
+
md-primary-tab {
|
|
16
|
+
flex: 1 1 0%;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
//# sourceMappingURL=IxPrimaryTab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IxPrimaryTab.js","sourceRoot":"","sources":["../../src/IxPrimaryTab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,yBAAyB,CAAC;AAEjC,MAAM,OAAO,YAAa,SAAQ,UAAU;IAa1C,MAAM;QACJ,OAAO,IAAI,CAAA,iDAAiD,CAAC;IAC/D,CAAC;;AAdM,mBAAM,GAAG,GAAG,CAAA;;;;;;;;;;GAUlB,CAAC","sourcesContent":["import { html, css, LitElement } from 'lit';\nimport './mdtabs/primary-tab.js';\n\nexport class IxPrimaryTab extends LitElement {\n static styles = css`\n :host {\n display: flex;\n }\n ::slotted(*) {\n flex: 1 1 0%;\n }\n md-primary-tab {\n flex: 1 1 0%;\n }\n `;\n\n render() {\n return html`<md-primary-tab><slot></slot></md-primary-tab> `;\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import './mdtabs/secondary-tab.js';
|
|
3
|
+
export class IxSecondaryTab extends LitElement {
|
|
4
|
+
render() {
|
|
5
|
+
return html `<md-secondary-tab><slot></slot></md-secondary-tab> `;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
IxSecondaryTab.styles = css `
|
|
9
|
+
:host {
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
::slotted(*) {
|
|
13
|
+
flex: 1 1 0%;
|
|
14
|
+
}
|
|
15
|
+
md-secondary-tab {
|
|
16
|
+
flex: 1 1 0%;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
//# sourceMappingURL=IxSecondaryTab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IxSecondaryTab.js","sourceRoot":"","sources":["../../src/IxSecondaryTab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,2BAA2B,CAAC;AAEnC,MAAM,OAAO,cAAe,SAAQ,UAAU;IAa5C,MAAM;QACJ,OAAO,IAAI,CAAA,qDAAqD,CAAC;IACnE,CAAC;;AAdM,qBAAM,GAAG,GAAG,CAAA;;;;;;;;;;GAUlB,CAAC","sourcesContent":["import { html, css, LitElement } from 'lit';\nimport './mdtabs/secondary-tab.js';\n\nexport class IxSecondaryTab extends LitElement {\n static styles = css`\n :host {\n display: flex;\n }\n ::slotted(*) {\n flex: 1 1 0%;\n }\n md-secondary-tab {\n flex: 1 1 0%;\n }\n `;\n\n render() {\n return html`<md-secondary-tab><slot></slot></md-secondary-tab> `;\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import './mdtabs/tabs.js';
|
|
3
|
+
import type { MdTabs } from './mdtabs/tabs.js';
|
|
4
|
+
export declare class IxTabs extends LitElement {
|
|
5
|
+
activeTab: MdTabs;
|
|
6
|
+
get activeTabIndex(): number;
|
|
7
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, LitElement } from 'lit';
|
|
3
|
+
import { query } from 'lit/decorators.js';
|
|
4
|
+
import './mdtabs/tabs.js';
|
|
5
|
+
export class IxTabs extends LitElement {
|
|
6
|
+
get activeTabIndex() {
|
|
7
|
+
return this.activeTab.activeTabIndex;
|
|
8
|
+
}
|
|
9
|
+
render() {
|
|
10
|
+
return html `
|
|
11
|
+
<md-tabs>
|
|
12
|
+
<slot></slot>
|
|
13
|
+
</md-tabs>
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
__decorate([
|
|
18
|
+
query('md-tabs')
|
|
19
|
+
], IxTabs.prototype, "activeTab", void 0);
|
|
20
|
+
//# sourceMappingURL=IxTabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IxTabs.js","sourceRoot":"","sources":["../../src/IxTabs.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,kBAAkB,CAAC;AAG1B,MAAM,OAAO,MAAO,SAAQ,UAAU;IAGpC,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;IACvC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;KAIV,CAAC;IACJ,CAAC;CACF;AAbmB;IAAjB,KAAK,CAAC,SAAS,CAAC;yCAAoB","sourcesContent":["import { html, LitElement } from 'lit';\nimport { query } from 'lit/decorators.js';\nimport './mdtabs/tabs.js';\nimport type { MdTabs } from './mdtabs/tabs.js';\n\nexport class IxTabs extends LitElement {\n @query('md-tabs') activeTab!: MdTabs;\n\n get activeTabIndex() {\n return this.activeTab.activeTabIndex;\n }\n\n render() {\n return html`\n <md-tabs>\n <slot></slot>\n </md-tabs>\n `;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { IxTabs } from './IxTabs.js';\nexport { IxPrimaryTab } from './IxPrimaryTab.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ix-primary-tab.js","sourceRoot":"","sources":["../../src/ix-primary-tab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { IxPrimaryTab } from './IxPrimaryTab.js';\n\nwindow.customElements.define('ix-primary-tab', IxPrimaryTab);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ix-secondary-tab.js","sourceRoot":"","sources":["../../src/ix-secondary-tab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { IxSecondaryTab } from './IxSecondaryTab.js';\n\nwindow.customElements.define('ix-secondary-tab', IxSecondaryTab);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ix-tabs.js","sourceRoot":"","sources":["../../src/ix-tabs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import { IxTabs } from './IxTabs.js';\n\nwindow.customElements.define('ix-tabs', IxTabs);\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Tab } from './tab.js';
|
|
7
|
+
/**
|
|
8
|
+
* A primary tab component.
|
|
9
|
+
*/
|
|
10
|
+
export declare class PrimaryTab extends Tab {
|
|
11
|
+
/**
|
|
12
|
+
* Whether or not the icon renders inline with label or stacked vertically.
|
|
13
|
+
*/
|
|
14
|
+
inlineIcon: boolean;
|
|
15
|
+
protected getContentClasses(): {
|
|
16
|
+
stacked: boolean;
|
|
17
|
+
'has-icon': boolean;
|
|
18
|
+
'has-label': boolean;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
|
+
import { property } from 'lit/decorators.js';
|
|
8
|
+
import { Tab } from './tab.js';
|
|
9
|
+
/**
|
|
10
|
+
* A primary tab component.
|
|
11
|
+
*/
|
|
12
|
+
export class PrimaryTab extends Tab {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
/**
|
|
16
|
+
* Whether or not the icon renders inline with label or stacked vertically.
|
|
17
|
+
*/
|
|
18
|
+
this.inlineIcon = false;
|
|
19
|
+
}
|
|
20
|
+
getContentClasses() {
|
|
21
|
+
return {
|
|
22
|
+
...super.getContentClasses(),
|
|
23
|
+
stacked: !this.inlineIcon,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
__decorate([
|
|
28
|
+
property({ type: Boolean, attribute: 'inline-icon' })
|
|
29
|
+
], PrimaryTab.prototype, "inlineIcon", void 0);
|
|
30
|
+
//# sourceMappingURL=primary-tab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primary-tab.js","sourceRoot":"","sources":["../../../../src/mdtabs/internal/primary-tab.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,GAAG;IAAnC;;QACE;;WAEG;QACoD,eAAU,GAAG,KAAK,CAAC;IAQ5E,CAAC;IANoB,iBAAiB;QAClC,OAAO;YACL,GAAG,KAAK,CAAC,iBAAiB,EAAE;YAC5B,OAAO,EAAE,CAAC,IAAI,CAAC,UAAU;SAC1B,CAAC;IACJ,CAAC;CACF;AARwD;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;8CAAoB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { property } from 'lit/decorators.js';\n\nimport { Tab } from './tab.js';\n\n/**\n * A primary tab component.\n */\nexport class PrimaryTab extends Tab {\n /**\n * Whether or not the icon renders inline with label or stacked vertically.\n */\n @property({ type: Boolean, attribute: 'inline-icon' }) inlineIcon = false;\n\n protected override getContentClasses() {\n return {\n ...super.getContentClasses(),\n stacked: !this.inlineIcon,\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Tab } from './tab.js';
|
|
7
|
+
/**
|
|
8
|
+
* A secondary tab component.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SecondaryTab extends Tab {
|
|
11
|
+
protected fullWidthIndicator: boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Tab } from './tab.js';
|
|
7
|
+
/**
|
|
8
|
+
* A secondary tab component.
|
|
9
|
+
*/
|
|
10
|
+
export class SecondaryTab extends Tab {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.fullWidthIndicator = true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=secondary-tab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secondary-tab.js","sourceRoot":"","sources":["../../../../src/mdtabs/internal/secondary-tab.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,GAAG;IAArC;;QACqB,uBAAkB,GAAG,IAAI,CAAC;IAC/C,CAAC;CAAA","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Tab } from './tab.js';\n\n/**\n * A secondary tab component.\n */\nexport class SecondaryTab extends Tab {\n protected override fullWidthIndicator = true;\n}\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import '@material/web/elevation/elevation.js';
|
|
7
|
+
import '@material/web/focus/md-focus-ring.js';
|
|
8
|
+
import '@material/web/ripple/ripple.js';
|
|
9
|
+
import { LitElement } from 'lit';
|
|
10
|
+
/**
|
|
11
|
+
* Symbol for tabs to use to animate their indicators based off another tab's
|
|
12
|
+
* indicator.
|
|
13
|
+
*/
|
|
14
|
+
declare const INDICATOR: unique symbol;
|
|
15
|
+
/**
|
|
16
|
+
* Symbol used by the tab bar to request a tab to animate its indicator from a
|
|
17
|
+
* previously selected tab.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ANIMATE_INDICATOR: unique symbol;
|
|
20
|
+
/**
|
|
21
|
+
* Tab component.
|
|
22
|
+
*/
|
|
23
|
+
export declare class Tab extends LitElement {
|
|
24
|
+
/**
|
|
25
|
+
* The attribute `md-tab` indicates that the element is a tab for the parent
|
|
26
|
+
* element, `<md-tabs>`. Make sure if you're implementing your own `md-tab`
|
|
27
|
+
* component that you have an `md-tab` attribute set.
|
|
28
|
+
*/
|
|
29
|
+
readonly isTab = true;
|
|
30
|
+
/**
|
|
31
|
+
* Whether or not the tab is selected.
|
|
32
|
+
*/
|
|
33
|
+
active: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* TODO(b/293476210): remove after migrating
|
|
36
|
+
* @deprecated use `active`
|
|
37
|
+
*/
|
|
38
|
+
get selected(): boolean;
|
|
39
|
+
set selected(active: boolean);
|
|
40
|
+
/**
|
|
41
|
+
* In SSR, set this to true when an icon is present.
|
|
42
|
+
*/
|
|
43
|
+
hasIcon: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* In SSR, set this to true when there is no label and only an icon.
|
|
46
|
+
*/
|
|
47
|
+
iconOnly: boolean;
|
|
48
|
+
readonly [INDICATOR]: HTMLElement | null;
|
|
49
|
+
protected fullWidthIndicator: boolean;
|
|
50
|
+
private readonly assignedDefaultNodes;
|
|
51
|
+
private readonly assignedIcons;
|
|
52
|
+
private readonly internals;
|
|
53
|
+
constructor();
|
|
54
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
55
|
+
protected getContentClasses(): {
|
|
56
|
+
'has-icon': boolean;
|
|
57
|
+
'has-label': boolean;
|
|
58
|
+
};
|
|
59
|
+
protected updated(): void;
|
|
60
|
+
private handleKeydown;
|
|
61
|
+
private handleContentClick;
|
|
62
|
+
[ANIMATE_INDICATOR](previousTab: Tab): void;
|
|
63
|
+
private getKeyframes;
|
|
64
|
+
private handleSlotChange;
|
|
65
|
+
private handleIconSlotChange;
|
|
66
|
+
}
|
|
67
|
+
export {};
|