igniteui-astro-components 0.0.1 → 0.0.3
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/README.md +21 -0
- package/package.json +3 -1
- package/src/assets/icons/angular-logo.svg +38 -0
- package/src/assets/icons/arrow-down.svg +3 -0
- package/src/assets/icons/arrow.svg +3 -0
- package/src/assets/icons/blazor-logo.svg +10 -0
- package/src/assets/icons/bullet-poiont.svg +3 -0
- package/src/assets/icons/chatGPT,.svg +4 -0
- package/src/assets/icons/check-circle.svg +3 -0
- package/src/assets/icons/check.svg +3 -0
- package/src/assets/icons/cheked.svg +3 -0
- package/src/assets/icons/chevron.svg +3 -0
- package/src/assets/icons/classes.svg +3 -0
- package/src/assets/icons/claude.svg +3 -0
- package/src/assets/icons/clear.svg +3 -0
- package/src/assets/icons/close.svg +3 -0
- package/src/assets/icons/code.svg +3 -0
- package/src/assets/icons/collapse.svg +5 -0
- package/src/assets/icons/command.svg +3 -0
- package/src/assets/icons/copy-clipboard.svg +3 -0
- package/src/assets/icons/copy.svg +3 -0
- package/src/assets/icons/crown.svg +3 -0
- package/src/assets/icons/dot.svg +3 -0
- package/src/assets/icons/download.svg +3 -0
- package/src/assets/icons/dropdown-indicator-bold.svg +3 -0
- package/src/assets/icons/dropdown-indicator.svg +3 -0
- package/src/assets/icons/enter-fullscreen.svg +3 -0
- package/src/assets/icons/enumerations.svg +3 -0
- package/src/assets/icons/exit-fullscreen.svg +3 -0
- package/src/assets/icons/expand-all.svg +5 -0
- package/src/assets/icons/expand-icon.svg +3 -0
- package/src/assets/icons/eye.svg +3 -0
- package/src/assets/icons/filter-clear.svg +1 -0
- package/src/assets/icons/filter.svg +3 -0
- package/src/assets/icons/functions.svg +5 -0
- package/src/assets/icons/github-logo.svg +3 -0
- package/src/assets/icons/hamburger-menu.svg +3 -0
- package/src/assets/icons/info.svg +3 -0
- package/src/assets/icons/interfaces.svg +3 -0
- package/src/assets/icons/link-blank.svg +3 -0
- package/src/assets/icons/link.svg +3 -0
- package/src/assets/icons/moon.svg +3 -0
- package/src/assets/icons/note.svg +3 -0
- package/src/assets/icons/open-link-blank.svg +3 -0
- package/src/assets/icons/page.svg +3 -0
- package/src/assets/icons/palette,.svg +3 -0
- package/src/assets/icons/pen.svg +3 -0
- package/src/assets/icons/play-circle.svg +10 -0
- package/src/assets/icons/premium.svg +3 -0
- package/src/assets/icons/react.svg +4 -0
- package/src/assets/icons/refresh.svg +3 -0
- package/src/assets/icons/rocket.svg +10 -0
- package/src/assets/icons/search.svg +10 -0
- package/src/assets/icons/shine.svg +3 -0
- package/src/assets/icons/show-more.svg +3 -0
- package/src/assets/icons/source-code.svg +3 -0
- package/src/assets/icons/start.svg +3 -0
- package/src/assets/icons/sub-directory-indicator.svg +3 -0
- package/src/assets/icons/sun.svg +3 -0
- package/src/assets/icons/system-theme.svg +3 -0
- package/src/assets/icons/system.svg +3 -0
- package/src/assets/icons/type-alias.svg +3 -0
- package/src/assets/icons/variables.svg +3 -0
- package/src/assets/icons/warning.svg +3 -0
- package/src/assets/icons/web-component-logo.svg +23 -0
- package/src/assets/icons/wrap-text.svg +3 -0
- package/src/assets/ig-logo.svg +33 -0
- package/src/assets/illustrations/classes.svg +3 -0
- package/src/assets/illustrations/enumerations.svg +3 -0
- package/src/assets/illustrations/functions.svg +5 -0
- package/src/assets/illustrations/interfaces.svg +3 -0
- package/src/assets/illustrations/type-alias.svg +3 -0
- package/src/assets/illustrations/variables.svg +3 -0
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +57 -0
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +51 -0
- package/src/components/DocsBreadcrumb/README.md +66 -0
- package/src/components/DocsSidebar/DocsSidebar.astro +28 -58
- package/src/components/DocsSidebar/DocsSidebar.scss +18 -0
- package/src/components/DocsSidebar/SidebarFilterInput.astro +22 -57
- package/src/components/DocsSidebar/SidebarFilterInput.scss +69 -0
- package/src/components/DocsSidebar/SidebarLabel.astro +2 -7
- package/src/components/DocsSubHeader/DocsSubHeader.astro +60 -248
- package/src/components/DocsSubHeader/DocsSubHeader.scss +69 -0
- package/src/components/DocsSubHeader/README.md +6 -37
- package/src/components/DocsToc/DocsToc.astro +38 -83
- package/src/components/DocsToc/DocsToc.scss +33 -0
- package/src/components/DocsTree/DocsTree.astro +16 -2
- package/src/components/DocsTree/DocsTreeItem.astro +21 -16
- package/src/components/DocsTree/docs-tree.scss +185 -0
- package/src/components/GlobalFooter/GlobalFooter.astro +1 -1
- package/src/components/GlobalFooter/GlobalFooter.module.scss +1 -0
- package/src/components/GlobalNavBar/GlobalNavBar.module.scss +217 -196
- package/src/components/MobileSidebarToggle/MobileSidebarToggle.astro +2 -47
- package/src/components/MobileSidebarToggle/MobileSidebarToggle.scss +0 -0
- package/src/components/Search/Search.astro +14 -103
- package/src/components/Search/Search.scss +50 -0
- package/src/components/ThemingWidget/ThemingWidget.astro +1 -5
- package/src/components/ThemingWidget/ThemingWidget.scss +3 -0
- package/src/components/mdx/DocsAside/DocsAside.astro +15 -47
- package/src/components/mdx/DocsAside/DocsAside.scss +36 -0
- package/src/components/mdx/DocsAside/README.md +6 -6
- package/src/components/mdx/Sample/Sample.astro +1 -32
- package/src/components/mdx/Sample/Sample.scss +32 -0
- package/src/integration.ts +9 -0
- package/src/layouts/DocsLayout/DocsLayout.astro +88 -204
- package/src/layouts/DocsLayout/DocsLayout.scss +125 -0
- package/src/scripts/icon-registry.ts +57 -0
- package/src/styles/custom.scss +17 -251
- package/src/styles/global/_breakpoints.scss +48 -0
- package/src/styles/global/_code-blocks.scss +77 -0
- package/src/styles/global/_component-themes.scss +68 -0
- package/src/styles/global/_index.scss +9 -0
- package/src/styles/global/_markdown.scss +120 -0
- package/src/styles/global/_members.scss +85 -0
- package/src/styles/global/_palette.scss +131 -0
- package/src/styles/global/_type-scale.scss +182 -0
- package/src/styles/global/_variables.scss +71 -0
- package/src/styles/theme.scss +58 -0
- package/src/components/DocsTree/docs-tree.css +0 -227
- package/src/styles/ig-theme.scss +0 -43
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
* DocsSubHeader
|
|
4
4
|
*
|
|
5
5
|
* A secondary fixed header bar rendered below the GlobalNavBar.
|
|
6
|
+
* Contains the search input and cross-product navigation links.
|
|
6
7
|
*
|
|
7
8
|
* Positioning (set in DocsLayout / custom.css):
|
|
8
9
|
* --docs-global-nav-height height of the GlobalNavBar above (default 86px)
|
|
9
10
|
* --docs-subheader-height height of this bar (default 40px)
|
|
11
|
+
*
|
|
12
|
+
* Note: The breadcrumb that previously lived in `.subheader-context` has been
|
|
13
|
+
* moved to the `DocsBreadcrumb` component, rendered inside the main frame.
|
|
10
14
|
*/
|
|
11
15
|
import { platform as virtualPlatform } from 'virtual:docs-template/nav-html';
|
|
12
|
-
import { productLinks
|
|
16
|
+
import { productLinks } from 'virtual:docs-template/site-meta';
|
|
13
17
|
import Search from '../Search/Search.astro';
|
|
14
|
-
import
|
|
15
|
-
import { getBreadcrumb } from '../../lib/sidebar/helpers';
|
|
18
|
+
import './DocsSubHeader.scss';
|
|
16
19
|
|
|
17
20
|
interface ProductLink {
|
|
18
21
|
label: string;
|
|
@@ -21,92 +24,61 @@ interface ProductLink {
|
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
interface Props {
|
|
24
|
-
/** Fallback title if the slug is not present in the sidebar tree. */
|
|
25
|
-
pageTitle?: string | null;
|
|
26
|
-
/** Current page slug — used to derive the breadcrumb from the sidebar tree. */
|
|
27
|
-
currentSlug?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Override the site title shown on the left. Defaults to the virtual module value.
|
|
30
|
-
* Useful when consuming without `siteMetaIntegration`.
|
|
31
|
-
*/
|
|
32
|
-
siteTitle?: string;
|
|
33
27
|
/**
|
|
34
28
|
* Override the cross-product navigation links. Defaults to the virtual module value.
|
|
35
29
|
* Useful when consuming without `siteMetaIntegration`.
|
|
36
30
|
*/
|
|
37
31
|
productLinks?: ProductLink[];
|
|
38
|
-
/**
|
|
39
|
-
* Override the sidebar tree used for breadcrumb generation.
|
|
40
|
-
* Defaults to the virtual module value.
|
|
41
|
-
*/
|
|
42
|
-
sidebarItems?: SidebarEntry[];
|
|
43
32
|
}
|
|
44
33
|
|
|
45
|
-
const {
|
|
46
|
-
const resolvedSiteTitle = siteTitleProp ?? siteTitle;
|
|
34
|
+
const { productLinks: productLinksProp } = Astro.props;
|
|
47
35
|
const currentPlatform = virtualPlatform ?? null;
|
|
48
36
|
const resolvedLinks = (productLinksProp ?? productLinks) as ProductLink[];
|
|
49
37
|
const filteredLinks = resolvedLinks.filter((l: ProductLink) => l.platform !== currentPlatform);
|
|
50
|
-
|
|
51
|
-
// Breadcrumb of sidebar labels for the current page (root group dropped),
|
|
52
|
-
// ending with the active item's own sidebar label. Falls back to `pageTitle`
|
|
53
|
-
// if the slug is not in the sidebar tree.
|
|
54
|
-
const resolvedSidebar = (sidebarItems ?? sidebarData) as SidebarEntry[];
|
|
55
|
-
const sidebarCrumbs = currentSlug ? getBreadcrumb(resolvedSidebar, currentSlug) : [];
|
|
56
|
-
const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitle] : []);
|
|
38
|
+
import logoRaw from '../../assets/ig-logo.svg?raw';
|
|
57
39
|
---
|
|
58
40
|
|
|
59
|
-
<docs-subheader-menu>
|
|
60
|
-
<div class="
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<div class="subheader-context">
|
|
64
|
-
{resolvedSiteTitle && <span class="subheader-site-title">{resolvedSiteTitle}</span>}
|
|
65
|
-
{crumbs.map((label, i) => (
|
|
66
|
-
<>
|
|
67
|
-
<span class="subheader-sep" aria-hidden="true">{i === 0 ? '-' : '/'}</span>
|
|
68
|
-
<span class="subheader-crumb" title={label}>{label}</span>
|
|
69
|
-
</>
|
|
70
|
-
))}
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
<!-- Search -->
|
|
74
|
-
<Search />
|
|
75
|
-
|
|
76
|
-
<!-- Right: product links. Desktop: flex row. Mobile: absolute dropdown. -->
|
|
77
|
-
<div class="subheader-right" id="docs-subheader-panel">
|
|
78
|
-
{filteredLinks.length > 0 && (
|
|
79
|
-
<div class="subheader-links">
|
|
80
|
-
{filteredLinks.map((link, i) => (
|
|
81
|
-
<>
|
|
82
|
-
{i > 0 && <span class="product-sep" aria-hidden="true">|</span>}
|
|
83
|
-
<a href={link.href} class="product-link">{link.label}</a>
|
|
84
|
-
</>
|
|
85
|
-
))}
|
|
86
|
-
</div>
|
|
87
|
-
)}
|
|
88
|
-
</div>
|
|
89
|
-
|
|
90
|
-
<!-- Mobile toggle (hidden on desktop) -->
|
|
91
|
-
<button
|
|
92
|
-
class="subheader-toggle"
|
|
93
|
-
data-docs-toggle
|
|
94
|
-
aria-expanded="false"
|
|
95
|
-
aria-controls="docs-subheader-panel"
|
|
96
|
-
aria-label="Toggle navigation"
|
|
97
|
-
>
|
|
98
|
-
<svg class="icon-open" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
99
|
-
<line x1="3" y1="6" x2="21" y2="6" />
|
|
100
|
-
<line x1="3" y1="12" x2="21" y2="12" />
|
|
101
|
-
<line x1="3" y1="18" x2="21" y2="18" />
|
|
102
|
-
</svg>
|
|
103
|
-
<svg class="icon-close" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
104
|
-
<line x1="18" y1="6" x2="6" y2="18" />
|
|
105
|
-
<line x1="6" y1="6" x2="18" y2="18" />
|
|
106
|
-
</svg>
|
|
107
|
-
</button>
|
|
108
|
-
|
|
41
|
+
<docs-subheader-menu class="docs-subheader">
|
|
42
|
+
<div class="igd-logo">
|
|
43
|
+
<Fragment set:html={logoRaw} />
|
|
44
|
+
<h1 class="ig-typography__body-2">IgniteUI</h1>
|
|
109
45
|
</div>
|
|
46
|
+
|
|
47
|
+
<!-- Search -->
|
|
48
|
+
<Search />
|
|
49
|
+
|
|
50
|
+
<!-- Right: product links. Desktop: flex row. Mobile: absolute dropdown. -->
|
|
51
|
+
<!--<div class="subheader-right" id="docs-subheader-panel">-->
|
|
52
|
+
<!-- {filteredLinks.length > 0 && (-->
|
|
53
|
+
<!-- <div class="subheader-links">-->
|
|
54
|
+
<!-- {filteredLinks.map((link, i) => (-->
|
|
55
|
+
<!-- <>-->
|
|
56
|
+
<!-- {i > 0 && <span class="product-sep" aria-hidden="true">|</span>}-->
|
|
57
|
+
<!-- <a href={link.href} class="product-link">{link.label}</a>-->
|
|
58
|
+
<!-- </>-->
|
|
59
|
+
<!-- ))}-->
|
|
60
|
+
<!-- </div>-->
|
|
61
|
+
<!-- )}-->
|
|
62
|
+
<!--</div>-->
|
|
63
|
+
|
|
64
|
+
<!-- Mobile toggle (hidden on desktop) -->
|
|
65
|
+
<!--<button-->
|
|
66
|
+
<!-- class="subheader-toggle"-->
|
|
67
|
+
<!-- data-docs-toggle-->
|
|
68
|
+
<!-- aria-expanded="false"-->
|
|
69
|
+
<!-- aria-controls="docs-subheader-panel"-->
|
|
70
|
+
<!-- aria-label="Toggle navigation"-->
|
|
71
|
+
<!-->-->
|
|
72
|
+
<!-- <svg class="icon-open" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">-->
|
|
73
|
+
<!-- <line x1="3" y1="6" x2="21" y2="6" />-->
|
|
74
|
+
<!-- <line x1="3" y1="12" x2="21" y2="12" />-->
|
|
75
|
+
<!-- <line x1="3" y1="18" x2="21" y2="18" />-->
|
|
76
|
+
<!-- </svg>-->
|
|
77
|
+
<!-- <svg class="icon-close" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">-->
|
|
78
|
+
<!-- <line x1="18" y1="6" x2="6" y2="18" />-->
|
|
79
|
+
<!-- <line x1="6" y1="6" x2="18" y2="18" />-->
|
|
80
|
+
<!-- </svg>-->
|
|
81
|
+
<!--</button>-->
|
|
110
82
|
</docs-subheader-menu>
|
|
111
83
|
|
|
112
84
|
<script>
|
|
@@ -139,6 +111,18 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
|
|
|
139
111
|
document.addEventListener('click', (e: MouseEvent) => {
|
|
140
112
|
if (!this.contains(e.target as Node)) setExpanded(false);
|
|
141
113
|
});
|
|
114
|
+
|
|
115
|
+
// Swap text → logo when the GlobalNavBar scrolls out of view.
|
|
116
|
+
const globalNav = document.querySelector('[data-astro-transition-persist="global-nav-bar"]');
|
|
117
|
+
if (globalNav) {
|
|
118
|
+
const observer = new IntersectionObserver(
|
|
119
|
+
([entry]) => {
|
|
120
|
+
this.classList.toggle('docs-subheader--pinned', !entry.isIntersecting);
|
|
121
|
+
},
|
|
122
|
+
{ threshold: 0 }
|
|
123
|
+
);
|
|
124
|
+
observer.observe(globalNav);
|
|
125
|
+
}
|
|
142
126
|
}
|
|
143
127
|
}
|
|
144
128
|
|
|
@@ -146,175 +130,3 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
|
|
|
146
130
|
}
|
|
147
131
|
</script>
|
|
148
132
|
|
|
149
|
-
<style>
|
|
150
|
-
docs-subheader-menu {
|
|
151
|
-
display: contents;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/* ── Fixed bar ─────────────────────────────────────────────────────────── */
|
|
155
|
-
|
|
156
|
-
.docs-subheader {
|
|
157
|
-
position: fixed;
|
|
158
|
-
inset-inline-start: 0;
|
|
159
|
-
inset-block-start: var(--docs-global-nav-height, 4.7rem);
|
|
160
|
-
width: 100%;
|
|
161
|
-
height: var(--docs-subheader-height, 2.5rem);
|
|
162
|
-
z-index: calc(var(--sl-z-index-navbar) - 1);
|
|
163
|
-
display: flex;
|
|
164
|
-
flex-direction: row;
|
|
165
|
-
align-items: center;
|
|
166
|
-
gap: 0.75rem;
|
|
167
|
-
padding-inline: 1rem;
|
|
168
|
-
background-color: var(--sl-color-bg-nav);
|
|
169
|
-
border-bottom: 1px solid var(--sl-color-hairline-shade);
|
|
170
|
-
overflow: visible;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/* ── Context (left) ────────────────────────────────────────────────────── */
|
|
174
|
-
|
|
175
|
-
.subheader-context {
|
|
176
|
-
flex: 1;
|
|
177
|
-
min-width: 0;
|
|
178
|
-
display: flex;
|
|
179
|
-
flex-direction: row;
|
|
180
|
-
align-items: center;
|
|
181
|
-
gap: 0.375rem;
|
|
182
|
-
overflow: hidden;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.subheader-site-title {
|
|
186
|
-
flex-shrink: 0;
|
|
187
|
-
font-size: 0.875rem;
|
|
188
|
-
font-weight: 600;
|
|
189
|
-
color: var(--sl-color-text-accent);
|
|
190
|
-
white-space: nowrap;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
.subheader-page-title {
|
|
194
|
-
font-size: 0.875rem;
|
|
195
|
-
color: var(--sl-color-text);
|
|
196
|
-
white-space: nowrap;
|
|
197
|
-
overflow: hidden;
|
|
198
|
-
text-overflow: ellipsis;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.subheader-crumb {
|
|
202
|
-
flex-shrink: 0;
|
|
203
|
-
font-size: 0.875rem;
|
|
204
|
-
color: var(--sl-color-gray-4);
|
|
205
|
-
white-space: nowrap;
|
|
206
|
-
overflow: hidden;
|
|
207
|
-
text-overflow: ellipsis;
|
|
208
|
-
max-width: 14rem;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.subheader-sep {
|
|
212
|
-
flex-shrink: 0;
|
|
213
|
-
color: var(--sl-color-gray-3);
|
|
214
|
-
font-size: 0.875rem;
|
|
215
|
-
user-select: none;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/* ── Right side: links ──────────────────────────────────────────────────── */
|
|
219
|
-
|
|
220
|
-
.subheader-right {
|
|
221
|
-
flex-shrink: 0;
|
|
222
|
-
display: flex;
|
|
223
|
-
flex-direction: row;
|
|
224
|
-
align-items: center;
|
|
225
|
-
gap: 0.5rem;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.subheader-links {
|
|
229
|
-
display: flex;
|
|
230
|
-
flex-direction: row;
|
|
231
|
-
align-items: center;
|
|
232
|
-
flex-wrap: nowrap;
|
|
233
|
-
gap: 0;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.product-link {
|
|
237
|
-
font-size: 0.75rem;
|
|
238
|
-
color: var(--sl-color-gray-2);
|
|
239
|
-
text-decoration: none;
|
|
240
|
-
white-space: nowrap;
|
|
241
|
-
padding-inline: 0.25rem;
|
|
242
|
-
line-height: 1;
|
|
243
|
-
transition: color 0.15s;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.product-link:hover,
|
|
247
|
-
.product-link:focus-visible {
|
|
248
|
-
color: var(--sl-color-text-accent);
|
|
249
|
-
text-decoration: underline;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.product-sep {
|
|
253
|
-
flex-shrink: 0;
|
|
254
|
-
font-size: 0.6875rem;
|
|
255
|
-
color: var(--sl-color-gray-4);
|
|
256
|
-
padding-inline: 0.125rem;
|
|
257
|
-
line-height: 1;
|
|
258
|
-
user-select: none;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/* ── Mobile toggle (hidden on desktop) ─────────────────────────────────── */
|
|
262
|
-
|
|
263
|
-
.subheader-toggle {
|
|
264
|
-
display: none;
|
|
265
|
-
flex-shrink: 0;
|
|
266
|
-
padding: 0.25rem;
|
|
267
|
-
background: none;
|
|
268
|
-
border: none;
|
|
269
|
-
border-radius: 0.25rem;
|
|
270
|
-
color: var(--sl-color-text);
|
|
271
|
-
cursor: pointer;
|
|
272
|
-
line-height: 0;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/* ══ Mobile (≤ 50rem) ══════════════════════════════════════════════════════ */
|
|
276
|
-
|
|
277
|
-
@media (max-width: 50rem) {
|
|
278
|
-
.subheader-right {
|
|
279
|
-
display: none;
|
|
280
|
-
position: absolute;
|
|
281
|
-
top: 100%;
|
|
282
|
-
left: 0;
|
|
283
|
-
right: 0;
|
|
284
|
-
flex-direction: column;
|
|
285
|
-
align-items: stretch;
|
|
286
|
-
gap: 0.5rem;
|
|
287
|
-
padding: 0.75rem 1rem;
|
|
288
|
-
background-color: var(--sl-color-bg-nav);
|
|
289
|
-
border-bottom: 1px solid var(--sl-color-hairline-shade);
|
|
290
|
-
box-shadow: var(--sl-shadow-md);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
docs-subheader-menu[aria-expanded='true'] .subheader-right {
|
|
294
|
-
display: flex;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
.subheader-links {
|
|
298
|
-
flex-wrap: wrap;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
.product-link {
|
|
302
|
-
font-size: 0.875rem;
|
|
303
|
-
padding-block: 0.25rem;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
.subheader-toggle {
|
|
307
|
-
display: flex;
|
|
308
|
-
align-items: center;
|
|
309
|
-
justify-content: center;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.subheader-toggle:hover,
|
|
313
|
-
.subheader-toggle:focus-visible {
|
|
314
|
-
background-color: var(--sl-color-hairline);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
docs-subheader-menu[aria-expanded='true'] .subheader-toggle .icon-open { display: none; }
|
|
318
|
-
docs-subheader-menu:not([aria-expanded='true']) .subheader-toggle .icon-close { display: none; }
|
|
319
|
-
}
|
|
320
|
-
</style>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
@use 'igniteui-theming/sass/typography' as *;
|
|
2
|
+
@use '../../styles/global/breakpoints' as *;
|
|
3
|
+
|
|
4
|
+
.docs-subheader {
|
|
5
|
+
position: sticky;
|
|
6
|
+
inset: 0;
|
|
7
|
+
display: grid;
|
|
8
|
+
grid-template-columns: var(--igd-page-layout-grid);
|
|
9
|
+
align-items: center;
|
|
10
|
+
width: 100%;
|
|
11
|
+
min-height: var(--igd-header-height);
|
|
12
|
+
grid-column: 1 / -1;
|
|
13
|
+
grid-row: 1;
|
|
14
|
+
border-block-end: var(--igd-app-outline);
|
|
15
|
+
z-index: 1;
|
|
16
|
+
background-color: var(--igd-layout-sections-bg);
|
|
17
|
+
|
|
18
|
+
.igd-logo {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
height: 100%;
|
|
22
|
+
|
|
23
|
+
@media (min-width: #{$bp-mobile-horizontal-max}) {
|
|
24
|
+
padding-inline: var(--igd-padding-lg);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
svg {
|
|
28
|
+
min-width: rem(79px);
|
|
29
|
+
height: rem(22px);
|
|
30
|
+
opacity: 0;
|
|
31
|
+
transform: translateY(-4px);
|
|
32
|
+
transition: opacity 200ms ease, transform 200ms ease;
|
|
33
|
+
position: absolute;
|
|
34
|
+
|
|
35
|
+
.logo-type {
|
|
36
|
+
fill: var(--igd-logo-type);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
h1 {
|
|
41
|
+
opacity: 1;
|
|
42
|
+
transform: translateY(0);
|
|
43
|
+
transition: opacity 200ms ease, transform 200ms ease;
|
|
44
|
+
margin: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
border-inline-end: var(--igd-app-outline);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Logo area: text visible by default, logo hidden.
|
|
51
|
+
// When the GlobalNavBar scrolls out of view, .docs-subheader--pinned is added
|
|
52
|
+
// and the logo fades in while the text fades out.
|
|
53
|
+
&--pinned {
|
|
54
|
+
.igd-logo {
|
|
55
|
+
svg {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
transform: translateY(0);
|
|
58
|
+
position: relative;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
h1 {
|
|
62
|
+
opacity: 0;
|
|
63
|
+
transform: translateY(4px);
|
|
64
|
+
position: absolute;
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# DocsSubHeader
|
|
2
2
|
|
|
3
|
-
Secondary fixed header bar rendered below the `GlobalNavBar`. Contains the
|
|
3
|
+
Secondary fixed header bar rendered below the `GlobalNavBar`. Contains the Pagefind search button and platform product-switch links.
|
|
4
|
+
|
|
5
|
+
> **Note:** The breadcrumb trail was extracted into the standalone [`DocsBreadcrumb`](../DocsBreadcrumb/README.md) component and is now rendered inside the main content frame, above the page body — not in this bar.
|
|
4
6
|
|
|
5
7
|
## Import
|
|
6
8
|
|
|
@@ -12,38 +14,21 @@ import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.as
|
|
|
12
14
|
|
|
13
15
|
| Prop | Type | Default | Description |
|
|
14
16
|
|------|------|---------|-------------|
|
|
15
|
-
| `pageTitle` | `string \| null` | — | Fallback label shown when `currentSlug` is not found in the sidebar tree. |
|
|
16
|
-
| `currentSlug` | `string` | `''` | Current page slug — used to derive the breadcrumb from the sidebar. |
|
|
17
|
-
| `siteTitle` | `string` | virtual module | Override the site name shown on the left. |
|
|
18
17
|
| `productLinks` | `{ label: string; href: string; platform?: string }[]` | virtual module | Override the cross-product navigation links. |
|
|
19
|
-
| `sidebarItems` | `SidebarEntry[]` | virtual module | Override the sidebar tree used for breadcrumb generation. |
|
|
20
18
|
|
|
21
19
|
## Behaviour
|
|
22
20
|
|
|
23
|
-
- The breadcrumb is built by walking `sidebarData` (from `virtual:docs-template/site-meta`) with `getBreadcrumb()`.
|
|
24
21
|
- Product links from the virtual module are shown; the currently active platform link is hidden.
|
|
25
22
|
- The search button opens the Pagefind dialog (see `Search` component).
|
|
26
23
|
- CSS custom properties used for positioning:
|
|
27
|
-
- `--docs-global-nav-height` (default `
|
|
28
|
-
- `--docs-subheader-height` (default `
|
|
24
|
+
- `--docs-global-nav-height` (default `4.7rem`) — height of the `GlobalNavBar` above
|
|
25
|
+
- `--docs-subheader-height` (default `2.5rem`) — height of this bar
|
|
29
26
|
|
|
30
27
|
## Example
|
|
31
28
|
|
|
32
|
-
### Prop-driven (no `siteMetaIntegration` required)
|
|
33
|
-
|
|
34
29
|
```astro
|
|
35
30
|
---
|
|
36
31
|
import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.astro';
|
|
37
|
-
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
38
|
-
|
|
39
|
-
const sidebar: SidebarEntry[] = [
|
|
40
|
-
{ label: 'Getting Started', collapsed: false, items: [
|
|
41
|
-
{ label: 'Introduction', slug: '' },
|
|
42
|
-
]},
|
|
43
|
-
{ label: 'Components', collapsed: false, items: [
|
|
44
|
-
{ label: 'Toast', slug: 'components/toast' },
|
|
45
|
-
]},
|
|
46
|
-
];
|
|
47
32
|
|
|
48
33
|
const productLinks = [
|
|
49
34
|
{ label: 'Angular', href: '/angular/', platform: 'angular' },
|
|
@@ -51,23 +36,7 @@ const productLinks = [
|
|
|
51
36
|
{ label: 'Web Components', href: '/web-components/', platform: 'web-components' },
|
|
52
37
|
];
|
|
53
38
|
---
|
|
54
|
-
<DocsSubHeader
|
|
55
|
-
siteTitle="My Library"
|
|
56
|
-
productLinks={productLinks}
|
|
57
|
-
sidebarItems={sidebar}
|
|
58
|
-
currentSlug="components/toast"
|
|
59
|
-
/>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### With `siteMetaIntegration` (integration-driven)
|
|
63
|
-
|
|
64
|
-
All props are optional when the virtual module provides the data:
|
|
65
|
-
|
|
66
|
-
```astro
|
|
67
|
-
---
|
|
68
|
-
import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.astro';
|
|
69
|
-
---
|
|
70
|
-
<DocsSubHeader pageTitle="Toast" currentSlug="components/toast" />
|
|
39
|
+
<DocsSubHeader productLinks={productLinks} />
|
|
71
40
|
```
|
|
72
41
|
|
|
73
42
|
This component is used automatically inside `DocsLayout` — you only need to
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import type { MarkdownHeading } from 'astro';
|
|
13
13
|
import DocsTree from '../DocsTree/DocsTree.astro';
|
|
14
14
|
import { headingsToTreeNodes, type TocConfig } from './toTreeNodes';
|
|
15
|
+
import './DocsToc.scss';
|
|
15
16
|
|
|
16
17
|
interface Props {
|
|
17
18
|
headings?: MarkdownHeading[];
|
|
@@ -31,9 +32,9 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
|
|
|
31
32
|
---
|
|
32
33
|
|
|
33
34
|
{nodes.length > 0 && (
|
|
34
|
-
<docs-toc data-offset-target={offsetTarget}>
|
|
35
|
+
<docs-toc class="toc-sidebar" data-offset-target={offsetTarget}>
|
|
36
|
+
<h2 class="toc-sidebar__heading" id="toc-heading">{label}</h2>
|
|
35
37
|
<nav aria-labelledby="toc-heading">
|
|
36
|
-
<h2 id="toc-heading">{label}</h2>
|
|
37
38
|
<DocsTree nodes={nodes} variant="toc" />
|
|
38
39
|
</nav>
|
|
39
40
|
</docs-toc>
|
|
@@ -49,7 +50,6 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
|
|
|
49
50
|
private rafId: number | undefined;
|
|
50
51
|
private headings: HTMLElement[] = [];
|
|
51
52
|
private links: HTMLAnchorElement[] = [];
|
|
52
|
-
private parentItems: HTMLElement[] = [];
|
|
53
53
|
private currentLink: HTMLAnchorElement | undefined;
|
|
54
54
|
private offsetEl: Element | null = null;
|
|
55
55
|
private resizeObserver: ResizeObserver | undefined;
|
|
@@ -92,14 +92,15 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
|
|
|
92
92
|
this.querySelectorAll('a[aria-current]').forEach(
|
|
93
93
|
(a) => a.removeAttribute('aria-current'),
|
|
94
94
|
);
|
|
95
|
+
// Clear any stale selected state on tree items.
|
|
96
|
+
this.querySelectorAll('igc-tree-item').forEach((item) => {
|
|
97
|
+
(item as HTMLElement & { selected: boolean }).selected = false;
|
|
98
|
+
});
|
|
95
99
|
|
|
96
100
|
this.links = Array.from(this.querySelectorAll<HTMLAnchorElement>('a[href^="#"]'));
|
|
97
101
|
this.headings = this.links
|
|
98
102
|
.map((link) => document.getElementById(decodeURIComponent(link.hash.slice(1))))
|
|
99
103
|
.filter((el): el is HTMLElement => el !== null);
|
|
100
|
-
this.parentItems = Array.from(
|
|
101
|
-
this.querySelectorAll<HTMLElement>('igc-tree-item[data-has-children]'),
|
|
102
|
-
);
|
|
103
104
|
|
|
104
105
|
if (this.headings.length === 0) return;
|
|
105
106
|
|
|
@@ -135,6 +136,10 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
|
|
|
135
136
|
|
|
136
137
|
this.bindOffsetTarget();
|
|
137
138
|
this.update();
|
|
139
|
+
// Safari: getBoundingClientRect() may not reflect final layout
|
|
140
|
+
// during the first rAF (before first paint). Schedule one extra
|
|
141
|
+
// update so the initial active item is always correct.
|
|
142
|
+
requestAnimationFrame(() => this.update());
|
|
138
143
|
}
|
|
139
144
|
|
|
140
145
|
private bindOffsetTarget() {
|
|
@@ -183,14 +188,10 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
|
|
|
183
188
|
}
|
|
184
189
|
}
|
|
185
190
|
|
|
186
|
-
// Above the first heading:
|
|
191
|
+
// Above the first heading: default to the first item so there
|
|
192
|
+
// is always an active entry when at the top of the page.
|
|
187
193
|
if (activeIndex === -1) {
|
|
188
|
-
|
|
189
|
-
this.currentLink.removeAttribute('aria-current');
|
|
190
|
-
this.currentLink = undefined;
|
|
191
|
-
}
|
|
192
|
-
this.syncExpansion(undefined);
|
|
193
|
-
return;
|
|
194
|
+
activeIndex = 0;
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
this.setActive(activeIndex);
|
|
@@ -207,38 +208,39 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
|
|
|
207
208
|
private setActive(index: number) {
|
|
208
209
|
const next = this.links[index];
|
|
209
210
|
if (!next || next === this.currentLink) return;
|
|
211
|
+
|
|
212
|
+
const prevItem = this.currentLink?.closest<HTMLElement & { selected: boolean }>('igc-tree-item');
|
|
213
|
+
if (prevItem) prevItem.selected = false;
|
|
210
214
|
this.currentLink?.removeAttribute('aria-current');
|
|
215
|
+
|
|
211
216
|
next.setAttribute('aria-current', 'true');
|
|
217
|
+
const nextItem = next.closest<HTMLElement & { selected: boolean }>('igc-tree-item');
|
|
218
|
+
if (nextItem) nextItem.selected = true;
|
|
219
|
+
|
|
212
220
|
this.currentLink = next;
|
|
213
221
|
this.syncExpansion(next);
|
|
214
222
|
}
|
|
215
223
|
|
|
216
224
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
225
|
+
* Additive expansion: walk up from the active anchor through
|
|
226
|
+
* every ancestor <igc-tree-item> (including the active item
|
|
227
|
+
* itself when it has children) and ensure each is `expanded`.
|
|
228
|
+
* Items outside the active path are left untouched, so
|
|
229
|
+
* previously visited sections stay open as the user scrolls
|
|
230
|
+
* past or back. Sections the user has never reached stay
|
|
231
|
+
* collapsed.
|
|
223
232
|
*/
|
|
224
|
-
private syncExpansion(activeLink: HTMLAnchorElement
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
activePath.add(item);
|
|
234
|
-
item = item.parentElement?.closest('igc-tree-item') ?? null;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
for (const el of this.parentItems) {
|
|
238
|
-
const wantOpen = activePath.has(el);
|
|
239
|
-
if ((el as ExpandableEl).expanded !== wantOpen) {
|
|
240
|
-
(el as ExpandableEl).expanded = wantOpen;
|
|
233
|
+
private syncExpansion(activeLink: HTMLAnchorElement) {
|
|
234
|
+
let item: Element | null = activeLink.closest('igc-tree-item');
|
|
235
|
+
while (
|
|
236
|
+
item &&
|
|
237
|
+
item.tagName === 'IGC-TREE-ITEM' &&
|
|
238
|
+
this.contains(item)
|
|
239
|
+
) {
|
|
240
|
+
if (!(item as ExpandableEl).expanded) {
|
|
241
|
+
(item as ExpandableEl).expanded = true;
|
|
241
242
|
}
|
|
243
|
+
item = item.parentElement?.closest('igc-tree-item') ?? null;
|
|
242
244
|
}
|
|
243
245
|
}
|
|
244
246
|
}
|
|
@@ -258,50 +260,3 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
|
|
|
258
260
|
});
|
|
259
261
|
</script>
|
|
260
262
|
|
|
261
|
-
<style>
|
|
262
|
-
:global(:root) {
|
|
263
|
-
--ig-toc-width: 24rem;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/* .toc-sidebar and .main-frame live in DocsLayout — use :global() */
|
|
267
|
-
:global(.toc-sidebar) {
|
|
268
|
-
display: none;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/* Hide the aside entirely when DocsToc has nothing to render */
|
|
272
|
-
:global(.toc-sidebar:not(:has(docs-toc))) {
|
|
273
|
-
display: none !important;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
@media (min-width: 84rem) {
|
|
277
|
-
:global(.toc-sidebar) {
|
|
278
|
-
display: block;
|
|
279
|
-
position: fixed;
|
|
280
|
-
top: var(--sl-nav-height);
|
|
281
|
-
right: 0;
|
|
282
|
-
width: var(--ig-toc-width);
|
|
283
|
-
height: calc(100vh - var(--sl-nav-height) - var(--sl-sidebar-bottom, 0px));
|
|
284
|
-
overflow-y: auto;
|
|
285
|
-
padding: 1.5rem 1rem 1.5rem 1.25rem;
|
|
286
|
-
border-inline-start: 1px solid var(--sl-color-hairline-shade, #d0d0d0);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
:global(.page:has(docs-toc) .main-frame) {
|
|
290
|
-
padding-inline-end: var(--ig-toc-width);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/* docs-toc layout — tree internals live in docs-tree.css */
|
|
295
|
-
docs-toc {
|
|
296
|
-
display: block;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
docs-toc h2 {
|
|
300
|
-
margin: 0 0 0.75rem;
|
|
301
|
-
font-size: var(--sl-text-xs, 0.75rem);
|
|
302
|
-
font-weight: 600;
|
|
303
|
-
text-transform: uppercase;
|
|
304
|
-
letter-spacing: 0.06em;
|
|
305
|
-
color: var(--sl-color-gray-3, #888);
|
|
306
|
-
}
|
|
307
|
-
</style>
|