igniteui-astro-components 0.0.26 → 0.0.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.
Files changed (93) hide show
  1. package/README.md +82 -74
  2. package/package.json +16 -9
  3. package/src/components/CopyCode/CopyCode.astro +21 -7
  4. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +33 -21
  5. package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +44 -43
  6. package/src/components/DocsBreadcrumb/README.md +10 -14
  7. package/src/components/DocsSidebar/DocsSidebar.astro +47 -45
  8. package/src/components/DocsSidebar/DocsSidebar.scss +120 -122
  9. package/src/components/DocsSidebar/README.md +25 -21
  10. package/src/components/DocsSidebar/SidebarFilterInput.astro +24 -29
  11. package/src/components/DocsSidebar/SidebarFilterInput.scss +90 -89
  12. package/src/components/DocsSidebar/SidebarLabel.astro +35 -26
  13. package/src/components/DocsSidebar/sidebar-filter.ts +93 -56
  14. package/src/components/DocsSubHeader/DocsSubHeader.astro +256 -185
  15. package/src/components/DocsSubHeader/DocsSubHeader.scss +181 -169
  16. package/src/components/DocsSubHeader/README.md +18 -16
  17. package/src/components/DocsToc/DocsToc.astro +301 -280
  18. package/src/components/DocsToc/DocsToc.scss +20 -21
  19. package/src/components/DocsToc/README.md +11 -9
  20. package/src/components/DocsToc/toTreeNodes.ts +3 -8
  21. package/src/components/DocsTree/DocsTree.astro +32 -20
  22. package/src/components/DocsTree/DocsTreeItem.astro +35 -30
  23. package/src/components/DocsTree/README.md +16 -15
  24. package/src/components/DocsTree/docs-tree.scss +267 -268
  25. package/src/components/GlobalFooter/GlobalFooter.astro +10 -10
  26. package/src/components/GlobalFooter/README.md +3 -2
  27. package/src/components/GlobalNavBar/GlobalNavBar.astro +4 -2
  28. package/src/components/GlobalNavBar/GlobalNavBar.module.scss +222 -222
  29. package/src/components/GlobalNavBar/README.md +3 -2
  30. package/src/components/LicenseIndicator/LicenseIndicator.astro +7 -5
  31. package/src/components/LicenseIndicator/LicenseIndicator.scss +3 -3
  32. package/src/components/MobileSidebarToggle/MobileSidebarToggle.astro +16 -17
  33. package/src/components/MobileSidebarToggle/README.md +3 -2
  34. package/src/components/MobileTocToggle/MobileTocToggle.astro +75 -61
  35. package/src/components/MobileTocToggle/MobileTocToggle.scss +65 -59
  36. package/src/components/Search/README.md +1 -0
  37. package/src/components/Search/Search.astro +137 -109
  38. package/src/components/Search/Search.scss +20 -20
  39. package/src/components/SearchAdvanced/README.md +21 -15
  40. package/src/components/SearchAdvanced/SearchAdvanced.astro +220 -133
  41. package/src/components/SearchAdvanced/SearchAdvanced.scss +152 -153
  42. package/src/components/mdx/ApiLink/ApiLink.astro +133 -113
  43. package/src/components/mdx/ApiLink/ApiLink.scss +9 -9
  44. package/src/components/mdx/ApiLink/README.md +26 -22
  45. package/src/components/mdx/ApiLink/api-link-index.ts +196 -173
  46. package/src/components/mdx/ApiRef/ApiRef.astro +54 -51
  47. package/src/components/mdx/ApiRef/README.md +20 -15
  48. package/src/components/mdx/Badge/Badge.astro +14 -14
  49. package/src/components/mdx/Badge/Badge.scss +61 -56
  50. package/src/components/mdx/Badge/README.md +24 -19
  51. package/src/components/mdx/DocsAside/DocsAside.astro +30 -37
  52. package/src/components/mdx/DocsAside/DocsAside.scss +82 -82
  53. package/src/components/mdx/DocsAside/README.md +22 -22
  54. package/src/components/mdx/Faq/Faq.astro +86 -0
  55. package/src/components/mdx/Faq/Faq.scss +105 -0
  56. package/src/components/mdx/Faq/FaqItem.astro +117 -0
  57. package/src/components/mdx/Faq/README.md +223 -0
  58. package/src/components/mdx/Faq/types.ts +34 -0
  59. package/src/components/mdx/PlatformBlock/PlatformBlock.astro +3 -2
  60. package/src/components/mdx/PlatformBlock/README.md +6 -8
  61. package/src/components/mdx/Sample/README.md +21 -16
  62. package/src/components/mdx/Sample/Sample.astro +97 -74
  63. package/src/components/mdx/Sample/Sample.scss +132 -132
  64. package/src/content-helper.ts +71 -72
  65. package/src/content.config.ts +1 -6
  66. package/src/integration.ts +566 -512
  67. package/src/layouts/DocsLayout/DocsLayout.astro +228 -182
  68. package/src/layouts/DocsLayout/DocsLayout.scss +261 -261
  69. package/src/layouts/DocsLayout/README.md +24 -35
  70. package/src/lib/nav-helpers.ts +88 -82
  71. package/src/lib/types.ts +76 -76
  72. package/src/llms.ts +205 -166
  73. package/src/platform.ts +312 -162
  74. package/src/plugins/rehype-heading-anchors.ts +45 -45
  75. package/src/plugins/rehype-pagefind-ignore.ts +19 -19
  76. package/src/plugins/rehype-table-wrapper.ts +30 -30
  77. package/src/plugins/remark-docfx.ts +12 -0
  78. package/src/plugins/remark-env-vars.ts +12 -4
  79. package/src/plugins/remark-md-links.ts +10 -4
  80. package/src/scripts/icon-manifest.ts +13 -5
  81. package/src/scripts/sample-widget.ts +557 -501
  82. package/src/sidebar.ts +103 -97
  83. package/src/styles/global/_code-blocks.scss +43 -44
  84. package/src/styles/global/_component-themes.scss +151 -153
  85. package/src/styles/global/_icon-gallery.scss +81 -81
  86. package/src/styles/global/_index.scss +0 -1
  87. package/src/styles/global/_markdown.scss +816 -787
  88. package/src/styles/global/_palette.scss +456 -110
  89. package/src/styles/global/_search-shared.scss +402 -398
  90. package/src/styles/global/_type-scale.scss +127 -127
  91. package/src/styles/global/_variables.scss +138 -111
  92. package/src/styles/theme.scss +49 -40
  93. package/src/virtual-modules.d.ts +11 -2
@@ -13,7 +13,13 @@
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, sidebar as sidebarData, title as siteTitle, packages as virtualPackages, selectedPackage as virtualSelectedPackage } from 'virtual:docs-template/site-meta';
16
+ import {
17
+ productLinks,
18
+ sidebar as sidebarData,
19
+ title as siteTitle,
20
+ packages as virtualPackages,
21
+ selectedPackage as virtualSelectedPackage,
22
+ } from 'virtual:docs-template/site-meta';
17
23
  import Search from '../Search/Search.astro';
18
24
  import type { SidebarEntry } from '../../lib/sidebar/types';
19
25
  import { getBreadcrumb } from '../../lib/sidebar/helpers';
@@ -28,10 +34,11 @@ const PLATFORM_ICONS: Record<string, string> = {
28
34
 
29
35
  function getPlatformIcon(text: string): string | null {
30
36
  const t = text.toLowerCase();
31
- if (t.includes('angular')) return 'angular-logo';
32
- if (t.includes('react')) return 'react-logo';
33
- if (t.includes('blazor')) return 'blazor-logo';
34
- if (t.includes('web-component') || t.includes('webcomponent') || t.includes('wc')) return 'wc-logo';
37
+ if (t.includes('angular')) return 'angular-logo';
38
+ if (t.includes('react')) return 'react-logo';
39
+ if (t.includes('blazor')) return 'blazor-logo';
40
+ if (t.includes('web-component') || t.includes('webcomponent') || t.includes('wc'))
41
+ return 'wc-logo';
35
42
  return null;
36
43
  }
37
44
 
@@ -112,14 +119,20 @@ const filteredLinks = resolvedLinks.filter((l: ProductLink) => l.platform !== cu
112
119
  type PackageEntry = string | { label: string; value?: string; href?: string };
113
120
  const rawPackages = packagesProp ?? (virtualPackages?.length > 0 ? virtualPackages : undefined);
114
121
  const packages = (rawPackages as PackageEntry[] | undefined)?.map((p: PackageEntry) =>
115
- typeof p === 'string' ? { label: p, value: p, href: undefined } : { label: p.label, value: p.value ?? p.label, href: p.href }
122
+ typeof p === 'string'
123
+ ? { label: p, value: p, href: undefined }
124
+ : { label: p.label, value: p.value ?? p.label, href: p.href },
116
125
  );
117
- const selectedPackage = selectedPackageProp ?? (virtualSelectedPackage || undefined) ?? packages?.[0]?.value;
118
- const platformIcon = PLATFORM_ICONS[selectedPackage ?? ''] ?? PLATFORM_ICONS[currentPlatform ?? ''] ?? null;
126
+ const selectedPackage =
127
+ selectedPackageProp ?? (virtualSelectedPackage || undefined) ?? packages?.[0]?.value;
128
+ const platformIcon =
129
+ PLATFORM_ICONS[selectedPackage ?? ''] ?? PLATFORM_ICONS[currentPlatform ?? ''] ?? null;
130
+ const selectedPackageLabel =
131
+ packages?.find((p) => p.value === selectedPackage)?.label ?? selectedPackage ?? '';
119
132
 
120
133
  const resolvedSidebar = (sidebarItems ?? sidebarData) as SidebarEntry[];
121
134
  const sidebarCrumbs = currentSlug ? getBreadcrumb(resolvedSidebar, currentSlug) : [];
122
- const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitle] : []);
135
+ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : pageTitle ? [pageTitle] : [];
123
136
 
124
137
  const PLATFORM_LABELS: Record<string, string> = {
125
138
  angular: 'Angular',
@@ -131,208 +144,266 @@ const platformLabel = currentPlatform ? (PLATFORM_LABELS[currentPlatform] ?? nul
131
144
  ---
132
145
 
133
146
  <docs-subheader-menu class="igd-docs-subheader" data-platform={currentPlatform ?? ''}>
134
- <div class="igd-logo">
135
- <!-- Sidebar toggle — visible only when the sidebar is hidden (tablet + mobile) -->
136
- <igc-icon-button
137
- class="subheader-sidebar-toggle"
138
- variant="flat"
139
- data-sidebar-toggle
140
- aria-label="Toggle sidebar navigation"
141
- aria-expanded="false"
142
- title="Toggle sidebar">
143
- <igc-icon name="hamburger-menu" collection="docs" aria-hidden="true"></igc-icon>
144
- </igc-icon-button>
145
- <div class="igd-logo__text">
146
- {/* Keep as <span>, not <h1> — avoids competing with the page <h1> in search. */}
147
- <span class="igd-logo-text">{logoText}</span>
148
- {platformLabel && <span class="igd-logo__platform">for {platformLabel}</span>}
149
- </div>
150
- </div>
147
+ <div class="igd-logo">
148
+ <!-- Sidebar toggle — visible only when the sidebar is hidden (tablet + mobile) -->
149
+ <igc-icon-button
150
+ class="subheader-sidebar-toggle"
151
+ variant="flat"
152
+ data-sidebar-toggle
153
+ aria-label="Toggle sidebar navigation"
154
+ aria-expanded="false"
155
+ title="Toggle sidebar"
156
+ >
157
+ <igc-icon name="hamburger-menu" collection="docs" aria-hidden="true"></igc-icon>
158
+ </igc-icon-button>
159
+ <div class="igd-logo__text">
160
+ {/* Keep as <span>, not <h1> — avoids competing with the page <h1> in search. */}
161
+ <span class="igd-logo-text">{logoText}</span>
162
+ {platformLabel && <span class="igd-logo__platform">for {platformLabel}</span>}
163
+ </div>
164
+ </div>
151
165
 
152
- <div class="igd-docs-subheader__content">
153
- <!-- Search (overridable via named slot) -->
154
- <slot name="search"><Search /></slot>
166
+ <div class="igd-docs-subheader__content">
167
+ <!-- Search (overridable via named slot) -->
168
+ <slot name="search"><Search /></slot>
155
169
 
156
- <!-- Package selector -->
157
- {packages && packages.length > 0 && (
158
- <igc-select distance="4" id="package-select" class="igd-package-select" outlined value={selectedPackage} aria-label={packageLabel}>
159
- {platformIcon && <igc-icon name={platformIcon} collection="docs" slot="prefix" aria-hidden="true"></igc-icon>}
160
- {packages.map((p) => {
161
- const icon = getPlatformIcon(p.value ?? '') ?? getPlatformIcon(p.label ?? '');
162
- return (
163
- <igc-select-item value={p.value} data-href={p.href}>
164
- {icon && <igc-icon slot="prefix" name={icon} collection="docs" aria-hidden="true"></igc-icon>}
165
- {p.label}
166
- </igc-select-item>
167
- );
168
- })}
169
- </igc-select>
170
- )}
171
-
172
- <!-- Version selector -->
173
- {versions && versions.length > 0 && (
174
- <igc-select distance="4" id="version-select" class="igd-version-select" outlined value={selectedVersion} aria-label={versionLabel}>
175
- {versions.map((v) => (
176
- <igc-select-item value={v}>{v}</igc-select-item>
177
- ))}
178
- </igc-select>
170
+ {/* Package selector */}
171
+ {
172
+ packages && packages.length > 0 && (
173
+ <>
174
+ <igc-select
175
+ distance="4"
176
+ id="package-select"
177
+ class="igd-package-select"
178
+ outlined
179
+ value={selectedPackage}
180
+ aria-label={packageLabel}
181
+ >
182
+ {platformIcon && (
183
+ <igc-icon name={platformIcon} collection="docs" slot="prefix" aria-hidden="true" />
179
184
  )}
185
+ {packages.map((p) => {
186
+ const icon = getPlatformIcon(p.value ?? '') ?? getPlatformIcon(p.label ?? '');
187
+ return (
188
+ <igc-select-item value={p.value} data-href={p.href}>
189
+ {icon && (
190
+ <igc-icon slot="prefix" name={icon} collection="docs" aria-hidden="true" />
191
+ )}
192
+ {p.label}
193
+ </igc-select-item>
194
+ );
195
+ })}
196
+ </igc-select>
197
+ <igc-tooltip
198
+ id="package-tooltip"
199
+ class="igd-package-select-tooltip"
200
+ anchor="package-select"
201
+ placement="bottom"
202
+ with-arrow
203
+ >
204
+ {selectedPackageLabel}
205
+ </igc-tooltip>
206
+ </>
207
+ )
208
+ }
180
209
 
210
+ <!-- Version selector -->
211
+ {
212
+ versions && versions.length > 0 && (
213
+ <igc-select
214
+ distance="4"
215
+ id="version-select"
216
+ class="igd-version-select"
217
+ outlined
218
+ value={selectedVersion}
219
+ aria-label={versionLabel}
220
+ >
221
+ {versions.map((v) => (
222
+ <igc-select-item value={v}>{v}</igc-select-item>
223
+ ))}
224
+ </igc-select>
225
+ )
226
+ }
181
227
 
182
- <!-- TODO WHY WE NEED THIS? -->
183
- <!--{filteredLinks.length > 0 && (-->
184
- <!-- <div class="subheader-links">-->
185
- <!-- {filteredLinks.map((link, i) => (-->
186
- <!-- <>-->
187
- <!-- {i > 0 && <span class="product-sep" aria-hidden="true">|</span>}-->
188
- <!-- <a href={link.href} class="product-link">{link.label}</a>-->
189
- <!-- </>-->
190
- <!-- ))}-->
191
- <!-- </div>-->
192
- <!--)}-->
193
- </div>
228
+ <!-- TODO WHY WE NEED THIS? -->
229
+ <!--{filteredLinks.length > 0 && (-->
230
+ <!-- <div class="subheader-links">-->
231
+ <!-- {filteredLinks.map((link, i) => (-->
232
+ <!-- <>-->
233
+ <!-- {i > 0 && <span class="product-sep" aria-hidden="true">|</span>}-->
234
+ <!-- <a href={link.href} class="product-link">{link.label}</a>-->
235
+ <!-- </>-->
236
+ <!-- ))}-->
237
+ <!-- </div>-->
238
+ <!--)}-->
239
+ </div>
194
240
  </docs-subheader-menu>
195
241
 
196
242
  <script>
197
- if (!customElements.get('docs-subheader-menu')) {
198
- class DocsSubHeaderMenu extends HTMLElement {
199
- connectedCallback() {
200
- // Package selector navigation
201
- const packageSelect = this.querySelector('#package-select');
202
- const packageTooltip = this.querySelector<any>('#package-tooltip');
203
- if (packageSelect) {
204
- // Truncates the native input value directly so the '\u2026' is baked in,
205
- // Keep the full package label in the native input and apply truncation
206
- // only as a visual style so assistive technologies still get the full text.
207
- function applyTriggerTruncation() {
208
- const igcInput = (packageSelect as any).shadowRoot?.querySelector('igc-input');
209
- const nativeInput = igcInput?.shadowRoot?.querySelector('input') as HTMLInputElement | null;
210
- if (!nativeInput || !nativeInput.value) return;
211
-
212
- const text = nativeInput.value;
213
-
214
- // Preserve the full label for accessibility and hover disclosure.
215
- nativeInput.setAttribute('aria-label', text);
216
- nativeInput.title = text;
243
+ if (!customElements.get('docs-subheader-menu')) {
244
+ class DocsSubHeaderMenu extends HTMLElement {
245
+ connectedCallback() {
246
+ // Package selector navigation
247
+ const packageSelect = this.querySelector('#package-select');
248
+ const packageTooltip = this.querySelector<any>('#package-tooltip');
249
+ if (packageSelect) {
250
+ // Truncates the native input value directly so the '\u2026' is baked in,
251
+ // Keep the full package label in the native input and apply truncation
252
+ // only as a visual style so assistive technologies still get the full text.
253
+ function applyTriggerTruncation() {
254
+ const igcInput = (packageSelect as any).shadowRoot?.querySelector('igc-input');
255
+ const nativeInput = igcInput?.shadowRoot?.querySelector(
256
+ 'input',
257
+ ) as HTMLInputElement | null;
258
+ if (!nativeInput || !nativeInput.value) return;
217
259
 
218
- // Apply truncation only to the rendered text.
219
- nativeInput.style.overflow = 'hidden';
220
- nativeInput.style.textOverflow = 'ellipsis';
221
- nativeInput.style.whiteSpace = 'nowrap';
222
- }
260
+ const text = nativeInput.value;
223
261
 
224
- // Run after igcInput's Lit render cycle settles (two rAFs = after microtasks + first paint)
225
- requestAnimationFrame(() => requestAnimationFrame(() => applyTriggerTruncation()));
262
+ // Preserve the full label for accessibility and hover disclosure.
263
+ nativeInput.setAttribute('aria-label', text);
264
+ nativeInput.title = text;
226
265
 
227
- // igcInput re-renders with the full text each time the dropdown closes;
228
- // re-apply truncation afterwards.
229
- packageSelect.addEventListener('igcClosed', () =>
230
- requestAnimationFrame(() => applyTriggerTruncation())
231
- );
266
+ // Apply truncation only to the rendered text.
267
+ nativeInput.style.overflow = 'hidden';
268
+ nativeInput.style.textOverflow = 'ellipsis';
269
+ nativeInput.style.whiteSpace = 'nowrap';
270
+ }
232
271
 
233
- packageSelect.addEventListener('igcChange', (e: Event) => {
234
- const val = (e as CustomEvent).detail?.value ?? (packageSelect as any).value;
235
- const item = packageSelect.querySelector<HTMLElement>(`igc-select-item[value="${val}"]`);
236
- const href = item?.dataset?.href;
237
- if (href) window.location.href = href;
238
- // Sync tooltip content with the new selection label
239
- if (packageTooltip) {
240
- packageTooltip.textContent = item?.textContent?.trim() ?? val;
241
- }
242
- });
243
- }
244
- // Only show the package tooltip when the label is visually truncated
245
- if (packageTooltip && packageSelect) {
246
- packageTooltip.addEventListener('igcOpening', (e: Event) => {
247
- const igcInput = (packageSelect as any).shadowRoot?.querySelector('igc-input');
248
- const nativeInput = igcInput?.shadowRoot?.querySelector('input');
249
- // Show when we applied manual truncation (ends with '\u2026') or
250
- // when there is natural CSS overflow.
251
- const truncated = nativeInput?.value?.endsWith('\u2026');
252
- const overflows = nativeInput && nativeInput.scrollWidth > nativeInput.clientWidth;
253
- if (!truncated && !overflows) {
254
- e.preventDefault();
255
- }
256
- });
257
- }
272
+ // Run after igcInput's Lit render cycle settles (two rAFs = after microtasks + first paint)
273
+ requestAnimationFrame(() => requestAnimationFrame(() => applyTriggerTruncation()));
258
274
 
259
- // Sidebar toggle
260
- const sidebarBtn = this.querySelector<HTMLButtonElement>('[data-sidebar-toggle]');
261
- if (sidebarBtn) {
262
- sidebarBtn.addEventListener('click', () => {
263
- const expanded = document.body.hasAttribute('data-sidebar-open');
264
- document.body.toggleAttribute('data-sidebar-open', !expanded);
265
- sidebarBtn.setAttribute('aria-expanded', String(!expanded));
266
- });
267
- }
275
+ // igcInput re-renders with the full text each time the dropdown closes;
276
+ // re-apply truncation afterwards.
277
+ packageSelect.addEventListener('igcClosed', () =>
278
+ requestAnimationFrame(() => applyTriggerTruncation()),
279
+ );
268
280
 
269
- // Close sidebar on Escape
270
- document.addEventListener('keyup', (e: KeyboardEvent) => {
271
- if (e.key === 'Escape' && document.body.hasAttribute('data-sidebar-open')) {
272
- document.body.removeAttribute('data-sidebar-open');
273
- sidebarBtn?.setAttribute('aria-expanded', 'false');
274
- sidebarBtn?.focus();
275
- }
276
- });
281
+ packageSelect.addEventListener('igcChange', (e: Event) => {
282
+ const val = (e as CustomEvent).detail?.value ?? (packageSelect as any).value;
283
+ const item = packageSelect.querySelector<HTMLElement>(
284
+ `igc-select-item[value="${val}"]`,
285
+ );
286
+ const href = item?.dataset?.href;
287
+ if (href) window.location.href = href;
288
+ // Sync tooltip content with the new selection label
289
+ if (packageTooltip) {
290
+ packageTooltip.textContent = item?.textContent?.trim() ?? val;
291
+ }
292
+ });
293
+ }
294
+ // Only show the package tooltip when the label is visually truncated
295
+ if (packageTooltip && packageSelect) {
296
+ // Hide tooltip when the dropdown opens
297
+ packageSelect.addEventListener('igcOpening', () => packageTooltip.hide?.());
277
298
 
278
- // Close sidebar on page navigation
279
- document.addEventListener('astro:page-load', () => {
280
- document.body.removeAttribute('data-sidebar-open');
281
- sidebarBtn?.setAttribute('aria-expanded', 'false');
282
- });
299
+ packageTooltip.addEventListener('igcOpening', (e: Event) => {
300
+ // Never show tooltip while the dropdown is open
301
+ if ((packageSelect as any).open) {
302
+ e.preventDefault();
303
+ return;
304
+ }
305
+ const igcInput = (packageSelect as any).shadowRoot?.querySelector('igc-input');
306
+ const nativeInput = igcInput?.shadowRoot?.querySelector('input');
307
+ // Show when we applied manual truncation (ends with '\u2026') or
308
+ // when there is natural CSS overflow.
309
+ const truncated = nativeInput?.value?.endsWith('\u2026');
310
+ const overflows = nativeInput && nativeInput.scrollWidth > nativeInput.clientWidth;
311
+ if (!truncated && !overflows) {
312
+ e.preventDefault();
283
313
  }
314
+ });
284
315
  }
285
316
 
286
- customElements.define('docs-subheader-menu', DocsSubHeaderMenu);
317
+ // Sidebar toggle
318
+ const sidebarBtn = this.querySelector<HTMLButtonElement>('[data-sidebar-toggle]');
319
+ if (sidebarBtn) {
320
+ sidebarBtn.addEventListener('click', () => {
321
+ const expanded = document.body.hasAttribute('data-sidebar-open');
322
+ document.body.toggleAttribute('data-sidebar-open', !expanded);
323
+ sidebarBtn.setAttribute('aria-expanded', String(!expanded));
324
+ });
325
+ }
326
+
327
+ // Close sidebar on Escape
328
+ document.addEventListener('keyup', (e: KeyboardEvent) => {
329
+ if (e.key === 'Escape' && document.body.hasAttribute('data-sidebar-open')) {
330
+ document.body.removeAttribute('data-sidebar-open');
331
+ sidebarBtn?.setAttribute('aria-expanded', 'false');
332
+ sidebarBtn?.focus();
333
+ }
334
+ });
335
+
336
+ // Close sidebar on page navigation
337
+ document.addEventListener('astro:page-load', () => {
338
+ document.body.removeAttribute('data-sidebar-open');
339
+ sidebarBtn?.setAttribute('aria-expanded', 'false');
340
+ });
341
+ }
287
342
  }
343
+
344
+ customElements.define('docs-subheader-menu', DocsSubHeaderMenu);
345
+ }
288
346
  </script>
289
347
 
290
348
  <script>
291
- import { defineComponents, IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent } from 'igniteui-webcomponents';
292
- import { registerIcons } from '../../scripts/icon-registry';
293
- defineComponents(IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent);
294
- registerIcons();
349
+ import {
350
+ defineComponents,
351
+ IgcIconComponent,
352
+ IgcIconButtonComponent,
353
+ IgcSelectComponent,
354
+ IgcSelectItemComponent,
355
+ IgcTooltipComponent,
356
+ } from 'igniteui-webcomponents';
357
+ import { registerIcons } from '../../scripts/icon-registry';
358
+ defineComponents(
359
+ IgcIconComponent,
360
+ IgcIconButtonComponent,
361
+ IgcSelectComponent,
362
+ IgcSelectItemComponent,
363
+ IgcTooltipComponent,
364
+ );
365
+ registerIcons();
295
366
 
296
- function getPlatformIcon(text: string): string | null {
297
- const t = text.toLowerCase();
298
- if (t.includes('angular')) return 'angular-logo';
299
- if (t.includes('react')) return 'react-logo';
300
- if (t.includes('blazor')) return 'blazor-logo';
301
- if (t.includes('web-component') || t.includes('webcomponent') || t.includes('wc')) return 'wc-logo';
302
- return null;
303
- }
367
+ function getPlatformIcon(text: string): string | null {
368
+ const t = text.toLowerCase();
369
+ if (t.includes('angular')) return 'angular-logo';
370
+ if (t.includes('react')) return 'react-logo';
371
+ if (t.includes('blazor')) return 'blazor-logo';
372
+ if (t.includes('web-component') || t.includes('webcomponent') || t.includes('wc'))
373
+ return 'wc-logo';
374
+ return null;
375
+ }
304
376
 
305
- function syncTriggerIcon(select: Element, val: string) {
306
- const icon = getPlatformIcon(val);
307
- let prefixIcon = select.querySelector<any>(':scope > igc-icon[slot="prefix"]');
308
- if (icon) {
309
- if (!prefixIcon) {
310
- prefixIcon = document.createElement('igc-icon') as any;
311
- prefixIcon.setAttribute('slot', 'prefix');
312
- prefixIcon.setAttribute('aria-hidden', 'true');
313
- prefixIcon.setAttribute('collection', 'docs');
314
- select.prepend(prefixIcon);
315
- }
316
- prefixIcon.setAttribute('name', icon);
317
- } else if (prefixIcon) {
318
- prefixIcon.remove();
319
- }
377
+ function syncTriggerIcon(select: Element, val: string) {
378
+ const icon = getPlatformIcon(val);
379
+ let prefixIcon = select.querySelector<any>(':scope > igc-icon[slot="prefix"]');
380
+ if (icon) {
381
+ if (!prefixIcon) {
382
+ prefixIcon = document.createElement('igc-icon') as any;
383
+ prefixIcon.setAttribute('slot', 'prefix');
384
+ prefixIcon.setAttribute('aria-hidden', 'true');
385
+ prefixIcon.setAttribute('collection', 'docs');
386
+ select.prepend(prefixIcon);
387
+ }
388
+ prefixIcon.setAttribute('name', icon);
389
+ } else if (prefixIcon) {
390
+ prefixIcon.remove();
320
391
  }
392
+ }
321
393
 
322
- function initSelectors() {
323
- const packageSelect = document.querySelector('#package-select');
324
- if (packageSelect) {
325
- packageSelect.addEventListener('igcChange', (e: Event) => {
326
- const val = (e as CustomEvent).detail?.value ?? (packageSelect as any).value;
327
- const item = packageSelect.querySelector<HTMLElement>(`igc-select-item[value="${val}"]`);
328
- syncTriggerIcon(packageSelect, val);
329
- const href = item?.dataset?.href;
330
- if (href) window.location.href = href;
331
- });
332
- }
394
+ function initSelectors() {
395
+ const packageSelect = document.querySelector('#package-select');
396
+ if (packageSelect) {
397
+ packageSelect.addEventListener('igcChange', (e: Event) => {
398
+ const val = (e as CustomEvent).detail?.value ?? (packageSelect as any).value;
399
+ const item = packageSelect.querySelector<HTMLElement>(`igc-select-item[value="${val}"]`);
400
+ syncTriggerIcon(packageSelect, val);
401
+ const href = item?.dataset?.href;
402
+ if (href) window.location.href = href;
403
+ });
333
404
  }
405
+ }
334
406
 
335
- document.addEventListener('astro:page-load', initSelectors);
336
- initSelectors();
407
+ document.addEventListener('astro:page-load', initSelectors);
408
+ initSelectors();
337
409
  </script>
338
-