igniteui-astro-components 1.6.0 → 1.8.0
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.
- package/README.md +322 -158
- package/llms-full.txt +3207 -0
- package/llms.txt +103 -0
- package/package.json +17 -5
- package/src/assets/icons/figma-logo.svg +10 -0
- package/src/code-theme/README.md +72 -0
- package/src/code-theme/index.ts +57 -0
- package/src/components/CopyCode/CopyCode.astro +6 -1
- package/src/components/CopyCode/README.md +38 -0
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +28 -30
- package/src/components/DocsSidebar/DocsSidebar.astro +14 -2
- package/src/components/DocsSidebar/README.md +58 -30
- package/src/components/DocsSidebar/SidebarLabel.astro +34 -36
- package/src/components/DocsSidebar/sidebar-filter.ts +53 -5
- package/src/components/DocsSidebar/toTreeNodes.ts +21 -5
- package/src/components/DocsSubHeader/DocsSubHeader.astro +22 -9
- package/src/components/DocsSubHeader/README.md +37 -31
- package/src/components/DocsToc/DocsToc.astro +12 -14
- package/src/components/DocsToc/README.md +7 -7
- package/src/components/DocsTree/DocsTree.astro +9 -11
- package/src/components/DocsTree/DocsTreeItem.astro +36 -40
- package/src/components/DocsTree/README.md +12 -9
- package/src/components/GlobalFooter/GlobalFooter.astro +6 -8
- package/src/components/GlobalNavBar/GlobalNavBar.astro +2 -4
- package/src/components/LicenseIndicator/LicenseIndicator.astro +6 -8
- package/src/components/MobileTocToggle/MobileTocToggle.astro +31 -33
- package/src/components/MobileTocToggle/README.md +45 -0
- package/src/components/Search/README.md +10 -10
- package/src/components/Search/Search.astro +12 -6
- package/src/components/SearchAdvanced/README.md +15 -8
- package/src/components/SearchAdvanced/SearchAdvanced.astro +17 -15
- package/src/components/ThemingWidget/ThemingWidget.astro +62 -60
- package/src/components/mdx/Anatomy/Anatomy.scss +1 -1
- package/src/components/mdx/Anatomy/README.md +40 -0
- package/src/components/mdx/ApiLink/ApiLink.astro +7 -9
- package/src/components/mdx/ApiLink/README.md +1 -0
- package/src/components/mdx/ApiRef/ApiRef.astro +7 -9
- package/src/components/mdx/ApiRef/README.md +1 -1
- package/src/components/mdx/Badge/Badge.astro +3 -1
- package/src/components/mdx/Badge/README.md +1 -3
- package/src/components/mdx/DocsAside/DocsAside.astro +3 -5
- package/src/components/mdx/DocsAside/README.md +47 -29
- package/src/components/mdx/Faq/Faq.astro +11 -13
- package/src/components/mdx/Faq/FaqItem.astro +20 -26
- package/src/components/mdx/FigmaUiKits/FigmaUiKits.astro +126 -0
- package/src/components/mdx/FigmaUiKits/FigmaUiKits.scss +165 -0
- package/src/components/mdx/FigmaUiKits/README.md +115 -0
- package/src/components/mdx/FigmaUiKits/kits.ts +26 -0
- package/src/components/mdx/PlatformBlock/README.md +5 -18
- package/src/components/mdx/Sample/README.md +67 -50
- package/src/components/mdx/Sample/Sample.astro +108 -33
- package/src/components/mdx/Sample/Sample.scss +38 -17
- package/src/integration.ts +6 -21
- package/src/layouts/DocsLayout/README.md +63 -28
- package/src/lib/warn-once.ts +8 -0
- package/src/scripts/copy-status.ts +35 -0
- package/src/scripts/icon-manifest.ts +1 -0
- package/src/scripts/sample-widget.ts +109 -42
- package/src/styles/global/_code-blocks.scss +58 -36
- package/src/styles/global/_copy-button.scss +18 -25
- package/src/styles/global/_markdown.scss +15 -8
- package/src/styles/global/_variables.scss +57 -0
- package/src/styles/theme.scss +4 -1
- package/src/virtual-modules.d.ts +2 -2
|
@@ -26,20 +26,18 @@ const { headings = [], tocConfig, label = 'On this page', offsetTarget } = Astro
|
|
|
26
26
|
const nodes = headingsToTreeNodes(headings, tocConfig);
|
|
27
27
|
---
|
|
28
28
|
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
42
|
-
}
|
|
29
|
+
{nodes.length > 0 && (
|
|
30
|
+
<aside class="toc-wrapper" data-pagefind-ignore="all">
|
|
31
|
+
<docs-toc class="toc-sidebar" data-offset-target={offsetTarget}>
|
|
32
|
+
<h2 class="toc-sidebar__heading" id="toc-heading">
|
|
33
|
+
{label}
|
|
34
|
+
</h2>
|
|
35
|
+
<nav aria-labelledby="toc-heading">
|
|
36
|
+
<DocsTree nodes={nodes} variant="toc" />
|
|
37
|
+
</nav>
|
|
38
|
+
</docs-toc>
|
|
39
|
+
</aside>
|
|
40
|
+
)}
|
|
43
41
|
|
|
44
42
|
<script>
|
|
45
43
|
type ExpandableEl = HTMLElement & { expanded: boolean };
|
|
@@ -12,12 +12,12 @@ import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
|
12
12
|
|
|
13
13
|
## Props
|
|
14
14
|
|
|
15
|
-
| Prop | Type | Default | Description
|
|
16
|
-
| -------------- | ----------------------------------------------------------------- | ---------------- |
|
|
17
|
-
| `headings` | `MarkdownHeading[]` | `[]` | Array of headings from Astro's `getHeadings()` or MDX frontmatter.
|
|
18
|
-
| `tocConfig` | `false \| { minHeadingLevel?: number; maxHeadingLevel?: number }` | — | Pass `false` to disable the TOC entirely.
|
|
19
|
-
| `label` | `string` | `'On this page'` | Heading label rendered above the list.
|
|
20
|
-
| `offsetTarget` | `string` | — | CSS selector for a sticky element (e.g. a nav bar). Its bottom edge is used as the scroll-spy threshold and sets `scroll-padding-top` automatically. |
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| -------------- | ----------------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `headings` | `MarkdownHeading[]` | `[]` | Array of headings from Astro's `getHeadings()` or MDX frontmatter. |
|
|
18
|
+
| `tocConfig` | `false \| { minHeadingLevel?: number; maxHeadingLevel?: number }` | — | Pass `false` to disable the TOC entirely. |
|
|
19
|
+
| `label` | `string` | `'On this page'` | Heading label rendered above the list. |
|
|
20
|
+
| `offsetTarget` | `string` | — | CSS selector for a sticky element (e.g. a nav bar). Its bottom edge is used as the scroll-spy threshold and sets `scroll-padding-top` automatically. Falls back to the `DocsSubHeader` element (`docs-subheader-menu`) when omitted or not found. |
|
|
21
21
|
|
|
22
22
|
`tocConfig` defaults:
|
|
23
23
|
|
|
@@ -49,7 +49,7 @@ Place it in the `toc` slot of `DocsLayout`: `<DocsToc slot="toc" headings={headi
|
|
|
49
49
|
|
|
50
50
|
## Scroll-spy behaviour
|
|
51
51
|
|
|
52
|
-
- The active link is determined by comparing each heading's position to a threshold (the bottom of the `offsetTarget` element + 8 px
|
|
52
|
+
- The active link is determined by comparing each heading's position to a threshold (the bottom of the `offsetTarget` element, or of the `DocsSubHeader`, + 8 px; 160 px when neither exists).
|
|
53
53
|
- At the bottom of the page the last heading is always highlighted, even if its section is too short to ever cross the threshold.
|
|
54
54
|
- **Click-pin**: clicking a TOC link immediately marks it active and suppresses the scroll-spy until the user interacts with the page via wheel, touch, or keyboard.
|
|
55
55
|
- The component uses `requestAnimationFrame` batching so scroll and resize handlers are cheap.
|
|
@@ -44,17 +44,15 @@ const { nodes, variant, activeId, toggleNodeOnClick, ariaLabel, renderLabel } =
|
|
|
44
44
|
aria-label={ariaLabel}
|
|
45
45
|
toggle-node-on-click={toggleNodeOnClick ? '' : undefined}
|
|
46
46
|
>
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
))
|
|
57
|
-
}
|
|
47
|
+
{nodes.map((node) => (
|
|
48
|
+
<DocsTreeItem
|
|
49
|
+
node={node}
|
|
50
|
+
depth={0}
|
|
51
|
+
variant={variant}
|
|
52
|
+
activeId={activeId}
|
|
53
|
+
renderLabel={renderLabel}
|
|
54
|
+
/>
|
|
55
|
+
))}
|
|
58
56
|
</igc-tree>
|
|
59
57
|
|
|
60
58
|
<script>
|
|
@@ -56,45 +56,41 @@ if (node.itemData) {
|
|
|
56
56
|
expanded={node.expanded ? '' : undefined}
|
|
57
57
|
{...dataAttrs}
|
|
58
58
|
>
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
)
|
|
86
|
-
}
|
|
59
|
+
{node.href ? (
|
|
60
|
+
<div slot="label">
|
|
61
|
+
{/* The anchor is used only for navigation purpose it behave as an overlay on the ::part(wrapper) */}
|
|
62
|
+
<a
|
|
63
|
+
href={node.href}
|
|
64
|
+
aria-current={isActive ? 'page' : undefined}
|
|
65
|
+
class="docs-tree-link"
|
|
66
|
+
{...node.linkAttrs}
|
|
67
|
+
/>
|
|
68
|
+
{hasChildren && <igc-icon name="chevron" collection="docs" class="tree-expand-icon" />}
|
|
69
|
+
{RenderLabel ? (
|
|
70
|
+
<RenderLabel node={node} depth={depth} isLeaf={isLeaf} isActive={isActive} />
|
|
71
|
+
) : (
|
|
72
|
+
<span class="docs-tree-label">{node.label}</span>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
) : (
|
|
76
|
+
<div slot="label" class="docs-tree-group">
|
|
77
|
+
<igc-icon name="chevron" collection="docs" class="tree-expand-icon" />
|
|
78
|
+
{RenderLabel ? (
|
|
79
|
+
<RenderLabel node={node} depth={depth} isLeaf={isLeaf} isActive={isActive} />
|
|
80
|
+
) : (
|
|
81
|
+
<span class="docs-tree-label">{node.label}</span>
|
|
82
|
+
)}
|
|
83
|
+
</div>
|
|
84
|
+
)}
|
|
87
85
|
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
))
|
|
99
|
-
}
|
|
86
|
+
{hasChildren &&
|
|
87
|
+
node.children!.map((child) => (
|
|
88
|
+
<Astro.self
|
|
89
|
+
node={child}
|
|
90
|
+
depth={depth + 1}
|
|
91
|
+
variant={variant}
|
|
92
|
+
activeId={activeId}
|
|
93
|
+
renderLabel={RenderLabel}
|
|
94
|
+
/>
|
|
95
|
+
))}
|
|
100
96
|
</igc-tree-item>
|
|
@@ -4,7 +4,7 @@ Base tree component shared by `DocsSidebar` and `DocsToc`. Wraps
|
|
|
4
4
|
`<igc-tree>` from `igniteui-webcomponents` and recursively renders
|
|
5
5
|
`<igc-tree-item>`s from a generic `TreeNode[]`.
|
|
6
6
|
|
|
7
|
-
The single styling locus is [`docs-tree.
|
|
7
|
+
The single styling locus is [`docs-tree.scss`](./docs-tree.scss). Designers
|
|
8
8
|
tune values via the `--docs-tree-*` CSS custom properties; per-variant
|
|
9
9
|
tweaks live at the bottom of the file under `[data-variant="sidebar"]`
|
|
10
10
|
and `[data-variant="toc"]` selectors.
|
|
@@ -31,13 +31,16 @@ const nodes: TreeNode[] = [/* your tree */];
|
|
|
31
31
|
|
|
32
32
|
## Props
|
|
33
33
|
|
|
34
|
-
| Prop | Type | Notes
|
|
35
|
-
| ------------------- | -------------------- |
|
|
36
|
-
| `nodes` | `TreeNode[]` | Required. Root of the tree.
|
|
37
|
-
| `variant` | `'sidebar' \| 'toc'` | Required. Drives variant CSS rules.
|
|
38
|
-
| `activeId` | `string` | Optional. SSR-time match against `TreeNode.id`. **See active-state contract below.**
|
|
39
|
-
| `toggleNodeOnClick` | `boolean` | Optional. Forwarded to `<igc-tree>`.
|
|
40
|
-
| `renderLabel` | Astro component | Optional. Receives `{ node, depth, isLeaf, isActive }`. Falls back to a plain `<span>{node.label}</span>` when omitted.
|
|
34
|
+
| Prop | Type | Notes |
|
|
35
|
+
| ------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
36
|
+
| `nodes` | `TreeNode[]` | Required. Root of the tree. |
|
|
37
|
+
| `variant` | `'sidebar' \| 'toc'` | Required. Drives variant CSS rules. |
|
|
38
|
+
| `activeId` | `string` | Optional. SSR-time match against `TreeNode.id`. **See active-state contract below.** |
|
|
39
|
+
| `toggleNodeOnClick` | `boolean` | Optional. Forwarded to `<igc-tree>`. |
|
|
40
|
+
| `renderLabel` | Astro component | Optional. Receives `{ node, depth, isLeaf, isActive }`. Falls back to a plain `<span>{node.label}</span>` when omitted. |
|
|
41
|
+
| `ariaLabel` | `string` | Optional. Accessible name for the tree's `nav` role. Skip it when an outer `<nav aria-labelledby>` already names the region. |
|
|
42
|
+
|
|
43
|
+
`DocsTreeItem.astro` (also exported) renders one `<igc-tree-item>` and recurses into `children`. Props: `node: TreeNode`, `depth: number`, `variant: TreeVariant`, `activeId?: string`, `renderLabel?`. You normally never mount it directly.
|
|
41
44
|
|
|
42
45
|
## TreeNode shape
|
|
43
46
|
|
|
@@ -77,7 +80,7 @@ flicker.
|
|
|
77
80
|
## Styling
|
|
78
81
|
|
|
79
82
|
All structural and per-variant rules are in
|
|
80
|
-
[`docs-tree.
|
|
83
|
+
[`docs-tree.scss`](./docs-tree.scss). The file is imported once by
|
|
81
84
|
`DocsTree.astro`; Astro hoists and dedupes it.
|
|
82
85
|
|
|
83
86
|
Sidebar layout tokens (set on `igc-tree[data-variant="sidebar"]`):
|
|
@@ -29,12 +29,10 @@ const igNav = await fetchIgNav(resolvedLang);
|
|
|
29
29
|
|
|
30
30
|
<div class={styles.footer} data-igd-footer>
|
|
31
31
|
{/* === IgniteUI / default Infragistics footer — fetched via fetchIgNav() === */}
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
)
|
|
39
|
-
}
|
|
32
|
+
{igNav?.prefetched && (
|
|
33
|
+
<>
|
|
34
|
+
<Fragment set:html={igNav.uiFooterHtml} />
|
|
35
|
+
{igNav.footerHtml && <Fragment set:html={igNav.footerHtml} />}
|
|
36
|
+
</>
|
|
37
|
+
)}
|
|
40
38
|
</div>
|
|
@@ -23,12 +23,10 @@ const resolvedLang = lang;
|
|
|
23
23
|
const igNav = await fetchIgNav(resolvedLang);
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
{
|
|
27
|
-
/* ============================================================
|
|
26
|
+
{/* ============================================================
|
|
28
27
|
IG-family global nav (angular, react, blazor, web-components,
|
|
29
28
|
slingshot, igniteui)
|
|
30
|
-
============================================================ */
|
|
31
|
-
}
|
|
29
|
+
============================================================ */}
|
|
32
30
|
<div class={styles.navBar} transition:persist="global-nav-bar">
|
|
33
31
|
{/* IG nav — fetched directly via fetchIgNav(); falls back to static markup */}
|
|
34
32
|
{igNav?.prefetched && <Fragment set:html={igNav.headerHtml} />}
|
|
@@ -11,12 +11,10 @@ const { license } = Astro.props;
|
|
|
11
11
|
const label = license === 'premium' ? 'Premium' : 'Open Source';
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
{
|
|
15
|
-
license
|
|
16
|
-
<
|
|
17
|
-
<span>{label}</span>
|
|
14
|
+
{license && (
|
|
15
|
+
<Badge variant={license} class="license-indicator-badge">
|
|
16
|
+
<span>{label}</span>
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
18
|
+
{license === 'premium' && <igc-icon name="premium" collection="docs" aria-hidden="true" />}
|
|
19
|
+
</Badge>
|
|
20
|
+
)}
|
|
@@ -23,42 +23,40 @@ const { headings = [], tocConfig, label = 'On this page' } = Astro.props;
|
|
|
23
23
|
const nodes = headingsToTreeNodes(headings, tocConfig);
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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" />
|
|
36
|
+
<svg
|
|
37
|
+
class="mobile-toc__chevron"
|
|
38
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
39
|
+
width="16"
|
|
40
|
+
height="16"
|
|
41
|
+
viewBox="0 0 24 24"
|
|
42
|
+
fill="none"
|
|
43
|
+
stroke="currentColor"
|
|
44
|
+
stroke-width="2.5"
|
|
45
|
+
stroke-linecap="round"
|
|
46
|
+
stroke-linejoin="round"
|
|
47
|
+
aria-hidden="true"
|
|
34
48
|
>
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class="mobile-toc__chevron"
|
|
39
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
40
|
-
width="16"
|
|
41
|
-
height="16"
|
|
42
|
-
viewBox="0 0 24 24"
|
|
43
|
-
fill="none"
|
|
44
|
-
stroke="currentColor"
|
|
45
|
-
stroke-width="2.5"
|
|
46
|
-
stroke-linecap="round"
|
|
47
|
-
stroke-linejoin="round"
|
|
48
|
-
aria-hidden="true"
|
|
49
|
-
>
|
|
50
|
-
<polyline points="6 9 12 15 18 9" />
|
|
51
|
-
</svg>
|
|
52
|
-
</button>
|
|
49
|
+
<polyline points="6 9 12 15 18 9" />
|
|
50
|
+
</svg>
|
|
51
|
+
</button>
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</div>
|
|
53
|
+
<div class="mobile-toc__dropdown" id="mobile-toc-dropdown" aria-hidden="true">
|
|
54
|
+
<nav aria-label={label}>
|
|
55
|
+
<DocsTree nodes={nodes} variant="toc" />
|
|
56
|
+
</nav>
|
|
59
57
|
</div>
|
|
60
|
-
|
|
61
|
-
}
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
62
60
|
|
|
63
61
|
<script>
|
|
64
62
|
function initMobileToc() {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# MobileTocToggle
|
|
2
|
+
|
|
3
|
+
Mobile-only sticky row rendered below the sub-header. Shows "On this page"
|
|
4
|
+
with the current active heading and a chevron; tapping it opens a dropdown with
|
|
5
|
+
the table-of-contents links rendered through `DocsTree`. Hidden on tablet and
|
|
6
|
+
above, where the full `DocsToc` sidebar is shown instead.
|
|
7
|
+
|
|
8
|
+
## Import
|
|
9
|
+
|
|
10
|
+
```astro
|
|
11
|
+
import MobileTocToggle from 'igniteui-astro-components/components/MobileTocToggle.astro';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Props
|
|
15
|
+
|
|
16
|
+
| Prop | Type | Default | Description |
|
|
17
|
+
| ----------- | ------------------- | ---------------- | ------------------------------------------------------------------------------ |
|
|
18
|
+
| `headings` | `MarkdownHeading[]` | `[]` | Astro's `headings` for the page. Renders nothing when empty. |
|
|
19
|
+
| `tocConfig` | `TocConfig` | — | Depth filter, same shape `DocsToc` accepts (`components/DocsToc/toTreeNodes`). |
|
|
20
|
+
| `label` | `string` | `'On this page'` | Trigger text. |
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```astro
|
|
25
|
+
---
|
|
26
|
+
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
27
|
+
import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
28
|
+
import MobileTocToggle from 'igniteui-astro-components/components/MobileTocToggle.astro';
|
|
29
|
+
|
|
30
|
+
const { headings } = Astro.props;
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<DocsLayout title="Grid">
|
|
34
|
+
<MobileTocToggle slot="mobile-toc" headings={headings} />
|
|
35
|
+
<DocsToc slot="toc" headings={headings} />
|
|
36
|
+
<slot />
|
|
37
|
+
</DocsLayout>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Markup
|
|
41
|
+
|
|
42
|
+
`.mobile-toc` → `button.mobile-toc__trigger#mobile-toc-trigger` (`aria-expanded`,
|
|
43
|
+
`aria-controls="mobile-toc-dropdown"`) with `.mobile-toc__label`,
|
|
44
|
+
`.mobile-toc__active` and `.mobile-toc__chevron`, followed by the dropdown.
|
|
45
|
+
Styles are in `MobileTocToggle.scss`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Search
|
|
2
2
|
|
|
3
|
-
Pagefind-powered full-text search modal. Renders a trigger button (`Ctrl+K`) and
|
|
3
|
+
Pagefind-powered full-text search modal. Renders a trigger button (`Ctrl+K`) and an `<igc-dialog>` whose results are rendered client-side from the Pagefind JS API (`/pagefind/pagefind.js`), not the Pagefind UI library.
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
@@ -14,7 +14,7 @@ None — the component is self-contained.
|
|
|
14
14
|
|
|
15
15
|
## Behaviour
|
|
16
16
|
|
|
17
|
-
- The search index (`/pagefind/`) is
|
|
17
|
+
- The search index (`/pagefind/`) is written by `siteMetaIntegration`'s `astro:build:done` hook through the Pagefind JS API (`createIndex` → `addDirectory({ rootSelector: 'main' })`). Only `<main data-pagefind-body>` content is indexed; `DocsToc` and code blocks carry `data-pagefind-ignore`.
|
|
18
18
|
- In development the button renders but the dynamic Pagefind import resolves as a no-op — no runtime errors.
|
|
19
19
|
- Keyboard shortcut: `Ctrl+K` / `⌘K` to open, `Escape` to close.
|
|
20
20
|
|
|
@@ -32,13 +32,13 @@ import Search from 'igniteui-astro-components/components/Search.astro';
|
|
|
32
32
|
|
|
33
33
|
## Build setup
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
The package imports `pagefind` but does not declare it as a dependency (issue #157), so the
|
|
36
|
+
host site must install it:
|
|
36
37
|
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
"scripts": {
|
|
41
|
-
"build": "astro build && pagefind --site dist"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
38
|
+
```sh
|
|
39
|
+
npm install --save-dev pagefind
|
|
44
40
|
```
|
|
41
|
+
|
|
42
|
+
If you do not use `siteMetaIntegration`, build the index yourself after
|
|
43
|
+
`astro build`, for example `pagefind --site dist`, or call the JS API from your
|
|
44
|
+
own integration.
|
|
@@ -35,9 +35,10 @@ import './Search.scss';
|
|
|
35
35
|
title="Search (Ctrl+K)"
|
|
36
36
|
>
|
|
37
37
|
<igc-icon name="search" collection="docs" slot="prefix" aria-hidden="true"></igc-icon>
|
|
38
|
-
<kbd class="search-trigger__hint" slot="suffix" style="display:none;"
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
<kbd class="search-trigger__hint" slot="suffix" style="display:none;">
|
|
39
|
+
<kbd>Ctrl</kbd>
|
|
40
|
+
<kbd>K</kbd>
|
|
41
|
+
</kbd>
|
|
41
42
|
</igc-input>
|
|
42
43
|
</div>
|
|
43
44
|
|
|
@@ -63,7 +64,8 @@ import './Search.scss';
|
|
|
63
64
|
name="search"
|
|
64
65
|
collection="docs"
|
|
65
66
|
slot="prefix"
|
|
66
|
-
aria-hidden="true"
|
|
67
|
+
aria-hidden="true"
|
|
68
|
+
></igc-icon>
|
|
67
69
|
<igc-icon-button
|
|
68
70
|
slot="suffix"
|
|
69
71
|
class="igd-search-clear"
|
|
@@ -72,7 +74,8 @@ import './Search.scss';
|
|
|
72
74
|
aria-label="Clear search"
|
|
73
75
|
name="clear"
|
|
74
76
|
collection="docs"
|
|
75
|
-
hidden
|
|
77
|
+
hidden
|
|
78
|
+
></igc-icon-button>
|
|
76
79
|
</igc-input>
|
|
77
80
|
</header>
|
|
78
81
|
<div class="igd-search-content">
|
|
@@ -83,7 +86,10 @@ import './Search.scss';
|
|
|
83
86
|
</igc-button>
|
|
84
87
|
</div>
|
|
85
88
|
<footer class="igd-search-footer">
|
|
86
|
-
<igc-button class="search-close" variant="outlined">
|
|
89
|
+
<igc-button class="search-close" variant="outlined">
|
|
90
|
+
{' '}
|
|
91
|
+
Close{' '}
|
|
92
|
+
</igc-button>
|
|
87
93
|
</footer>
|
|
88
94
|
</div>
|
|
89
95
|
</igc-dialog>
|
|
@@ -10,14 +10,21 @@ import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.
|
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
13
|
-
| Prop | Type | Default
|
|
14
|
-
| ------------- | ------------- |
|
|
15
|
-
| `class` | `string` | —
|
|
16
|
-
| `indexUrl` | `string` | `${BASE_URL}api-search-index.json` | URL
|
|
17
|
-
| `placeholder` | `string` | `"Search"`
|
|
18
|
-
| `showScope` | `boolean` | `false`
|
|
19
|
-
| `tabs` | `SearchTab[]` | `[]`
|
|
20
|
-
| `allTabLimit` | `number` | `10`
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| ------------- | ------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| `class` | `string` | — | CSS class for the outer element |
|
|
16
|
+
| `indexUrl` | `string` | `${BASE_URL}api-search-index/manifest.json` | URL of the search index: a single JSON file or a manifest (see "Index format") |
|
|
17
|
+
| `placeholder` | `string` | `"Search"` | Search input placeholder text |
|
|
18
|
+
| `showScope` | `boolean` | `false` | Show scope selector (current package / all packages) |
|
|
19
|
+
| `tabs` | `SearchTab[]` | `[]` | Tab categories (besides the always-present "All" tab) |
|
|
20
|
+
| `allTabLimit` | `number` | `10` | Max results per category in the "All" tab |
|
|
21
|
+
| `platform` | `string` | — | Platform key (`angular`, `react`, `blazor`, `web-components`) for the logo icon in the scope selector; auto-detected from the enclosing `DocsSubHeader` when omitted. The scope itself comes from the URL path under `BASE_URL` (`<platform>/<package>/<version>`). |
|
|
22
|
+
|
|
23
|
+
`indexUrl` accepts two shapes. A **single file** is a JSON document with
|
|
24
|
+
`{ pages: [...] }`. A **manifest** is `{ files: ["pkg/version.json", ...] }`;
|
|
25
|
+
every listed file is fetched relative to the manifest URL and their `pages`
|
|
26
|
+
are merged. The host generates and serves the index; `playground/public/api-search-index/`
|
|
27
|
+
holds a sample manifest.
|
|
21
28
|
|
|
22
29
|
### `SearchTab`
|
|
23
30
|
|
|
@@ -121,7 +121,8 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
121
121
|
>
|
|
122
122
|
<igc-icon name="search" collection="docs" slot="prefix" aria-hidden="true"></igc-icon>
|
|
123
123
|
<kbd class="search-trigger__hint" slot="suffix" style="display: none;">
|
|
124
|
-
<kbd>Ctrl</kbd
|
|
124
|
+
<kbd>Ctrl</kbd>
|
|
125
|
+
<kbd>K</kbd>
|
|
125
126
|
</kbd>
|
|
126
127
|
</igc-input>
|
|
127
128
|
</div>
|
|
@@ -147,7 +148,8 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
147
148
|
name="search"
|
|
148
149
|
collection="docs"
|
|
149
150
|
slot="prefix"
|
|
150
|
-
aria-hidden="true"
|
|
151
|
+
aria-hidden="true"
|
|
152
|
+
></igc-icon>
|
|
151
153
|
<igc-icon-button
|
|
152
154
|
slot="suffix"
|
|
153
155
|
class="igd-search-clear"
|
|
@@ -156,7 +158,8 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
156
158
|
aria-label="Clear search"
|
|
157
159
|
name="clear"
|
|
158
160
|
collection="docs"
|
|
159
|
-
hidden
|
|
161
|
+
hidden
|
|
162
|
+
></igc-icon-button>
|
|
160
163
|
</igc-input>
|
|
161
164
|
|
|
162
165
|
<igc-select
|
|
@@ -169,17 +172,15 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
169
172
|
aria-label="Search scope"
|
|
170
173
|
value="current"
|
|
171
174
|
>
|
|
172
|
-
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
)
|
|
182
|
-
}
|
|
175
|
+
{platformIcon && (
|
|
176
|
+
<igc-icon
|
|
177
|
+
id="search-scope-trigger-icon"
|
|
178
|
+
name={platformIcon}
|
|
179
|
+
collection="docs"
|
|
180
|
+
slot="prefix"
|
|
181
|
+
aria-hidden="true"
|
|
182
|
+
/>
|
|
183
|
+
)}
|
|
183
184
|
<igc-select-item value="current">
|
|
184
185
|
<span data-scope-label>Current package</span>
|
|
185
186
|
</igc-select-item>
|
|
@@ -189,7 +190,8 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
189
190
|
anchor="search-scope-select"
|
|
190
191
|
class="igd-search-scope-tooltip"
|
|
191
192
|
placement="bottom"
|
|
192
|
-
with-arrow
|
|
193
|
+
with-arrow
|
|
194
|
+
></igc-tooltip>
|
|
193
195
|
</header>
|
|
194
196
|
<div class="igd-search-content">
|
|
195
197
|
<div class="igd-search-status" aria-live="polite"></div>
|