@fluid-topics/ft-reader-toc 1.1.8 → 1.1.10

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.
@@ -7,5 +7,8 @@ export declare const FtReaderTocCssVariables: {
7
7
  highlightedFontWeight: import("@fluid-topics/ft-wc-utils").FtCssVariable;
8
8
  highlightedBackgroundColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
9
9
  iconFontSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
10
+ treeNodeIconColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
11
+ leafNodeIconColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
12
+ expandCollapseAllButtonColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
10
13
  };
11
14
  export declare const styles: import("lit").CSSResult;
@@ -11,6 +11,9 @@ export const FtReaderTocCssVariables = {
11
11
  highlightedFontWeight: FtCssVariableFactory.create("--ft-reader-toc-highlighted-font-weight", "", "UNKNOWN", "bold"),
12
12
  highlightedBackgroundColor: FtCssVariableFactory.create("--ft-reader-toc-highlighted-background-color", "", "COLOR", "transparent"),
13
13
  iconFontSize: FtCssVariableFactory.create("--ft-reader-toc-icon-font-size", "", "SIZE", "16px"),
14
+ treeNodeIconColor: FtCssVariableFactory.create("--ft-reader-toc-tree-node-icon-color", "", "COLOR", designSystemVariables.colorPrimary),
15
+ leafNodeIconColor: FtCssVariableFactory.create("--ft-reader-toc-leaf-node-icon-color", "", "COLOR", designSystemVariables.colorPrimary),
16
+ expandCollapseAllButtonColor: FtCssVariableFactory.create("--ft-reader-toc-expand-collapse-all-button-color", "", "COLOR", designSystemVariables.colorPrimary),
14
17
  };
15
18
  // language=CSS
16
19
  export const styles = css `
@@ -39,6 +42,18 @@ export const styles = css `
39
42
  ${setVariable(FtButtonCssVariables.iconSize, FtReaderTocCssVariables.iconFontSize)};
40
43
  }
41
44
 
45
+ .ft-reader-toc--leaf-node-icon {
46
+ color: ${FtReaderTocCssVariables.leafNodeIconColor};
47
+ }
48
+
49
+ .ft-reader-toc--tree-node-button {
50
+ ${setVariable(FtButtonCssVariables.color, FtReaderTocCssVariables.treeNodeIconColor)};
51
+ }
52
+
53
+ .ft-reader-toc--expand-collapse-all-button {
54
+ ${setVariable(FtButtonCssVariables.color, FtReaderTocCssVariables.expandCollapseAllButtonColor)};
55
+ }
56
+
42
57
  .ft-reader-toc--toggle-container {
43
58
  flex-shrink: 0;
44
59
  }
@@ -55,6 +70,14 @@ export const styles = css `
55
70
  width: 0;
56
71
  }
57
72
 
73
+ .ft-reader-toc-mobile .ft-reader-toc--leaf-node-icon {
74
+ width: calc(${FtReaderTocCssVariables.iconFontSize} + 12px);
75
+ }
76
+
77
+ .ft-reader-toc-desktop .ft-reader-toc--leaf-node-icon {
78
+ width: calc(${FtReaderTocCssVariables.iconFontSize} + 4px);
79
+ }
80
+
58
81
  .ft-reader-toc-expand-collapse-all-container {
59
82
  margin: 8px 4px;
60
83
  display: flex;
@@ -10,6 +10,8 @@ export declare class FtReaderToc extends FtReaderComponent implements FtReaderTo
10
10
  iconVariant: FtIconVariants;
11
11
  collapseIcon: string;
12
12
  expandIcon: string;
13
+ leafNodeIconVariant: FtIconVariants;
14
+ leafNodeIcon: string;
13
15
  expandCollapseAll: boolean;
14
16
  expandCollapseAllHideLabel: boolean;
15
17
  expandCollapseAllTrailingIcon: boolean;
@@ -44,4 +46,5 @@ export declare class FtReaderToc extends FtReaderComponent implements FtReaderTo
44
46
  private onViewportSizeChange;
45
47
  private toggleExpandCollapseAll;
46
48
  private getExpandCollapseAllTooltipPosition;
49
+ private getLeafNodeIcon;
47
50
  }
@@ -13,7 +13,7 @@ import { deepEqual, jsonProperty, ParametrizedLabelResolver, redux } from "@flui
13
13
  import { FtReaderComponent, } from "@fluid-topics/ft-reader-context/build/registration";
14
14
  import { FtTypography } from "@fluid-topics/ft-typography";
15
15
  import { FtReaderInternalLink } from "@fluid-topics/ft-reader-internal-link";
16
- import { FtIconVariants } from "@fluid-topics/ft-icon";
16
+ import { FtIcon, FtIconVariants } from "@fluid-topics/ft-icon";
17
17
  import { FtButton } from "@fluid-topics/ft-button";
18
18
  import { FtSizeCategory, FtSizeWatcher } from "@fluid-topics/ft-size-watcher";
19
19
  import { DEFAULT_LABELS } from "./ft-reader-toc.properties";
@@ -25,6 +25,8 @@ class FtReaderToc extends FtReaderComponent {
25
25
  this.iconVariant = FtIconVariants.fluid_topics;
26
26
  this.collapseIcon = "MINUS";
27
27
  this.expandIcon = "PLUS";
28
+ this.leafNodeIconVariant = FtIconVariants.fluid_topics;
29
+ this.leafNodeIcon = "DOT";
28
30
  this.expandCollapseAll = false;
29
31
  this.expandCollapseAllHideLabel = false;
30
32
  this.expandCollapseAllTrailingIcon = false;
@@ -92,6 +94,7 @@ class FtReaderToc extends FtReaderComponent {
92
94
  class="ft-reader-toc-expand-collapse-all-container ft-reader-toc-expand-collapse-all-${this.expandCollapseAllAlignment}">
93
95
  <ft-button
94
96
  part="expand-collapse-all"
97
+ class="ft-reader-toc--expand-collapse-all-button"
95
98
  iconVariant="${this.expandCollapseAllIconVariant}"
96
99
  icon="${this.expandCollapseAllHideIcon ? "" : (this.expandAll
97
100
  ? (this.collapseAllIcon || "ICON_COLLAPSE")
@@ -124,6 +127,7 @@ class FtReaderToc extends FtReaderComponent {
124
127
  ${canDisplayChildren ? html `
125
128
  <ft-button
126
129
  part="expand-collapse-node"
130
+ class="ft-reader-toc--tree-node-button"
127
131
  round hideTooltip
128
132
  ?dense=${this.viewportSize !== FtSizeCategory.S}
129
133
  label="${this.labelResolver.resolve(isExpanded
@@ -139,9 +143,9 @@ class FtReaderToc extends FtReaderComponent {
139
143
  aria-expanded="${isExpanded}"
140
144
  >
141
145
  </ft-button>
142
- ` : nothing}
146
+ ` : this.getLeafNodeIcon()}
143
147
  </div>
144
- ` : nothing}
148
+ ` : !canDisplayChildren ? this.getLeafNodeIcon() : nothing}
145
149
  <ft-reader-internal-link
146
150
  part="node-link"
147
151
  tocId="${node.tocId}"
@@ -203,10 +207,14 @@ class FtReaderToc extends FtReaderComponent {
203
207
  return "bottom";
204
208
  }
205
209
  }
210
+ getLeafNodeIcon() {
211
+ return html `
212
+ <ft-icon class="ft-reader-toc--leaf-node-icon" .variant="${this.leafNodeIconVariant}" .value="${this.leafNodeIcon}"></ft-icon>`;
213
+ }
206
214
  }
207
- // Uncomment to use scoped web components
208
215
  FtReaderToc.elementDefinitions = {
209
216
  "ft-button": FtButton,
217
+ "ft-icon": FtIcon,
210
218
  "ft-reader-internal-link": FtReaderInternalLink,
211
219
  "ft-size-watcher": FtSizeWatcher,
212
220
  "ft-typography": FtTypography,
@@ -225,6 +233,12 @@ __decorate([
225
233
  __decorate([
226
234
  property()
227
235
  ], FtReaderToc.prototype, "expandIcon", void 0);
236
+ __decorate([
237
+ property()
238
+ ], FtReaderToc.prototype, "leafNodeIconVariant", void 0);
239
+ __decorate([
240
+ property()
241
+ ], FtReaderToc.prototype, "leafNodeIcon", void 0);
228
242
  __decorate([
229
243
  property({ type: Boolean })
230
244
  ], FtReaderToc.prototype, "expandCollapseAll", void 0);