@digital-realty/ix-tabs 1.0.25 → 1.0.28-alpha.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/dist/IxPrimaryTab.d.ts +8 -8
- package/dist/IxPrimaryTab.js +21 -21
- package/dist/IxSecondaryTab.d.ts +7 -7
- package/dist/IxSecondaryTab.js +17 -17
- package/dist/IxTabs.d.ts +25 -25
- package/dist/IxTabs.js +118 -118
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/ix-primary-tab.d.ts +1 -1
- package/dist/ix-primary-tab.js +2 -2
- package/dist/ix-secondary-tab.d.ts +1 -1
- package/dist/ix-secondary-tab.js +2 -2
- package/dist/ix-tabs.d.ts +1 -1
- package/dist/ix-tabs.js +2 -2
- package/dist/ix-tabs.min.js +1 -1
- package/dist/mdtabs/internal/primary-tab.d.ts +20 -20
- package/dist/mdtabs/internal/primary-tab.js +29 -29
- package/dist/mdtabs/internal/secondary-tab.d.ts +12 -12
- package/dist/mdtabs/internal/secondary-tab.js +15 -15
- package/dist/mdtabs/internal/tab.d.ts +67 -67
- package/dist/mdtabs/internal/tab.js +188 -188
- package/dist/mdtabs/internal/tabs.d.ts +73 -73
- package/dist/mdtabs/internal/tabs.js +280 -280
- package/dist/mdtabs/primary-tab.d.ts +13 -13
- package/dist/mdtabs/primary-tab.js +28 -28
- package/dist/mdtabs/secondary-tab.d.ts +18 -18
- package/dist/mdtabs/secondary-tab.js +23 -23
- package/dist/mdtabs/tabs.d.ts +13 -13
- package/dist/mdtabs/tabs.js +26 -26
- package/dist/react/IxPrimaryTab.d.ts +2 -2
- package/dist/react/IxPrimaryTab.js +9 -9
- package/dist/react/IxSecondaryTab.d.ts +2 -2
- package/dist/react/IxSecondaryTab.js +9 -9
- package/dist/react/IxTabs.d.ts +2 -2
- package/dist/react/IxTabs.js +9 -9
- package/package.json +4 -4
package/dist/IxPrimaryTab.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import './mdtabs/primary-tab.js';
|
|
3
|
-
export declare class IxPrimaryTab extends LitElement {
|
|
4
|
-
static styles: import("lit").CSSResult;
|
|
5
|
-
active: boolean;
|
|
6
|
-
inlineIcon: boolean;
|
|
7
|
-
render(): import("lit").TemplateResult<1>;
|
|
8
|
-
}
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import './mdtabs/primary-tab.js';
|
|
3
|
+
export declare class IxPrimaryTab extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult;
|
|
5
|
+
active: boolean;
|
|
6
|
+
inlineIcon: boolean;
|
|
7
|
+
render(): import("lit").TemplateResult<1>;
|
|
8
|
+
}
|
package/dist/IxPrimaryTab.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { html, css, LitElement } from 'lit';
|
|
3
|
-
import { property } from 'lit/decorators.js';
|
|
4
|
-
import './mdtabs/primary-tab.js';
|
|
5
|
-
export class IxPrimaryTab extends LitElement {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.active = false;
|
|
9
|
-
this.inlineIcon = false;
|
|
10
|
-
}
|
|
11
|
-
render() {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, css, LitElement } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
4
|
+
import './mdtabs/primary-tab.js';
|
|
5
|
+
export class IxPrimaryTab extends LitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.active = false;
|
|
9
|
+
this.inlineIcon = false;
|
|
10
|
+
}
|
|
11
|
+
render() {
|
|
12
12
|
return html `<md-primary-tab
|
|
13
13
|
?active=${this.active}
|
|
14
14
|
?inline-icon=${this.inlineIcon}
|
|
15
15
|
>
|
|
16
16
|
<slot slot="icon" name="icon"></slot>
|
|
17
17
|
<slot></slot
|
|
18
|
-
></md-primary-tab> `;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
18
|
+
></md-primary-tab> `;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
21
|
IxPrimaryTab.styles = css `
|
|
22
22
|
:host {
|
|
23
23
|
display: flex;
|
|
@@ -35,11 +35,11 @@ IxPrimaryTab.styles = css `
|
|
|
35
35
|
md-primary-tab {
|
|
36
36
|
flex: 1 1 0%;
|
|
37
37
|
}
|
|
38
|
-
`;
|
|
39
|
-
__decorate([
|
|
40
|
-
property({ type: Boolean, reflect: true })
|
|
41
|
-
], IxPrimaryTab.prototype, "active", void 0);
|
|
42
|
-
__decorate([
|
|
43
|
-
property({ type: Boolean, attribute: 'inline-icon' })
|
|
44
|
-
], IxPrimaryTab.prototype, "inlineIcon", void 0);
|
|
38
|
+
`;
|
|
39
|
+
__decorate([
|
|
40
|
+
property({ type: Boolean, reflect: true })
|
|
41
|
+
], IxPrimaryTab.prototype, "active", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
property({ type: Boolean, attribute: 'inline-icon' })
|
|
44
|
+
], IxPrimaryTab.prototype, "inlineIcon", void 0);
|
|
45
45
|
//# sourceMappingURL=IxPrimaryTab.js.map
|
package/dist/IxSecondaryTab.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import './mdtabs/secondary-tab.js';
|
|
3
|
-
export declare class IxSecondaryTab extends LitElement {
|
|
4
|
-
static styles: import("lit").CSSResult;
|
|
5
|
-
active: boolean;
|
|
6
|
-
render(): import("lit").TemplateResult<1>;
|
|
7
|
-
}
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import './mdtabs/secondary-tab.js';
|
|
3
|
+
export declare class IxSecondaryTab extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult;
|
|
5
|
+
active: boolean;
|
|
6
|
+
render(): import("lit").TemplateResult<1>;
|
|
7
|
+
}
|
package/dist/IxSecondaryTab.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { html, css, LitElement } from 'lit';
|
|
3
|
-
import { property } from 'lit/decorators.js';
|
|
4
|
-
import './mdtabs/secondary-tab.js';
|
|
5
|
-
export class IxSecondaryTab extends LitElement {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.active = false;
|
|
9
|
-
}
|
|
10
|
-
render() {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, css, LitElement } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
4
|
+
import './mdtabs/secondary-tab.js';
|
|
5
|
+
export class IxSecondaryTab extends LitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.active = false;
|
|
9
|
+
}
|
|
10
|
+
render() {
|
|
11
11
|
return html `<md-secondary-tab ?active=${this.active}>
|
|
12
12
|
<slot slot="icon" name="icon"></slot>
|
|
13
13
|
<slot></slot
|
|
14
|
-
></md-secondary-tab>`;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
14
|
+
></md-secondary-tab>`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
IxSecondaryTab.styles = css `
|
|
18
18
|
:host {
|
|
19
19
|
display: flex;
|
|
@@ -31,8 +31,8 @@ IxSecondaryTab.styles = css `
|
|
|
31
31
|
md-secondary-tab {
|
|
32
32
|
flex: 1 1 0%;
|
|
33
33
|
}
|
|
34
|
-
`;
|
|
35
|
-
__decorate([
|
|
36
|
-
property({ type: Boolean, reflect: true })
|
|
37
|
-
], IxSecondaryTab.prototype, "active", void 0);
|
|
34
|
+
`;
|
|
35
|
+
__decorate([
|
|
36
|
+
property({ type: Boolean, reflect: true })
|
|
37
|
+
], IxSecondaryTab.prototype, "active", void 0);
|
|
38
38
|
//# sourceMappingURL=IxSecondaryTab.js.map
|
package/dist/IxTabs.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import './mdtabs/tabs.js';
|
|
3
|
-
import type { MdTabs } from './mdtabs/tabs.js';
|
|
4
|
-
import '@digital-realty/ix-icon-button/ix-icon-button.js';
|
|
5
|
-
export declare class IxTabs extends LitElement {
|
|
6
|
-
static styles: import("lit").CSSResult;
|
|
7
|
-
mdTabs: MdTabs;
|
|
8
|
-
activeTab: Element;
|
|
9
|
-
scrollButtons: boolean;
|
|
10
|
-
hideScrollBar: boolean;
|
|
11
|
-
inline: boolean;
|
|
12
|
-
alignLeft: boolean;
|
|
13
|
-
private enableLeftScroll;
|
|
14
|
-
private enableRightScroll;
|
|
15
|
-
private tabContainer;
|
|
16
|
-
get activeTabIndex(): number;
|
|
17
|
-
set activeTabIndex(index: number);
|
|
18
|
-
private calculateScrollButtonsEnabled;
|
|
19
|
-
private debounceEvent;
|
|
20
|
-
private updateScrollButtonState;
|
|
21
|
-
slotChange(): Promise<void>;
|
|
22
|
-
disconnectedCallback(): void;
|
|
23
|
-
private scrollTabs;
|
|
24
|
-
render(): import("lit").TemplateResult<1>;
|
|
25
|
-
}
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import './mdtabs/tabs.js';
|
|
3
|
+
import type { MdTabs } from './mdtabs/tabs.js';
|
|
4
|
+
import '@digital-realty/ix-icon-button/ix-icon-button.js';
|
|
5
|
+
export declare class IxTabs extends LitElement {
|
|
6
|
+
static styles: import("lit").CSSResult;
|
|
7
|
+
mdTabs: MdTabs;
|
|
8
|
+
activeTab: Element;
|
|
9
|
+
scrollButtons: boolean;
|
|
10
|
+
hideScrollBar: boolean;
|
|
11
|
+
inline: boolean;
|
|
12
|
+
alignLeft: boolean;
|
|
13
|
+
private enableLeftScroll;
|
|
14
|
+
private enableRightScroll;
|
|
15
|
+
private tabContainer;
|
|
16
|
+
get activeTabIndex(): number;
|
|
17
|
+
set activeTabIndex(index: number);
|
|
18
|
+
private calculateScrollButtonsEnabled;
|
|
19
|
+
private debounceEvent;
|
|
20
|
+
private updateScrollButtonState;
|
|
21
|
+
slotChange(): Promise<void>;
|
|
22
|
+
disconnectedCallback(): void;
|
|
23
|
+
private scrollTabs;
|
|
24
|
+
render(): import("lit").TemplateResult<1>;
|
|
25
|
+
}
|
package/dist/IxTabs.js
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { html, css, nothing, LitElement } from 'lit';
|
|
3
|
-
import { property, query } from 'lit/decorators.js';
|
|
4
|
-
import './mdtabs/tabs.js';
|
|
5
|
-
import '@digital-realty/ix-icon-button/ix-icon-button.js';
|
|
6
|
-
export class IxTabs extends LitElement {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.scrollButtons = false;
|
|
10
|
-
this.hideScrollBar = false;
|
|
11
|
-
this.inline = false;
|
|
12
|
-
this.alignLeft = false;
|
|
13
|
-
this.enableLeftScroll = true;
|
|
14
|
-
this.enableRightScroll = true;
|
|
15
|
-
this.tabContainer = null;
|
|
16
|
-
this.updateScrollButtonState = () => {
|
|
17
|
-
clearTimeout(this.debounceEvent);
|
|
18
|
-
this.debounceEvent = setTimeout(this.calculateScrollButtonsEnabled.bind(this), 100);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
get activeTabIndex() {
|
|
22
|
-
return this.mdTabs.activeTabIndex;
|
|
23
|
-
}
|
|
24
|
-
set activeTabIndex(index) {
|
|
25
|
-
this.mdTabs.activeTabIndex = index;
|
|
26
|
-
}
|
|
27
|
-
calculateScrollButtonsEnabled() {
|
|
28
|
-
var _a;
|
|
29
|
-
if (this.tabContainer) {
|
|
30
|
-
const { clientWidth, scrollWidth, scrollLeft } = this.tabContainer;
|
|
31
|
-
this.enableLeftScroll = scrollLeft !== 0;
|
|
32
|
-
this.enableRightScroll = scrollLeft !== scrollWidth - clientWidth;
|
|
33
|
-
if (this.alignLeft) {
|
|
34
|
-
const parent = (_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.clientWidth;
|
|
35
|
-
if (parent && scrollWidth > parent) {
|
|
36
|
-
this.inline = false;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this.inline = true;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async slotChange() {
|
|
45
|
-
var _a, _b;
|
|
46
|
-
await 0;
|
|
47
|
-
(_a = this.querySelector('ix-primary-tab[active]')) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
48
|
-
this.tabContainer = (_b = this.mdTabs.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.tabs');
|
|
49
|
-
if (this.tabContainer) {
|
|
50
|
-
if (this.scrollButtons) {
|
|
51
|
-
if (this.hideScrollBar) {
|
|
52
|
-
this.tabContainer.classList.add('no-scrollbar');
|
|
53
|
-
}
|
|
54
|
-
this.calculateScrollButtonsEnabled();
|
|
55
|
-
window.addEventListener('resize', this.updateScrollButtonState);
|
|
56
|
-
this.tabContainer.addEventListener('scroll', this.updateScrollButtonState);
|
|
57
|
-
}
|
|
58
|
-
const { clientWidth, scrollWidth } = this.tabContainer;
|
|
59
|
-
if (this.alignLeft && scrollWidth <= clientWidth) {
|
|
60
|
-
this.inline = true;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
disconnectedCallback() {
|
|
65
|
-
var _a;
|
|
66
|
-
super.disconnectedCallback();
|
|
67
|
-
if (this.scrollButtons) {
|
|
68
|
-
window.removeEventListener('resize', this.updateScrollButtonState);
|
|
69
|
-
(_a = this.tabContainer) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', this.updateScrollButtonState);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
scrollTabs(direction = 'left', scrollAmount = 0.75) {
|
|
73
|
-
if (this.tabContainer) {
|
|
74
|
-
const { clientWidth, scrollLeft } = this.tabContainer;
|
|
75
|
-
const offset = direction === 'left'
|
|
76
|
-
? clientWidth * -scrollAmount
|
|
77
|
-
: clientWidth * scrollAmount;
|
|
78
|
-
const scrollToPosition = scrollLeft + offset;
|
|
79
|
-
this.tabContainer.scrollTo({
|
|
80
|
-
top: 0,
|
|
81
|
-
left: scrollToPosition,
|
|
82
|
-
behavior: 'smooth',
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
render() {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, css, nothing, LitElement } from 'lit';
|
|
3
|
+
import { property, query } from 'lit/decorators.js';
|
|
4
|
+
import './mdtabs/tabs.js';
|
|
5
|
+
import '@digital-realty/ix-icon-button/ix-icon-button.js';
|
|
6
|
+
export class IxTabs extends LitElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.scrollButtons = false;
|
|
10
|
+
this.hideScrollBar = false;
|
|
11
|
+
this.inline = false;
|
|
12
|
+
this.alignLeft = false;
|
|
13
|
+
this.enableLeftScroll = true;
|
|
14
|
+
this.enableRightScroll = true;
|
|
15
|
+
this.tabContainer = null;
|
|
16
|
+
this.updateScrollButtonState = () => {
|
|
17
|
+
clearTimeout(this.debounceEvent);
|
|
18
|
+
this.debounceEvent = setTimeout(this.calculateScrollButtonsEnabled.bind(this), 100);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
get activeTabIndex() {
|
|
22
|
+
return this.mdTabs.activeTabIndex;
|
|
23
|
+
}
|
|
24
|
+
set activeTabIndex(index) {
|
|
25
|
+
this.mdTabs.activeTabIndex = index;
|
|
26
|
+
}
|
|
27
|
+
calculateScrollButtonsEnabled() {
|
|
28
|
+
var _a;
|
|
29
|
+
if (this.tabContainer) {
|
|
30
|
+
const { clientWidth, scrollWidth, scrollLeft } = this.tabContainer;
|
|
31
|
+
this.enableLeftScroll = scrollLeft !== 0;
|
|
32
|
+
this.enableRightScroll = scrollLeft !== scrollWidth - clientWidth;
|
|
33
|
+
if (this.alignLeft) {
|
|
34
|
+
const parent = (_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.clientWidth;
|
|
35
|
+
if (parent && scrollWidth > parent) {
|
|
36
|
+
this.inline = false;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.inline = true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async slotChange() {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
await 0;
|
|
47
|
+
(_a = this.querySelector('ix-primary-tab[active]')) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
48
|
+
this.tabContainer = (_b = this.mdTabs.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.tabs');
|
|
49
|
+
if (this.tabContainer) {
|
|
50
|
+
if (this.scrollButtons) {
|
|
51
|
+
if (this.hideScrollBar) {
|
|
52
|
+
this.tabContainer.classList.add('no-scrollbar');
|
|
53
|
+
}
|
|
54
|
+
this.calculateScrollButtonsEnabled();
|
|
55
|
+
window.addEventListener('resize', this.updateScrollButtonState);
|
|
56
|
+
this.tabContainer.addEventListener('scroll', this.updateScrollButtonState);
|
|
57
|
+
}
|
|
58
|
+
const { clientWidth, scrollWidth } = this.tabContainer;
|
|
59
|
+
if (this.alignLeft && scrollWidth <= clientWidth) {
|
|
60
|
+
this.inline = true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
disconnectedCallback() {
|
|
65
|
+
var _a;
|
|
66
|
+
super.disconnectedCallback();
|
|
67
|
+
if (this.scrollButtons) {
|
|
68
|
+
window.removeEventListener('resize', this.updateScrollButtonState);
|
|
69
|
+
(_a = this.tabContainer) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', this.updateScrollButtonState);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
scrollTabs(direction = 'left', scrollAmount = 0.75) {
|
|
73
|
+
if (this.tabContainer) {
|
|
74
|
+
const { clientWidth, scrollLeft } = this.tabContainer;
|
|
75
|
+
const offset = direction === 'left'
|
|
76
|
+
? clientWidth * -scrollAmount
|
|
77
|
+
: clientWidth * scrollAmount;
|
|
78
|
+
const scrollToPosition = scrollLeft + offset;
|
|
79
|
+
this.tabContainer.scrollTo({
|
|
80
|
+
top: 0,
|
|
81
|
+
left: scrollToPosition,
|
|
82
|
+
behavior: 'smooth',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
render() {
|
|
87
87
|
return html `
|
|
88
|
-
${this.scrollButtons
|
|
88
|
+
${this.scrollButtons
|
|
89
89
|
? html `<ix-icon-button
|
|
90
90
|
icon="chevron_left"
|
|
91
91
|
@click=${() => this.scrollTabs('left')}
|
|
92
92
|
?disabled=${!this.enableLeftScroll}
|
|
93
|
-
></ix-icon-button>`
|
|
93
|
+
></ix-icon-button>`
|
|
94
94
|
: nothing}
|
|
95
95
|
<md-tabs>
|
|
96
96
|
<slot @slotchange=${this.slotChange}></slot>
|
|
97
97
|
</md-tabs>
|
|
98
|
-
${this.scrollButtons
|
|
98
|
+
${this.scrollButtons
|
|
99
99
|
? html `<ix-icon-button
|
|
100
100
|
icon="chevron_right"
|
|
101
101
|
@click=${() => this.scrollTabs('right')}
|
|
102
102
|
?disabled=${!this.enableRightScroll}
|
|
103
|
-
></ix-icon-button>`
|
|
103
|
+
></ix-icon-button>`
|
|
104
104
|
: nothing}
|
|
105
|
-
`;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
108
|
IxTabs.styles = css `
|
|
109
109
|
:host {
|
|
110
110
|
display: flex;
|
|
@@ -133,29 +133,29 @@ IxTabs.styles = css `
|
|
|
133
133
|
.scroll {
|
|
134
134
|
cursor: pointer;
|
|
135
135
|
}
|
|
136
|
-
`;
|
|
137
|
-
__decorate([
|
|
138
|
-
query('md-Tabs')
|
|
139
|
-
], IxTabs.prototype, "mdTabs", void 0);
|
|
140
|
-
__decorate([
|
|
141
|
-
query('ix-primary-tab[active]')
|
|
142
|
-
], IxTabs.prototype, "activeTab", void 0);
|
|
143
|
-
__decorate([
|
|
144
|
-
property({ type: Boolean })
|
|
145
|
-
], IxTabs.prototype, "scrollButtons", void 0);
|
|
146
|
-
__decorate([
|
|
147
|
-
property({ type: Boolean })
|
|
148
|
-
], IxTabs.prototype, "hideScrollBar", void 0);
|
|
149
|
-
__decorate([
|
|
150
|
-
property({ type: Boolean, reflect: true })
|
|
151
|
-
], IxTabs.prototype, "inline", void 0);
|
|
152
|
-
__decorate([
|
|
153
|
-
property({ type: Boolean, attribute: 'left-align' })
|
|
154
|
-
], IxTabs.prototype, "alignLeft", void 0);
|
|
155
|
-
__decorate([
|
|
156
|
-
property({ type: Boolean })
|
|
157
|
-
], IxTabs.prototype, "enableLeftScroll", void 0);
|
|
158
|
-
__decorate([
|
|
159
|
-
property({ type: Boolean })
|
|
160
|
-
], IxTabs.prototype, "enableRightScroll", void 0);
|
|
136
|
+
`;
|
|
137
|
+
__decorate([
|
|
138
|
+
query('md-Tabs')
|
|
139
|
+
], IxTabs.prototype, "mdTabs", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
query('ix-primary-tab[active]')
|
|
142
|
+
], IxTabs.prototype, "activeTab", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
property({ type: Boolean })
|
|
145
|
+
], IxTabs.prototype, "scrollButtons", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
property({ type: Boolean })
|
|
148
|
+
], IxTabs.prototype, "hideScrollBar", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
property({ type: Boolean, reflect: true })
|
|
151
|
+
], IxTabs.prototype, "inline", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
property({ type: Boolean, attribute: 'left-align' })
|
|
154
|
+
], IxTabs.prototype, "alignLeft", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
property({ type: Boolean })
|
|
157
|
+
], IxTabs.prototype, "enableLeftScroll", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
property({ type: Boolean })
|
|
160
|
+
], IxTabs.prototype, "enableRightScroll", void 0);
|
|
161
161
|
//# sourceMappingURL=IxTabs.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { IxTabs } from './IxTabs.js';
|
|
2
|
-
export { IxPrimaryTab } from './IxPrimaryTab.js';
|
|
1
|
+
export { IxTabs } from './IxTabs.js';
|
|
2
|
+
export { IxPrimaryTab } from './IxPrimaryTab.js';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { IxTabs } from './IxTabs.js';
|
|
2
|
-
export { IxPrimaryTab } from './IxPrimaryTab.js';
|
|
1
|
+
export { IxTabs } from './IxTabs.js';
|
|
2
|
+
export { IxPrimaryTab } from './IxPrimaryTab.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/ix-primary-tab.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/dist/ix-primary-tab.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IxPrimaryTab } from './IxPrimaryTab.js';
|
|
2
|
-
window.customElements.define('ix-primary-tab', IxPrimaryTab);
|
|
1
|
+
import { IxPrimaryTab } from './IxPrimaryTab.js';
|
|
2
|
+
window.customElements.define('ix-primary-tab', IxPrimaryTab);
|
|
3
3
|
//# sourceMappingURL=ix-primary-tab.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/dist/ix-secondary-tab.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IxSecondaryTab } from './IxSecondaryTab.js';
|
|
2
|
-
window.customElements.define('ix-secondary-tab', IxSecondaryTab);
|
|
1
|
+
import { IxSecondaryTab } from './IxSecondaryTab.js';
|
|
2
|
+
window.customElements.define('ix-secondary-tab', IxSecondaryTab);
|
|
3
3
|
//# sourceMappingURL=ix-secondary-tab.js.map
|
package/dist/ix-tabs.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/dist/ix-tabs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IxTabs } from './IxTabs.js';
|
|
2
|
-
window.customElements.define('ix-tabs', IxTabs);
|
|
1
|
+
import { IxTabs } from './IxTabs.js';
|
|
2
|
+
window.customElements.define('ix-tabs', IxTabs);
|
|
3
3
|
//# sourceMappingURL=ix-tabs.js.map
|
package/dist/ix-tabs.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{LitElement,isServer,html,nothing,css}from"lit";import{property,query,state,queryAssignedNodes,queryAssignedElements,customElement}from"lit/decorators.js";import{styles}from"@material/web/tabs/internal/tabs-styles.css.js";import"@material/web/divider/divider.js";import"@material/web/elevation/elevation.js";import"@material/web/focus/md-focus-ring.js";import"@material/web/ripple/ripple.js";import{classMap}from"lit/directives/class-map.js";import{EASING}from"@material/web/internal/motion/animation.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";var _a;
|
|
1
|
+
import{__decorate}from"tslib";import{LitElement,isServer,html,nothing,css}from"lit";import{property,query,state,queryAssignedNodes,queryAssignedElements,customElement}from"lit/decorators.js";import{styles}from"@material/web/tabs/internal/tabs-styles.css.js";import"@material/web/divider/divider.js";import"@material/web/elevation/elevation.js";import"@material/web/focus/md-focus-ring.js";import"@material/web/ripple/ripple.js";import{classMap}from"lit/directives/class-map.js";import{EASING}from"@material/web/internal/motion/animation.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";var _a;let INDICATOR=Symbol("indicator"),ANIMATE_INDICATOR=Symbol("animateIndicator");function shouldReduceMotion(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}class Tab extends LitElement{get selected(){return this.active}set selected(t){this.active=t}constructor(){super(),this.isTab=!0,this.active=!1,this.hasIcon=!1,this.iconOnly=!1,this.fullWidthIndicator=!0,this.internals=this.attachInternals(),isServer||(this.internals.role="tab",this.addEventListener("keydown",this.handleKeydown.bind(this)))}render(){var t=html`<div class="indicator"></div>`;return html`<div class="button" role="presentation" @click="${this.handleContentClick}"><md-focus-ring part="focus-ring" inward .control="${this}"></md-focus-ring><md-elevation></md-elevation><md-ripple .control="${this}"></md-ripple><div class="content ${classMap(this.getContentClasses())}" role="presentation"><slot name="icon" @slotchange="${this.handleIconSlotChange}"></slot><slot @slotchange="${this.handleSlotChange}"></slot>${this.fullWidthIndicator?nothing:t}</div>${this.fullWidthIndicator?t:nothing}</div>`}getContentClasses(){return{"has-icon":this.hasIcon,"has-label":!this.iconOnly}}updated(){this.internals.ariaSelected=String(this.active)}async handleKeydown(t){await 0,t.defaultPrevented||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.click())}handleContentClick(t){t.stopPropagation(),this.click()}[(_a=INDICATOR,ANIMATE_INDICATOR)](t){this[INDICATOR]&&(this[INDICATOR].getAnimations().forEach(t=>{t.cancel()}),t=null==(t=null==t?void 0:t.shadowRoot)?void 0:t.querySelector("*"),null!==(t=this.getKeyframes(t)))&&this[INDICATOR].animate(t,{duration:250,easing:EASING.EMPHASIZED})}getKeyframes(t){var e,i,a,o,s=shouldReduceMotion();return this.active?(e={},i=(t=null!=(t=null==(t=t[INDICATOR])?void 0:t.getBoundingClientRect())?t:{}).left,t=t.width,o=(a=this[INDICATOR].getBoundingClientRect()).left,t=t/a.width,!s&&void 0!==i&&void 0!==o&&Number(t)?e.transform=`translateX(${(i-o).toFixed(4)}px) scaleX(${t.toFixed(4)})`:e.opacity=0,[e,{transform:"none"}]):s?[{opacity:1},{transform:"none"}]:null}handleSlotChange(){this.iconOnly=!1;for(var t of this.assignedDefaultNodes){var e=t.nodeType===Node.TEXT_NODE&&!!t.wholeText.match(/\S/);if(t.nodeType===Node.ELEMENT_NODE||e)return}this.iconOnly=!0}handleIconSlotChange(){this.hasIcon=0<this.assignedIcons.length}}function isTab(t){return t instanceof HTMLElement&&("IX-PRIMARY-TAB"===t.tagName||"IX-SECONDARY-TAB"===t.tagName)}__decorate([property({type:Boolean,reflect:!0,attribute:"md-tab"})],Tab.prototype,"isTab",void 0),__decorate([property({type:Boolean,reflect:!0})],Tab.prototype,"active",void 0),__decorate([property({type:Boolean})],Tab.prototype,"selected",null),__decorate([property({type:Boolean,attribute:"has-icon"})],Tab.prototype,"hasIcon",void 0),__decorate([property({type:Boolean,attribute:"icon-only"})],Tab.prototype,"iconOnly",void 0),__decorate([query(".indicator")],Tab.prototype,_a,void 0),__decorate([state()],Tab.prototype,"fullWidthIndicator",void 0),__decorate([queryAssignedNodes({flatten:!0})],Tab.prototype,"assignedDefaultNodes",void 0),__decorate([queryAssignedElements({slot:"icon",flatten:!0})],Tab.prototype,"assignedIcons",void 0);class Tabs extends LitElement{get activeTab(){var t;return null!=(t=this.tabs.find(t=>t.active))?t:null}set activeTab(t){t&&this.activateTab(t)}get activeTabIndex(){return this.tabs.findIndex(t=>t.active)}set activeTabIndex(e){var t=()=>{var t=this.tabs[e];t&&this.activateTab(t)};this.slotElement?t():this.updateComplete.then(t)}get focusedTab(){return this.tabs.find(t=>t.matches(":focus-within"))}constructor(){super(),this.autoActivate=!1,this.internals=this.attachInternals(),isServer||(this.internals.role="tablist",this.addEventListener("keydown",this.handleKeydown.bind(this)),this.addEventListener("keyup",this.handleKeyup.bind(this)),this.addEventListener("focusout",this.handleFocusout.bind(this)))}async scrollToTab(t){await this.updateComplete;var e=this.tabs;if((t=null!=t?t:this.activeTab)&&e.includes(t)){for(var i of this.tabs)await i.updateComplete;var e=t.offsetLeft,t=t.offsetWidth,a=this.scrollLeft,o=this.offsetWidth,e=Math.min(e-48,Math.max(e+t-o+48,a)),t=this.focusedTab?"instant":"smooth";this.scrollTo({behavior:t,top:0,left:e})}}render(){return html`<div class="tabs"><slot @slotchange="${this.handleSlotChange}" @click="${this.handleTabClick}" @keydown="${this.handleTabClick}"></slot></div><md-divider part="divider"></md-divider>`}async handleTabClick(t){var e=t.target;await 0,t.defaultPrevented||!isTab(e)||e.active||this.activateTab(e)}activateTab(t){var e=this.tabs,i=this.activeTab;if(e.includes(t)&&i!==t){for(var a of e){a.active=a===t;var o=null==(o=a.shadowRoot)?void 0:o.querySelector("*");o&&(o.active=a.active)}if(i){if(!this.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0}))){for(var s of e)s.active=s===i;return}(null==(e=t.shadowRoot)?void 0:e.querySelector("*"))[ANIMATE_INDICATOR](i)}this.updateFocusableTab(t),this.scrollToTab(t)}}updateFocusableTab(t){for(var e of this.tabs)e.tabIndex=e===t?0:-1}async handleKeydown(e){await 0;var i="ArrowLeft"===e.key,a="ArrowRight"===e.key,o="Home"===e.key,s="End"===e.key;if(!e.defaultPrevented&&(i||a||o||s)){var n=this.tabs;if(!(n.length<2)){e.preventDefault();let t;o||s?t=o?0:n.length-1:(e="rtl"===getComputedStyle(this).direction?i:a,s=this.focusedTab,s?(o=this.tabs.indexOf(s),(t=e?o+1:o-1)>=n.length?t=0:t<0&&(t=n.length-1)):t=e?0:n.length-1);i=n[t];i.focus(),this.autoActivate?this.activateTab(i):this.updateFocusableTab(i)}}}handleKeyup(){var t;this.scrollToTab(null!=(t=this.focusedTab)?t:this.activeTab)}handleFocusout(){var t;this.matches(":focus-within")||(t=this.activeTab,t&&this.updateFocusableTab(t))}handleSlotChange(){var t=this.tabs[0];!this.activeTab&&t&&this.activateTab(t),this.scrollToTab(this.activeTab)}}__decorate([queryAssignedElements({flatten:!0})],Tabs.prototype,"tabs",void 0),__decorate([property({type:Boolean,attribute:"auto-activate"})],Tabs.prototype,"autoActivate",void 0),__decorate([query("slot")],Tabs.prototype,"slotElement",void 0);let MdTabs=class extends Tabs{};MdTabs.styles=[styles,css`.tabs.no-scrollbar::-webkit-scrollbar{display:none}`],MdTabs=__decorate([customElement("md-tabs")],MdTabs);class IxTabs extends LitElement{constructor(){super(...arguments),this.scrollButtons=!1,this.hideScrollBar=!1,this.inline=!1,this.alignLeft=!1,this.enableLeftScroll=!0,this.enableRightScroll=!0,this.tabContainer=null,this.updateScrollButtonState=()=>{clearTimeout(this.debounceEvent),this.debounceEvent=setTimeout(this.calculateScrollButtonsEnabled.bind(this),100)}}get activeTabIndex(){return this.mdTabs.activeTabIndex}set activeTabIndex(t){this.mdTabs.activeTabIndex=t}calculateScrollButtonsEnabled(){var t,e,i;this.tabContainer&&({clientWidth:i,scrollWidth:t,scrollLeft:e}=this.tabContainer,this.enableLeftScroll=0!==e,this.enableRightScroll=e!==t-i,this.alignLeft)&&(i=null==(e=this.parentElement)?void 0:e.clientWidth,this.inline=!(i&&i<t))}async slotChange(){var t,e;await 0,null!=(t=this.querySelector("ix-primary-tab[active]"))&&t.scrollIntoView(),this.tabContainer=null==(t=this.mdTabs.shadowRoot)?void 0:t.querySelector(".tabs"),this.tabContainer&&(this.scrollButtons&&(this.hideScrollBar&&this.tabContainer.classList.add("no-scrollbar"),this.calculateScrollButtonsEnabled(),window.addEventListener("resize",this.updateScrollButtonState),this.tabContainer.addEventListener("scroll",this.updateScrollButtonState)),{clientWidth:t,scrollWidth:e}=this.tabContainer,this.alignLeft)&&e<=t&&(this.inline=!0)}disconnectedCallback(){var t;super.disconnectedCallback(),this.scrollButtons&&(window.removeEventListener("resize",this.updateScrollButtonState),null!=(t=this.tabContainer))&&t.removeEventListener("scroll",this.updateScrollButtonState)}scrollTabs(t="left",e=.75){var i,a;this.tabContainer&&({clientWidth:i,scrollLeft:a}=this.tabContainer,this.tabContainer.scrollTo({top:0,left:a+("left"===t?i*-e:i*e),behavior:"smooth"}))}render(){return html`${this.scrollButtons?html`<ix-icon-button icon="chevron_left" @click="${()=>this.scrollTabs("left")}" ?disabled="${!this.enableLeftScroll}"></ix-icon-button>`:nothing}<md-tabs><slot @slotchange="${this.slotChange}"></slot></md-tabs>${this.scrollButtons?html`<ix-icon-button icon="chevron_right" @click="${()=>this.scrollTabs("right")}" ?disabled="${!this.enableRightScroll}"></ix-icon-button>`:nothing}`}}IxTabs.styles=css`:host{display:flex;align-items:center;justify-content:center;overflow:hidden}:host(ix-tabs[inline]){display:inline-flex}:host(ix-tabs[inline]) ix-icon-button[disabled]{display:none}md-tabs{flex-grow:1;--md-primary-tab-container-color:transparent}ix-icon-button{--md-icon-button-hover-state-layer-opacity:0;--md-icon-button-pressed-state-layer-opacity:0;--md-icon-button-icon-color:var(--md-sys-text-color-secondary);--md-icon-button-pressed-state-layer-color:var(
|
|
2
2
|
--md-sys-text-color-secondary
|
|
3
3
|
)}.scroll{cursor:pointer}`,__decorate([query("md-Tabs")],IxTabs.prototype,"mdTabs",void 0),__decorate([query("ix-primary-tab[active]")],IxTabs.prototype,"activeTab",void 0),__decorate([property({type:Boolean})],IxTabs.prototype,"scrollButtons",void 0),__decorate([property({type:Boolean})],IxTabs.prototype,"hideScrollBar",void 0),__decorate([property({type:Boolean,reflect:!0})],IxTabs.prototype,"inline",void 0),__decorate([property({type:Boolean,attribute:"left-align"})],IxTabs.prototype,"alignLeft",void 0),__decorate([property({type:Boolean})],IxTabs.prototype,"enableLeftScroll",void 0),__decorate([property({type:Boolean})],IxTabs.prototype,"enableRightScroll",void 0),window.customElements.define("ix-tabs",IxTabs);
|
|
@@ -1,20 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,30 +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);
|
|
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
30
|
//# sourceMappingURL=primary-tab.js.map
|