igniteui-astro-components 0.0.7 → 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 (54) hide show
  1. package/package.json +4 -2
  2. package/src/assets/icons/open-link-blank.svg +1 -1
  3. package/src/assets/logos/code-sandbox.svg +14 -0
  4. package/src/assets/logos/stackblitz.svg +13 -0
  5. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +3 -3
  6. package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +13 -4
  7. package/src/components/DocsSidebar/DocsSidebar.astro +19 -8
  8. package/src/components/DocsSidebar/DocsSidebar.scss +140 -3
  9. package/src/components/DocsSidebar/SidebarFilterInput.astro +3 -4
  10. package/src/components/DocsSidebar/SidebarFilterInput.scss +9 -6
  11. package/src/components/DocsSidebar/SidebarLabel.astro +25 -4
  12. package/src/components/DocsSidebar/toTreeNodes.ts +1 -1
  13. package/src/components/DocsSubHeader/DocsSubHeader.astro +128 -302
  14. package/src/components/DocsSubHeader/DocsSubHeader.scss +115 -18
  15. package/src/components/DocsToc/DocsToc.astro +15 -7
  16. package/src/components/DocsToc/DocsToc.scss +10 -11
  17. package/src/components/DocsTree/DocsTree.astro +9 -0
  18. package/src/components/DocsTree/docs-tree.scss +146 -118
  19. package/src/components/GlobalNavBar/GlobalNavBar.module.scss +16 -1
  20. package/src/components/LicenseIndicator/LicenseIndicator.astro +19 -0
  21. package/src/components/LicenseIndicator/LicenseIndicator.scss +5 -0
  22. package/src/components/MobileTocToggle/MobileTocToggle.astro +96 -0
  23. package/src/components/MobileTocToggle/MobileTocToggle.scss +74 -0
  24. package/src/components/Search/Search.astro +45 -15
  25. package/src/components/Search/Search.scss +21 -40
  26. package/src/components/SearchAdvanced/SearchAdvanced.astro +196 -355
  27. package/src/components/SearchAdvanced/SearchAdvanced.scss +208 -0
  28. package/src/components/mdx/ApiRef/README.md +1 -1
  29. package/src/components/mdx/DocsAside/DocsAside.astro +37 -32
  30. package/src/components/mdx/DocsAside/DocsAside.scss +106 -35
  31. package/src/components/mdx/Sample/Sample.astro +55 -45
  32. package/src/components/mdx/Sample/Sample.scss +173 -30
  33. package/src/integration.ts +7 -0
  34. package/src/layouts/DocsLayout/DocsLayout.astro +81 -21
  35. package/src/layouts/DocsLayout/DocsLayout.scss +251 -46
  36. package/src/lib/sidebar/helpers.ts +14 -1
  37. package/src/lib/sidebar/types.ts +5 -7
  38. package/src/plugins/rehype-heading-anchors.ts +74 -0
  39. package/src/plugins/rehype-table-wrapper.ts +49 -0
  40. package/src/plugins/remark-docfx.ts +0 -0
  41. package/src/scripts/sample-widget.ts +107 -114
  42. package/src/styles/global/_breakpoints.scss +15 -37
  43. package/src/styles/global/_code-blocks.scss +1 -1
  44. package/src/styles/global/_component-themes.scss +99 -18
  45. package/src/styles/global/_index.scss +2 -2
  46. package/src/styles/global/_markdown.scss +552 -78
  47. package/src/styles/global/_palette.scss +8 -0
  48. package/src/styles/global/_search-shared.scss +272 -0
  49. package/src/styles/global/_type-scale.scss +2 -2
  50. package/src/styles/global/_variables.scss +55 -13
  51. package/src/styles/theme.scss +98 -11
  52. package/src/assets/icons/copy-clipboard.svg +0 -3
  53. package/src/assets/icons/filter-clear.svg +0 -1
  54. package/src/styles/custom.scss +0 -20
@@ -17,10 +17,12 @@ import './Search.scss';
17
17
  class="search-trigger"
18
18
  aria-label="Search documentation"
19
19
  title="Search (Ctrl+K)"
20
+ commandfor="search-dialog"
21
+ command="show-modal"
20
22
  >
21
23
  <igc-icon name="search" collection="docs" aria-hidden="true"></igc-icon>
22
24
  <span class="search-trigger__label">Search</span>
23
- <span class="search-trigger__hint"><span>Ctrl</span>K</span>
25
+ <kbd class="search-trigger__hint" style="display:none;"><kbd>Ctrl</kbd><kbd>K</kbd></kbd>
24
26
  </button>
25
27
 
26
28
  <script>
@@ -30,7 +32,19 @@ import './Search.scss';
30
32
  </script>
31
33
 
32
34
  <dialog id="search-dialog" class="search-dialog" aria-label="Search">
33
- <div class="search-dialog-inner">
35
+ <div class="igd-search-shell">
36
+ <div class="igd-search-mobile-bar">
37
+ <button
38
+ type="button"
39
+ class="search-trigger search-close"
40
+ aria-label="Close search"
41
+ commandfor="search-dialog"
42
+ command="close"
43
+ >
44
+ <igc-icon name="close" collection="docs" aria-hidden="true"></igc-icon>
45
+ </button>
46
+ </div>
47
+ <div class="igd-search-status" aria-live="polite"></div>
34
48
  <div id="search-pagefind"></div>
35
49
  </div>
36
50
  </dialog>
@@ -43,13 +57,10 @@ import './Search.scss';
43
57
  // State is kept on `window` so it survives re-executions.
44
58
  const _w = window as any;
45
59
 
46
- async function openSearch() {
60
+ async function loadAndMountPagefind() {
47
61
  const dialog = document.getElementById('search-dialog') as HTMLDialogElement | null;
48
62
  if (!dialog) return;
49
63
 
50
- // Load pagefind-ui.js only once — it's an IIFE that sets window.PagefindUI.
51
- // Checking window.PagefindUI avoids appending a duplicate <script> tag whose
52
- // onload never fires (cached scripts don't re-trigger onload).
53
64
  if (!_w.PagefindUI) {
54
65
  try {
55
66
  const link = Object.assign(document.createElement('link'), {
@@ -69,12 +80,10 @@ import './Search.scss';
69
80
  console.error('[Search] pagefind failed to load:', err);
70
81
  const el = document.getElementById('search-pagefind');
71
82
  if (el) el.textContent = 'Search index not available — run a production build first.';
72
- dialog.showModal();
73
83
  return;
74
84
  }
75
85
  }
76
86
 
77
- // Mount the UI if the container is empty (first open, or after DOM swap).
78
87
  const container = document.getElementById('search-pagefind');
79
88
  if (container && !container.firstChild) {
80
89
  try {
@@ -91,21 +100,41 @@ import './Search.scss';
91
100
  }
92
101
  }
93
102
 
94
- dialog.showModal();
95
103
  requestAnimationFrame(() => {
96
104
  (dialog.querySelector('input') as HTMLInputElement | null)?.focus();
97
105
  });
98
106
  }
99
107
 
100
- // All listeners go on `document` so they survive ClientRouter DOM swaps.
101
- // The window flag ensures they are registered only once (script runs once,
102
- // but guard is here for safety in case the behaviour changes).
108
+ async function openSearch() {
109
+ const dialog = document.getElementById('search-dialog') as HTMLDialogElement | null;
110
+ if (!dialog) return;
111
+ await loadAndMountPagefind();
112
+ dialog.showModal();
113
+ }
114
+
103
115
  if (!_w.__searchListeners) {
104
116
  _w.__searchListeners = true;
105
117
 
106
- // Button click — delegate so the listener survives trigger DOM replacement.
107
- document.addEventListener('click', (e) => {
108
- if ((e.target as Element | null)?.closest('#search-trigger')) openSearch();
118
+ function updateSearchHint() {
119
+ const hint = document.querySelector<HTMLElement>('kbd.search-trigger__hint');
120
+ if (!hint) return;
121
+ const isMac = /Mac|iPhone|iPod|iPad/i.test(navigator.userAgent);
122
+ const modKey = hint.querySelector('kbd');
123
+ if (modKey) modKey.textContent = isMac ? '\u2318' : 'Ctrl';
124
+ const btn = document.getElementById('search-trigger');
125
+ btn?.setAttribute('aria-keyshortcuts', isMac ? 'Meta+K' : 'Control+K');
126
+ btn?.setAttribute('title', isMac ? 'Search (\u2318K)' : 'Search (Ctrl+K)');
127
+ hint.style.display = '';
128
+ }
129
+ updateSearchHint();
130
+
131
+ // Declarative show-modal via commandfor fires a `command` event on the dialog —
132
+ // use it to load page find and focus the input.
133
+ document.addEventListener('command', async (e: Event) => {
134
+ const ce = e as CommandEvent;
135
+ if (ce.target instanceof HTMLDialogElement && ce.target.id === 'search-dialog') {
136
+ await loadAndMountPagefind();
137
+ }
109
138
  });
110
139
 
111
140
  // Keyboard shortcut
@@ -127,6 +156,7 @@ import './Search.scss';
127
156
  document.addEventListener('astro:page-load', () => {
128
157
  const dialog = document.getElementById('search-dialog') as HTMLDialogElement | null;
129
158
  dialog?.close();
159
+ updateSearchHint();
130
160
  });
131
161
  }
132
162
  </script>
@@ -1,50 +1,31 @@
1
- @use '../../styles/global/breakpoints' as *;
2
- @use 'igniteui-theming/sass/typography' as *;
1
+ @use 'igniteui-theming' as *;
2
+ @use '../../styles/global/search-shared' as *;
3
3
 
4
- .search-trigger {
5
- --ig-size: 1;
6
-
7
- width: 100%;
8
- max-width: rem(330px);
9
- display: flex;
10
- height: 100%;
11
- align-items: center;
4
+ @layer components {
5
+
6
+ .search-dialog {
7
+ @include search-dialog-base-styles;
8
+ background: var(--igd-layout-sections-bg);
9
+ color: inherit;
12
10
  border: none;
13
- border-inline-end: var(--igd-app-outline);
14
- padding-inline: var(--igd-padding-sm);
15
- gap: rem(8px);
16
- white-space: nowrap;
17
-
18
- // Override native button styles
19
- background-color: transparent;
20
- box-shadow: none;
21
-
11
+ padding: 0;
12
+
22
13
  &:focus-visible {
23
14
  outline: none;
24
- box-shadow: inset 0 0 0 1px var(--igd-accent);
25
15
  }
26
- }
27
16
 
28
- .search-trigger__hint {
29
- @include type-style('subtitle-1') {
30
- margin: 0;
31
- };
32
-
33
- display: flex;
34
- align-items: center;
35
- margin-inline-start: auto;
36
-
37
- span {
38
- @include type-style('detail-1', false) {
39
- margin: 0;
40
- };
17
+ &::backdrop {
18
+ @include search-dialog-backdrop;
19
+ @include search-dialog-backdrop-open;
41
20
  }
42
21
  }
43
22
 
44
- .search-trigger__label {
45
- @include type-style('body-2') {
46
- margin: 0;
47
- };
48
-
49
- color: var(--ig-gray-600);
23
+ // Mobile-only bar — DocsLayout.scss flips display:flex on mobile.
24
+ .igd-search-mobile-bar {
25
+ display: none;
26
+ justify-content: flex-end;
27
+ border-bottom: rem(1px) solid var(--igd-app-outline-color);
28
+ min-height: rem(48px);
29
+ }
30
+
50
31
  }