@fluid-topics/ftds-toc 0.0.0-stage → 2.2.28

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.
@@ -0,0 +1,11 @@
1
+ export interface FtdsTocItem {
2
+ value: string;
3
+ label: string;
4
+ href: string;
5
+ children?: FtdsTocItem[];
6
+ }
7
+ export interface FtdsTocProperties {
8
+ items: FtdsTocItem[];
9
+ label: string;
10
+ current?: string;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { toc } from "@fluid-topics/design-system-variables";
2
+ export { toc as FtdsTocCssVariables };
3
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,135 @@
1
+ import { css } from "lit";
2
+ import { foundation, toc, } from "@fluid-topics/design-system-variables";
3
+ export { toc as FtdsTocCssVariables };
4
+ // language=CSS
5
+ export const styles = css `
6
+ :host {
7
+ display: block;
8
+ position: sticky;
9
+ top: ${toc.offsetTop};
10
+ }
11
+
12
+ /* Not sticky on smaller screens */
13
+ @media (max-width: 1440px) {
14
+ :host {
15
+ display: none;
16
+ }
17
+ }
18
+
19
+ nav {
20
+ display: flex;
21
+ flex-direction: column;
22
+ gap: ${toc.titleGap};
23
+ }
24
+
25
+ .title {
26
+ color: ${toc.titleColor};
27
+ }
28
+
29
+ ul {
30
+ display: flex;
31
+ flex-direction: column;
32
+ gap: ${toc.itemGap};
33
+ margin: 0;
34
+ padding: 0;
35
+ list-style: none;
36
+ }
37
+
38
+ a {
39
+ --toc-label-color: ${toc.itemInactiveLabelColor};
40
+ --toc-border-color: ${toc.itemInactiveBorderColor};
41
+ --toc-border-width: ${toc.itemBorderWidth};
42
+ --toc-layer-color: ${toc.itemInactiveStateLayerColor};
43
+ --toc-layer-opacity: 0;
44
+
45
+ position: relative;
46
+ display: flex;
47
+ align-items: baseline;
48
+ gap: ${foundation.spacing2};
49
+ padding: ${toc.itemVerticalPadding} ${toc.itemHorizontalPadding};
50
+ border-radius: ${toc.itemBorderRadius};
51
+ color: var(--toc-label-color);
52
+ text-decoration: none;
53
+ outline: none;
54
+ cursor: pointer;
55
+ }
56
+
57
+ /* Left bar, absolutely positioned so that the width change doesn't shift the label */
58
+ a::after {
59
+ content: "";
60
+ position: absolute;
61
+ top: 0;
62
+ bottom: 0;
63
+ left: 0;
64
+ width: var(--toc-border-width);
65
+ background-color: var(--toc-border-color);
66
+ pointer-events: none;
67
+ }
68
+
69
+ /* State layer */
70
+ a::before {
71
+ content: "";
72
+ position: absolute;
73
+ inset: 0;
74
+ border-radius: inherit;
75
+ background-color: var(--toc-layer-color);
76
+ opacity: var(--toc-layer-opacity);
77
+ pointer-events: none;
78
+ }
79
+
80
+ .bullet {
81
+ flex-shrink: 0;
82
+ }
83
+
84
+ .label {
85
+ min-width: 0;
86
+ overflow-wrap: anywhere;
87
+ }
88
+
89
+ a:hover {
90
+ --toc-layer-opacity: ${toc.itemInactiveHoverStateLayerOpacity};
91
+ }
92
+
93
+ a:focus-visible {
94
+ --toc-layer-opacity: ${toc.itemInactiveFocusStateLayerOpacity};
95
+ outline: ${toc.itemFocusFocusRingWidth} solid ${toc.itemFocusFocusRingColor};
96
+ outline-offset: calc(-1 * ${toc.itemFocusFocusRingWidth});
97
+ }
98
+
99
+ /* Active */
100
+ a[aria-current="page"] {
101
+ --toc-label-color: ${toc.itemActiveLabelColor};
102
+ --toc-border-color: ${toc.itemActiveBorderColor};
103
+ --toc-border-width: ${toc.itemActiveBorderWidth};
104
+ --toc-layer-color: ${toc.itemActiveStateLayerColor};
105
+ --toc-layer-opacity: ${toc.itemActiveDefaultStateLayerOpacity};
106
+ }
107
+
108
+ a[aria-current="page"]:hover {
109
+ --toc-layer-opacity: ${toc.itemActiveHoverStateLayerOpacity};
110
+ }
111
+
112
+ a[aria-current="page"]:focus-visible {
113
+ --toc-layer-opacity: ${toc.itemActiveFocusStateLayerOpacity};
114
+ }
115
+
116
+ /* Root with an active child */
117
+ a.children-active {
118
+ --toc-label-color: ${toc.itemChildActiveLabelColor};
119
+ --toc-border-color: ${toc.itemChildActiveBorderColor};
120
+ --toc-layer-color: ${toc.itemChildActiveStateLayerColor};
121
+ }
122
+
123
+ a.children-active:hover {
124
+ --toc-layer-opacity: ${toc.itemChildActiveHoverStateLayerOpacity};
125
+ }
126
+
127
+ a.children-active:focus-visible {
128
+ --toc-layer-opacity: ${toc.itemChildActiveFocusStateLayerOpacity};
129
+ }
130
+
131
+ /* Child */
132
+ a.child {
133
+ padding-left: calc(${toc.itemHorizontalPadding} + ${foundation.spacing2});
134
+ }
135
+ `;
@@ -0,0 +1,4 @@
1
+ export * from "./ftds-toc.properties";
2
+ export * from "./ftds-toc.styles";
3
+ export * from "./ftds-toc";
4
+ import "./define";
package/build/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./ftds-toc.properties";
2
+ export * from "./ftds-toc.styles";
3
+ export * from "./ftds-toc";
4
+ import "./define";
package/package.json CHANGED
@@ -1,6 +1,31 @@
1
1
  {
2
- "name": "@fluid-topics/ftds-toc",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@fluid-topics/ftds-toc",
3
+ "version": "2.2.28",
4
+ "description": "The design system table of contents (TOC) component",
5
+ "keywords": [
6
+ "Lit"
7
+ ],
8
+ "author": "Fluid Topics <devtopics@antidot.net>",
9
+ "license": "ISC",
10
+ "main": "build/index.js",
11
+ "web": "build/ftds-toc.min.js",
12
+ "typings": "build/index",
13
+ "files": [
14
+ "build/**/*.js",
15
+ "build/**/*.ts"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
+ },
21
+ "dependencies": {
22
+ "@fluid-topics/design-system-variables": "3.16.0",
23
+ "@fluid-topics/ft-wc-utils": "2.2.28",
24
+ "@fluid-topics/ftds-typography": "2.2.28",
25
+ "lit": "3.3.3"
26
+ },
27
+ "devDependencies": {
28
+ "@fluid-topics/ft-wc-test-utils": "2.2.28"
29
+ },
30
+ "gitHead": "8ca1d190ac34fad2ecec7ad3b03890913f865eb7"
31
+ }