igniteui-astro-components 0.0.8 → 0.0.9

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 (30) hide show
  1. package/package.json +1 -1
  2. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +3 -3
  3. package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +12 -3
  4. package/src/components/DocsSidebar/DocsSidebar.astro +5 -1
  5. package/src/components/DocsSidebar/DocsSidebar.scss +27 -40
  6. package/src/components/DocsSidebar/SidebarFilterInput.astro +3 -4
  7. package/src/components/DocsSidebar/SidebarFilterInput.scss +2 -3
  8. package/src/components/DocsSubHeader/DocsSubHeader.astro +16 -7
  9. package/src/components/DocsSubHeader/DocsSubHeader.scss +32 -35
  10. package/src/components/DocsToc/DocsToc.astro +10 -5
  11. package/src/components/DocsToc/DocsToc.scss +10 -11
  12. package/src/components/DocsTree/docs-tree.scss +16 -9
  13. package/src/components/MobileTocToggle/MobileTocToggle.astro +96 -0
  14. package/src/components/MobileTocToggle/MobileTocToggle.scss +74 -0
  15. package/src/components/Search/Search.astro +11 -0
  16. package/src/components/Search/Search.scss +13 -0
  17. package/src/components/SearchAdvanced/SearchAdvanced.astro +17 -3
  18. package/src/components/SearchAdvanced/SearchAdvanced.scss +170 -139
  19. package/src/components/mdx/DocsAside/DocsAside.scss +11 -28
  20. package/src/components/mdx/Sample/Sample.scss +3 -3
  21. package/src/layouts/DocsLayout/DocsLayout.astro +24 -6
  22. package/src/layouts/DocsLayout/DocsLayout.scss +241 -81
  23. package/src/styles/global/_breakpoints.scss +15 -37
  24. package/src/styles/global/_component-themes.scss +8 -27
  25. package/src/styles/global/_markdown.scss +514 -452
  26. package/src/styles/global/_palette.scss +8 -7
  27. package/src/styles/global/_search-shared.scss +63 -64
  28. package/src/styles/global/_type-scale.scss +2 -2
  29. package/src/styles/global/_variables.scss +8 -21
  30. package/src/styles/theme.scss +26 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-astro-components",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
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": {
@@ -41,13 +41,13 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle
41
41
  { resolvedSiteTitle && (
42
42
  <li class="docs-breadcrumb-item docs-breadcrumb-home">
43
43
  <span>{ resolvedSiteTitle }</span>
44
- <span class="docs-breadcrumb-sep" aria-hidden="true">
45
- /
46
- </span>
47
44
  </li>
48
45
  ) }
49
46
  { crumbs.map((label, i) => (
50
47
  <li class="docs-breadcrumb-item">
48
+ <span class="docs-breadcrumb-sep" aria-hidden="true">
49
+ /
50
+ </span>
51
51
  <span class="docs-breadcrumb-crumb" title={ label }>{ label }</span>
52
52
  </li>
53
53
  )) }
@@ -17,7 +17,17 @@
17
17
  gap: rem(4px);
18
18
  list-style: none;
19
19
  padding: 0;
20
- color: var(--ig-gray-500);
20
+ color: light-dark(var(--ig-gray-700), var(--ig-gray-400));
21
+ }
22
+
23
+ [data-theme='dark'] {
24
+ .docs-breadcrumb-list {
25
+ color: var(--ig-gray-600);
26
+ }
27
+
28
+ .docs-breadcrumb-home {
29
+ color: var(--ig-gray-400);
30
+ }
21
31
  }
22
32
 
23
33
  .docs-breadcrumb-item {
@@ -29,8 +39,7 @@
29
39
  }
30
40
 
31
41
  .docs-breadcrumb-home {
32
- font-weight: 600;
33
- color: var(--ig-gray-700);
42
+ color: light-dark(var(--ig-gray-500), var(--ig-gray-600));
34
43
  flex-shrink: 0;
35
44
  }
36
45
 
@@ -9,6 +9,7 @@
9
9
  * in the <script> block below to use @infragistics/igniteui-webcomponents.
10
10
  */
11
11
  import { sidebar as sidebarData, trailingSlash as configuredTrailingSlash } from 'virtual:docs-template/site-meta';
12
+ import logoRaw from '../../assets/ig-logo.svg?raw';
12
13
  import SidebarFilterInput from './SidebarFilterInput.astro';
13
14
  import './DocsSidebar.scss';
14
15
  import SidebarLabel from './SidebarLabel.astro';
@@ -43,7 +44,10 @@ const activeId = normalizeSlug(currentSlug);
43
44
 
44
45
  <sidebar-filter class="docs-sidebar" id="docs-sidebar" data-no-results="No topics match">
45
46
  <div class="sidebar-gutter">
46
- { showFilter && <SidebarFilterInput/> }
47
+ <div class="sidebar-logo" aria-hidden="true">
48
+ <Fragment set:html={logoRaw} />
49
+ </div>
50
+ { showFilter && <SidebarFilterInput/> }
47
51
  </div>
48
52
  <div class="sidebar-scroll" data-sidebar-scroll>
49
53
  <DocsTree
@@ -1,10 +1,13 @@
1
1
  @use 'igniteui-theming/sass/typography' as *;
2
- @use '../../styles/global/breakpoints' as *;
3
2
 
3
+ @layer components {
4
+
5
+ // Desktop base. On tablet/mobile DocsLayout.scss turns this into a slide-in overlay.
4
6
  .docs-sidebar {
7
+ --igd-sidebar-z-index: 0;
5
8
  display: flex;
6
9
  flex-direction: column;
7
- z-index: 0;
10
+ z-index: var(--igd-sidebar-z-index);
8
11
  border-inline-end: var(--igd-app-outline);
9
12
  padding-inline: var(--igd-padding-md);
10
13
  padding-block: calc(var(--igd-padding-lg) + rem(14px));
@@ -16,60 +19,41 @@
16
19
  align-self: start;
17
20
  gap: rem(24px);
18
21
 
19
- // On tablet/mobile: sidebar becomes a full-height fixed overlay, hidden off-screen by default.
20
- @media (max-width: #{$bp-tablet-max}) {
21
- position: fixed;
22
- inset-block: 0;
23
- inset-inline-start: 0;
24
- height: 100dvh;
25
- max-height: 100dvh;
26
- width: min(rem(360px), 85vw);
27
- z-index: 100;
28
- transform: translateX(-100%);
29
- transition: transform 250ms ease, box-shadow 250ms ease;
30
- box-shadow: none;
31
- }
32
-
33
22
  .sidebar-gutter {
34
23
  overflow-y: hidden;
35
24
  scrollbar-gutter: stable;
36
-
25
+
37
26
  // This Makes sure the input border is visible
38
27
  // This is the height of the input in fluent theme + 8px padding
39
28
  // TODO this can be made smart using a css variable to override the original height of the input and used here
40
29
  min-height: rem(40px);
30
+
31
+
32
+ igc-icon {
33
+ color: light-dark(var(--ig-gray-800), var(--ig-gray-300));
34
+ }
35
+
36
+ &:empty {
37
+ display: none;
38
+ }
41
39
  }
42
40
  }
43
41
 
44
- // Overlay backdrop — only visible on tablet when sidebar is open.
42
+ // Hidden by default. DocsLayout.scss reveals it on tablet/mobile when the sidebar is open.
45
43
  .docs-sidebar-backdrop {
46
44
  display: none;
47
-
48
- @media (max-width: #{$bp-tablet-max}) {
49
- display: block;
50
- position: fixed;
51
- inset: 0;
52
- z-index: 99;
53
- background: rgba(0, 0, 0, 0.4);
54
- opacity: 0;
55
- pointer-events: none;
56
- transition: opacity 250ms ease;
57
- }
58
45
  }
59
46
 
60
- // Open state — driven by data-sidebar-open on <body>
61
- body[data-sidebar-open] {
62
- @media (max-width: #{$bp-tablet-max}) {
63
- overflow: hidden;
47
+ .sidebar-logo {
48
+ display: none;
49
+ margin-block-end: rem(8px);
50
+ padding-inline-start: rem(20px);
64
51
 
65
- .docs-sidebar {
66
- transform: translateX(0);
67
- box-shadow: var(--ig-elevation-8);
68
- }
52
+ > svg {
53
+ width: rem(79px);
69
54
 
70
- .docs-sidebar-backdrop {
71
- opacity: 1;
72
- pointer-events: auto;
55
+ .logo-type {
56
+ fill: var(--igd-logo-type);
73
57
  }
74
58
  }
75
59
  }
@@ -166,3 +150,6 @@ body[data-sidebar-open] {
166
150
  gap: rem(4px);
167
151
  margin-left: auto;
168
152
  }
153
+
154
+ }
155
+
@@ -31,9 +31,8 @@ import './SidebarFilterInput.scss';
31
31
  </igc-input>
32
32
 
33
33
  <p role="status"
34
- aria-atomic="true"
35
- class="sidebar-filter-status"
36
- data-sidebar-filter-status>
37
- </p>
34
+ aria-atomic="true"
35
+ class="sidebar-filter-status"
36
+ data-sidebar-filter-status></p>
38
37
 
39
38
 
@@ -5,7 +5,7 @@ igc-input {
5
5
  --ig-input-group-input-suffix-color--filled: light-dark(var(--ig-gray-900), var(--ig-gray-800));
6
6
  --ig-input-group-input-suffix-color--focused: light-dark(var(--ig-gray-900), var(--ig-gray-800));
7
7
  --ig-input-group-idle-text-color: light-dark(var(--ig-gray-900), var(--ig-gray-800));
8
- --ig-input-group-filled-text-color: light-dark(var(--ig-gray-900), var(--ig-gray-50));
8
+ --ig-input-group-filled-text-color: light-dark(var(--ig-gray-900), var(--ig-gray-900));
9
9
  --ig-input-group-placeholder-color: var(--ig-gray-500);
10
10
  --ig-input-group-hover-placeholder-color: var(--ig-gray-500);
11
11
  --ig-flat-button-hover-background: transparent;
@@ -20,7 +20,7 @@ igc-input {
20
20
  }
21
21
 
22
22
  igc-input::part(input) {
23
- @include type-style('caption') {
23
+ @include type-style('body-2') {
24
24
  margin: 0;
25
25
  }
26
26
  }
@@ -29,7 +29,6 @@ igc-input::part(container) {
29
29
  border-inline: 0;
30
30
  border-block-start: 0;
31
31
  border-block-end: rem(1px) solid light-dark(var(--ig-gray-200), var(--ig-gray-300));
32
-
33
32
  border-radius: 0;
34
33
  padding-inline: rem(16px);
35
34
 
@@ -110,7 +110,7 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
110
110
 
111
111
  <div class="igd-logo">
112
112
  <Fragment set:html={logoRaw} />
113
- <h1 class="ig-typography__body-2">{logoText}</h1>
113
+ <h1>{logoText}</h1>
114
114
  </div>
115
115
 
116
116
  <div class="igd-docs-subheader__content">
@@ -119,7 +119,7 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
119
119
 
120
120
  <!-- Package selector (optional) -->
121
121
  {packages && packages.length > 0 && (
122
- <igc-select id="package-select" class="igd-package-select" outlined value={selectedPackage} aria-label={packageLabel}>
122
+ <igc-select distance="17" placement="bottom-end" id="package-select" class="igd-package-select" outlined value={selectedPackage} aria-label={packageLabel}>
123
123
  {platformIcon && <igc-icon name={platformIcon} collection="docs" slot="prefix" aria-hidden="true"></igc-icon>}
124
124
  {packages.map((p) => (
125
125
  <igc-select-item value={p}>{p}</igc-select-item>
@@ -129,7 +129,7 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
129
129
 
130
130
  <!-- Version selector (optional) -->
131
131
  {versions && versions.length > 0 && (
132
- <igc-select class="igd-version-select" id="version-select" outlined value={selectedVersion} aria-label={versionLabel}>
132
+ <igc-select distance="17" class="igd-version-select" id="version-select" outlined value={selectedVersion} aria-label={versionLabel}>
133
133
  {versions.map((v) => (
134
134
  <igc-select-item value={v}>{v}</igc-select-item>
135
135
  ))}
@@ -150,7 +150,7 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
150
150
  </igc-icon-button>
151
151
  )}
152
152
 
153
- <!-- Hamburger — visible only when the sidebar is hidden (tablet + mobile) -->
153
+ <!-- Sidebar toggle — visible only when the sidebar is hidden (tablet + mobile) -->
154
154
  <igc-icon-button
155
155
  class="subheader-sidebar-toggle"
156
156
  variant="flat"
@@ -158,7 +158,8 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
158
158
  aria-label="Toggle sidebar navigation"
159
159
  aria-expanded="false"
160
160
  title="Toggle sidebar">
161
- <igc-icon name="hamburger-menu" collection="docs" aria-hidden="true"></igc-icon>
161
+ <igc-icon name="dropdown-indicator-bold" collection="docs" class="toggle-icon toggle-icon--dropdown" aria-hidden="true"></igc-icon>
162
+ <igc-icon name="hamburger-menu" collection="docs" class="toggle-icon toggle-icon--hamburger" aria-hidden="true"></igc-icon>
162
163
  </igc-icon-button>
163
164
 
164
165
  <!-- TODO WHY WE NEED THIS? -->
@@ -213,6 +214,14 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
213
214
  document.documentElement.setAttribute('data-theme', next);
214
215
  const key = themeBtn.dataset.themeKey || 'docs-theme';
215
216
  try { localStorage.setItem(key, next); } catch (_) {}
217
+
218
+ // Force WebKit to repaint the document scrollbar so
219
+ // ::-webkit-scrollbar-* styles pick up the new data-theme.
220
+ const html = document.documentElement;
221
+ const saved = html.style.overflow;
222
+ html.style.overflow = 'hidden';
223
+ html.offsetHeight; // trigger reflow
224
+ html.style.overflow = saved;
216
225
  });
217
226
  }
218
227
 
@@ -221,7 +230,7 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
221
230
  if (globalNav) {
222
231
  const observer = new IntersectionObserver(
223
232
  ([entry]) => {
224
- this.classList.toggle('docs-subheader--pinned', !entry.isIntersecting);
233
+ this.classList.toggle('igd-docs-subheader--pinned', !entry.isIntersecting);
225
234
  },
226
235
  { threshold: 0 }
227
236
  );
@@ -231,7 +240,7 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
231
240
  // The observer fires mid-transition (GlobalNavBar briefly clipped)
232
241
  // and would leave --pinned set when the new page loads at scroll=0.
233
242
  document.addEventListener('astro:before-swap', () => {
234
- this.classList.remove('docs-subheader--pinned');
243
+ this.classList.remove('igd-docs-subheader--pinned');
235
244
  });
236
245
  }
237
246
  }
@@ -1,10 +1,14 @@
1
1
  @use 'igniteui-theming/sass/typography' as *;
2
- @use '../../styles/global/breakpoints' as *;
2
+
3
+ @layer components {
3
4
 
4
5
  .igd-docs-subheader {
5
6
  position: sticky;
6
7
  inset: 0;
7
8
  display: grid;
9
+
10
+ // Subgrid: mirror the parent .igd-page-layout column tracks so the logo
11
+ // column aligns with the sidebar column at all breakpoints.
8
12
  grid-template-columns: var(--igd-page-layout-grid);
9
13
  align-items: center;
10
14
  width: 100%;
@@ -15,31 +19,16 @@
15
19
  z-index: 1;
16
20
  background-color: var(--igd-layout-sections-bg);
17
21
 
18
- // On tablet the sidebar column collapses — logo+toggle share their column,
19
- // search fills the remainder. No extra column needed.
20
- @media (max-width: #{$bp-mobile-horizontal-max}) {
21
- .igd-docs-subheader {
22
- --igd-page-layout-grid: 1fr;
23
- }
24
-
25
- padding-inline-end: rem(16px);
26
- }
27
-
28
22
  .igd-logo {
29
23
  display: flex;
30
24
  align-items: center;
31
25
  height: 100%;
32
26
  padding-inline: rem(32px) rem(16px);
33
27
 
34
- @media (max-width: #{$bp-mobile-horizontal-max}) {
35
- display: none;
36
- }
37
-
38
28
  > svg {
39
29
  min-width: rem(79px);
40
30
  height: rem(22px);
41
31
  opacity: 0;
42
- transform: translateY(-4px);
43
32
  transition: opacity 200ms ease, transform 200ms ease;
44
33
  position: absolute;
45
34
 
@@ -48,11 +37,13 @@
48
37
  }
49
38
  }
50
39
 
51
- h1 {
40
+ > h1 {
41
+ @include type-style('body-2') {
42
+ margin: 0;
43
+ };
44
+
52
45
  opacity: 1;
53
- transform: translateY(0);
54
46
  transition: opacity 200ms ease, transform 200ms ease;
55
- margin: 0;
56
47
  }
57
48
 
58
49
  border-inline-end: var(--igd-app-outline);
@@ -84,28 +75,21 @@
84
75
  align-items: center;
85
76
  height: 100%;
86
77
  gap: rem(16px);
87
-
78
+
88
79
  > igc-select:first-of-type {
89
80
  margin-inline-start: auto;
90
81
  }
91
-
82
+
92
83
  &:last-child {
93
84
  margin-inline-end: rem(32px);
94
85
  }
95
-
96
- @media (max-width: #{$bp-mobile-horizontal-max}) {
97
- &:last-child {
98
- margin-inline-end: 0;
99
- }
100
- }
101
86
  }
102
87
 
103
- // Sidebar toggle button — only visible on tablet/mobile (when the sidebar is hidden).
104
- // Rendered as igc-icon-button; styled via CSS custom properties.
88
+ // Hidden by default. DocsLayout.scss reveals it on tablet/mobile (when the sidebar is hidden).
105
89
  .subheader-sidebar-toggle {
106
90
  display: none;
107
91
 
108
- --foreground: light-dark(var(--ig-gray-700), var(--ig-gray-300));
92
+ --foreground: light-dark(var(--ig-gray-900), var(--ig-gray-900));
109
93
  --background: transparent;
110
94
  --border-color: transparent;
111
95
 
@@ -118,9 +102,19 @@
118
102
  --active-foreground: var(--igd-accent);
119
103
  --active-background: transparent;
120
104
 
121
- @media (max-width: #{$bp-tablet-max}) {
105
+ .toggle-icon--hamburger {
106
+ display: none;
107
+ }
108
+ }
109
+
110
+ // When the subheader becomes sticky, swap dropdown-indicator → hamburger.
111
+ .igd-docs-subheader--pinned .subheader-sidebar-toggle {
112
+ .toggle-icon--dropdown {
113
+ display: none;
114
+ }
115
+
116
+ .toggle-icon--hamburger {
122
117
  display: flex;
123
- flex-shrink: 0;
124
118
  }
125
119
  }
126
120
 
@@ -130,13 +124,13 @@
130
124
  --background: transparent;
131
125
  --border-color: transparent;
132
126
 
133
- --hover-foreground: var(--ig-primary-100);
127
+ --hover-foreground: var(--igd-accent);
134
128
  --hover-background: transparent;
135
129
 
136
- --focus-foreground: var(--ig-primary-100);
130
+ --focus-foreground: var(--igd-accent);
137
131
  --focus-background: transparent;
138
132
 
139
- --active-foreground: var(--ig-primary-100);
133
+ --active-foreground: var(--igd-accent);
140
134
  --active-background: transparent;
141
135
 
142
136
  .theme-icon {
@@ -167,3 +161,6 @@
167
161
  }
168
162
  }
169
163
  }
164
+
165
+ }
166
+
@@ -92,9 +92,11 @@ 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.
95
+ // Clear any stale selected / active state on tree items.
96
96
  this.querySelectorAll('igc-tree-item').forEach((item) => {
97
- (item as HTMLElement & { selected: boolean }).selected = false;
97
+ const treeItem = item as HTMLElement & { selected: boolean; active: boolean };
98
+ treeItem.selected = false;
99
+ treeItem.active = false;
98
100
  });
99
101
 
100
102
  this.links = Array.from(this.querySelectorAll<HTMLAnchorElement>('a[href^="#"]'));
@@ -212,12 +214,15 @@ const nodes = headingsToTreeNodes(headings, tocConfig);
212
214
  const next = this.links[index];
213
215
  if (!next || next === this.currentLink) return;
214
216
 
215
- const prevItem = this.currentLink?.closest<HTMLElement & { selected: boolean }>('igc-tree-item');
216
- if (prevItem) prevItem.selected = false;
217
+ const prevItem = this.currentLink?.closest<HTMLElement & { selected: boolean; active: boolean }>('igc-tree-item');
218
+ if (prevItem) {
219
+ prevItem.selected = false;
220
+ prevItem.active = false;
221
+ }
217
222
  this.currentLink?.removeAttribute('aria-current');
218
223
 
219
224
  next.setAttribute('aria-current', 'true');
220
- const nextItem = next.closest<HTMLElement & { selected: boolean }>('igc-tree-item');
225
+ const nextItem = next.closest<HTMLElement & { selected: boolean; active: boolean }>('igc-tree-item');
221
226
  if (nextItem) nextItem.selected = true;
222
227
 
223
228
  this.currentLink = next;
@@ -19,15 +19,14 @@
19
19
  background-color: var(--igd-layout-sections-bg);
20
20
  }
21
21
 
22
- .ig-typography {
23
- .toc-sidebar__heading {
24
- @include type-style('body-2') {
25
- margin: 0;
26
- };
27
-
28
- color: var(--ig-gray-500);
29
- padding-block-end: rem(8px);
30
- padding-inline: rem(24px) 0;
31
- text-transform: uppercase;
32
- }
22
+
23
+ .toc-sidebar__heading {
24
+ @include type-style('body-2') {
25
+ margin: 0;
26
+ };
27
+
28
+ color: var(--ig-gray-500);
29
+ padding-block-end: rem(8px);
30
+ padding-inline: rem(24px) 0;
31
+ text-transform: uppercase;
33
32
  }
@@ -66,7 +66,7 @@ igc-tree[data-variant='toc'] igc-tree-item[selected] > [slot='label'] {
66
66
  igc-tree-item {
67
67
  --igc-tree-indentation-size: #{rem(20px)};
68
68
  --background: transparent;
69
- --foreground: light-dark(var(--ig-gray-600), var(--ig-gray-500));
69
+ --foreground: light-dark(var(--ig-gray-600), var(--ig-gray-400));
70
70
  --background-selected: transparent;
71
71
  --background-active: transparent;
72
72
  --foreground-active: var(--igd-accent);
@@ -123,6 +123,7 @@ igc-tree-item::part(indicator) {
123
123
  igc-tree-item::part(label) {
124
124
  width: 100%;
125
125
  max-height: 100%;
126
+ padding-block: rem(6px);
126
127
  }
127
128
 
128
129
  igc-tree-item[data-has-children] {
@@ -142,21 +143,27 @@ igc-tree-item[data-has-children] {
142
143
  transition: transform 0.2s ease;
143
144
  }
144
145
 
145
- igc-tree-item[aria-expanded='true'] {
146
+ igc-tree-item[aria-expanded='false'] > [slot='label'] {
146
147
  .tree-expand-icon {
147
- transform: rotate(0deg);
148
148
  color: var(--igd-accent);
149
149
  }
150
150
  }
151
151
 
152
+ igc-tree-item[aria-expanded='true'] > [slot='label'] {
153
+ .tree-expand-icon {
154
+ transform: rotate(0deg);
155
+ color: light-dark(var(--ig-gray-800), var(--ig-gray-300));
156
+ }
157
+ }
158
+
152
159
  igc-tree-item[data-has-children][data-depth='0'] {
153
160
  --igc-tree-indentation-size: 0;
154
161
  }
155
162
 
156
163
  igc-tree-item[data-has-children] {
157
- --foreground: light-dark(var(--ig-gray-900), var(--ig-gray-50));
158
- --foreground-selected: light-dark(var(--ig-gray-900), var(--ig-gray-50));
159
- --foreground-active-selected: light-dark(var(--ig-gray-900), var(--ig-gray-50));
164
+ --foreground: light-dark(var(--ig-gray-900), var(--ig-gray-600));
165
+ --foreground-selected: light-dark(var(--ig-gray-900), var(--ig-gray-600));
166
+ --foreground-active-selected: light-dark(var(--ig-gray-900), var(--ig-gray-600));
160
167
  --foreground-active: light-dark(var(--ig-gray-900), var(--ig-gray-50));
161
168
  --foreground-hover: light-dark(var(--ig-gray-900), var(--ig-gray-50));
162
169
  }
@@ -175,9 +182,9 @@ igc-tree[data-variant='sidebar'] {
175
182
  overflow: hidden;
176
183
 
177
184
  igc-tree-item[data-has-children] {
178
- --foreground: light-dark(var(--ig-gray-900), var(--ig-gray-50));
179
- --foreground-selected: light-dark(var(--ig-gray-900), var(--ig-gray-50));
180
- --foreground-active-selected: light-dark(var(--ig-gray-900), var(--ig-gray-50));
185
+ --foreground: light-dark(var(--ig-gray-900), var(--ig-gray-600));
186
+ --foreground-selected: light-dark(var(--ig-gray-900), var(--ig-gray-600));
187
+ --foreground-active-selected: light-dark(var(--ig-gray-900), var(--ig-gray-600));
181
188
  --foreground-active: light-dark(var(--ig-gray-900), var(--ig-gray-50));
182
189
  --foreground-hover: light-dark(var(--ig-gray-900), var(--ig-gray-50));
183
190
  }
@@ -0,0 +1,96 @@
1
+ ---
2
+ /**
3
+ * MobileTocToggle
4
+ *
5
+ * Mobile-only sticky row rendered below the DocsSubHeader.
6
+ * Shows "On this page" with the current active heading and a chevron.
7
+ * Tapping it opens a dropdown containing the TOC links.
8
+ *
9
+ * Hidden on tablet and above — the full DocsToc sidebar is shown there.
10
+ */
11
+ import type { MarkdownHeading } from 'astro';
12
+ import DocsTree from '../DocsTree/DocsTree.astro';
13
+ import { headingsToTreeNodes, type TocConfig } from '../DocsToc/toTreeNodes';
14
+ import './MobileTocToggle.scss';
15
+
16
+ interface Props {
17
+ headings?: MarkdownHeading[];
18
+ tocConfig?: TocConfig;
19
+ label?: string;
20
+ }
21
+
22
+ const { headings = [], tocConfig, label = 'On this page' } = Astro.props;
23
+ const nodes = headingsToTreeNodes(headings, tocConfig);
24
+ ---
25
+
26
+ {nodes.length > 0 && (
27
+ <div class="mobile-toc">
28
+ <button
29
+ class="mobile-toc__trigger"
30
+ id="mobile-toc-trigger"
31
+ aria-expanded="false"
32
+ aria-controls="mobile-toc-dropdown"
33
+ >
34
+ <span class="mobile-toc__label">{label}</span>
35
+ <span class="mobile-toc__active" id="mobile-toc-active" aria-hidden="true"></span>
36
+ <svg class="mobile-toc__chevron" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
37
+ <polyline points="6 9 12 15 18 9"></polyline>
38
+ </svg>
39
+ </button>
40
+
41
+ <div class="mobile-toc__dropdown" id="mobile-toc-dropdown" aria-hidden="true">
42
+ <nav aria-label={label}>
43
+ <DocsTree nodes={nodes} variant="toc" />
44
+ </nav>
45
+ </div>
46
+ </div>
47
+ )}
48
+
49
+ <script>
50
+ function initMobileToc() {
51
+ const trigger = document.getElementById('mobile-toc-trigger');
52
+ const dropdown = document.getElementById('mobile-toc-dropdown');
53
+ const activeLabel = document.getElementById('mobile-toc-active');
54
+ if (!trigger || !dropdown) return;
55
+
56
+ // Toggle open/close
57
+ trigger.addEventListener('click', () => {
58
+ const isOpen = dropdown.getAttribute('aria-hidden') === 'false';
59
+ dropdown.setAttribute('aria-hidden', String(isOpen));
60
+ trigger.setAttribute('aria-expanded', String(!isOpen));
61
+ });
62
+
63
+ // Close on link click
64
+ dropdown.addEventListener('click', (e) => {
65
+ if ((e.target as Element | null)?.closest('a')) {
66
+ dropdown.setAttribute('aria-hidden', 'true');
67
+ trigger.setAttribute('aria-expanded', 'false');
68
+ }
69
+ });
70
+
71
+ // Close on Escape
72
+ document.addEventListener('keyup', (e) => {
73
+ if (e.key === 'Escape' && dropdown.getAttribute('aria-hidden') === 'false') {
74
+ dropdown.setAttribute('aria-hidden', 'true');
75
+ trigger.setAttribute('aria-expanded', 'false');
76
+ trigger.focus();
77
+ }
78
+ });
79
+
80
+ // Sync active heading text from the desktop TOC scroll-spy.
81
+ // DocsToc sets aria-current="true" on the active anchor — observe that.
82
+ const syncActive = () => {
83
+ if (!activeLabel) return;
84
+ const active = document.querySelector<HTMLAnchorElement>(
85
+ '#mobile-toc-dropdown a[aria-current="true"]'
86
+ );
87
+ activeLabel.textContent = active?.textContent?.trim() ?? '';
88
+ };
89
+
90
+ const observer = new MutationObserver(syncActive);
91
+ observer.observe(dropdown, { subtree: true, attributeFilter: ['aria-current'] });
92
+ syncActive();
93
+ }
94
+
95
+ document.addEventListener('astro:page-load', initMobileToc);
96
+ </script>