igniteui-astro-components 0.0.17 → 0.0.19

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 (44) hide show
  1. package/package.json +1 -1
  2. package/src/assets/icons/{chatGPT,.svg → chatgpt.svg} +0 -1
  3. package/src/assets/ig-logo.svg +1 -1
  4. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +1 -3
  5. package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +12 -3
  6. package/src/components/DocsSidebar/DocsSidebar.astro +26 -7
  7. package/src/components/DocsSidebar/DocsSidebar.scss +35 -28
  8. package/src/components/DocsSidebar/SidebarFilterInput.astro +2 -2
  9. package/src/components/DocsSidebar/SidebarFilterInput.scss +76 -51
  10. package/src/components/DocsSidebar/sidebar-filter.ts +3 -18
  11. package/src/components/DocsSubHeader/DocsSubHeader.astro +93 -114
  12. package/src/components/DocsSubHeader/DocsSubHeader.scss +69 -121
  13. package/src/components/DocsToc/DocsToc.astro +14 -10
  14. package/src/components/DocsToc/DocsToc.scss +7 -5
  15. package/src/components/DocsTree/docs-tree.scss +125 -54
  16. package/src/components/GlobalFooter/GlobalFooter.module.scss +1 -1
  17. package/src/components/GlobalNavBar/GlobalNavBar.module.scss +1 -3
  18. package/src/components/Search/Search.astro +57 -23
  19. package/src/components/Search/Search.scss +15 -21
  20. package/src/components/SearchAdvanced/SearchAdvanced.astro +87 -53
  21. package/src/components/SearchAdvanced/SearchAdvanced.scss +22 -30
  22. package/src/components/mdx/DocsAside/DocsAside.scss +10 -14
  23. package/src/layouts/DocsLayout/DocsLayout.astro +5 -5
  24. package/src/layouts/DocsLayout/DocsLayout.scss +58 -97
  25. package/src/scripts/icon-manifest.ts +73 -0
  26. package/src/scripts/icon-registry.ts +4 -35
  27. package/src/styles/global/_breakpoints.scss +0 -1
  28. package/src/styles/global/_code-blocks.scss +1 -0
  29. package/src/styles/global/_component-themes.scss +133 -125
  30. package/src/styles/global/_icon-gallery.scss +108 -0
  31. package/src/styles/global/_index.scss +1 -0
  32. package/src/styles/global/_markdown.scss +127 -16
  33. package/src/styles/global/_palette.scss +101 -101
  34. package/src/styles/global/_search-shared.scss +302 -315
  35. package/src/styles/global/_type-scale.scss +17 -17
  36. package/src/styles/global/_variables.scss +15 -6
  37. package/src/styles/theme.scss +7 -61
  38. package/src/assets/icons/classes.svg +0 -3
  39. package/src/assets/icons/enumerations.svg +0 -3
  40. package/src/assets/icons/functions.svg +0 -5
  41. package/src/assets/icons/interfaces.svg +0 -3
  42. package/src/assets/icons/type-alias.svg +0 -3
  43. package/src/assets/icons/variables.svg +0 -3
  44. /package/src/assets/icons/{palette,.svg → palette.svg} +0 -0
@@ -95,36 +95,36 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
95
95
  data-show-scope={showScope ? 'true' : 'false'}
96
96
  data-platform-icon={platformIcon ?? ''}
97
97
  >
98
- <button
99
- data-open-modal
100
- disabled
101
- aria-label={placeholder}
102
- aria-keyshortcuts="Control+K"
103
- class="search-trigger"
104
-
105
- >
106
- <igc-icon name="search" collection="docs" aria-hidden="true"></igc-icon>
107
- <span class="search-trigger__lable" aria-hidden="true">{placeholder}</span>
108
-
109
- <kbd class="search-trigger__hint" style="display: none;">
110
- <kbd>Ctrl</kbd><kbd>K</kbd>
111
- </kbd>
112
- </button>
98
+ <div class="search-decoration">
99
+ <igc-icon-button
100
+ class="search-trigger-mobile"
101
+ variant="flat"
102
+ aria-label={placeholder}
103
+ aria-haspopup="dialog"
104
+ data-open-modal
105
+ >
106
+ <igc-icon name="search" collection="docs" aria-hidden="true"></igc-icon>
107
+ </igc-icon-button>
108
+ <igc-input
109
+ data-open-modal
110
+ readonly
111
+ placeholder={placeholder}
112
+ aria-label={placeholder}
113
+ aria-keyshortcuts="Control+K"
114
+ aria-haspopup="dialog"
115
+ role="button"
116
+ class="search-trigger"
117
+ >
118
+ <igc-icon name="search" collection="docs" slot="prefix" aria-hidden="true"></igc-icon>
119
+ <kbd class="search-trigger__hint" slot="suffix" style="display: none;">
120
+ <kbd>Ctrl</kbd><kbd>K</kbd>
121
+ </kbd>
122
+ </igc-input>
123
+ </div>
113
124
 
114
125
  <igc-dialog aria-label={placeholder} class="igd-search-dialog" hide-default-action close-on-outside-click>
115
126
  <div class="igd-search-shell">
116
127
  <header class="igd-search-header">
117
- <igc-select placement="bottom-start" distance="17" id="search-scope-select" slot="prefix" class="igd-search-scope" outlined aria-label="Search scope" value="current">
118
- {platformIcon && <igc-icon id="search-scope-trigger-icon" name={platformIcon} collection="docs" slot="prefix" aria-hidden="true"></igc-icon>}
119
- <igc-select-item value="current">
120
- <span data-scope-label>Current package</span>
121
- </igc-select-item>
122
- <igc-select-item value="all">All packages</igc-select-item>
123
- </igc-select>
124
- <igc-tooltip anchor="search-scope-select" class="igd-search-scope-tooltip" placement="bottom" with-arrow></igc-tooltip>
125
-
126
- <igc-divider vertical></igc-divider>
127
-
128
128
  <igc-input
129
129
  type="text"
130
130
  class="igd-search-input"
@@ -137,22 +137,26 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
137
137
  <igc-icon-button slot="suffix" class="igd-search-clear" variant="flat" type="button" aria-label="Clear search" name="clear" collection="docs" hidden></igc-icon-button>
138
138
  </igc-input>
139
139
 
140
- <button
141
- type="button"
142
- data-close-modal
143
- class="search-trigger search-close"
144
- aria-label="Close search"
145
- >
146
- <igc-icon name="close" collection="docs" aria-hidden="true"></igc-icon>
147
- </button>
148
- </header>
149
-
150
- <igc-divider></igc-divider>
151
-
152
- <div class="igd-search-status" aria-live="polite"></div>
140
+ <igc-select placement="bottom-start" distance="17" id="search-scope-select" slot="prefix" class="igd-search-scope" outlined aria-label="Search scope" value="current">
141
+ {platformIcon && <igc-icon id="search-scope-trigger-icon" name={platformIcon} collection="docs" slot="prefix" aria-hidden="true"></igc-icon>}
142
+ <igc-select-item value="current">
143
+ <span data-scope-label>Current package</span>
144
+ </igc-select-item>
145
+ <igc-select-item value="all">All packages</igc-select-item>
146
+ </igc-select>
147
+ <igc-tooltip anchor="search-scope-select" class="igd-search-scope-tooltip" placement="bottom" with-arrow></igc-tooltip>
153
148
 
154
- <igc-tabs class="igd-search-tabs" activation="manual" hidden></igc-tabs>
155
- <igc-list class="igd-search-results--flat" hidden></igc-list>
149
+ </header>
150
+ <div class="igd-search-content">
151
+ <div class="igd-search-status" aria-live="polite"></div>
152
+ <igc-tabs class="igd-search-tabs"></igc-tabs>
153
+ <igc-list class="igd-search-results--flat" hidden></igc-list>
154
+ </div>
155
+ <footer class="igd-search-footer">
156
+ <igc-button slot="footer" data-close-modal class="search-close" variant="outlined">
157
+ Close
158
+ </igc-button>
159
+ </footer>
156
160
  </div>
157
161
  </igc-dialog>
158
162
  </api-search-advanced>
@@ -162,6 +166,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
162
166
  defineComponents,
163
167
  IgcInputComponent,
164
168
  IgcDialogComponent,
169
+ IgcButtonComponent,
165
170
  IgcSelectComponent,
166
171
  IgcSelectItemComponent,
167
172
  IgcIconButtonComponent,
@@ -178,6 +183,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
178
183
  defineComponents(
179
184
  IgcInputComponent,
180
185
  IgcDialogComponent,
186
+ IgcButtonComponent,
181
187
  IgcSelectComponent,
182
188
  IgcSelectItemComponent,
183
189
  IgcIconButtonComponent,
@@ -255,7 +261,8 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
255
261
  private tabsEl!: IgcTabsComponent;
256
262
  private statusEl!: HTMLElement;
257
263
  private flatListEl!: HTMLElement;
258
- private indexPromise: Promise<IndexedPage[]> | null = null;
264
+ private currentIndexPromise: Promise<IndexedPage[]> | null = null;
265
+ private allIndexPromise: Promise<IndexedPage[]> | null = null;
259
266
  private currentTab: string = 'all';
260
267
  private currentMatches: Map<string, Match[]> = new Map();
261
268
  private currentQuery: string = '';
@@ -294,8 +301,9 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
294
301
  }
295
302
  }
296
303
 
297
- const openBtn = this.querySelector<HTMLButtonElement>('button[data-open-modal]')!;
298
- const closeBtn = this.querySelector<HTMLButtonElement>('button[data-close-modal]')!;
304
+ const openBtn = this.querySelector<HTMLElement>('igc-input[data-open-modal]')!;
305
+ const openBtns = this.querySelectorAll<HTMLElement>('[data-open-modal]');
306
+ const closeBtn = this.querySelector<HTMLElement>('[data-close-modal]')!;
299
307
  this.dialog = this.querySelector<IgcDialogComponent>('igc-dialog')!;
300
308
  this.input = this.querySelector<IgcInputComponent>('igc-input.igd-search-input')!;
301
309
  this.clearBtn = this.querySelector<IgcIconButtonComponent>('.igd-search-clear')!;
@@ -349,19 +357,27 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
349
357
  }
350
358
 
351
359
  const open = async () => {
352
- await this.dialog.show();
360
+ const sw = window.innerWidth - document.documentElement.clientWidth;
361
+ if (sw) document.body.style.paddingRight = `${sw}px`;
353
362
  document.body.toggleAttribute('data-search-modal-open', true);
363
+ await this.dialog.show();
354
364
  this.loadIndex();
355
365
  this.input.focus();
356
366
  };
357
367
 
358
- openBtn.addEventListener('click', open);
359
- openBtn.disabled = false;
368
+ openBtns.forEach(btn => btn.addEventListener('click', open));
369
+ openBtns.forEach(btn => btn.addEventListener('keydown', (e: KeyboardEvent) => {
370
+ if (e.key === 'Enter' || e.key === ' ') {
371
+ e.preventDefault();
372
+ open();
373
+ }
374
+ }));
360
375
 
361
376
  closeBtn.addEventListener('click', () => this.closeModal());
362
377
 
363
378
  this.dialog.addEventListener('igcClosed', () => {
364
379
  document.body.toggleAttribute('data-search-modal-open', false);
380
+ document.body.style.paddingRight = '';
365
381
  });
366
382
 
367
383
  // Close dialog when a result link is clicked — covers both tab panels and the flat list
@@ -395,6 +411,9 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
395
411
  if (this.scopeSelect) {
396
412
  this.scopeSelect.addEventListener('igcChange', () => {
397
413
  this.scope = this.scopeSelect!.value === 'all' ? 'all' : 'current';
414
+ // Start loading the full index as soon as the user switches to 'all'
415
+ // so it is ready when they type (or re-run the current query).
416
+ if (this.scope === 'all') this.loadIndex();
398
417
  if (this.currentQuery) this.runSearch();
399
418
  this.syncScopeTooltip();
400
419
  });
@@ -476,9 +495,24 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
476
495
  }
477
496
 
478
497
  private loadIndex(): Promise<IndexedPage[]> {
479
- if (this.indexPromise) return this.indexPromise;
480
- this.indexPromise = this.fetchIndex();
481
- return this.indexPromise;
498
+ if (this.showScope && this.scope === 'current' && this.currentPkg && this.currentVersion) {
499
+ if (!this.currentIndexPromise) this.currentIndexPromise = this.fetchCurrentVersion();
500
+ return this.currentIndexPromise;
501
+ }
502
+ if (!this.allIndexPromise) this.allIndexPromise = this.fetchIndex();
503
+ return this.allIndexPromise;
504
+ }
505
+
506
+ private async fetchCurrentVersion(): Promise<IndexedPage[]> {
507
+ const baseUrl = this.indexUrl.replace(/[^/]*$/, '');
508
+ try {
509
+ const res = await fetch(`${baseUrl}${this.currentPkg}/${this.currentVersion}.json`);
510
+ if (!res.ok) return [];
511
+ const d = await res.json();
512
+ return Array.isArray(d?.pages) ? d.pages as IndexedPage[] : [];
513
+ } catch {
514
+ return [];
515
+ }
482
516
  }
483
517
 
484
518
  private async fetchIndex(): Promise<IndexedPage[]> {
@@ -835,7 +869,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
835
869
  }
836
870
  tabsHtml.push(
837
871
  `<igc-tab data-tab-id="all" label="All"${this.currentTab === 'all' ? ' selected' : ''}>` +
838
- `<span slot="suffix" class="igd-search-tab-count">/${totalCount}/</span>` +
872
+ `<span slot="suffix" class="igd-search-tab-count">${totalCount}</span>` +
839
873
  allContent.join('') +
840
874
  `</igc-tab>`
841
875
  );
@@ -851,7 +885,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
851
885
  const hasMore = list.length > MAX_PER_CATEGORY_TAB;
852
886
  tabsHtml.push(
853
887
  `<igc-tab data-tab-id="${cat.id}" label="${escapeHtml(cat.label)}"${isSelected ? ' selected' : ''}>` +
854
- `<span slot="suffix" class="igd-search-tab-count">/${list.length}/</span>` +
888
+ `<span slot="suffix" class="igd-search-tab-count">${list.length}</span>` +
855
889
  `<igc-list class="igd-search-results">${displayList.map(m => this.matchHtml(m)).join('')}</igc-list>` +
856
890
  (hasMore ? `<p class="igd-search-refine-hint">Showing first ${MAX_PER_CATEGORY_TAB} of ${list.length} matches &mdash; refine your search to narrow results.</p>` : '') +
857
891
  `</igc-tab>`
@@ -876,7 +910,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
876
910
  const totalCount = Array.from(this.currentMatches.values()).reduce((s, l) => s + l.length, 0);
877
911
  if (totalCount === 0) {
878
912
  this.statusEl.innerHTML = this.currentQuery
879
- ? `No results for "<strong class="igd-search-query">${escapeHtml(this.currentQuery)}</strong>".`
913
+ ? `<span>No results for "<strong class="igd-search-query">${escapeHtml(this.currentQuery)}</strong>".</span>`
880
914
  : 'No results.';
881
915
  } else {
882
916
  this.statusEl.textContent = '';
@@ -2,41 +2,26 @@
2
2
  @use '../../styles/global/search-shared' as *;
3
3
 
4
4
  @layer components {
5
+ .igd-search-shell {
6
+ grid-template-rows: auto calc(100% - (var(--search-header-footer-height) * 1));
7
+ }
8
+
5
9
  api-search-advanced {
6
10
  display: contents;
7
11
 
8
-
9
- .igd-search-header {
10
- igc-input::part(container) {
11
- &:focus-within {
12
- box-shadow:
13
- 0 0 0 1px var(--igd-accent),
14
- inset 0 1px 0 var(--igd-accent),
15
- inset 0 -1px 0 var(--igd-accent),
16
- inset -1px 0 0 var(--igd-accent);
17
- }
18
- }
19
- }
20
-
21
-
22
12
  #search-scope-trigger-icon {
23
13
  margin-inline-start: rem(16px);
24
14
  }
25
15
  }
26
16
 
27
- .search-trigger {
28
- color: light-dark(var(--ig-gray-600), var(--ig-gray-400));
29
- }
30
-
31
17
  // TODO BUG IN THE TAB COMPONENT
32
18
  igc-tabs::part(inner) {
33
19
  flex-grow: 1;
34
-
35
20
  }
36
21
 
37
22
  igc-tabs {
38
23
  igc-divider {
39
- margin-block: rem(26px);
24
+ margin-block: rem(16px) rem(24px);
40
25
 
41
26
  &:last-of-type {
42
27
  display: none;
@@ -53,7 +38,6 @@
53
38
 
54
39
  .igd-search-tabs {
55
40
  --item-background: var(--igd-layout-sections-bg);
56
- --indicator-color: transparent;
57
41
  --button-color: var(--igd-accent);
58
42
  --button-hover-color: var(--igd-accent);
59
43
  --button-background: var(--igd-layout-sections-bg);
@@ -92,21 +76,34 @@
92
76
 
93
77
  igc-tab::part(content),
94
78
  igc-tab::part(base) {
95
- @include type-style('overline') {
79
+ @include type-style('body-2') {
96
80
  margin: 0;
97
81
  }
98
82
  }
99
83
 
84
+ igc-tab::part(base) {
85
+ gap: rem(4px);
86
+ }
87
+
100
88
  igc-tab::part(tab-body) {
101
89
  overflow-y: auto;
102
90
  flex: 1 1 auto;
103
91
  min-height: 0;
104
- padding-block: rem(26px);
92
+ padding-block: rem(16px);
93
+ padding-inline: 0;
94
+ border-block-start: var(--igd-app-outline);
105
95
  }
106
96
  }
107
97
 
108
98
  .igd-search-tab-count {
109
- color: light-dark(var(--ig-gray-500), var(--ig-gray-300));
99
+ color: light-dark(var(--ig-gray-400), var(--ig-gray-300));
100
+
101
+ &::before {
102
+ content: '(';
103
+ }
104
+ &::after {
105
+ content: ')';
106
+ }
110
107
  }
111
108
 
112
109
  .igd-search-refine-hint {
@@ -130,17 +127,12 @@
130
127
  }
131
128
 
132
129
  igc-divider {
133
- --color: light-dark(var(--ig-gray-400), var(--ig-gray-300));
130
+ --color: light-dark(var(--ig-gray-200), var(--ig-gray-300));
134
131
  }
135
132
 
136
133
  .igd-search-scope {
137
134
  max-width: rem(250px);
138
135
 
139
- &::part(input) {
140
- min-width: 0;
141
- overflow: hidden;
142
- }
143
-
144
136
  &::part(native-input) {
145
137
  min-width: 0;
146
138
  overflow: hidden;
@@ -24,6 +24,11 @@ blockquote {
24
24
  }
25
25
 
26
26
  .igd-aside__title {
27
+ @include type-style('h5') {
28
+ font-weight: bold;
29
+ margin: 0;
30
+ };
31
+
27
32
  grid-row: 1;
28
33
  grid-column: 2;
29
34
  align-self: center;
@@ -35,6 +40,11 @@ blockquote {
35
40
  }
36
41
 
37
42
  .igd-aside__content {
43
+ @include type-style('body-1') {
44
+ margin: 0;
45
+ font-weight: 400;
46
+ }
47
+
38
48
  grid-column: 2;
39
49
  grid-row: 2;
40
50
 
@@ -97,17 +107,3 @@ blockquote {
97
107
  }
98
108
 
99
109
  // TYPOGRAPHY STYLES
100
- .igd-aside__title {
101
- @include type-style('body-2') {
102
- font-weight: bold;
103
- margin: 0;
104
- };
105
-
106
- }
107
-
108
- .igd-aside__content {
109
- @include type-style('detail-1', false) {
110
- margin: 0;
111
- }
112
- }
113
-
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  import { ClientRouter } from 'astro:transitions';
3
- import '@fontsource-variable/inter/wght.css';
4
- import '@fontsource-variable/inter/wght-italic.css';
5
3
  import '@fontsource-variable/jetbrains-mono/wght.css';
6
4
  import '@fontsource-variable/jetbrains-mono/wght-italic.css';
7
5
  import GlobalNavBar from '../../components/GlobalNavBar/GlobalNavBar.astro';
@@ -9,6 +7,7 @@ import GlobalFooter from '../../components/GlobalFooter/GlobalFooter.astro';
9
7
  import DocsSubHeader from '../../components/DocsSubHeader/DocsSubHeader.astro';
10
8
  import DocsBreadcrumb from '../../components/DocsBreadcrumb/DocsBreadcrumb.astro';
11
9
  import LicenseIndicator from '../../components/LicenseIndicator/LicenseIndicator.astro';
10
+ import igLogoRaw from '../../assets/ig-logo.svg?raw';
12
11
  import MobileSidebarToggle from '../../components/MobileSidebarToggle/MobileSidebarToggle.astro';
13
12
  import CopyCode from '../../components/CopyCode/CopyCode.astro';
14
13
  import { widgetScriptSrc, platform as virtualPlatform } from 'virtual:docs-template/nav-html';
@@ -73,6 +72,7 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
73
72
  {description && <meta name="description" content={description} />}
74
73
  {keywords && <meta name="keywords" content={keywords} />}
75
74
  <link rel="icon" href="/favicon.svg" type="image/svg+xml" />
75
+ <link rel="stylesheet" href="https://use.typekit.net/bng2zgw.css" />
76
76
  {widgetScriptSrc && <script is:inline src={widgetScriptSrc} async></script>}
77
77
  {(headEntries as HeadEntry[]).map(({ tag: Tag, attrs = {}, content }) =>
78
78
  content ? <Tag {...attrs} set:html={content} /> : <Tag {...attrs} />
@@ -255,8 +255,10 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
255
255
 
256
256
  <div class="igd-main-content">
257
257
  <div class="igd-main-content__inner">
258
+
258
259
  <div class="igd-main-content__page">
259
260
  <main class="igd-main-content__markdown">
261
+ <Fragment set:html={igLogoRaw} />
260
262
  <LicenseIndicator license={licenseType} />
261
263
  <DocsBreadcrumb pageTitle={ title } currentSlug={ currentSlug } siteTitle={ siteTitleProp }/>
262
264
  <slot/>
@@ -264,9 +266,7 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
264
266
  </div>
265
267
 
266
268
  { hasToc && (
267
- <aside>
268
- <slot name="toc"/>
269
- </aside>
269
+ <slot name="toc"/>
270
270
  ) }
271
271
  </div>
272
272
  </div>