igniteui-astro-components 0.0.4 → 0.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-astro-components",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Reusable Astro components, layouts, and integrations for Infragistics / Ignite UI documentation sites. Replaces the Starlight defaults with project-specific implementations.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -44,6 +44,7 @@
44
44
  "./components/GlobalFooter.astro": "./src/components/GlobalFooter/GlobalFooter.astro",
45
45
  "./components/DocsSubHeader.astro": "./src/components/DocsSubHeader/DocsSubHeader.astro",
46
46
  "./components/Search.astro": "./src/components/Search/Search.astro",
47
+ "./components/SearchAdvanced.astro": "./src/components/SearchAdvanced/SearchAdvanced.astro",
47
48
  "./components/ThemingWidget.astro": "./src/components/ThemingWidget/ThemingWidget.astro",
48
49
  "./components/MobileSidebarToggle.astro": "./src/components/MobileSidebarToggle/MobileSidebarToggle.astro",
49
50
  "./components/DocsToc.astro": "./src/components/DocsToc/DocsToc.astro",
@@ -64,10 +65,10 @@
64
65
  "./components/mdx/Sample.astro": "./src/components/mdx/Sample/Sample.astro",
65
66
  "./lib/sidebar/types": "./src/lib/sidebar/types.ts",
66
67
  "./lib/sidebar/helpers": "./src/lib/sidebar/helpers.ts",
67
- "./lib/platform-context": "./src/lib/platform-context.ts",
68
+ "./lib/types": "./src/lib/types.ts",
68
69
  "./plugins/remark-docfx": "./src/plugins/remark-docfx.ts",
69
70
  "./styles/custom.scss": "./src/styles/custom.scss",
70
- "./styles/ig-theme.scss": "./src/styles/ig-theme.scss",
71
+ "./styles/theme.scss": "./src/styles/theme.scss",
71
72
  "./package.json": "./package.json"
72
73
  },
73
74
  "peerDependencies": {
@@ -24,6 +24,8 @@ interface Props {
24
24
  * Useful when consuming the component without `siteMetaIntegration`.
25
25
  */
26
26
  items?: SidebarEntry[];
27
+ /** Show the filter input above the tree. Defaults to true. */
28
+ showFilter?: boolean;
27
29
  /**
28
30
  * Append trailing slash to sidebar links.
29
31
  * Defaults to the value derived from the site's `trailingSlash` Astro config
@@ -33,14 +35,14 @@ interface Props {
33
35
  }
34
36
 
35
37
  const useTrailingSlash = configuredTrailingSlash !== 'never';
36
- const { currentSlug = '', items: itemsProp, trailingSlash = useTrailingSlash } = Astro.props;
38
+ const { currentSlug = '', items: itemsProp, showFilter = true, trailingSlash = useTrailingSlash } = Astro.props;
37
39
  const items = (itemsProp ?? sidebarData) as SidebarEntry[];
38
40
  const nodes = toTreeNodes(items, currentSlug, { trailingSlash });
39
41
  const activeId = normalizeSlug(currentSlug);
40
42
  ---
41
43
 
42
44
  <sidebar-filter class="docs-sidebar" id="docs-sidebar" data-no-results="No topics match">
43
- <SidebarFilterInput/>
45
+ { showFilter && <SidebarFilterInput/> }
44
46
  <div class="sidebar-scroll" data-sidebar-scroll>
45
47
  <DocsTree
46
48
  nodes={ nodes }
@@ -74,3 +76,9 @@ const activeId = normalizeSlug(currentSlug);
74
76
  import './sidebar-filter';
75
77
  </script>
76
78
 
79
+ { showFilter === false && (
80
+ <style is:global>
81
+ #docs-sidebar [data-sidebar-filter-status] { display: none; }
82
+ </style>
83
+ ) }
84
+
@@ -104,6 +104,7 @@ type FilterInputEl = HTMLElement & { value: string; focus(): void };
104
104
  type FilterClearEl = HTMLElement & { hidden: boolean };
105
105
 
106
106
  class SidebarFilter extends HTMLElement {
107
+ private hasFilter = false;
107
108
  private input!: FilterInputEl;
108
109
  private clearBtn!: FilterClearEl;
109
110
  private status!: HTMLElement;
@@ -122,11 +123,15 @@ class SidebarFilter extends HTMLElement {
122
123
  const input = this.querySelector<FilterInputEl>('[data-sidebar-filter-input]');
123
124
  const clearBtn = this.querySelector<FilterClearEl>('[data-sidebar-filter-clear]');
124
125
  const status = this.querySelector<HTMLElement>('[data-sidebar-filter-status]');
125
- if (!input || !clearBtn || !status) return;
126
+ const hasFilter = !!(input && clearBtn && status);
127
+ this.hasFilter = hasFilter;
128
+
129
+ if (hasFilter) {
130
+ this.input = input;
131
+ this.clearBtn = clearBtn;
132
+ this.status = status;
133
+ }
126
134
 
127
- this.input = input;
128
- this.clearBtn = clearBtn;
129
- this.status = status;
130
135
  this.scrollEl = this.querySelector<HTMLElement>(SCROLL_SELECTOR);
131
136
  this.items = [...this.querySelectorAll<HTMLElement>(ITEM_SELECTOR)];
132
137
  this.groups = [...this.querySelectorAll<HTMLElement>(GROUP_SELECTOR)];
@@ -138,7 +143,7 @@ class SidebarFilter extends HTMLElement {
138
143
  safeSet(DETAILS_KEY, collectExpandedKeys(this).join('\n'));
139
144
  }
140
145
 
141
- this.bindEvents();
146
+ if (hasFilter) this.bindEvents(); else this.bindTreeEvents();
142
147
  this.restoreOnConnect();
143
148
  }
144
149
 
@@ -150,6 +155,11 @@ class SidebarFilter extends HTMLElement {
150
155
  this.input.addEventListener('keydown', this.onFilterKeydown);
151
156
  this.clearBtn.addEventListener('click', this.onClearClick);
152
157
 
158
+ this.bindTreeEvents();
159
+ }
160
+
161
+ /** Bind only the tree expand/collapse events (no filter input). */
162
+ private bindTreeEvents(): void {
153
163
  // igcItemExpanded / igcItemCollapsed are dispatched on <igc-tree> with
154
164
  // the igc-tree-item instance in event.detail — NOT in e.target.
155
165
  this.addEventListener('igcItemExpanded', this.onItemToggle as EventListener);
@@ -209,14 +219,16 @@ class SidebarFilter extends HTMLElement {
209
219
  const isClientNav = _isClientSideNav;
210
220
  _isClientSideNav = false;
211
221
 
212
- const saved = isClientNav ? safeGet(FILTER_KEY) : '';
213
- if (!isClientNav) safeRemove(FILTER_KEY);
222
+ if (this.hasFilter) {
223
+ const saved = isClientNav ? safeGet(FILTER_KEY) : '';
224
+ if (!isClientNav) safeRemove(FILTER_KEY);
214
225
 
215
- if (saved) {
216
- this.input.value = saved;
217
- this.applyFilter(saved, 'restore');
218
- } else {
219
- this.syncClearButton('');
226
+ if (saved) {
227
+ this.input.value = saved;
228
+ this.applyFilter(saved, 'restore');
229
+ } else {
230
+ this.syncClearButton('');
231
+ }
220
232
  }
221
233
 
222
234
  this.restoreScroll(isClientNav);
@@ -373,10 +385,12 @@ class SidebarFilter extends HTMLElement {
373
385
  // ── UI sync ──────────────────────────────────────────────────────────────
374
386
 
375
387
  private updateStatus(state: 'no-match' | null): void {
388
+ if (!this.hasFilter) return;
376
389
  this.status.textContent = state === 'no-match' ? (this.dataset.noResults ?? 'No topics match') : '';
377
390
  }
378
391
 
379
392
  private syncClearButton(value: string): void {
393
+ if (!this.hasFilter) return;
380
394
  this.clearBtn.hidden = value.length === 0;
381
395
  }
382
396
 
@@ -13,8 +13,11 @@
13
13
  * moved to the `DocsBreadcrumb` component, rendered inside the main frame.
14
14
  */
15
15
  import { platform as virtualPlatform } from 'virtual:docs-template/nav-html';
16
- import { productLinks } from 'virtual:docs-template/site-meta';
16
+ import { productLinks, sidebar as sidebarData, title as siteTitle } from 'virtual:docs-template/site-meta';
17
17
  import Search from '../Search/Search.astro';
18
+ import type { SidebarEntry } from '../../lib/sidebar/types';
19
+ import { getBreadcrumb } from '../../lib/sidebar/helpers';
20
+ import logoRaw from '../../assets/ig-logo.svg?raw';
18
21
  import './DocsSubHeader.scss';
19
22
 
20
23
  interface ProductLink {
@@ -24,61 +27,154 @@ interface ProductLink {
24
27
  }
25
28
 
26
29
  interface Props {
30
+ /** Fallback title if the slug is not present in the sidebar tree. */
31
+ pageTitle?: string | null;
32
+ /** Current page slug — used to derive the breadcrumb from the sidebar tree. */
33
+ currentSlug?: string;
34
+ /**
35
+ * Override the site title shown on the left. Defaults to the virtual module value.
36
+ * Useful when consuming without `siteMetaIntegration`.
37
+ */
38
+ siteTitle?: string;
27
39
  /**
28
40
  * Override the cross-product navigation links. Defaults to the virtual module value.
29
41
  * Useful when consuming without `siteMetaIntegration`.
30
42
  */
31
43
  productLinks?: ProductLink[];
44
+ /**
45
+ * Override the sidebar tree used for breadcrumb generation.
46
+ * Defaults to the virtual module value.
47
+ */
48
+ sidebarItems?: SidebarEntry[];
49
+ /** Package names for the package selector dropdown. When omitted the selector is hidden. */
50
+ packages?: string[];
51
+ /** Currently selected package (must match one of `packages`). */
52
+ selectedPackage?: string;
53
+ /** Label rendered before the package selector. Defaults to `'Package'`. */
54
+ packageLabel?: string;
55
+ /** Version labels for the version selector dropdown. When omitted the selector is hidden. */
56
+ versions?: string[];
57
+ /** Currently selected version (must match one of `versions`). */
58
+ selectedVersion?: string;
59
+ /** Label rendered before the version selector. Defaults to `'Version'`. */
60
+ versionLabel?: string;
61
+ /** Show a light/dark theme toggle button. */
62
+ showThemeToggle?: boolean;
63
+ /** `localStorage` key for persisting the theme. Defaults to `'docs-theme'`. */
64
+ themeStorageKey?: string;
32
65
  }
33
66
 
34
- const { productLinks: productLinksProp } = Astro.props;
67
+ const {
68
+ pageTitle = '',
69
+ currentSlug = '',
70
+ siteTitle: siteTitleProp,
71
+ productLinks: productLinksProp,
72
+ sidebarItems,
73
+ packages,
74
+ selectedPackage,
75
+ packageLabel = 'Package',
76
+ versions,
77
+ selectedVersion,
78
+ versionLabel = 'Version',
79
+ showThemeToggle = false,
80
+ themeStorageKey = 'docs-theme',
81
+ } = Astro.props;
82
+ const resolvedSiteTitle = siteTitleProp ?? siteTitle;
35
83
  const currentPlatform = virtualPlatform ?? null;
36
84
  const resolvedLinks = (productLinksProp ?? productLinks) as ProductLink[];
37
85
  const filteredLinks = resolvedLinks.filter((l: ProductLink) => l.platform !== currentPlatform);
38
- import logoRaw from '../../assets/ig-logo.svg?raw';
86
+
87
+ const resolvedSidebar = (sidebarItems ?? sidebarData) as SidebarEntry[];
88
+ const sidebarCrumbs = currentSlug ? getBreadcrumb(resolvedSidebar, currentSlug) : [];
89
+ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitle] : []);
39
90
  ---
40
91
 
41
- <docs-subheader-menu class="docs-subheader">
92
+ <docs-subheader-menu>
93
+ <div class="docs-subheader">
42
94
  <div class="igd-logo">
43
95
  <Fragment set:html={logoRaw} />
44
- <h1 class="ig-typography__body-2">IgniteUI</h1>
96
+ <h1 class="ig-typography__body-2">{resolvedSiteTitle}</h1>
45
97
  </div>
46
98
 
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>-->
99
+ <div class="subheader-body">
100
+
101
+ <!-- Left: title area, takes all free space -->
102
+ <!-- <div class="subheader-context">
103
+ {resolvedSiteTitle && <span class="subheader-site-title">{resolvedSiteTitle}</span>}
104
+ {crumbs.map((label: string, i: number) => (
105
+ <>
106
+ <span class="subheader-sep" aria-hidden="true">{i === 0 ? '-' : '/'}</span>
107
+ <span class="subheader-crumb" title={label}>{label}</span>
108
+ </>
109
+ ))}
110
+ </div> -->
111
+
112
+ <!-- Search (overridable via named slot) -->
113
+ <slot name="search"><Search /></slot>
114
+
115
+ <!-- Package selector (optional) -->
116
+ {packages && packages.length > 0 && (
117
+ <div class="selector-group">
118
+ <igc-select id="package-select" outlined value={selectedPackage} aria-label={packageLabel}>
119
+ {packages.map((p) => (
120
+ <igc-select-item value={p}>{p}</igc-select-item>
121
+ ))}
122
+ </igc-select>
123
+ </div>
124
+ )}
125
+
126
+ <!-- Version selector (optional) -->
127
+ {versions && versions.length > 0 && (
128
+ <div class="selector-group">
129
+ <igc-select id="version-select" outlined value={selectedVersion} aria-label={versionLabel}>
130
+ {versions.map((v) => (
131
+ <igc-select-item value={v}>{v}</igc-select-item>
132
+ ))}
133
+ </igc-select>
134
+ </div>
135
+ )}
136
+
137
+ <!-- Right: theme toggle + product links. Desktop: flex row. Mobile: absolute dropdown. -->
138
+ <div class="subheader-right" id="docs-subheader-panel">
139
+ {showThemeToggle && (
140
+ <igc-icon-button class="subheader-theme-toggle" variant="flat" data-theme-toggle data-theme-key={themeStorageKey} aria-label="Toggle theme" title="Toggle light/dark theme">
141
+ <svg class="theme-icon-light" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>
142
+ <svg class="theme-icon-dark" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
143
+ </igc-icon-button>
144
+ )}
145
+ {filteredLinks.length > 0 && (
146
+ <div class="subheader-links">
147
+ {filteredLinks.map((link, i) => (
148
+ <>
149
+ {i > 0 && <span class="product-sep" aria-hidden="true">|</span>}
150
+ <a href={link.href} class="product-link">{link.label}</a>
151
+ </>
152
+ ))}
153
+ </div>
154
+ )}
155
+ </div>
63
156
 
64
157
  <!-- 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
- <!--&gt;-->
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>-->
158
+ <button
159
+ class="subheader-toggle"
160
+ data-docs-toggle
161
+ aria-expanded="false"
162
+ aria-controls="docs-subheader-panel"
163
+ aria-label="Toggle navigation"
164
+ >
165
+ <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">
166
+ <line x1="3" y1="6" x2="21" y2="6" />
167
+ <line x1="3" y1="12" x2="21" y2="12" />
168
+ <line x1="3" y1="18" x2="21" y2="18" />
169
+ </svg>
170
+ <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">
171
+ <line x1="18" y1="6" x2="6" y2="18" />
172
+ <line x1="6" y1="6" x2="18" y2="18" />
173
+ </svg>
174
+ </button>
175
+
176
+ </div>{/* subheader-body */}
177
+ </div>{/* docs-subheader */}
82
178
  </docs-subheader-menu>
83
179
 
84
180
  <script>
@@ -112,16 +208,16 @@ import logoRaw from '../../assets/ig-logo.svg?raw';
112
208
  if (!this.contains(e.target as Node)) setExpanded(false);
113
209
  });
114
210
 
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);
211
+ // Theme toggle
212
+ const themeBtn = this.querySelector<HTMLElement>('[data-theme-toggle]');
213
+ if (themeBtn) {
214
+ themeBtn.addEventListener('click', () => {
215
+ const current = document.documentElement.getAttribute('data-theme');
216
+ const next = current === 'dark' ? 'light' : 'dark';
217
+ document.documentElement.setAttribute('data-theme', next);
218
+ const key = themeBtn.dataset.themeKey || 'docs-theme';
219
+ try { localStorage.setItem(key, next); } catch (_) {}
220
+ });
125
221
  }
126
222
  }
127
223
  }
@@ -130,3 +226,207 @@ import logoRaw from '../../assets/ig-logo.svg?raw';
130
226
  }
131
227
  </script>
132
228
 
229
+ <script>
230
+ import {
231
+ defineComponents,
232
+ IgcSelectComponent,
233
+ IgcSelectItemComponent,
234
+ IgcIconButtonComponent,
235
+ } from 'igniteui-webcomponents';
236
+
237
+ defineComponents(IgcSelectComponent, IgcSelectItemComponent, IgcIconButtonComponent);
238
+ </script>
239
+
240
+ <style>
241
+ docs-subheader-menu {
242
+ display: contents;
243
+ }
244
+
245
+ /* ── Body: flex row occupying grid column 2 ────────────────────────────── */
246
+
247
+ .subheader-body {
248
+ display: flex;
249
+ flex-direction: row;
250
+ align-items: center;
251
+ gap: 0.75rem;
252
+ padding-inline: 1rem;
253
+ overflow: visible;
254
+ min-width: 0;
255
+ }
256
+
257
+ /* ── Context (left) ────────────────────────────────────────────────────── */
258
+
259
+ .subheader-context {
260
+ flex: 1;
261
+ min-width: 0;
262
+ display: flex;
263
+ flex-direction: row;
264
+ align-items: center;
265
+ gap: 0.375rem;
266
+ overflow: hidden;
267
+ }
268
+
269
+ .subheader-site-title {
270
+ flex-shrink: 0;
271
+ font-size: 0.875rem;
272
+ font-weight: 600;
273
+ color: var(--sl-color-text-accent);
274
+ white-space: nowrap;
275
+ }
276
+
277
+ .subheader-page-title {
278
+ font-size: 0.875rem;
279
+ color: var(--sl-color-text);
280
+ white-space: nowrap;
281
+ overflow: hidden;
282
+ text-overflow: ellipsis;
283
+ }
284
+
285
+ .subheader-crumb {
286
+ flex-shrink: 0;
287
+ font-size: 0.875rem;
288
+ color: var(--sl-color-gray-4);
289
+ white-space: nowrap;
290
+ overflow: hidden;
291
+ text-overflow: ellipsis;
292
+ max-width: 14rem;
293
+ }
294
+
295
+ .subheader-sep {
296
+ flex-shrink: 0;
297
+ color: var(--sl-color-gray-3);
298
+ font-size: 0.875rem;
299
+ user-select: none;
300
+ }
301
+
302
+ /* ── Selectors (optional) ──────────────────────────────────────────────── */
303
+
304
+ .selector-group {
305
+ flex-shrink: 0;
306
+ display: flex;
307
+ align-items: center;
308
+ gap: 0.3rem;
309
+ white-space: nowrap;
310
+ }
311
+
312
+ .selector-group igc-select {
313
+ min-width: 100px;
314
+ --ig-size: 1;
315
+ }
316
+
317
+ /* ── Theme toggle (optional) ────────────────────────────────────────────── */
318
+
319
+ .subheader-theme-toggle {
320
+ --ig-size: 1;
321
+ color: var(--sl-color-text);
322
+ }
323
+
324
+ .subheader-theme-toggle .theme-icon-dark { display: none; }
325
+ :global([data-theme='dark']) .subheader-theme-toggle .theme-icon-light { display: none; }
326
+ :global([data-theme='dark']) .subheader-theme-toggle .theme-icon-dark { display: block; }
327
+
328
+ /* ── Right side: links ──────────────────────────────────────────────────── */
329
+
330
+ .subheader-right {
331
+ flex-shrink: 0;
332
+ display: flex;
333
+ flex-direction: row;
334
+ align-items: center;
335
+ gap: 0.5rem;
336
+ }
337
+
338
+ .subheader-links {
339
+ display: flex;
340
+ flex-direction: row;
341
+ align-items: center;
342
+ flex-wrap: nowrap;
343
+ gap: 0;
344
+ }
345
+
346
+ .product-link {
347
+ font-size: 0.75rem;
348
+ color: var(--sl-color-gray-2);
349
+ text-decoration: none;
350
+ white-space: nowrap;
351
+ padding-inline: 0.25rem;
352
+ line-height: 1;
353
+ transition: color 0.15s;
354
+ }
355
+
356
+ .product-link:hover,
357
+ .product-link:focus-visible {
358
+ color: var(--sl-color-text-accent);
359
+ text-decoration: underline;
360
+ }
361
+
362
+ .product-sep {
363
+ flex-shrink: 0;
364
+ font-size: 0.6875rem;
365
+ color: var(--sl-color-gray-4);
366
+ padding-inline: 0.125rem;
367
+ line-height: 1;
368
+ user-select: none;
369
+ }
370
+
371
+ /* ── Mobile toggle (hidden on desktop) ─────────────────────────────────── */
372
+
373
+ .subheader-toggle {
374
+ display: none;
375
+ flex-shrink: 0;
376
+ padding: 0.25rem;
377
+ background: none;
378
+ border: none;
379
+ border-radius: 0.25rem;
380
+ color: var(--sl-color-text);
381
+ cursor: pointer;
382
+ line-height: 0;
383
+ }
384
+
385
+ /* ══ Mobile (≤ 50rem) ══════════════════════════════════════════════════════ */
386
+
387
+ @media (max-width: 50rem) {
388
+ .selector-group { display: none; }
389
+
390
+ .subheader-right {
391
+ display: none;
392
+ position: absolute;
393
+ top: 100%;
394
+ left: 0;
395
+ right: 0;
396
+ flex-direction: column;
397
+ align-items: stretch;
398
+ gap: 0.5rem;
399
+ padding: 0.75rem 1rem;
400
+ background-color: var(--sl-color-bg-nav);
401
+ border-bottom: 1px solid var(--sl-color-hairline-shade);
402
+ box-shadow: var(--sl-shadow-md);
403
+ }
404
+
405
+ docs-subheader-menu[aria-expanded='true'] .subheader-right {
406
+ display: flex;
407
+ }
408
+
409
+ .subheader-links {
410
+ flex-wrap: wrap;
411
+ }
412
+
413
+ .product-link {
414
+ font-size: 0.875rem;
415
+ padding-block: 0.25rem;
416
+ }
417
+
418
+ .subheader-toggle {
419
+ display: flex;
420
+ align-items: center;
421
+ justify-content: center;
422
+ }
423
+
424
+ .subheader-toggle:hover,
425
+ .subheader-toggle:focus-visible {
426
+ background-color: var(--sl-color-hairline);
427
+ }
428
+
429
+ docs-subheader-menu[aria-expanded='true'] .subheader-toggle .icon-open { display: none; }
430
+ docs-subheader-menu:not([aria-expanded='true']) .subheader-toggle .icon-close { display: none; }
431
+ }
432
+ </style>
@@ -15,6 +15,21 @@ import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.as
15
15
  | Prop | Type | Default | Description |
16
16
  |------|------|---------|-------------|
17
17
  | `productLinks` | `{ label: string; href: string; platform?: string }[]` | virtual module | Override the cross-product navigation links. |
18
+ | `sidebarItems` | `SidebarEntry[]` | virtual module | Override the sidebar tree used for breadcrumb generation. |
19
+ | `packages` | `string[]` | — | Package names for the package selector dropdown. Hidden when omitted. |
20
+ | `selectedPackage` | `string` | — | Currently selected package (must match one of `packages`). |
21
+ | `packageLabel` | `string` | `'Package'` | Label rendered before the package selector. |
22
+ | `versions` | `string[]` | — | Version labels for the version selector dropdown. Hidden when omitted. |
23
+ | `selectedVersion` | `string` | — | Currently selected version (must match one of `versions`). |
24
+ | `versionLabel` | `string` | `'Version'` | Label rendered before the version selector. |
25
+ | `showThemeToggle` | `boolean` | `false` | Show a light/dark theme toggle button. |
26
+ | `themeStorageKey` | `string` | `'docs-theme'` | `localStorage` key for persisting the theme preference. |
27
+
28
+ ## Slots
29
+
30
+ | Slot | Default | Description |
31
+ |------|---------|-------------|
32
+ | `search` | `<Search />` | Override the search widget rendered in the subheader. |
18
33
 
19
34
  ## Behaviour
20
35
 
@@ -41,3 +56,29 @@ const productLinks = [
41
56
 
42
57
  This component is used automatically inside `DocsLayout` — you only need to
43
58
  mount it directly when building a custom page shell.
59
+
60
+ ### With package/version selectors and theme toggle
61
+
62
+ ```astro
63
+ ---
64
+ import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.astro';
65
+ import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.astro';
66
+ ---
67
+ <DocsSubHeader
68
+ siteTitle="Ignite UI for Angular"
69
+ packages={['igniteui-angular', 'igniteui-charts']}
70
+ selectedPackage="igniteui-angular"
71
+ packageLabel="Package"
72
+ versions={['19.1 (latest)', '18.2', '18.1']}
73
+ selectedVersion="19.1 (latest)"
74
+ versionLabel="Version"
75
+ showThemeToggle
76
+ themeStorageKey="api-docs-theme"
77
+ productLinks={[]}
78
+ >
79
+ <SearchAdvanced slot="search" showScope tabs={[]} />
80
+ </DocsSubHeader>
81
+ ```
82
+
83
+ The `#package-select` and `#version-select` elements emit native `change`
84
+ events — attach your own navigation logic via `document.getElementById`.