@fluid-topics/ft-tabs 2.0.38 → 2.1.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/build/definitions.d.ts +0 -2
- package/build/definitions.js +0 -2
- package/build/ft-tabs.d.ts +26 -14
- package/build/ft-tabs.js +140 -12
- package/build/ft-tabs.light.js +182 -958
- package/build/ft-tabs.min.js +194 -969
- package/build/ft-tabs.properties.d.ts +15 -0
- package/build/ft-tabs.properties.js +8 -0
- package/build/ft-tabs.styles.d.ts +8 -8
- package/build/ft-tabs.styles.js +2 -2
- package/build/index.d.ts +1 -3
- package/build/index.js +1 -3
- package/package.json +7 -7
- package/build/ft-base-tabs.d.ts +0 -42
- package/build/ft-base-tabs.js +0 -191
- package/build/ftds-tabs.d.ts +0 -19
- package/build/ftds-tabs.js +0 -48
- package/build/ftds-tabs.styles.d.ts +0 -2
- package/build/ftds-tabs.styles.js +0 -182
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum FtTabsAlignment {
|
|
2
|
+
left = "left",
|
|
3
|
+
right = "right",
|
|
4
|
+
start = "start",
|
|
5
|
+
end = "end",
|
|
6
|
+
justify = "justify"
|
|
7
|
+
}
|
|
8
|
+
export interface FtTabsProperties {
|
|
9
|
+
activeIndex?: number;
|
|
10
|
+
alignTabs: FtTabsAlignment;
|
|
11
|
+
horizontal?: boolean;
|
|
12
|
+
dense: boolean;
|
|
13
|
+
collapsible: boolean;
|
|
14
|
+
contentBefore: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export var FtTabsAlignment;
|
|
2
|
+
(function (FtTabsAlignment) {
|
|
3
|
+
FtTabsAlignment["left"] = "left";
|
|
4
|
+
FtTabsAlignment["right"] = "right";
|
|
5
|
+
FtTabsAlignment["start"] = "start";
|
|
6
|
+
FtTabsAlignment["end"] = "end";
|
|
7
|
+
FtTabsAlignment["justify"] = "justify";
|
|
8
|
+
})(FtTabsAlignment || (FtTabsAlignment = {}));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare const FtTabsCssVariables: {
|
|
2
|
-
horizontalButtonsWidth: import("@fluid-topics/
|
|
3
|
-
horizontalDenseButtonsWidth: import("@fluid-topics/
|
|
4
|
-
widthWhenHorizontalAndOpen: import("@fluid-topics/
|
|
5
|
-
colorSurface: import("@fluid-topics/
|
|
6
|
-
colorPrimary: import("@fluid-topics/
|
|
7
|
-
colorOnSurfaceMedium: import("@fluid-topics/
|
|
8
|
-
colorOnSurfaceDisabled: import("@fluid-topics/
|
|
2
|
+
horizontalButtonsWidth: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
3
|
+
horizontalDenseButtonsWidth: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
4
|
+
widthWhenHorizontalAndOpen: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
5
|
+
colorSurface: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
6
|
+
colorPrimary: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
7
|
+
colorOnSurfaceMedium: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
8
|
+
colorOnSurfaceDisabled: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
9
9
|
};
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const tabsStyles: import("lit").CSSResult;
|
package/build/ft-tabs.styles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
|
-
import { designSystemVariables, FtCssVariableFactory } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
import { designSystemVariables, FtCssVariableFactory, } from "@fluid-topics/ft-wc-utils";
|
|
3
3
|
export const FtTabsCssVariables = {
|
|
4
4
|
horizontalButtonsWidth: FtCssVariableFactory.create("--ft-tabs-horizontal-buttons-width", "Width of the tab buttons (N/A for vertical justified tabs)", "SIZE", "100px"),
|
|
5
5
|
horizontalDenseButtonsWidth: FtCssVariableFactory.create("--ft-tabs-horizontal-dense-buttons-width", "Width of the tab buttons when dense (N/A for vertical justified tabs)", "SIZE", "56px"),
|
|
@@ -10,7 +10,7 @@ export const FtTabsCssVariables = {
|
|
|
10
10
|
colorOnSurfaceDisabled: FtCssVariableFactory.external(designSystemVariables.colorOnSurfaceDisabled, "Design system"),
|
|
11
11
|
};
|
|
12
12
|
// language=CSS
|
|
13
|
-
export const
|
|
13
|
+
export const tabsStyles = css `
|
|
14
14
|
.ft-tabs {
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-direction: column;
|
package/build/index.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ export * from "./ft-tab.styles";
|
|
|
2
2
|
export * from "./ft-tab.properties";
|
|
3
3
|
export * from "./ft-tab";
|
|
4
4
|
export * from "./ft-tabs.styles";
|
|
5
|
+
export * from "./ft-tabs.properties";
|
|
5
6
|
export * from "./ft-tabs";
|
|
6
|
-
export * from "./ft-base-tabs";
|
|
7
|
-
export * from "./ftds-tabs.styles";
|
|
8
|
-
export * from "./ftds-tabs";
|
|
9
7
|
import "./define";
|
package/build/index.js
CHANGED
|
@@ -2,8 +2,6 @@ export * from "./ft-tab.styles";
|
|
|
2
2
|
export * from "./ft-tab.properties";
|
|
3
3
|
export * from "./ft-tab";
|
|
4
4
|
export * from "./ft-tabs.styles";
|
|
5
|
+
export * from "./ft-tabs.properties";
|
|
5
6
|
export * from "./ft-tabs";
|
|
6
|
-
export * from "./ft-base-tabs";
|
|
7
|
-
export * from "./ftds-tabs.styles";
|
|
8
|
-
export * from "./ftds-tabs";
|
|
9
7
|
import "./define";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-tabs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Generic tabs component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-icon": "2.
|
|
23
|
-
"@fluid-topics/ft-ripple": "2.
|
|
24
|
-
"@fluid-topics/ft-tooltip": "2.
|
|
25
|
-
"@fluid-topics/ft-typography": "2.
|
|
26
|
-
"@fluid-topics/ft-wc-utils": "2.
|
|
22
|
+
"@fluid-topics/ft-icon": "2.1.1",
|
|
23
|
+
"@fluid-topics/ft-ripple": "2.1.1",
|
|
24
|
+
"@fluid-topics/ft-tooltip": "2.1.1",
|
|
25
|
+
"@fluid-topics/ft-typography": "2.1.1",
|
|
26
|
+
"@fluid-topics/ft-wc-utils": "2.1.1",
|
|
27
27
|
"lit": "3.1.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "a9f1e471fb2dba9aeb8c12394a25460f675597dc"
|
|
30
30
|
}
|
package/build/ft-base-tabs.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { PropertyValues, TemplateResult } from "lit";
|
|
2
|
-
import { ClassInfo } from "lit/directives/class-map.js";
|
|
3
|
-
import { ElementDefinitionsMap, FtLitElement, Optional } from "@fluid-topics/ft-wc-utils";
|
|
4
|
-
import { FtTab } from "./ft-tab";
|
|
5
|
-
export declare enum FtTabsAlignment {
|
|
6
|
-
left = "left",
|
|
7
|
-
right = "right",
|
|
8
|
-
start = "start",
|
|
9
|
-
end = "end",
|
|
10
|
-
justify = "justify"
|
|
11
|
-
}
|
|
12
|
-
export interface FtBaseTabsProperties {
|
|
13
|
-
activeIndex?: number;
|
|
14
|
-
alignTabs: FtTabsAlignment;
|
|
15
|
-
}
|
|
16
|
-
export declare class IndexChangeEvent extends CustomEvent<Optional<number>> {
|
|
17
|
-
constructor(index: Optional<number>);
|
|
18
|
-
}
|
|
19
|
-
export declare abstract class FtBaseTabs extends FtLitElement implements FtBaseTabsProperties {
|
|
20
|
-
static elementDefinitions: ElementDefinitionsMap;
|
|
21
|
-
alignTabs: FtTabsAlignment;
|
|
22
|
-
private ftTabs;
|
|
23
|
-
private tabsContainer?;
|
|
24
|
-
private activeTab?;
|
|
25
|
-
private activeTabIndicator?;
|
|
26
|
-
horizontal: boolean;
|
|
27
|
-
activeIndex?: number;
|
|
28
|
-
abstract get tabsClasses(): ClassInfo;
|
|
29
|
-
get typographyVariant(): string;
|
|
30
|
-
protected render(): TemplateResult<1>;
|
|
31
|
-
private updateDebouncer;
|
|
32
|
-
private onTabUpdated;
|
|
33
|
-
private onContentChange;
|
|
34
|
-
protected update(props: PropertyValues): void;
|
|
35
|
-
private resizeObserver;
|
|
36
|
-
protected contentAvailableCallback(props: PropertyValues): void;
|
|
37
|
-
private placeIndicator;
|
|
38
|
-
protected placeActiveTabIndicator(activeTabIndicator?: HTMLDivElement, activeTab?: HTMLButtonElement): void;
|
|
39
|
-
protected toggleTab(index: number): void;
|
|
40
|
-
private updateTabs;
|
|
41
|
-
protected addTooltipIfNecessary(tab: FtTab, button: TemplateResult): TemplateResult;
|
|
42
|
-
}
|
package/build/ft-base-tabs.js
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
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
|
-
};
|
|
7
|
-
import { html } from "lit";
|
|
8
|
-
import { property, query, state } from "lit/decorators.js";
|
|
9
|
-
import { repeat } from "lit/directives/repeat.js";
|
|
10
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
11
|
-
import { Debouncer, FtLitElement, numberProperty, PostResizeEvent, PreResizeEvent } from "@fluid-topics/ft-wc-utils";
|
|
12
|
-
import { FtTab } from "./ft-tab";
|
|
13
|
-
import { FtRipple, FtRippleCssVariables } from "@fluid-topics/ft-ripple";
|
|
14
|
-
import { FtIcon } from "@fluid-topics/ft-icon";
|
|
15
|
-
import { FtTooltip } from "@fluid-topics/ft-tooltip";
|
|
16
|
-
export var FtTabsAlignment;
|
|
17
|
-
(function (FtTabsAlignment) {
|
|
18
|
-
FtTabsAlignment["left"] = "left";
|
|
19
|
-
FtTabsAlignment["right"] = "right";
|
|
20
|
-
FtTabsAlignment["start"] = "start";
|
|
21
|
-
FtTabsAlignment["end"] = "end";
|
|
22
|
-
FtTabsAlignment["justify"] = "justify";
|
|
23
|
-
})(FtTabsAlignment || (FtTabsAlignment = {}));
|
|
24
|
-
export class IndexChangeEvent extends CustomEvent {
|
|
25
|
-
constructor(index) {
|
|
26
|
-
super("index-change", { detail: index });
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export class FtBaseTabs extends FtLitElement {
|
|
30
|
-
constructor() {
|
|
31
|
-
super(...arguments);
|
|
32
|
-
this.alignTabs = FtTabsAlignment.justify;
|
|
33
|
-
this.ftTabs = [];
|
|
34
|
-
this.horizontal = false;
|
|
35
|
-
this.activeIndex = 0;
|
|
36
|
-
this.updateDebouncer = new Debouncer(2);
|
|
37
|
-
this.onTabUpdated = () => this.updateDebouncer.run(() => {
|
|
38
|
-
this.requestUpdate();
|
|
39
|
-
this.dispatchEvent(new PostResizeEvent());
|
|
40
|
-
});
|
|
41
|
-
this.resizeObserver = new ResizeObserver(() => this.placeIndicator());
|
|
42
|
-
}
|
|
43
|
-
get typographyVariant() {
|
|
44
|
-
return "";
|
|
45
|
-
}
|
|
46
|
-
render() {
|
|
47
|
-
var _a, _b;
|
|
48
|
-
const activeTabColor = (_b = this.ftTabs[(_a = this.activeIndex) !== null && _a !== void 0 ? _a : 0]) === null || _b === void 0 ? void 0 : _b.color;
|
|
49
|
-
return html `
|
|
50
|
-
<div class="${classMap(this.tabsClasses)}" part="container">
|
|
51
|
-
<div role="tablist" part="tablist">
|
|
52
|
-
${repeat(this.ftTabs, (tab, index) => this.addTooltipIfNecessary(tab, html `
|
|
53
|
-
<button class="${classMap({
|
|
54
|
-
"ft-tabs--tab-with-icon": !!tab.icon,
|
|
55
|
-
"ft-tabs--tab-with-label": !!tab.label,
|
|
56
|
-
})}"
|
|
57
|
-
?disabled=${tab.disabled}
|
|
58
|
-
@click=${() => this.toggleTab(index)}
|
|
59
|
-
role="tab"
|
|
60
|
-
part="tab tab-${tab.id}${tab.active ? " active-tab" : ""}"
|
|
61
|
-
id="${tab.ariaLabelledBy}"
|
|
62
|
-
aria-label="${tab.label}"
|
|
63
|
-
aria-selected="${tab.active ? "true" : "false"}"
|
|
64
|
-
tabindex="${tab.disabled ? "-1" : "0"}"
|
|
65
|
-
aria-controls="${tab.id}"
|
|
66
|
-
style="${tab.color ? `color: ${tab.color} !important;` : ""}">
|
|
67
|
-
<ft-ripple primary
|
|
68
|
-
?disabled=${tab.disabled}
|
|
69
|
-
part="tab-ripple${tab.active ? " active-tab-ripple" : ""}"
|
|
70
|
-
style="${(tab.color || tab.rippleColor)
|
|
71
|
-
? FtRippleCssVariables.color.set(tab.color || tab.rippleColor)
|
|
72
|
-
: ""}"></ft-ripple>
|
|
73
|
-
<ft-icon class="ft-tabs--tab-icon"
|
|
74
|
-
part="tab-icon${tab.active ? " active-tab-icon" : ""}"
|
|
75
|
-
.variant=${tab.iconVariant}>
|
|
76
|
-
${tab.icon}
|
|
77
|
-
</ft-icon>
|
|
78
|
-
<ft-or-ftds-typography class="ft-tabs--tab-label"
|
|
79
|
-
part="tab-label${tab.active ? " active-tab-label" : ""}"
|
|
80
|
-
variant="${this.typographyVariant}">
|
|
81
|
-
${tab.label}
|
|
82
|
-
</ft-or-ftds-typography>
|
|
83
|
-
</button>
|
|
84
|
-
`))}
|
|
85
|
-
<div class="ft-tabs--active-tab-indicator"
|
|
86
|
-
part="active-tab-indicator"
|
|
87
|
-
style="${activeTabColor ? `background-color: ${activeTabColor} !important;` : ""}">
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
<div class="ft-tabs--content" part="content">
|
|
91
|
-
<slot @slotchange=${this.onContentChange}></slot>
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
`;
|
|
95
|
-
}
|
|
96
|
-
onContentChange(e) {
|
|
97
|
-
const slot = e.composedPath()[0];
|
|
98
|
-
this.ftTabs = slot.assignedElements().map((n) => n);
|
|
99
|
-
this.ftTabs.forEach((tab) => {
|
|
100
|
-
tab.removeEventListener("updated", this.onTabUpdated);
|
|
101
|
-
tab.addEventListener("updated", this.onTabUpdated);
|
|
102
|
-
});
|
|
103
|
-
this.updateTabs();
|
|
104
|
-
}
|
|
105
|
-
update(props) {
|
|
106
|
-
super.update(props);
|
|
107
|
-
if (props.has("activeIndex")) {
|
|
108
|
-
this.dispatchEvent(new PreResizeEvent());
|
|
109
|
-
}
|
|
110
|
-
if (props.has("ftTabs") || props.has("activeIndex")) {
|
|
111
|
-
this.updateTabs();
|
|
112
|
-
}
|
|
113
|
-
if (props.has("activeIndex")) {
|
|
114
|
-
this.dispatchEvent(new IndexChangeEvent(this.activeIndex));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
contentAvailableCallback(props) {
|
|
118
|
-
super.contentAvailableCallback(props);
|
|
119
|
-
if (this.tabsContainer) {
|
|
120
|
-
this.resizeObserver.observe(this.tabsContainer);
|
|
121
|
-
}
|
|
122
|
-
this.placeIndicator();
|
|
123
|
-
}
|
|
124
|
-
placeIndicator() {
|
|
125
|
-
this.placeActiveTabIndicator(this.activeTabIndicator, this.activeTab);
|
|
126
|
-
}
|
|
127
|
-
placeActiveTabIndicator(activeTabIndicator, activeTab) {
|
|
128
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
129
|
-
if (activeTabIndicator) {
|
|
130
|
-
const target = (_a = activeTab === null || activeTab === void 0 ? void 0 : activeTab.closest(".ft-tabs--tab-tooltip")) !== null && _a !== void 0 ? _a : activeTab;
|
|
131
|
-
if (target) {
|
|
132
|
-
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;
|
|
133
|
-
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;
|
|
134
|
-
if (this.horizontal) {
|
|
135
|
-
activeTabIndicator.style.height = targetHeight + "px";
|
|
136
|
-
activeTabIndicator.style.width = "3px";
|
|
137
|
-
activeTabIndicator.style.left = ((_f = target === null || target === void 0 ? void 0 : target.offsetLeft) !== null && _f !== void 0 ? _f : 0) + targetWidth - 3 + "px";
|
|
138
|
-
activeTabIndicator.style.top = ((_g = target === null || target === void 0 ? void 0 : target.offsetTop) !== null && _g !== void 0 ? _g : 0) + "px";
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
activeTabIndicator.style.height = "3px";
|
|
142
|
-
activeTabIndicator.style.width = targetWidth + "px";
|
|
143
|
-
activeTabIndicator.style.left = ((_h = target === null || target === void 0 ? void 0 : target.offsetLeft) !== null && _h !== void 0 ? _h : 0) + "px";
|
|
144
|
-
activeTabIndicator.style.top = (((_j = target === null || target === void 0 ? void 0 : target.offsetTop) !== null && _j !== void 0 ? _j : 0) + targetHeight - 3) + "px";
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
activeTabIndicator.style.height = "0px";
|
|
149
|
-
activeTabIndicator.style.width = "0px";
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
toggleTab(index) {
|
|
154
|
-
this.activeIndex = index;
|
|
155
|
-
}
|
|
156
|
-
updateTabs() {
|
|
157
|
-
this.ftTabs.forEach((tab, index) => {
|
|
158
|
-
tab.active = index == this.activeIndex;
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
addTooltipIfNecessary(tab, button) {
|
|
162
|
-
return button;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
FtBaseTabs.elementDefinitions = {
|
|
166
|
-
"ft-tab": FtTab,
|
|
167
|
-
"ft-ripple": FtRipple,
|
|
168
|
-
"ft-tooltip": FtTooltip,
|
|
169
|
-
"ft-icon": FtIcon,
|
|
170
|
-
};
|
|
171
|
-
__decorate([
|
|
172
|
-
property()
|
|
173
|
-
], FtBaseTabs.prototype, "alignTabs", void 0);
|
|
174
|
-
__decorate([
|
|
175
|
-
state()
|
|
176
|
-
], FtBaseTabs.prototype, "ftTabs", void 0);
|
|
177
|
-
__decorate([
|
|
178
|
-
query("[role='tablist']")
|
|
179
|
-
], FtBaseTabs.prototype, "tabsContainer", void 0);
|
|
180
|
-
__decorate([
|
|
181
|
-
query("[aria-selected='true']")
|
|
182
|
-
], FtBaseTabs.prototype, "activeTab", void 0);
|
|
183
|
-
__decorate([
|
|
184
|
-
query(".ft-tabs--active-tab-indicator")
|
|
185
|
-
], FtBaseTabs.prototype, "activeTabIndicator", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
property({ type: Boolean })
|
|
188
|
-
], FtBaseTabs.prototype, "horizontal", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
numberProperty({ reflect: true })
|
|
191
|
-
], FtBaseTabs.prototype, "activeIndex", void 0);
|
package/build/ftds-tabs.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { FtBaseTabs, FtBaseTabsProperties } from "./ft-base-tabs";
|
|
2
|
-
import { ClassInfo } from "lit/directives/class-map.js";
|
|
3
|
-
import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
|
|
4
|
-
export declare enum FtDsTabsStructure {
|
|
5
|
-
topIcon = "top-icon",
|
|
6
|
-
sideIcon = "side-icon",
|
|
7
|
-
labelOnly = "label-only",
|
|
8
|
-
iconOnly = "icon-only"
|
|
9
|
-
}
|
|
10
|
-
export interface FtdsTabsProperties extends FtBaseTabsProperties {
|
|
11
|
-
structure?: FtDsTabsStructure;
|
|
12
|
-
}
|
|
13
|
-
export declare class FtdsTabs extends FtBaseTabs implements FtdsTabsProperties {
|
|
14
|
-
static elementDefinitions: ElementDefinitionsMap;
|
|
15
|
-
structure: FtDsTabsStructure;
|
|
16
|
-
static styles: import("lit").CSSResult[];
|
|
17
|
-
get tabsClasses(): ClassInfo;
|
|
18
|
-
get typographyVariant(): string;
|
|
19
|
-
}
|
package/build/ftds-tabs.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
};
|
|
7
|
-
import { FtBaseTabs } from "./ft-base-tabs";
|
|
8
|
-
import { safariEllipsisFix } from "@fluid-topics/ft-wc-utils";
|
|
9
|
-
import { designSystemStyles } from "./ftds-tabs.styles";
|
|
10
|
-
import { property } from "lit/decorators.js";
|
|
11
|
-
import { FtdsTypography, FtdsTypographyVariants } from "@fluid-topics/ft-typography";
|
|
12
|
-
export var FtDsTabsStructure;
|
|
13
|
-
(function (FtDsTabsStructure) {
|
|
14
|
-
FtDsTabsStructure["topIcon"] = "top-icon";
|
|
15
|
-
FtDsTabsStructure["sideIcon"] = "side-icon";
|
|
16
|
-
FtDsTabsStructure["labelOnly"] = "label-only";
|
|
17
|
-
FtDsTabsStructure["iconOnly"] = "icon-only";
|
|
18
|
-
})(FtDsTabsStructure || (FtDsTabsStructure = {}));
|
|
19
|
-
export class FtdsTabs extends FtBaseTabs {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.structure = FtDsTabsStructure.sideIcon;
|
|
23
|
-
}
|
|
24
|
-
get tabsClasses() {
|
|
25
|
-
return {
|
|
26
|
-
"ft-tabs": true,
|
|
27
|
-
["ft-tabs--align-" + this.alignTabs]: true,
|
|
28
|
-
"ft-tabs--horizontal": this.horizontal,
|
|
29
|
-
"ft-tabs--side-icon": this.structure == FtDsTabsStructure.sideIcon,
|
|
30
|
-
"ft-tabs--icon-only": this.structure == FtDsTabsStructure.iconOnly,
|
|
31
|
-
"ft-tabs--label-only": this.structure == FtDsTabsStructure.labelOnly,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
get typographyVariant() {
|
|
35
|
-
return FtdsTypographyVariants.body2medium;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
FtdsTabs.elementDefinitions = {
|
|
39
|
-
...FtBaseTabs.elementDefinitions,
|
|
40
|
-
"ft-or-ftds-typography": FtdsTypography,
|
|
41
|
-
};
|
|
42
|
-
FtdsTabs.styles = [
|
|
43
|
-
safariEllipsisFix,
|
|
44
|
-
designSystemStyles,
|
|
45
|
-
];
|
|
46
|
-
__decorate([
|
|
47
|
-
property()
|
|
48
|
-
], FtdsTabs.prototype, "structure", void 0);
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
import { tabs } from "@fluid-topics/design-system-variables";
|
|
3
|
-
import { setVariable } from "@fluid-topics/ft-wc-utils";
|
|
4
|
-
import { FtRippleCssVariables } from "@fluid-topics/ft-ripple/build/ft-ripple.styles";
|
|
5
|
-
export { tabs as FtdsTabsCssVariables } from "@fluid-topics/design-system-variables";
|
|
6
|
-
// language=CSS
|
|
7
|
-
export const designSystemStyles = css `
|
|
8
|
-
.ft-tabs {
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
height: 100%;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.ft-tabs.ft-tabs--horizontal {
|
|
15
|
-
flex-direction: row;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
[role="tablist"] {
|
|
19
|
-
flex-shrink: 0;
|
|
20
|
-
flex-grow: 0;
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: row;
|
|
23
|
-
position: relative;
|
|
24
|
-
flex-wrap: wrap;
|
|
25
|
-
border-bottom: ${tabs.offBorderBottomWidth} solid ${tabs.offBorderBottomColor};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.ft-tabs--horizontal [role="tablist"] {
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
border-bottom: unset;
|
|
31
|
-
border-right: ${tabs.offBorderBottomWidth} solid ${tabs.offBorderBottomColor};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.ft-tabs--align-end [role="tablist"],
|
|
35
|
-
.ft-tabs--align-right [role="tablist"] {
|
|
36
|
-
justify-content: flex-end;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.ft-tabs--align-justify [role="tablist"] {
|
|
40
|
-
justify-content: space-evenly;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
[role='tab'] {
|
|
44
|
-
position: relative;
|
|
45
|
-
display: flex;
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
flex-direction: column;
|
|
48
|
-
align-items: center;
|
|
49
|
-
justify-content: center;
|
|
50
|
-
padding: ${tabs.withLabelVerticalPadding} ${tabs.withLabelHorizontalPadding};
|
|
51
|
-
background: none;
|
|
52
|
-
box-shadow: 0px 0px 0px transparent;
|
|
53
|
-
text-shadow: 0px 0px 0px transparent;
|
|
54
|
-
cursor: pointer;
|
|
55
|
-
outline: none;
|
|
56
|
-
font-size: 16px;
|
|
57
|
-
line-height: 1;
|
|
58
|
-
color: ${tabs.offColor};
|
|
59
|
-
border-radius: ${tabs.topLeftBorderRadius} ${tabs.topRightBorderRadius} 0 0;
|
|
60
|
-
border: 0;
|
|
61
|
-
gap: ${tabs.verticalGap} ${tabs.horizontalGap};
|
|
62
|
-
z-index: 0;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.ft-tabs--horizontal [role="tab"] {
|
|
66
|
-
border-radius: ${tabs.topRightBorderRadius} 0 0 ${tabs.topLeftBorderRadius};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.ft-tabs--horizontal.ft-tabs--side-icon [role="tab"],
|
|
70
|
-
.ft-tabs--horizontal.ft-tabs--label-only [role="tab"] {
|
|
71
|
-
align-items: flex-end;
|
|
72
|
-
justify-content: end;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.ft-tabs--icon-only [role='tab'] {
|
|
76
|
-
padding: ${tabs.iconOnlyVerticalPadding} ${tabs.iconOnlyHorizontalPadding};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
[role='tab'] ft-ripple {
|
|
80
|
-
${setVariable(FtRippleCssVariables.color, tabs.onStateLayerColor)};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
[role='tab']:focus-visible {
|
|
84
|
-
outline: ${tabs.focusOutlineWidth} solid ${tabs.focusFocusRingColor};
|
|
85
|
-
outline-offset: calc(${tabs.focusOutlineWidth} * -1);
|
|
86
|
-
border-radius: ${tabs.focusOutlineWidth};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
[role='tab']::before {
|
|
90
|
-
content: "";
|
|
91
|
-
position: absolute;
|
|
92
|
-
top: 0;
|
|
93
|
-
left: 0;
|
|
94
|
-
width: 100%;
|
|
95
|
-
height: 100%;
|
|
96
|
-
z-index: -1;
|
|
97
|
-
background-color: ${tabs.offStateLayerColor};
|
|
98
|
-
opacity: ${tabs.offDefaultStateLayerOpacity};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
[role='tab']:focus-visible::before {
|
|
102
|
-
background-color: ${tabs.offStateLayerColor};
|
|
103
|
-
opacity: ${tabs.offFocusStateLayerOpacity};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
[role='tab']:hover::before {
|
|
107
|
-
background-color: ${tabs.offStateLayerColor};
|
|
108
|
-
opacity: ${tabs.offHoverStateLayerOpacity};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
[role='tab'][disabled] {
|
|
112
|
-
opacity: ${tabs.offDisabledComponentOpacity};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.ft-tabs--side-icon [role='tab'] {
|
|
116
|
-
flex-direction: row;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
[role='tab'][aria-selected='true'] {
|
|
120
|
-
color: ${tabs.onColor};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
[role='tab'][aria-selected='true']::before {
|
|
124
|
-
background-color: ${tabs.onStateLayerColor};
|
|
125
|
-
opacity: ${tabs.onDefaultStateLayerOpacity};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
[role='tab'][aria-selected='true']:active::before {
|
|
129
|
-
background-color: ${tabs.onStateLayerColor};
|
|
130
|
-
opacity: ${tabs.onActiveStateLayerOpacity};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
[role='tab'][aria-selected='true']:hover::before {
|
|
134
|
-
background-color: ${tabs.onStateLayerColor};
|
|
135
|
-
opacity: ${tabs.onHoverStateLayerOpacity};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
[role='tab'][aria-selected='true']:focus-visible::before {
|
|
139
|
-
background-color: ${tabs.onStateLayerColor};
|
|
140
|
-
opacity: ${tabs.onFocusStateLayerOpacity};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.ft-tabs--align-justify [role='tab'],
|
|
144
|
-
.ft-tabs--align-justify .ft-tabs--tab-tooltip,
|
|
145
|
-
.ft-tabs--align-justify .ft-tabs--tab-tooltip::part(container) {
|
|
146
|
-
display: flex;
|
|
147
|
-
flex-grow: 1;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
[role='tab'] .ft-tabs--tab-label {
|
|
151
|
-
white-space: nowrap;
|
|
152
|
-
overflow: hidden;
|
|
153
|
-
text-overflow: ellipsis;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
[role='tab']:not(.ft-tabs--tab-with-label) .ft-tabs--tab-label,
|
|
157
|
-
.ft-tabs--icon-only .ft-tabs--tab-with-icon .ft-tabs--tab-label {
|
|
158
|
-
display: none;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
[role='tab']:not(.ft-tabs--tab-with-icon) .ft-tabs--tab-icon,
|
|
162
|
-
.ft-tabs--label-only .ft-tabs--tab-with-label .ft-tabs--tab-icon {
|
|
163
|
-
display: none;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.ft-tabs--active-tab-indicator {
|
|
167
|
-
position: absolute;
|
|
168
|
-
border-radius: 0;
|
|
169
|
-
background-color: ${tabs.onActiveTabIndicatorColor};
|
|
170
|
-
transition: width 200ms ease, left 200ms ease, top 200ms ease;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.ft-tabs--content {
|
|
174
|
-
flex-shrink: 1;
|
|
175
|
-
flex-grow: 1;
|
|
176
|
-
overflow: auto;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.ft-tabs--horizontal .ft-tabs--content {
|
|
180
|
-
overflow: unset;
|
|
181
|
-
}
|
|
182
|
-
`;
|