@fluid-topics/ft-tabs 1.1.80 → 1.1.82
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/build/ft-base-tabs.d.ts +4 -10
- package/build/ft-base-tabs.js +15 -59
- package/build/ft-tabs.d.ts +17 -2
- package/build/ft-tabs.js +82 -0
- package/build/ft-tabs.light.js +183 -165
- package/build/ft-tabs.min.js +232 -214
- package/build/ftds-tabs.d.ts +10 -4
- package/build/ftds-tabs.js +13 -8
- package/build/ftds-tabs.styles.d.ts +1 -11
- package/build/ftds-tabs.styles.js +71 -64
- package/package.json +7 -7
package/build/ft-base-tabs.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PropertyValues, TemplateResult } from "lit";
|
|
2
2
|
import { ElementDefinitionsMap, FtLitElement, Optional } from "@fluid-topics/ft-wc-utils";
|
|
3
|
+
import { FtTab } from "./ft-tab";
|
|
3
4
|
import { ClassInfo } from "lit/directives/class-map";
|
|
4
5
|
export declare enum FtTabsAlignment {
|
|
5
6
|
left = "left",
|
|
@@ -9,10 +10,6 @@ export declare enum FtTabsAlignment {
|
|
|
9
10
|
justify = "justify"
|
|
10
11
|
}
|
|
11
12
|
export interface FtBaseTabsProperties {
|
|
12
|
-
dense: boolean;
|
|
13
|
-
collapsible: boolean;
|
|
14
|
-
horizontal: boolean;
|
|
15
|
-
contentBefore: boolean;
|
|
16
13
|
activeIndex?: number;
|
|
17
14
|
alignTabs: FtTabsAlignment;
|
|
18
15
|
}
|
|
@@ -21,10 +18,6 @@ export declare class IndexChangeEvent extends CustomEvent<Optional<number>> {
|
|
|
21
18
|
}
|
|
22
19
|
export declare abstract class FtBaseTabs extends FtLitElement implements FtBaseTabsProperties {
|
|
23
20
|
static elementDefinitions: ElementDefinitionsMap;
|
|
24
|
-
dense: boolean;
|
|
25
|
-
collapsible: boolean;
|
|
26
|
-
horizontal: boolean;
|
|
27
|
-
contentBefore: boolean;
|
|
28
21
|
alignTabs: FtTabsAlignment;
|
|
29
22
|
private ftTabs;
|
|
30
23
|
private tabsContainer?;
|
|
@@ -40,7 +33,8 @@ export declare abstract class FtBaseTabs extends FtLitElement implements FtBaseT
|
|
|
40
33
|
private resizeObserver;
|
|
41
34
|
protected contentAvailableCallback(props: PropertyValues): void;
|
|
42
35
|
private placeIndicator;
|
|
43
|
-
|
|
36
|
+
protected placeActiveTabIndicator(activeTabIndicator?: HTMLDivElement, activeTab?: HTMLButtonElement): void;
|
|
37
|
+
protected toggleTab(index: number): void;
|
|
44
38
|
private updateTabs;
|
|
45
|
-
|
|
39
|
+
protected addTooltipIfNecessary(tab: FtTab, button: TemplateResult): TemplateResult;
|
|
46
40
|
}
|
package/build/ft-base-tabs.js
CHANGED
|
@@ -30,10 +30,6 @@ export class IndexChangeEvent extends CustomEvent {
|
|
|
30
30
|
class FtBaseTabs extends FtLitElement {
|
|
31
31
|
constructor() {
|
|
32
32
|
super(...arguments);
|
|
33
|
-
this.dense = false;
|
|
34
|
-
this.collapsible = false;
|
|
35
|
-
this.horizontal = false;
|
|
36
|
-
this.contentBefore = false;
|
|
37
33
|
this.alignTabs = FtTabsAlignment.justify;
|
|
38
34
|
this.ftTabs = [];
|
|
39
35
|
this.activeIndex = 0;
|
|
@@ -123,43 +119,28 @@ class FtBaseTabs extends FtLitElement {
|
|
|
123
119
|
this.placeIndicator();
|
|
124
120
|
}
|
|
125
121
|
placeIndicator() {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
122
|
+
this.placeActiveTabIndicator(this.activeTabIndicator, this.activeTab);
|
|
123
|
+
}
|
|
124
|
+
placeActiveTabIndicator(activeTabIndicator, activeTab) {
|
|
125
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
126
|
+
if (activeTabIndicator) {
|
|
127
|
+
const target = (_a = activeTab === null || activeTab === void 0 ? void 0 : activeTab.closest(".ft-tabs--tab-tooltip")) !== null && _a !== void 0 ? _a : activeTab;
|
|
129
128
|
if (target) {
|
|
130
|
-
const targetHeight = (
|
|
131
|
-
const targetWidth = (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (this.contentBefore) {
|
|
137
|
-
this.activeTabIndicator.style.left = ((_h = target === null || target === void 0 ? void 0 : target.offsetLeft) !== null && _h !== void 0 ? _h : 0) + "px";
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
this.activeTabIndicator.style.left = (((_j = target === null || target === void 0 ? void 0 : target.offsetLeft) !== null && _j !== void 0 ? _j : 0) + targetWidth - 3) + "px";
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
this.activeTabIndicator.style.height = "3px";
|
|
145
|
-
this.activeTabIndicator.style.width = targetWidth + "px";
|
|
146
|
-
this.activeTabIndicator.style.left = ((_k = target === null || target === void 0 ? void 0 : target.offsetLeft) !== null && _k !== void 0 ? _k : 0) + "px";
|
|
147
|
-
if (this.contentBefore) {
|
|
148
|
-
this.activeTabIndicator.style.top = ((_l = target === null || target === void 0 ? void 0 : target.offsetTop) !== null && _l !== void 0 ? _l : 0) + "px";
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
this.activeTabIndicator.style.top = (((_m = target === null || target === void 0 ? void 0 : target.offsetTop) !== null && _m !== void 0 ? _m : 0) + targetHeight - 3) + "px";
|
|
152
|
-
}
|
|
153
|
-
}
|
|
129
|
+
const targetHeight = (_c = (_b = target === null || target === void 0 ? void 0 : target.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 0;
|
|
130
|
+
const targetWidth = (_e = (_d = target === null || target === void 0 ? void 0 : target.getBoundingClientRect()) === null || _d === void 0 ? void 0 : _d.width) !== null && _e !== void 0 ? _e : 0;
|
|
131
|
+
activeTabIndicator.style.height = "3px";
|
|
132
|
+
activeTabIndicator.style.width = targetWidth + "px";
|
|
133
|
+
activeTabIndicator.style.left = ((_f = target === null || target === void 0 ? void 0 : target.offsetLeft) !== null && _f !== void 0 ? _f : 0) + "px";
|
|
134
|
+
activeTabIndicator.style.top = (((_g = target === null || target === void 0 ? void 0 : target.offsetTop) !== null && _g !== void 0 ? _g : 0) + targetHeight - 3) + "px";
|
|
154
135
|
}
|
|
155
136
|
else {
|
|
156
|
-
|
|
157
|
-
|
|
137
|
+
activeTabIndicator.style.height = "0px";
|
|
138
|
+
activeTabIndicator.style.width = "0px";
|
|
158
139
|
}
|
|
159
140
|
}
|
|
160
141
|
}
|
|
161
142
|
toggleTab(index) {
|
|
162
|
-
this.activeIndex =
|
|
143
|
+
this.activeIndex = index;
|
|
163
144
|
}
|
|
164
145
|
updateTabs() {
|
|
165
146
|
this.ftTabs.forEach((tab, index) => {
|
|
@@ -167,19 +148,6 @@ class FtBaseTabs extends FtLitElement {
|
|
|
167
148
|
});
|
|
168
149
|
}
|
|
169
150
|
addTooltipIfNecessary(tab, button) {
|
|
170
|
-
if (tab.label && tab.icon && (this.dense || this.horizontal)) {
|
|
171
|
-
let tooltipPosition = this.horizontal
|
|
172
|
-
? this.contentBefore ? "left" : "right"
|
|
173
|
-
: this.contentBefore ? "top" : "bottom";
|
|
174
|
-
return html `
|
|
175
|
-
<ft-tooltip class="ft-tabs--tab-tooltip"
|
|
176
|
-
part="tab-tooltip"
|
|
177
|
-
text="${tab.label}"
|
|
178
|
-
position="${tooltipPosition}">
|
|
179
|
-
${button}
|
|
180
|
-
</ft-tooltip>
|
|
181
|
-
`;
|
|
182
|
-
}
|
|
183
151
|
return button;
|
|
184
152
|
}
|
|
185
153
|
}
|
|
@@ -190,18 +158,6 @@ FtBaseTabs.elementDefinitions = {
|
|
|
190
158
|
"ft-typography": FtTypography,
|
|
191
159
|
"ft-icon": FtIcon,
|
|
192
160
|
};
|
|
193
|
-
__decorate([
|
|
194
|
-
property({ type: Boolean })
|
|
195
|
-
], FtBaseTabs.prototype, "dense", void 0);
|
|
196
|
-
__decorate([
|
|
197
|
-
property({ type: Boolean })
|
|
198
|
-
], FtBaseTabs.prototype, "collapsible", void 0);
|
|
199
|
-
__decorate([
|
|
200
|
-
property({ type: Boolean })
|
|
201
|
-
], FtBaseTabs.prototype, "horizontal", void 0);
|
|
202
|
-
__decorate([
|
|
203
|
-
property({ type: Boolean })
|
|
204
|
-
], FtBaseTabs.prototype, "contentBefore", void 0);
|
|
205
161
|
__decorate([
|
|
206
162
|
property()
|
|
207
163
|
], FtBaseTabs.prototype, "alignTabs", void 0);
|
package/build/ft-tabs.d.ts
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { ClassInfo } from "lit/directives/class-map";
|
|
2
|
-
import { FtBaseTabs } from "./ft-base-tabs";
|
|
3
|
-
|
|
2
|
+
import { FtBaseTabs, FtBaseTabsProperties } from "./ft-base-tabs";
|
|
3
|
+
import { FtTab } from "./ft-tab";
|
|
4
|
+
import { TemplateResult } from "lit";
|
|
5
|
+
export interface FtTabsProperties extends FtBaseTabsProperties {
|
|
6
|
+
dense: boolean;
|
|
7
|
+
collapsible: boolean;
|
|
8
|
+
horizontal: boolean;
|
|
9
|
+
contentBefore: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class FtTabs extends FtBaseTabs implements FtTabsProperties {
|
|
12
|
+
dense: boolean;
|
|
13
|
+
collapsible: boolean;
|
|
14
|
+
horizontal: boolean;
|
|
15
|
+
contentBefore: boolean;
|
|
4
16
|
static styles: import("lit").CSSResult[];
|
|
5
17
|
get tabsClasses(): ClassInfo;
|
|
18
|
+
protected placeActiveTabIndicator(activeTabIndicator?: HTMLDivElement, activeTab?: HTMLButtonElement): void;
|
|
19
|
+
protected toggleTab(index: number): void;
|
|
20
|
+
protected addTooltipIfNecessary(tab: FtTab, button: TemplateResult): TemplateResult;
|
|
6
21
|
}
|
package/build/ft-tabs.js
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
1
7
|
import { FtBaseTabs } from "./ft-base-tabs";
|
|
2
8
|
import { safariEllipsisFix } from "@fluid-topics/ft-wc-utils";
|
|
3
9
|
import { styles } from "./ft-tabs.styles";
|
|
10
|
+
import { property } from "lit/decorators.js";
|
|
11
|
+
import { html } from "lit";
|
|
4
12
|
class FtTabs extends FtBaseTabs {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.dense = false;
|
|
16
|
+
this.collapsible = false;
|
|
17
|
+
this.horizontal = false;
|
|
18
|
+
this.contentBefore = false;
|
|
19
|
+
}
|
|
5
20
|
get tabsClasses() {
|
|
6
21
|
return {
|
|
7
22
|
"ft-tabs": true,
|
|
@@ -12,9 +27,76 @@ class FtTabs extends FtBaseTabs {
|
|
|
12
27
|
["ft-tabs--align-" + this.alignTabs]: true
|
|
13
28
|
};
|
|
14
29
|
}
|
|
30
|
+
placeActiveTabIndicator(activeTabIndicator, activeTab) {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
32
|
+
if (activeTabIndicator) {
|
|
33
|
+
const target = (_a = activeTab === null || activeTab === void 0 ? void 0 : activeTab.closest(".ft-tabs--tab-tooltip")) !== null && _a !== void 0 ? _a : activeTab;
|
|
34
|
+
if (target) {
|
|
35
|
+
const targetHeight = (_c = (_b = target === null || target === void 0 ? void 0 : target.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 0;
|
|
36
|
+
const targetWidth = (_e = (_d = target === null || target === void 0 ? void 0 : target.getBoundingClientRect()) === null || _d === void 0 ? void 0 : _d.width) !== null && _e !== void 0 ? _e : 0;
|
|
37
|
+
if (this.horizontal) {
|
|
38
|
+
activeTabIndicator.style.height = targetHeight + "px";
|
|
39
|
+
activeTabIndicator.style.width = "3px";
|
|
40
|
+
activeTabIndicator.style.top = ((_f = target === null || target === void 0 ? void 0 : target.offsetTop) !== null && _f !== void 0 ? _f : 0) + "px";
|
|
41
|
+
if (this.contentBefore) {
|
|
42
|
+
activeTabIndicator.style.left = ((_g = target === null || target === void 0 ? void 0 : target.offsetLeft) !== null && _g !== void 0 ? _g : 0) + "px";
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
activeTabIndicator.style.left = (((_h = target === null || target === void 0 ? void 0 : target.offsetLeft) !== null && _h !== void 0 ? _h : 0) + targetWidth - 3) + "px";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
activeTabIndicator.style.height = "3px";
|
|
50
|
+
activeTabIndicator.style.width = targetWidth + "px";
|
|
51
|
+
activeTabIndicator.style.left = ((_j = target === null || target === void 0 ? void 0 : target.offsetLeft) !== null && _j !== void 0 ? _j : 0) + "px";
|
|
52
|
+
if (this.contentBefore) {
|
|
53
|
+
activeTabIndicator.style.top = ((_k = target === null || target === void 0 ? void 0 : target.offsetTop) !== null && _k !== void 0 ? _k : 0) + "px";
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
activeTabIndicator.style.top = (((_l = target === null || target === void 0 ? void 0 : target.offsetTop) !== null && _l !== void 0 ? _l : 0) + targetHeight - 3) + "px";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
activeTabIndicator.style.height = "0px";
|
|
62
|
+
activeTabIndicator.style.width = "0px";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
toggleTab(index) {
|
|
67
|
+
this.activeIndex = this.collapsible && index === this.activeIndex ? undefined : index;
|
|
68
|
+
}
|
|
69
|
+
addTooltipIfNecessary(tab, button) {
|
|
70
|
+
if (tab.label && tab.icon && (this.dense || this.horizontal)) {
|
|
71
|
+
let tooltipPosition = this.horizontal
|
|
72
|
+
? this.contentBefore ? "left" : "right"
|
|
73
|
+
: this.contentBefore ? "top" : "bottom";
|
|
74
|
+
return html `
|
|
75
|
+
<ft-tooltip class="ft-tabs--tab-tooltip"
|
|
76
|
+
part="tab-tooltip"
|
|
77
|
+
text="${tab.label}"
|
|
78
|
+
position="${tooltipPosition}">
|
|
79
|
+
${button}
|
|
80
|
+
</ft-tooltip>
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
return button;
|
|
84
|
+
}
|
|
15
85
|
}
|
|
16
86
|
FtTabs.styles = [
|
|
17
87
|
safariEllipsisFix,
|
|
18
88
|
styles
|
|
19
89
|
];
|
|
90
|
+
__decorate([
|
|
91
|
+
property({ type: Boolean })
|
|
92
|
+
], FtTabs.prototype, "dense", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
property({ type: Boolean })
|
|
95
|
+
], FtTabs.prototype, "collapsible", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
property({ type: Boolean })
|
|
98
|
+
], FtTabs.prototype, "horizontal", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
property({ type: Boolean })
|
|
101
|
+
], FtTabs.prototype, "contentBefore", void 0);
|
|
20
102
|
export { FtTabs };
|