@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.
@@ -1,10 +1,16 @@
1
- import { FtBaseTabs } from "./ft-base-tabs";
1
+ import { FtBaseTabs, FtBaseTabsProperties } from "./ft-base-tabs";
2
2
  import { ClassInfo } from "lit/directives/class-map.js";
3
- export interface FtdsTabsProperties {
4
- sideIcon?: boolean;
3
+ export declare enum FtDsTabsStructure {
4
+ topIcon = "top-icon",
5
+ sideIcon = "side-icon",
6
+ labelOnly = "label-only",
7
+ iconOnly = "icon-only"
8
+ }
9
+ export interface FtdsTabsProperties extends FtBaseTabsProperties {
10
+ structure?: FtDsTabsStructure;
5
11
  }
6
12
  export declare class FtdsTabs extends FtBaseTabs implements FtdsTabsProperties {
7
- sideIcon: boolean;
13
+ structure: FtDsTabsStructure;
8
14
  static styles: import("lit").CSSResult[];
9
15
  get tabsClasses(): ClassInfo;
10
16
  }
@@ -8,20 +8,25 @@ import { FtBaseTabs } from "./ft-base-tabs";
8
8
  import { safariEllipsisFix } from "@fluid-topics/ft-wc-utils";
9
9
  import { designSystemStyles } from "./ftds-tabs.styles";
10
10
  import { property } from "lit/decorators.js";
11
+ export var FtDsTabsStructure;
12
+ (function (FtDsTabsStructure) {
13
+ FtDsTabsStructure["topIcon"] = "top-icon";
14
+ FtDsTabsStructure["sideIcon"] = "side-icon";
15
+ FtDsTabsStructure["labelOnly"] = "label-only";
16
+ FtDsTabsStructure["iconOnly"] = "icon-only";
17
+ })(FtDsTabsStructure || (FtDsTabsStructure = {}));
11
18
  class FtdsTabs extends FtBaseTabs {
12
19
  constructor() {
13
20
  super(...arguments);
14
- this.sideIcon = false;
21
+ this.structure = FtDsTabsStructure.sideIcon;
15
22
  }
16
23
  get tabsClasses() {
17
24
  return {
18
25
  "ft-tabs": true,
19
- "ft-tabs--collapsed": this.collapsible && this.activeIndex == null,
20
- "ft-tabs--horizontal": this.horizontal,
21
- "ft-tabs--reverse": this.contentBefore,
22
- "ft-tabs--dense": this.dense,
23
26
  ["ft-tabs--align-" + this.alignTabs]: true,
24
- "ft-tabs--side-icon": this.sideIcon
27
+ "ft-tabs--side-icon": this.structure == FtDsTabsStructure.sideIcon,
28
+ "ft-tabs--icon-only": this.structure == FtDsTabsStructure.iconOnly,
29
+ "ft-tabs--label-only": this.structure == FtDsTabsStructure.labelOnly,
25
30
  };
26
31
  }
27
32
  }
@@ -30,6 +35,6 @@ FtdsTabs.styles = [
30
35
  designSystemStyles
31
36
  ];
32
37
  __decorate([
33
- property({ type: Boolean })
34
- ], FtdsTabs.prototype, "sideIcon", void 0);
38
+ property()
39
+ ], FtdsTabs.prototype, "structure", void 0);
35
40
  export { FtdsTabs };
@@ -1,12 +1,2 @@
1
- export declare const FtdsTabsCssVariables: {
2
- horizontalButtonsWidth: import("@fluid-topics/ft-wc-utils").FtCssVariable;
3
- horizontalDenseButtonsWidth: import("@fluid-topics/ft-wc-utils").FtCssVariable;
4
- widthWhenHorizontalAndOpen: import("@fluid-topics/ft-wc-utils").FtCssVariable;
5
- colorSurface: import("@fluid-topics/ft-wc-utils").FtCssVariable;
6
- colorPrimary: import("@fluid-topics/ft-wc-utils").FtCssVariable;
7
- backgroundPrimary: import("@fluid-topics/ft-wc-utils").FtCssVariable;
8
- color: import("@fluid-topics/ft-wc-utils").FtCssVariable;
9
- colorDisabled: import("@fluid-topics/ft-wc-utils").FtCssVariable;
10
- focusBorderColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
11
- };
1
+ export { tabs as FtdsTabsCssVariables } from "@fluid-topics/design-system-variables";
12
2
  export declare const designSystemStyles: import("lit").CSSResult;
@@ -1,54 +1,14 @@
1
1
  import { css } from "lit";
2
- import { FtCssVariableFactory } from "@fluid-topics/ft-wc-utils";
3
- import { foundation } from "@fluid-topics/design-system-variables/build/generated/ts/foundation";
4
- export const FtdsTabsCssVariables = {
5
- horizontalButtonsWidth: FtCssVariableFactory.create("--ft-tabs-horizontal-buttons-width", "Width of the tab buttons (N/A for vertical justified tabs)", "SIZE", "100px"),
6
- horizontalDenseButtonsWidth: FtCssVariableFactory.create("--ft-tabs-horizontal-dense-buttons-width", "Width of the tab buttons when dense (N/A for vertical justified tabs)", "SIZE", "56px"),
7
- widthWhenHorizontalAndOpen: FtCssVariableFactory.create("--ft-tabs-width-when-horizontal-and-open", "Width of the component when set to horizontal and open", "SIZE", "100%"),
8
- colorSurface: FtCssVariableFactory.create("--ft-tabs-color-surface", "", "COLOR", "#FFFFFF"),
9
- colorPrimary: FtCssVariableFactory.create("--ft-tabs-color-primary", "", "COLOR", foundation.colorBrand0),
10
- backgroundPrimary: FtCssVariableFactory.create("--ft-tabs-background-primary", "", "COLOR", foundation.colorBrand10),
11
- color: FtCssVariableFactory.create("--ft-tabs-color", "", "COLOR", foundation.colorGray200),
12
- colorDisabled: FtCssVariableFactory.create("--ft-tabs-color-disabled", "", "COLOR", foundation.colorGray60),
13
- focusBorderColor: FtCssVariableFactory.create("--ft-tabs-focus-border-color", "", "COLOR", foundation.colorCyan70),
14
- };
2
+ import { tabs } from "@fluid-topics/design-system-variables";
3
+ export { tabs as FtdsTabsCssVariables } from "@fluid-topics/design-system-variables";
15
4
  // language=CSS
16
5
  export const designSystemStyles = css `
17
6
  .ft-tabs {
18
7
  display: flex;
19
8
  flex-direction: column;
20
- background-color: ${FtdsTabsCssVariables.colorSurface};
21
9
  height: 100%;
22
10
  }
23
11
 
24
- .ft-tabs--horizontal {
25
- -webkit-transition: width 200ms ease-in-out;
26
- -moz-transition: width 200ms ease-in-out;
27
- -o-transition: width 200ms ease-in-out;
28
- transition: width 200ms ease-in-out;
29
- width: ${FtdsTabsCssVariables.widthWhenHorizontalAndOpen};
30
- }
31
-
32
- .ft-tabs--horizontal.ft-tabs--collapsed {
33
- width: ${FtdsTabsCssVariables.horizontalButtonsWidth};
34
- }
35
-
36
- .ft-tabs--horizontal.ft-tabs--dense.ft-tabs--collapsed {
37
- width: ${FtdsTabsCssVariables.horizontalDenseButtonsWidth};
38
- }
39
-
40
- .ft-tabs--horizontal {
41
- flex-direction: row;
42
- }
43
-
44
- .ft-tabs--reverse {
45
- flex-direction: column-reverse;
46
- }
47
-
48
- .ft-tabs--horizontal.ft-tabs--reverse {
49
- flex-direction: row-reverse;
50
- }
51
-
52
12
  [role="tablist"] {
53
13
  flex-shrink: 0;
54
14
  flex-grow: 0;
@@ -57,10 +17,6 @@ export const designSystemStyles = css `
57
17
  flex-wrap: wrap;
58
18
  }
59
19
 
60
- .ft-tabs--horizontal [role="tablist"] {
61
- flex-direction: column;
62
- }
63
-
64
20
  .ft-tabs--align-end [role="tablist"],
65
21
  .ft-tabs--align-right [role="tablist"] {
66
22
  justify-content: flex-end;
@@ -77,42 +33,84 @@ export const designSystemStyles = css `
77
33
  flex-direction: column;
78
34
  align-items: center;
79
35
  justify-content: center;
80
- padding: 8px 16px;
36
+ padding: ${tabs.withLabelVerticalPadding} ${tabs.withLabelHorizontalPadding};
81
37
  background: none;
82
38
  box-shadow: 0px 0px 0px transparent;
83
- border: 3px solid transparent;
39
+ border: ${tabs.focusOutlineWidth} solid transparent;
84
40
  text-shadow: 0px 0px 0px transparent;
85
41
  cursor: pointer;
86
42
  outline: none;
87
43
  font-size: 16px;
88
44
  line-height: 1;
89
- color: ${FtdsTabsCssVariables.color};
45
+ color: ${tabs.offColor};
46
+ border-radius: ${tabs.topLeftBorderRadius} ${tabs.topRightBorderRadius} 0 0;
90
47
  }
91
48
 
92
- [role='tab']:focus {
93
- border: 3px solid ${FtdsTabsCssVariables.focusBorderColor};
94
- border-radius: 3px;
49
+ .ft-tabs--icon-only [role='tab'] {
50
+ padding: ${tabs.iconOnlyVerticalPadding} ${tabs.iconOnlyHorizontalPadding};
51
+ }
52
+
53
+ [role='tab'] ft-ripple {
54
+ --ft-ripple-color: ${tabs.onStateLayerColor}
55
+ }
56
+
57
+ [role='tab']::before {
58
+ content: "";
59
+ position: absolute;
60
+ top: 0;
61
+ left: 0;
62
+ width: 100%;
63
+ height: 100%;
64
+ z-index: -1;
65
+ background-color: ${tabs.offStateLayerColor};
66
+ opacity: ${tabs.offDefaultStateLayerOpacity};
67
+ }
68
+
69
+ [role='tab']:focus-visible {
70
+ border-color: ${tabs.focusFocusRingColor};
71
+ border-radius: ${tabs.focusOutlineWidth};
72
+ }
73
+
74
+ [role='tab']:focus-visible::before {
75
+ background-color: ${tabs.offStateLayerColor};
76
+ opacity: ${tabs.offFocusStateLayerOpacity};
77
+ }
78
+
79
+ [role='tab']:hover::before {
80
+ background-color: ${tabs.offStateLayerColor};
81
+ opacity: ${tabs.offHoverStateLayerOpacity};
82
+ }
83
+
84
+ [role='tab'][disabled] {
85
+ opacity: ${tabs.offDisabledComponentOpacity};
95
86
  }
96
87
 
97
88
  .ft-tabs--side-icon [role='tab'] {
98
89
  flex-direction: row;
99
90
  }
100
91
 
101
- .ft-tabs--horizontal [role='tab'] {
102
- width: ${FtdsTabsCssVariables.horizontalButtonsWidth};
92
+ [role='tab'][aria-selected='true'] {
93
+ color: ${tabs.onColor};
103
94
  }
104
95
 
105
- .ft-tabs--horizontal.ft-tabs--dense [role='tab'] {
106
- width: ${FtdsTabsCssVariables.horizontalDenseButtonsWidth};
96
+ [role='tab'][aria-selected='true']::before {
97
+ background-color: ${tabs.onStateLayerColor};
98
+ opacity: ${tabs.onDefaultStateLayerOpacity};
107
99
  }
108
100
 
109
- [role='tab'][aria-selected='true'] {
110
- color: ${FtdsTabsCssVariables.colorPrimary};
111
- background-color: ${FtdsTabsCssVariables.backgroundPrimary};
101
+ [role='tab'][aria-selected='true']:active::before {
102
+ background-color: ${tabs.onStateLayerColor};
103
+ opacity: ${tabs.onActiveStateLayerOpacity};
112
104
  }
113
105
 
114
- [role='tab'][disabled] {
115
- color: ${FtdsTabsCssVariables.colorDisabled};
106
+ [role='tab'][aria-selected='true']:hover::before {
107
+ background-color: ${tabs.onStateLayerColor};
108
+ opacity: ${tabs.onHoverStateLayerOpacity};
109
+ }
110
+
111
+ [role='tab'][aria-selected='true']:focus::before {
112
+ background-color: ${tabs.onStateLayerColor};
113
+ opacity: ${tabs.onFocusStateLayerOpacity};
116
114
  }
117
115
 
118
116
  .ft-tabs--align-justify [role='tab'],
@@ -130,19 +128,28 @@ export const designSystemStyles = css `
130
128
  }
131
129
 
132
130
  [role='tab']:not(.ft-tabs--tab-with-label) .ft-tabs--tab-label,
133
- .ft-tabs--dense .ft-tabs--tab-with-icon .ft-tabs--tab-label {
131
+ .ft-tabs--icon-only .ft-tabs--tab-with-icon .ft-tabs--tab-label {
134
132
  display: none;
135
133
  }
136
134
 
137
- [role='tab']:not(.ft-tabs--tab-with-icon) .ft-tabs--tab-icon {
135
+ [role='tab']:not(.ft-tabs--tab-with-icon) .ft-tabs--tab-icon,
136
+ .ft-tabs--label-only .ft-tabs--tab-with-label .ft-tabs--tab-icon {
138
137
  display: none;
139
138
  }
140
139
 
140
+ .ft-tabs--tab-icon {
141
+ padding: ${tabs.verticalGap} 0;
142
+ }
143
+
144
+ .ft-tabs--side-icon .ft-tabs--tab-icon {
145
+ padding: 0 ${tabs.horizontalGap};
146
+ }
147
+
141
148
  .ft-tabs--active-tab-indicator {
142
149
  position: absolute;
143
150
  height: 3px;
144
151
  border-radius: 2px;
145
- background-color: ${FtdsTabsCssVariables.colorPrimary};
152
+ background-color: ${tabs.onColor};
146
153
  transition: width 200ms ease, left 200ms ease, top 200ms ease;
147
154
  }
148
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-tabs",
3
- "version": "1.1.80",
3
+ "version": "1.1.82",
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": "1.1.80",
23
- "@fluid-topics/ft-ripple": "1.1.80",
24
- "@fluid-topics/ft-tooltip": "1.1.80",
25
- "@fluid-topics/ft-typography": "1.1.80",
26
- "@fluid-topics/ft-wc-utils": "1.1.80",
22
+ "@fluid-topics/ft-icon": "1.1.82",
23
+ "@fluid-topics/ft-ripple": "1.1.82",
24
+ "@fluid-topics/ft-tooltip": "1.1.82",
25
+ "@fluid-topics/ft-typography": "1.1.82",
26
+ "@fluid-topics/ft-wc-utils": "1.1.82",
27
27
  "lit": "3.1.0"
28
28
  },
29
- "gitHead": "9454653b9d84c51d905be4956706b7a0ef1aa2f6"
29
+ "gitHead": "2fd30a90406265aa7cc0714cafe53090343c0086"
30
30
  }