igniteui-astro-components 0.0.27 → 0.0.29

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