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
package/llms-full.txt
ADDED
|
@@ -0,0 +1,3207 @@
|
|
|
1
|
+
# igniteui-astro-components — full reference
|
|
2
|
+
|
|
3
|
+
> Everything an agent needs to use or change this package, in one file.
|
|
4
|
+
> Generated by `scripts/build-llms.mjs` from `llms.txt`, `README.md` and every
|
|
5
|
+
> `src/**/README.md`. Do not edit by hand: run `npm run build:llms`.
|
|
6
|
+
> The installed version is in `package.json#version` next to this file.
|
|
7
|
+
> Paths are relative to the package root (in a consumer:
|
|
8
|
+
> `node_modules/igniteui-astro-components/`).
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## llms.txt
|
|
12
|
+
|
|
13
|
+
## igniteui-astro-components
|
|
14
|
+
|
|
15
|
+
> Astro components, layouts, plugins and styles that build the Infragistics / Ignite UI documentation sites. No build step: `.astro`, `.ts` and `.scss` sources ship as-is and are imported by subpath.
|
|
16
|
+
|
|
17
|
+
### How to use this file
|
|
18
|
+
|
|
19
|
+
- Links are relative to the package root. In a consumer that root is `node_modules/igniteui-astro-components/` (a symlink to a checkout when installed with a `file:` dependency); on GitHub prefix them with `https://raw.githubusercontent.com/IgniteUI/igniteui-astro-components/master/`. Prefer the local copy: it matches the installed version (`package.json#version` beside this file).
|
|
20
|
+
- Each line below gives the import specifier, what the component does, its prop names (`*` = required) and the README that documents it. The `export interface Props` at the top of each `.astro` file is the authority when a README disagrees.
|
|
21
|
+
- `llms-full.txt` next to this file (in the published package; generated, not committed) contains every README verbatim for one-shot ingestion.
|
|
22
|
+
|
|
23
|
+
### Consumer prerequisites
|
|
24
|
+
|
|
25
|
+
- Peers: `astro ^7.3.5`, `igniteui-theming ^29`, `igniteui-webcomponents ^7.4.1`, plus `@astrojs/mdx` for the MDX components and `@astrojs/markdown-satteri` for the Markdown pipeline. Sass: `vite.css.preprocessorOptions.scss.loadPaths: ['node_modules']` is not enough under Vite 8 (igniteui-theming's export map rejects `@use 'igniteui-theming/sass/typography'`); add the `importers` entry from [README.md](README.md#quick-start) step 1, which maps `igniteui-theming/...` to files in the package.
|
|
26
|
+
- Styles: `igniteui-astro-components/styles/theme.scss` is the only stylesheet. `DocsLayout` imports it (and the JetBrains Mono font); import it yourself only without the layout. Theme by overriding `--igd-*` custom properties (see [Styles](#styles)).
|
|
27
|
+
- Virtual modules: `DocsLayout`, `DocsSidebar`, `DocsSubHeader`, `DocsBreadcrumb`, `DoDont` and `FigmaUiKits` import `virtual:docs-template/site-meta`; `DocsLayout`, `DocsSidebar` and `DocsSubHeader` also import `virtual:docs-template/nav-html`. `GlobalNavBar` and `GlobalFooter` import neither. Stub both with a Vite plugin (complete snippet in [README.md](README.md#quick-start) step 2). `site-meta` must export every one of `title`, `sidebar`, `productLinks`, `headEntries`, `trailingSlash`, `navLang`, `packages`, `selectedPackage`; `nav-html` must export `platform`. `siteMetaIntegration()` omits `packages` and `selectedPackage`, so it cannot provide the module. Contract: [src/virtual-modules.d.ts](src/virtual-modules.d.ts).
|
|
28
|
+
- Middleware: `ApiLink`, `ApiRef`, `PlatformBlock` and `Sample` read `Astro.locals.platformContext` (`PlatformContext` from `igniteui-astro-components/lib/types`) and throw without it. `Sample` and `ThemingWidget` read `Astro.locals.envVars`, optional (`{}` when unset). Set both in `src/middleware.ts`; complete example in [README.md](README.md#quick-start) step 3.
|
|
29
|
+
- MDX components are not auto-registered: import each one at the top of the MDX file, or pass a `components` map to `<Content />`.
|
|
30
|
+
- Markdown pipeline: the plugins are Sätteri plugins, so `markdown.remarkPlugins` / `rehypePlugins` reject them. Use `markdown: { processor: satteri({ mdastPlugins: [...], hastPlugins: [...] }) }` from `@astrojs/markdown-satteri`: remark-style plugins (`remarkEnvVars`, `remarkMdLinks`, `remarkHtmlTransforms`, for the docs repos' content conventions) go in `mdastPlugins`; rehype-style plugins (`rehypeHeadingAnchors` for every consumer, `rehypeTableWrapper`, `rehypePagefindIgnore`) go in `hastPlugins`.
|
|
31
|
+
- `createDocsSite()` / `siteMetaIntegration()` in `igniteui-astro-components/integration` is reference code, not used by any consumer: it injects routes the package does not ship (#158), imports `pagefind` without declaring it (#157), omits `packages` / `selectedPackage` from `site-meta`, and registers no middleware. See [README.md](README.md#the-reference-integration).
|
|
32
|
+
- Local checkout instead of npm: `"igniteui-astro-components": "file:../astro-components"` (symlink; Vite 8 may need `vite.resolve.preserveSymlinks: true`), or a `tsconfig` path alias. See [README.md](README.md#using-from-another-repo-without-publishing-a-package).
|
|
33
|
+
|
|
34
|
+
### Common tasks
|
|
35
|
+
|
|
36
|
+
1. Import a component: `import X from 'igniteui-astro-components/<subpath>.astro'` using the specifiers listed below; `.astro` files are never reachable from the bare package name.
|
|
37
|
+
2. Find a component's props: its line here, then its README, then `interface Props` in the `.astro` file.
|
|
38
|
+
3. Embed a live demo in MDX: `<Sample src="/grids/grid/overview" height={600} alt="..." />` ([Sample](src/components/mdx/Sample/README.md)).
|
|
39
|
+
4. Link an API symbol: `<ApiLink type="Grid" member="sortingExpressions" />` ([ApiLink](src/components/mdx/ApiLink/README.md)).
|
|
40
|
+
5. Callout: `<DocsAside type="info" title="...">...</DocsAside>`; `type` is `note`, `info` or `warning`.
|
|
41
|
+
6. Platform-specific MDX: `<PlatformBlock for="Angular, React">...</PlatformBlock>`; names are exactly `Angular`, `React`, `WebComponents`, `Blazor`, `WinUI`, `Uno` (`PlatformName` in `igniteui-astro-components/lib/types`).
|
|
42
|
+
7. Build a page: `DocsLayout` with `DocsSidebar` in `slot="sidebar"`, `DocsToc` in `slot="toc"`, `MobileTocToggle` in `slot="mobile-toc"` ([DocsLayout](src/layouts/DocsLayout/README.md)).
|
|
43
|
+
8. Highlight code in the brand theme: `markdown: { shikiConfig: igShikiConfig }` in `astro.config`, or `<Code theme={igCodeTheme} wrap />`, both from `igniteui-astro-components/code-theme` ([Code theme](src/code-theme/README.md)). `createDocsSite()` sets it already.
|
|
44
|
+
9. Change colours, fonts or spacing: override `--igd-*` custom properties in the host stylesheet; no Sass variables are configurable.
|
|
45
|
+
10. Sidebar data: `SidebarEntry[]` from `igniteui-astro-components/lib/sidebar/types`; groups have `items`, links have `slug` and optional `badges`.
|
|
46
|
+
11. Report a problem with the package: [CONTRIBUTING.md](CONTRIBUTING.md#filing-issues). Problems with docs *content* belong in IgniteUI/igniteui-documentation.
|
|
47
|
+
|
|
48
|
+
### MDX components
|
|
49
|
+
|
|
50
|
+
- [ApiLink](src/components/mdx/ApiLink/README.md): `igniteui-astro-components/components/mdx/ApiLink.astro` — inline link to an API symbol, URL resolved per platform. Props (TypeDoc): `type`*, `member`, `label`, `pkg`, `kind`, `prefixed`, `suffix`, `raw`; (Sass): `kind="sass"`*, `module`, `type`, `label`, `code`. Needs `platformContext`.
|
|
51
|
+
- [ApiRef](src/components/mdx/ApiRef/README.md): `igniteui-astro-components/components/mdx/ApiRef.astro` — "API References" list for several symbols. Props: `types`*, `kind`, `pkg`, `prefixed`, `suffix`. Needs `platformContext`.
|
|
52
|
+
- [Sample](src/components/mdx/Sample/README.md): `igniteui-astro-components/components/mdx/Sample.astro` — live demo iframe with code tabs and live-edit buttons. Props: `src`*, `height`, `alt`, `lob`, `dv`, `crm`, `wc`, `chrome` (`widget` | `demo` | `bare`), `showThemePicker`, `fullscreenBtn`, `fitContent`, `spacing`, `position`, `resizable`, `noBorder`, `noBackground`, `whiteBackground`, `iframeOnly` and `hideCode` (deprecated: `chrome="bare"` and `chrome="demo"`). Needs `platformContext` and `envVars` (`demosBaseUrl`, `dvDemosBaseUrl`, `lobDemosBaseUrl`, `crmDemoBaseUrl`, `wcDemosBaseUrl`, `defaultSampleTheme`).
|
|
53
|
+
- [PlatformBlock](src/components/mdx/PlatformBlock/README.md): `igniteui-astro-components/components/mdx/PlatformBlock.astro` — renders children only on the listed platforms. Props: `for`* (comma list). Needs `platformContext`.
|
|
54
|
+
- [DocsAside](src/components/mdx/DocsAside/README.md): `igniteui-astro-components/components/mdx/DocsAside.astro` — callout. Props: `type` (`note` | `info` | `warning`), `title`, `icon`, `class`, `color` (declared, not read: #162). Default slot is the body.
|
|
55
|
+
- [Badge](src/components/mdx/Badge/README.md): `igniteui-astro-components/components/mdx/Badge.astro` — status chip on `igc-badge`. Props: `variant` (`preview` | `new` | `updated` | `premium` | `opensource`), `class`, `aria-label`, `aria-hidden`. Default slot overrides the text.
|
|
56
|
+
- [Anatomy](src/components/mdx/Anatomy/README.md): `igniteui-astro-components/components/mdx/Anatomy.astro` — framed anatomy diagram. Props: `src`*, `alt`*, `class`.
|
|
57
|
+
- [DoDont](src/components/mdx/DoDont/README.md): `igniteui-astro-components/components/mdx/DoDont.astro` — side-by-side Do / Don't image panels. Props: `doSrc`*, `doAlt`*, `dontSrc`*, `dontAlt`*, `doLabel`, `dontLabel`, `loading`, `errorText`, `class`. Slots `do`*, `dont`* (an empty slot throws at build). Imports `virtual:docs-template/site-meta` (`navLang`).
|
|
58
|
+
- [FigmaUiKits](src/components/mdx/FigmaUiKits/README.md): `igniteui-astro-components/components/mdx/FigmaUiKits.astro` — "Check it out in our free Figma UI kits" banner linking to the four Indigo.Design UI kits. Props: `kits`, `title`, `compactTitle`, `variant` (`auto` | `compact`), `class`. An empty `kits` array or a kit with an empty `label` or `href` throws at build. `igniteui-astro-components/components/mdx/FigmaUiKits/kits` exports `FigmaUiKit` and `DEFAULT_FIGMA_UI_KITS`. Imports `virtual:docs-template/site-meta` (`navLang`).
|
|
59
|
+
- [Faq](src/components/mdx/Faq/README.md): `igniteui-astro-components/components/mdx/Faq.astro` — accordion of questions on `igc-accordion`. Props: `items`, `singleExpand`, `indicatorPosition`, `class`, `id`, aria/data pass-through. `igniteui-astro-components/components/mdx/FaqItem.astro` — one panel; props: `question`*, `subtitle`, `answer`, `open`, `disabled`, `indicatorPosition`, `class`, `id`. Types: `igniteui-astro-components/components/mdx/Faq/types` (`FaqEntry`, `FaqIndicatorPosition`).
|
|
60
|
+
|
|
61
|
+
### Layout and chrome
|
|
62
|
+
|
|
63
|
+
- [DocsLayout](src/layouts/DocsLayout/README.md): `igniteui-astro-components/layouts/DocsLayout.astro` — full page shell (nav bar, sub-header, breadcrumb, sidebar, content, TOC, footer). Props: `title`, `description`, `keywords`, `hasSidebar`, `currentSlug`, `siteTitle`, `license`, `is404`, `packages`, `selectedPackage`, `packageLabel`, `versions`, `selectedVersion`, `versionLabel`, `showThemeToggle` and `themeStorageKey` (both forwarded to `DocsSubHeader` and unused) (+ runtime-only `hasToc`, #161). Slots: default, `sidebar`, `toc`, `mobile-toc`, `subheader`, `head`. Imports `styles/theme.scss`; needs both virtual modules.
|
|
64
|
+
- [DocsSubHeader](src/components/DocsSubHeader/README.md): `igniteui-astro-components/components/DocsSubHeader.astro` — sticky bar with logo, package/version selectors (`igc-select`, fire `igcChange`) and search. Props: `logoText`, `packages`, `selectedPackage`, `packageLabel`, `versions`, `selectedVersion`, `versionLabel`; accepted but not rendered: `siteTitle`, `pageTitle`, `currentSlug`, `productLinks`, `sidebarItems`, `showThemeToggle`, `themeStorageKey`. Slot `search`.
|
|
65
|
+
- [GlobalNavBar](src/components/GlobalNavBar/README.md): `igniteui-astro-components/components/GlobalNavBar.astro` — legacy Infragistics header fetched from `/navigation` at build. Props: `lang`*.
|
|
66
|
+
- [GlobalFooter](src/components/GlobalFooter/README.md): `igniteui-astro-components/components/GlobalFooter.astro` — legacy Infragistics footer. Props: `lang`*.
|
|
67
|
+
- [Search](src/components/Search/README.md): `igniteui-astro-components/components/Search.astro` — full-text search in an `igc-dialog` (Ctrl/⌘+K) over the Pagefind JS API. No props; the host must install `pagefind` and build the index.
|
|
68
|
+
- [SearchAdvanced](src/components/SearchAdvanced/README.md): `igniteui-astro-components/components/SearchAdvanced.astro` — client-side API symbol search over a JSON index. Props: `indexUrl`, `placeholder`, `showScope`, `tabs`, `allTabLimit`, `platform` (logo icon only; the scope comes from the URL path under `BASE_URL`), `class`.
|
|
69
|
+
- [ThemingWidget](src/components/ThemingWidget/README.md): `igniteui-astro-components/components/ThemingWidget.astro` — theme and colour-mode picker, emits `igd-theme-change`. Props: `themes`, `selectedTheme`, `mode`, `showMode`, `id`, `class`, `label`, `target`.
|
|
70
|
+
- [CopyCode](src/components/CopyCode/README.md): `igniteui-astro-components/components/CopyCode.astro` — adds a copy button to every Shiki `<pre>`. No props; `DocsLayout` mounts it.
|
|
71
|
+
- [MobileSidebarToggle](src/components/MobileSidebarToggle/README.md): `igniteui-astro-components/components/MobileSidebarToggle.astro` — mobile disclosure button for the sidebar. Props: `label` (default `Components List`).
|
|
72
|
+
- [MobileTocToggle](src/components/MobileTocToggle/README.md): `igniteui-astro-components/components/MobileTocToggle.astro` — mobile "On this page" dropdown. Props: `headings`, `tocConfig`, `label`.
|
|
73
|
+
- [DocsBreadcrumb](src/components/DocsBreadcrumb/README.md): rendered by `DocsLayout` above the content; not exported yet. `LicenseIndicator` likewise.
|
|
74
|
+
|
|
75
|
+
### Sidebar, TOC and tree
|
|
76
|
+
|
|
77
|
+
- [DocsSidebar](src/components/DocsSidebar/README.md): `igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro` — logo, filter and navigation tree. Props: `currentSlug`, `items`, `showFilter`, `trailingSlash`, `logoText`, `platformLabel`, `singleBranchExpand` (default `true`; then a group's `collapsed` is ignored). Companions: `igniteui-astro-components/components/DocsSidebar/SidebarFilterInput.astro`, `igniteui-astro-components/components/DocsSidebar/SidebarLabel.astro` (`node`, `depth`, `isLeaf`, `isActive`), `igniteui-astro-components/components/DocsSidebar/toTreeNodes` (`toTreeNodes(entries, currentSlug, { trailingSlash, singleBranch })`), `igniteui-astro-components/components/DocsSidebar/sidebar-filter` (`<sidebar-filter>` element).
|
|
78
|
+
- [DocsToc](src/components/DocsToc/README.md): `igniteui-astro-components/components/DocsToc.astro` — "On this page" list with scroll-spy. Props: `headings`, `tocConfig`, `label`, `offsetTarget`. Adapter: `igniteui-astro-components/components/DocsToc/toTreeNodes` (`headingsToTreeNodes`, `TocConfig`).
|
|
79
|
+
- [DocsTree](src/components/DocsTree/README.md): `igniteui-astro-components/components/DocsTree/DocsTree.astro` — generic `<igc-tree>` renderer used by both. Props: `nodes`*, `variant`* (`sidebar` | `toc`), `activeId`, `toggleNodeOnClick`, `ariaLabel`, `renderLabel`. Also `igniteui-astro-components/components/DocsTree/DocsTreeItem.astro`, `igniteui-astro-components/components/DocsTree/types` (`TreeNode`, `TreeVariant`) and `igniteui-astro-components/components/DocsTree/docs-tree.css` (export broken, see issue #159; the file is `docs-tree.scss`). Tokens `--docs-tree-*`.
|
|
80
|
+
- Types and helpers: `igniteui-astro-components/lib/sidebar/types` (`SidebarEntry`, `SidebarGroup`, `SidebarLink`, `SidebarBadge`, `SIDEBAR_BADGE_VARIANTS`), `igniteui-astro-components/lib/sidebar/helpers` (`isGroup`, `isActive`, `hasActive`, `joinPath`, `isInitiallyOpen`, `getBreadcrumb`, `getActiveLink`, …), `igniteui-astro-components/lib/types` (`PlatformName`, `ApiPackageConfig`, `PlatformContext`).
|
|
81
|
+
- `igniteui-astro-components/sidebar` — `buildSidebarFromToc({ tocPath, docsDir, exclude })`, converts a JSON TOC to `SidebarEntry[]` at config time.
|
|
82
|
+
|
|
83
|
+
### Plugins and build helpers
|
|
84
|
+
|
|
85
|
+
- Rehype: `igniteui-astro-components/plugins/rehype-heading-anchors` (anchor links on headings), `igniteui-astro-components/plugins/rehype-table-wrapper` (scrollable table wrapper), `igniteui-astro-components/plugins/rehype-pagefind-ignore` (`data-pagefind-ignore` on code).
|
|
86
|
+
- Remark: `igniteui-astro-components/plugins/remark-env-vars` (`{Environment.X}` substitution), `igniteui-astro-components/plugins/remark-md-links` (`.md` → slug links, `DOCS_BASE` prefix), `igniteui-astro-components/plugins/remark-html-transforms` (dividers, code language normalisation, image paths).
|
|
87
|
+
- `igniteui-astro-components/platform` — `PlatformKey`, `NavLang`, `PLATFORM_DEFS`, `getPlatformHead(platform, lang, { legacyChrome })`, `getNavConfig()`, `platformLabelFor()`.
|
|
88
|
+
- `igniteui-astro-components/content` — `createDocsCollection(sourceDir, { exclude, extendSchema })`; `igniteui-astro-components/content-config` — default content collections.
|
|
89
|
+
- `igniteui-astro-components` (bare) — barrel of the runtime helpers above (`integration`, `sidebar`, `platform`, `content`, sidebar types and helpers); never `.astro` files. Avoid it: it re-exports `integration`, which imports the undeclared `pagefind` (#157), so the bare import fails unless the host installs `pagefind`. Import the subpaths instead.
|
|
90
|
+
|
|
91
|
+
### Code theme
|
|
92
|
+
|
|
93
|
+
- [Code theme](src/code-theme/README.md): `igniteui-astro-components/code-theme` — `igCodeTheme` (Shiki theme `ig-dark`: Rosé Pine Moon recoloured with `colorReplacements`) and `igShikiConfig` (`{ theme: igCodeTheme, wrap: true }`) for `markdown.shikiConfig`. Shiki writes colours inline; the surface comes from `--igd-code-*` tokens.
|
|
94
|
+
|
|
95
|
+
### Styles
|
|
96
|
+
|
|
97
|
+
- `igniteui-astro-components/styles/theme.scss` — igniteui-theming setup (`--ig-theme: fluent`), cascade layers, `--font-mono`, and the `global/` partials: palette, variables, type scale, markdown, code blocks (always dark), copy button, component overrides.
|
|
98
|
+
- Tokens on `:root` in [src/styles/global/_variables.scss](src/styles/global/_variables.scss): fonts `--igd-font-sans`, `--igd-font-mono`; brand `--igd-accent`, `--igd-on-accent`, `--igd-logo-type`, `--igd-illustration`; surfaces `--igd-app-bg`, `--igd-on-app-bg`, `--igd-layout-sections-bg`, `--igd-app-outline*`; shape `--igd-border-radius`, `--igd-border-radius-xl`, `--igd-padding-{sm,md,lg}`, `--igd-page-padding`, `--igd-sidebar-spacing`; layout `--igd-header-height`, `--igd-page-layout-grid`, `--igd-toc-*`; badges `--igd-{preview,new,updated,premium,opensource}-{bg,color,border}`; asides `--igd-aside-*`; FAQ `--igd-faq-*`; tables `--igd-table-*`; code snippets `--igd-code-*` (border, radius, padding, font, copy button).
|
|
99
|
+
- Component-scoped tokens: `--igd-theming-*` (ThemingWidget), `--igd-anatomy-*` (Anatomy), `--igd-dodont-*` (DoDont), `--igd-figma-kits-*` (FigmaUiKits), `--docs-tree-*` (DocsTree), `--ig-toc-width` (DocsToc). `--igd-anatomy-*` are declared on `.igd-anatomy` itself, so override them on that selector, not on `:root`.
|
|
100
|
+
|
|
101
|
+
### Contributing
|
|
102
|
+
|
|
103
|
+
Repository files, not in the npm package:
|
|
104
|
+
|
|
105
|
+
- [AGENTS.md](AGENTS.md): commands, layout, conventions, issue and PR rules for agents working in this repo.
|
|
106
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md): the same for people, with reasons, plus release and consumer-testing procedures.
|
|
107
|
+
- [.github/PULL_REQUEST_TEMPLATE.md](.github/PULL_REQUEST_TEMPLATE.md): the PR body a CI check enforces.
|
|
108
|
+
|
|
109
|
+
### Optional
|
|
110
|
+
|
|
111
|
+
- `llms-full.txt`: this index plus every README, generated by `npm run build:llms` (at `prepack`, so it is in the published package, not in the repository).
|
|
112
|
+
- `igniteui-astro-components/integration` — `createDocsSite()`, `siteMetaIntegration()`, `staticImagesIntegration()`; reference only (see prerequisites).
|
|
113
|
+
- `igniteui-astro-components/chrome` (`igChrome({ snapshot })`) and `igniteui-astro-components/chrome/contract` (`parseFragment()`, `CHROME_CONTRACT`) — render the marketing site's header/footer from a synced snapshot. See [README.md](README.md#the-infragistics-header-and-footer).
|
|
114
|
+
- `igniteui-astro-components/llms` — `buildLlmsTxt()` and `LlmsSet`: generates `llms.txt` files for a docs *site*; unrelated to this file.
|
|
115
|
+
- [playground/README.md](playground/README.md) (repository only): the in-repo site that renders every component for manual testing.
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## Subpath exports
|
|
119
|
+
|
|
120
|
+
| Subpath | Source | Kind |
|
|
121
|
+
| --- | --- | --- |
|
|
122
|
+
| `igniteui-astro-components` | `src/index.ts` | module |
|
|
123
|
+
| `igniteui-astro-components/integration` | `src/integration.ts` | module |
|
|
124
|
+
| `igniteui-astro-components/sidebar` | `src/sidebar.ts` | module |
|
|
125
|
+
| `igniteui-astro-components/platform` | `src/platform.ts` | module |
|
|
126
|
+
| `igniteui-astro-components/content` | `src/content-helper.ts` | module |
|
|
127
|
+
| `igniteui-astro-components/content-config` | `src/content.config.ts` | module |
|
|
128
|
+
| `igniteui-astro-components/llms` | `src/llms.ts` | module |
|
|
129
|
+
| `igniteui-astro-components/code-theme` | `src/code-theme/index.ts` | module |
|
|
130
|
+
| `igniteui-astro-components/layouts/DocsLayout.astro` | `src/layouts/DocsLayout/DocsLayout.astro` | layout |
|
|
131
|
+
| `igniteui-astro-components/chrome` | `src/chrome/integration.ts` | module |
|
|
132
|
+
| `igniteui-astro-components/chrome/contract` | `src/chrome/contract.mjs` | module |
|
|
133
|
+
| `igniteui-astro-components/components/GlobalNavBar.astro` | `src/components/GlobalNavBar/GlobalNavBar.astro` | component |
|
|
134
|
+
| `igniteui-astro-components/components/GlobalFooter.astro` | `src/components/GlobalFooter/GlobalFooter.astro` | component |
|
|
135
|
+
| `igniteui-astro-components/components/DocsSubHeader.astro` | `src/components/DocsSubHeader/DocsSubHeader.astro` | component |
|
|
136
|
+
| `igniteui-astro-components/components/CopyCode.astro` | `src/components/CopyCode/CopyCode.astro` | component |
|
|
137
|
+
| `igniteui-astro-components/components/Search.astro` | `src/components/Search/Search.astro` | component |
|
|
138
|
+
| `igniteui-astro-components/components/SearchAdvanced.astro` | `src/components/SearchAdvanced/SearchAdvanced.astro` | component |
|
|
139
|
+
| `igniteui-astro-components/components/ThemingWidget.astro` | `src/components/ThemingWidget/ThemingWidget.astro` | component |
|
|
140
|
+
| `igniteui-astro-components/components/MobileSidebarToggle.astro` | `src/components/MobileSidebarToggle/MobileSidebarToggle.astro` | component |
|
|
141
|
+
| `igniteui-astro-components/components/MobileTocToggle.astro` | `src/components/MobileTocToggle/MobileTocToggle.astro` | component |
|
|
142
|
+
| `igniteui-astro-components/components/DocsToc.astro` | `src/components/DocsToc/DocsToc.astro` | component |
|
|
143
|
+
| `igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro` | `src/components/DocsSidebar/DocsSidebar.astro` | component |
|
|
144
|
+
| `igniteui-astro-components/components/DocsSidebar/SidebarFilterInput.astro` | `src/components/DocsSidebar/SidebarFilterInput.astro` | component |
|
|
145
|
+
| `igniteui-astro-components/components/DocsSidebar/SidebarLabel.astro` | `src/components/DocsSidebar/SidebarLabel.astro` | component |
|
|
146
|
+
| `igniteui-astro-components/components/DocsSidebar/sidebar-filter` | `src/components/DocsSidebar/sidebar-filter.ts` | module |
|
|
147
|
+
| `igniteui-astro-components/components/DocsSidebar/toTreeNodes` | `src/components/DocsSidebar/toTreeNodes.ts` | module |
|
|
148
|
+
| `igniteui-astro-components/components/DocsToc/toTreeNodes` | `src/components/DocsToc/toTreeNodes.ts` | module |
|
|
149
|
+
| `igniteui-astro-components/components/DocsTree/DocsTree.astro` | `src/components/DocsTree/DocsTree.astro` | component |
|
|
150
|
+
| `igniteui-astro-components/components/DocsTree/DocsTreeItem.astro` | `src/components/DocsTree/DocsTreeItem.astro` | component |
|
|
151
|
+
| `igniteui-astro-components/components/DocsTree/types` | `src/components/DocsTree/types.ts` | module |
|
|
152
|
+
| `igniteui-astro-components/components/DocsTree/docs-tree.css` | `src/components/DocsTree/docs-tree.css` | styles |
|
|
153
|
+
| `igniteui-astro-components/components/mdx/Anatomy.astro` | `src/components/mdx/Anatomy/Anatomy.astro` | component |
|
|
154
|
+
| `igniteui-astro-components/components/mdx/ApiRef.astro` | `src/components/mdx/ApiRef/ApiRef.astro` | component |
|
|
155
|
+
| `igniteui-astro-components/components/mdx/ApiLink.astro` | `src/components/mdx/ApiLink/ApiLink.astro` | component |
|
|
156
|
+
| `igniteui-astro-components/components/mdx/DocsAside.astro` | `src/components/mdx/DocsAside/DocsAside.astro` | component |
|
|
157
|
+
| `igniteui-astro-components/components/mdx/DoDont.astro` | `src/components/mdx/DoDont/DoDont.astro` | component |
|
|
158
|
+
| `igniteui-astro-components/components/mdx/Badge.astro` | `src/components/mdx/Badge/Badge.astro` | component |
|
|
159
|
+
| `igniteui-astro-components/components/mdx/FigmaUiKits.astro` | `src/components/mdx/FigmaUiKits/FigmaUiKits.astro` | component |
|
|
160
|
+
| `igniteui-astro-components/components/mdx/FigmaUiKits/kits` | `src/components/mdx/FigmaUiKits/kits.ts` | module |
|
|
161
|
+
| `igniteui-astro-components/components/mdx/Faq.astro` | `src/components/mdx/Faq/Faq.astro` | component |
|
|
162
|
+
| `igniteui-astro-components/components/mdx/FaqItem.astro` | `src/components/mdx/Faq/FaqItem.astro` | component |
|
|
163
|
+
| `igniteui-astro-components/components/mdx/Faq/types` | `src/components/mdx/Faq/types.ts` | module |
|
|
164
|
+
| `igniteui-astro-components/components/mdx/PlatformBlock.astro` | `src/components/mdx/PlatformBlock/PlatformBlock.astro` | component |
|
|
165
|
+
| `igniteui-astro-components/components/mdx/Sample.astro` | `src/components/mdx/Sample/Sample.astro` | component |
|
|
166
|
+
| `igniteui-astro-components/lib/sidebar/types` | `src/lib/sidebar/types.ts` | module |
|
|
167
|
+
| `igniteui-astro-components/lib/sidebar/helpers` | `src/lib/sidebar/helpers.ts` | module |
|
|
168
|
+
| `igniteui-astro-components/lib/types` | `src/lib/types.ts` | module |
|
|
169
|
+
| `igniteui-astro-components/plugins/remark-env-vars` | `src/plugins/remark-env-vars.ts` | plugin |
|
|
170
|
+
| `igniteui-astro-components/plugins/remark-md-links` | `src/plugins/remark-md-links.ts` | plugin |
|
|
171
|
+
| `igniteui-astro-components/plugins/remark-html-transforms` | `src/plugins/remark-html-transforms.ts` | plugin |
|
|
172
|
+
| `igniteui-astro-components/plugins/rehype-table-wrapper` | `src/plugins/rehype-table-wrapper.ts` | plugin |
|
|
173
|
+
| `igniteui-astro-components/plugins/rehype-heading-anchors` | `src/plugins/rehype-heading-anchors.ts` | plugin |
|
|
174
|
+
| `igniteui-astro-components/plugins/rehype-pagefind-ignore` | `src/plugins/rehype-pagefind-ignore.ts` | plugin |
|
|
175
|
+
| `igniteui-astro-components/styles/theme.scss` | `src/styles/theme.scss` | styles |
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## README.md
|
|
179
|
+
|
|
180
|
+
## igniteui-astro-components
|
|
181
|
+
|
|
182
|
+
Reusable [Astro](https://astro.build) components, layouts, integrations, and
|
|
183
|
+
utilities used to build Infragistics / Ignite UI documentation sites.
|
|
184
|
+
|
|
185
|
+
This package provides the navbar, sidebar, search, page frame, and MDX
|
|
186
|
+
components for Infragistics documentation sites, keeping the integration
|
|
187
|
+
story simple for consumer repos.
|
|
188
|
+
|
|
189
|
+
> **Status:** internal. Consumed by
|
|
190
|
+
> [igniteui-documentation](https://github.com/IgniteUI/igniteui-documentation)
|
|
191
|
+
> (`docs-template`), api-docs and the Infragistics blog. The docs repo keeps its
|
|
192
|
+
> own fork of the Astro integration and uses this package as a component library.
|
|
193
|
+
|
|
194
|
+
> **For AI agents:** start with [`llms.txt`](llms.txt) — an index of every
|
|
195
|
+
> export with its props and a link to the README that documents it. The package
|
|
196
|
+
> ships it, so in a consumer it is at
|
|
197
|
+
> `node_modules/igniteui-astro-components/llms.txt`. Working on this repo? Read
|
|
198
|
+
> [`AGENTS.md`](AGENTS.md).
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### Installation
|
|
203
|
+
|
|
204
|
+
```sh
|
|
205
|
+
npm install igniteui-astro-components
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Peer dependencies: `astro@^7.3.5`, `igniteui-theming@^29`,
|
|
209
|
+
`igniteui-webcomponents@^7.4.1`. There is no build step: the package ships its
|
|
210
|
+
`.astro`, `.ts` and `.scss` sources and your Astro/Vite pipeline compiles them.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
### Quick start
|
|
215
|
+
|
|
216
|
+
This is the setup every current consumer uses: the package as a component
|
|
217
|
+
library, with the host owning its Astro config. The playground in this repo is
|
|
218
|
+
the same wiring, but it is not published, so every snippet below is complete.
|
|
219
|
+
|
|
220
|
+
**1. Astro config.** Enable MDX, run the package's Markdown plugins through
|
|
221
|
+
Sätteri, and resolve the package's bare `@use 'igniteui-theming/...'` imports.
|
|
222
|
+
Two details matter:
|
|
223
|
+
|
|
224
|
+
- Astro 7 renders Markdown with Sätteri and the package's plugins are Sätteri
|
|
225
|
+
plugins (`defineHastPlugin`), so `markdown.rehypePlugins` rejects them. Pass
|
|
226
|
+
them to `satteri()`: remark-style plugins go in `mdastPlugins`, rehype-style
|
|
227
|
+
plugins in `hastPlugins`. Add `@astrojs/markdown-satteri` to the host's
|
|
228
|
+
dependencies (it is already a dependency of this package).
|
|
229
|
+
- `loadPaths: ['node_modules']` alone is not enough. Vite 8 enforces
|
|
230
|
+
igniteui-theming's export map, which does not resolve extensionless Sass
|
|
231
|
+
subpaths, so `@use 'igniteui-theming/sass/typography'` fails with `is not
|
|
232
|
+
exported under the conditions`. The importer below maps them to files.
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
// astro.config.ts
|
|
236
|
+
import fs from 'node:fs';
|
|
237
|
+
import path from 'node:path';
|
|
238
|
+
import { createRequire } from 'node:module';
|
|
239
|
+
import { pathToFileURL } from 'node:url';
|
|
240
|
+
import { defineConfig } from 'astro/config';
|
|
241
|
+
import mdx from '@astrojs/mdx';
|
|
242
|
+
import { satteri } from '@astrojs/markdown-satteri';
|
|
243
|
+
import { rehypeHeadingAnchors } from 'igniteui-astro-components/plugins/rehype-heading-anchors';
|
|
244
|
+
|
|
245
|
+
const themingDir = path.dirname(
|
|
246
|
+
createRequire(import.meta.url).resolve('igniteui-theming/package.json'),
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
// Resolves `igniteui-theming/sass/...` to files inside the package.
|
|
250
|
+
const themingSassImporter = {
|
|
251
|
+
findFileUrl(url: string) {
|
|
252
|
+
if (!url.startsWith('igniteui-theming/')) return null;
|
|
253
|
+
const candidate = path.join(themingDir, url.slice('igniteui-theming/'.length));
|
|
254
|
+
return fs.existsSync(candidate) || fs.existsSync(path.dirname(candidate))
|
|
255
|
+
? pathToFileURL(candidate)
|
|
256
|
+
: null;
|
|
257
|
+
},
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export default defineConfig({
|
|
261
|
+
integrations: [mdx()],
|
|
262
|
+
markdown: {
|
|
263
|
+
processor: satteri({ hastPlugins: [rehypeHeadingAnchors] }),
|
|
264
|
+
},
|
|
265
|
+
vite: {
|
|
266
|
+
plugins: [virtualDocsModules()], // step 2
|
|
267
|
+
css: {
|
|
268
|
+
preprocessorOptions: {
|
|
269
|
+
scss: { importers: [themingSassImporter], loadPaths: ['node_modules'] },
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**2. Virtual modules.** `DocsLayout`, `DocsSidebar`, `DocsSubHeader`,
|
|
277
|
+
`DocsBreadcrumb` and `DoDont` import `virtual:docs-template/site-meta` at
|
|
278
|
+
module level, and the first three also import `virtual:docs-template/nav-html`,
|
|
279
|
+
so both modules must resolve wherever those components appear (an MDX page
|
|
280
|
+
that uses `<DoDont>` included). Stub them with a Vite plugin. Every name below
|
|
281
|
+
must be exported: `DocsSubHeader` imports `packages` and `selectedPackage`,
|
|
282
|
+
which `siteMetaIntegration()` does not emit, so the integration cannot provide
|
|
283
|
+
these modules today (see [The reference integration](#the-reference-integration)).
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
// astro.config.ts (continued)
|
|
287
|
+
function virtualDocsModules() {
|
|
288
|
+
const modules: Record<string, string> = {
|
|
289
|
+
'virtual:docs-template/site-meta': `
|
|
290
|
+
export const title = 'My Library';
|
|
291
|
+
export const sidebar = [];
|
|
292
|
+
export const productLinks = [];
|
|
293
|
+
export const headEntries = [];
|
|
294
|
+
export const trailingSlash = 'ignore';
|
|
295
|
+
export const navLang = 'en';
|
|
296
|
+
export const packages = [];
|
|
297
|
+
export const selectedPackage = undefined;
|
|
298
|
+
`,
|
|
299
|
+
// platform: 'angular' | 'react' | 'blazor' | 'web-components' | 'winui' | 'uno' | null
|
|
300
|
+
'virtual:docs-template/nav-html': `export const platform = 'angular';`,
|
|
301
|
+
};
|
|
302
|
+
return {
|
|
303
|
+
name: 'virtual-docs-modules',
|
|
304
|
+
resolveId: (id: string) => (id in modules ? '\0' + id : null),
|
|
305
|
+
load: (id: string) => modules[id.slice(1)] ?? null,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
The module contract, and the `App.Locals` typing for step 3, are declared in
|
|
311
|
+
[src/virtual-modules.d.ts](src/virtual-modules.d.ts). Add
|
|
312
|
+
`node_modules/igniteui-astro-components/src/virtual-modules.d.ts` to your
|
|
313
|
+
`tsconfig` `include` so the imports type-check.
|
|
314
|
+
|
|
315
|
+
**3. Middleware.** `ApiLink`, `ApiRef`, `PlatformBlock` and `Sample` read
|
|
316
|
+
`Astro.locals.platformContext` and throw without it. `Sample` and
|
|
317
|
+
`ThemingWidget` also read `Astro.locals.envVars`, which is optional and treated
|
|
318
|
+
as `{}` when missing. Set both in `src/middleware.ts`:
|
|
319
|
+
|
|
320
|
+
```ts
|
|
321
|
+
// src/middleware.ts
|
|
322
|
+
import { defineMiddleware } from 'astro:middleware';
|
|
323
|
+
import type { PlatformContext } from 'igniteui-astro-components/lib/types';
|
|
324
|
+
|
|
325
|
+
const platformContext: PlatformContext = {
|
|
326
|
+
name: 'React', // 'Angular' | 'React' | 'WebComponents' | 'Blazor' | 'WinUI' | 'Uno'
|
|
327
|
+
lower: 'react',
|
|
328
|
+
prefix: 'Igr',
|
|
329
|
+
productName: 'Ignite UI for React',
|
|
330
|
+
productSpinal: 'ignite-ui-react',
|
|
331
|
+
apiPackages: {
|
|
332
|
+
core: {
|
|
333
|
+
docRoot: 'https://www.infragistics.com/react-apis-new/react/igniteui-react/latest',
|
|
334
|
+
packageId: 'igniteui-react',
|
|
335
|
+
noPackagePrefix: true,
|
|
336
|
+
preserveCase: true,
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
packages: {
|
|
340
|
+
common: 'igniteui-react',
|
|
341
|
+
charts: 'igniteui-react-charts',
|
|
342
|
+
grids: 'igniteui-react-grids',
|
|
343
|
+
gauges: 'igniteui-react-gauges',
|
|
344
|
+
maps: 'igniteui-react-maps',
|
|
345
|
+
},
|
|
346
|
+
links: {
|
|
347
|
+
github: 'https://github.com/IgniteUI/igniteui-react',
|
|
348
|
+
forums: 'https://www.infragistics.com/community/forums/f/ignite-ui-for-react',
|
|
349
|
+
repoSamples: 'https://github.com/IgniteUI/igniteui-react-examples/tree/master/samples',
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
export const onRequest = defineMiddleware((context, next) => {
|
|
354
|
+
context.locals.platformContext = platformContext;
|
|
355
|
+
context.locals.envVars = {
|
|
356
|
+
demosBaseUrl: 'https://www.infragistics.com/react-demos',
|
|
357
|
+
defaultSampleTheme: 'bootstrap',
|
|
358
|
+
};
|
|
359
|
+
return next();
|
|
360
|
+
});
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
`envVars` keys: `demosBaseUrl`, `dvDemosBaseUrl`, `lobDemosBaseUrl`,
|
|
364
|
+
`crmDemoBaseUrl` and `wcDemosBaseUrl` (`Sample`, see its README),
|
|
365
|
+
`defaultSampleTheme` (`Sample` and `ThemingWidget`) and `defaultSampleMode`
|
|
366
|
+
(`ThemingWidget`). Leave unused keys out rather than setting them to `""`.
|
|
367
|
+
|
|
368
|
+
**4. A layout.** `DocsLayout` imports `styles/theme.scss` and the JetBrains Mono
|
|
369
|
+
font itself, so nothing else is needed:
|
|
370
|
+
|
|
371
|
+
```astro
|
|
372
|
+
---
|
|
373
|
+
// src/layouts/MyDocsLayout.astro
|
|
374
|
+
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
375
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
376
|
+
import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
377
|
+
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
378
|
+
import type { MarkdownHeading } from 'astro';
|
|
379
|
+
|
|
380
|
+
interface Props {
|
|
381
|
+
title: string;
|
|
382
|
+
currentSlug: string;
|
|
383
|
+
headings?: MarkdownHeading[];
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const { title, currentSlug, headings = [] } = Astro.props;
|
|
387
|
+
|
|
388
|
+
const sidebar: SidebarEntry[] = [
|
|
389
|
+
{
|
|
390
|
+
label: 'Getting started',
|
|
391
|
+
items: [
|
|
392
|
+
{ label: 'Introduction', slug: '' },
|
|
393
|
+
{ label: 'Installation', slug: 'installation' },
|
|
394
|
+
],
|
|
395
|
+
},
|
|
396
|
+
];
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
<DocsLayout title={title} siteTitle="My Library" hasSidebar currentSlug={currentSlug}>
|
|
400
|
+
<DocsSidebar slot="sidebar" items={sidebar} currentSlug={currentSlug} />
|
|
401
|
+
<DocsToc slot="toc" headings={headings} />
|
|
402
|
+
<slot />
|
|
403
|
+
</DocsLayout>
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
`DocsToc` measures the sub-header on its own, so `offsetTarget` is only needed outside `DocsLayout`. A page renders its content inside it:
|
|
407
|
+
`<MyDocsLayout title={entry.data.title} currentSlug={slug} headings={headings}><Content /></MyDocsLayout>`.
|
|
408
|
+
|
|
409
|
+
**5. MDX components.** Nothing is auto-registered. Import what a topic uses at
|
|
410
|
+
the top of the MDX file (the convention in the docs repos):
|
|
411
|
+
|
|
412
|
+
```mdx
|
|
413
|
+
import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
414
|
+
import ApiLink from 'igniteui-astro-components/components/mdx/ApiLink.astro';
|
|
415
|
+
import DocsAside from 'igniteui-astro-components/components/mdx/DocsAside.astro';
|
|
416
|
+
import PlatformBlock from 'igniteui-astro-components/components/mdx/PlatformBlock.astro';
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
or pass them through the `components` map of `<Content />` when the MDX is
|
|
420
|
+
authored without imports.
|
|
421
|
+
|
|
422
|
+
#### The reference integration
|
|
423
|
+
|
|
424
|
+
`igniteui-astro-components/integration` exports `createDocsSite()` and
|
|
425
|
+
`siteMetaIntegration()`: a full docs-site config (site meta virtual modules,
|
|
426
|
+
sidebar from a JSON TOC, static images, remark/rehype pipeline, Pagefind index,
|
|
427
|
+
`llms.txt` generation, the Infragistics chrome). It is the origin of the docs
|
|
428
|
+
repo's integration, but it is **not usable as-is today**: it injects route files
|
|
429
|
+
that are not in this package (#158), it imports `pagefind` without declaring it
|
|
430
|
+
(#157), its `site-meta` module lacks the `packages` and `selectedPackage`
|
|
431
|
+
exports `DocsSubHeader` imports, and it registers no middleware. Treat it as
|
|
432
|
+
reference code until those issues are closed.
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
### Fonts
|
|
437
|
+
|
|
438
|
+
`DocsLayout` imports the **JetBrains Mono** variable font from
|
|
439
|
+
`@fontsource-variable/jetbrains-mono` (self-hosted, no CDN request) and
|
|
440
|
+
`styles/theme.scss` sets `--font-mono: 'JetBrains Mono Variable'` on `:root`.
|
|
441
|
+
The sans-serif stack is the Infragistics brand font through
|
|
442
|
+
`--igd-font-sans`, and code uses `--igd-font-mono`. Override either custom
|
|
443
|
+
property to change the fonts site-wide.
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
### Prop-driven usage (without `siteMetaIntegration`)
|
|
448
|
+
|
|
449
|
+
By default, `DocsLayout`, `DocsSidebar`, and `DocsSubHeader` read their data (site title, sidebar tree, package list) from the `virtual:docs-template/site-meta` virtual module, which the host stubs in its Astro config ([Quick start](#quick-start) step 2).
|
|
450
|
+
|
|
451
|
+
If you are not using the integration — for example when consuming the package via a GitHub dependency in a project that builds its own config — every piece of data can be passed directly as a prop instead.
|
|
452
|
+
|
|
453
|
+
#### DocsLayout
|
|
454
|
+
|
|
455
|
+
| Prop | Overrides |
|
|
456
|
+
| ----------- | ------------------------------------------- |
|
|
457
|
+
| `siteTitle` | `virtual:docs-template/site-meta` → `title` |
|
|
458
|
+
|
|
459
|
+
```astro
|
|
460
|
+
---
|
|
461
|
+
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
<DocsLayout title="Toast" siteTitle="My Library" hasSidebar currentSlug="components/toast">
|
|
465
|
+
<slot />
|
|
466
|
+
</DocsLayout>
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
#### DocsSidebar
|
|
470
|
+
|
|
471
|
+
| Prop | Overrides |
|
|
472
|
+
| ------- | --------------------------------------------- |
|
|
473
|
+
| `items` | `virtual:docs-template/site-meta` → `sidebar` |
|
|
474
|
+
|
|
475
|
+
```astro
|
|
476
|
+
---
|
|
477
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
478
|
+
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
479
|
+
|
|
480
|
+
const sidebar: SidebarEntry[] = [
|
|
481
|
+
{
|
|
482
|
+
label: 'Getting Started',
|
|
483
|
+
collapsed: false,
|
|
484
|
+
items: [
|
|
485
|
+
{ label: 'Introduction', slug: '' },
|
|
486
|
+
{ label: 'Installation', slug: 'installation' },
|
|
487
|
+
],
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
label: 'Components',
|
|
491
|
+
collapsed: false,
|
|
492
|
+
items: [{ label: 'Toast', slug: 'components/toast' }],
|
|
493
|
+
},
|
|
494
|
+
];
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
<DocsSidebar items={sidebar} currentSlug="components/toast" />
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
#### DocsSubHeader
|
|
501
|
+
|
|
502
|
+
| Prop | Overrides |
|
|
503
|
+
| ----------------- | ----------------------------------------------------- |
|
|
504
|
+
| `packages` | `virtual:docs-template/site-meta` → `packages` |
|
|
505
|
+
| `selectedPackage` | `virtual:docs-template/site-meta` → `selectedPackage` |
|
|
506
|
+
|
|
507
|
+
`siteTitle`, `productLinks` and `sidebarItems` are accepted and read from the
|
|
508
|
+
virtual module as fallbacks, but nothing in the sub-header renders them any
|
|
509
|
+
more (the breadcrumb moved to `DocsBreadcrumb`, the product links markup is
|
|
510
|
+
commented out). See the [DocsSubHeader README](src/components/DocsSubHeader/README.md).
|
|
511
|
+
|
|
512
|
+
```astro
|
|
513
|
+
---
|
|
514
|
+
import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.astro';
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
<DocsSubHeader
|
|
518
|
+
packages={['igniteui-angular', 'igniteui-charts']}
|
|
519
|
+
selectedPackage="igniteui-angular"
|
|
520
|
+
/>
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
#### Combining prop-driven components without the integration
|
|
524
|
+
|
|
525
|
+
The layout in [Quick start](#quick-start) step 4 is the minimal setup: every
|
|
526
|
+
piece of data arrives as a prop. The virtual modules must still resolve at
|
|
527
|
+
build time, because the components import them at module level; step 2 shows
|
|
528
|
+
the stub.
|
|
529
|
+
|
|
530
|
+
---
|
|
531
|
+
|
|
532
|
+
### What's included
|
|
533
|
+
|
|
534
|
+
#### Astro integration
|
|
535
|
+
|
|
536
|
+
| Export | Purpose |
|
|
537
|
+
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
538
|
+
| `igniteui-astro-components/integration` | `createDocsSite()`, `siteMetaIntegration()`, `staticImagesIntegration()`, `buildSidebarFromToc()` re-export |
|
|
539
|
+
|
|
540
|
+
#### Layouts
|
|
541
|
+
|
|
542
|
+
| Export | Purpose | Docs |
|
|
543
|
+
| ---------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------ |
|
|
544
|
+
| `igniteui-astro-components/layouts/DocsLayout.astro` | Top-level page shell — global nav + sub-header + optional sidebar + main frame + footer | [README](src/layouts/DocsLayout/README.md) |
|
|
545
|
+
|
|
546
|
+
#### Chrome components
|
|
547
|
+
|
|
548
|
+
| Export | Purpose | Docs |
|
|
549
|
+
| ---------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
550
|
+
| `…/components/GlobalNavBar.astro` | IG global navigation bar — legacy, fetched from `/navigation` | [README](src/components/GlobalNavBar/README.md) |
|
|
551
|
+
| `…/components/GlobalFooter.astro` | IG global footer — legacy, fetched from `/navigation` | [README](src/components/GlobalFooter/README.md) |
|
|
552
|
+
| `…/chrome` | `igChrome()` — render the header/footer from a synced snapshot | [below](#the-infragistics-header-and-footer) |
|
|
553
|
+
| `…/chrome/contract` | `parseFragment()` — the `ig-chrome` contract checks, for sync scripts | [below](#the-infragistics-header-and-footer) |
|
|
554
|
+
| `…/components/DocsSubHeader.astro` | Secondary fixed bar — package/version selectors, search | [README](src/components/DocsSubHeader/README.md) |
|
|
555
|
+
| `…/components/Search.astro` | Pagefind-powered full-text search modal | [README](src/components/Search/README.md) |
|
|
556
|
+
| `…/components/SearchAdvanced.astro` | Client-side API symbol search over a JSON index (api-docs) | [README](src/components/SearchAdvanced/README.md) |
|
|
557
|
+
| `…/components/ThemingWidget.astro` | Theme / colour-mode picker | [README](src/components/ThemingWidget/README.md) |
|
|
558
|
+
| `…/components/CopyCode.astro` | Adds a copy button to every Shiki code block | [README](src/components/CopyCode/README.md) |
|
|
559
|
+
| `…/components/MobileSidebarToggle.astro` | Mobile-only sidebar disclosure button | [README](src/components/MobileSidebarToggle/README.md) |
|
|
560
|
+
| `…/components/MobileTocToggle.astro` | Mobile-only "On this page" dropdown | [README](src/components/MobileTocToggle/README.md) |
|
|
561
|
+
| `…/components/DocsToc.astro` | "On this page" table of contents with scroll-spy | [README](src/components/DocsToc/README.md) |
|
|
562
|
+
| `…/components/DocsToc/toTreeNodes` | `headingsToTreeNodes()`, `TocConfig` — headings → `TreeNode[]` | [README](src/components/DocsToc/README.md) |
|
|
563
|
+
|
|
564
|
+
`DocsBreadcrumb` and `LicenseIndicator` are rendered by `DocsLayout` but are
|
|
565
|
+
not exported yet.
|
|
566
|
+
|
|
567
|
+
#### Sidebar and tree
|
|
568
|
+
|
|
569
|
+
| Export | Purpose | Docs |
|
|
570
|
+
| --------------------------------------------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------- |
|
|
571
|
+
| `…/components/DocsSidebar/DocsSidebar.astro` | Composition root — logo, filter input, tree | [README](src/components/DocsSidebar/README.md) |
|
|
572
|
+
| `…/components/DocsSidebar/SidebarFilterInput.astro` | Filter input markup | [README](src/components/DocsSidebar/README.md) |
|
|
573
|
+
| `…/components/DocsSidebar/SidebarLabel.astro` | Label renderer used with `DocsTree` | [README](src/components/DocsSidebar/README.md) |
|
|
574
|
+
| `…/components/DocsSidebar/toTreeNodes` | `toTreeNodes()` — `SidebarEntry[]` → `TreeNode[]` | [README](src/components/DocsSidebar/README.md) |
|
|
575
|
+
| `…/components/DocsSidebar/sidebar-filter` | `<sidebar-filter>` custom element + cross-navigation hooks | [README](src/components/DocsSidebar/README.md) |
|
|
576
|
+
| `…/components/DocsTree/DocsTree.astro` | Generic `<igc-tree>` renderer shared by sidebar and TOC | [README](src/components/DocsTree/README.md) |
|
|
577
|
+
| `…/components/DocsTree/DocsTreeItem.astro` | One `<igc-tree-item>`, recursive | [README](src/components/DocsTree/README.md) |
|
|
578
|
+
| `…/components/DocsTree/types` | `TreeNode`, `TreeVariant` | [README](src/components/DocsTree/README.md) |
|
|
579
|
+
| `…/components/DocsTree/docs-tree.css` | Tree styles (export points at a missing file, see #159; the real file is `docs-tree.scss`) | [README](src/components/DocsTree/README.md) |
|
|
580
|
+
| `…/lib/sidebar/types` | `SidebarEntry`, `SidebarGroup`, `SidebarLink`, `SidebarBadge`, `SIDEBAR_BADGE_VARIANTS` | — |
|
|
581
|
+
| `…/lib/sidebar/helpers` | `isActive`, `isGroup`, `isInitiallyOpen`, `getBreadcrumb`, `joinPath`, … | — |
|
|
582
|
+
| `…/lib/types` | `PlatformName`, `ApiPackageConfig`, `PlatformContext` | — |
|
|
583
|
+
| `…/sidebar` | `buildSidebarFromToc()` — JSON TOC → sidebar tree converter (build-time) | — |
|
|
584
|
+
|
|
585
|
+
#### MDX components
|
|
586
|
+
|
|
587
|
+
| Export | Purpose | Docs |
|
|
588
|
+
| -------------------------------------- | ------------------------------------------------------------------- | ---------------------------------------------------- |
|
|
589
|
+
| `…/components/mdx/ApiLink.astro` | Inline link to an API symbol with platform-aware URLs | [README](src/components/mdx/ApiLink/README.md) |
|
|
590
|
+
| `…/components/mdx/ApiRef.astro` | Block "API References" list | [README](src/components/mdx/ApiRef/README.md) |
|
|
591
|
+
| `…/components/mdx/Sample.astro` | Embedded live sample with code tabs and live-edit buttons | [README](src/components/mdx/Sample/README.md) |
|
|
592
|
+
| `…/components/mdx/PlatformBlock.astro` | Show content only on selected platforms | [README](src/components/mdx/PlatformBlock/README.md) |
|
|
593
|
+
| `…/components/mdx/DocsAside.astro` | Note / info / warning callout | [README](src/components/mdx/DocsAside/README.md) |
|
|
594
|
+
| `…/components/mdx/Badge.astro` | Status chip (preview, new, updated, premium, opensource) | [README](src/components/mdx/Badge/README.md) |
|
|
595
|
+
| `…/components/mdx/Anatomy.astro` | Framed component anatomy image | [README](src/components/mdx/Anatomy/README.md) |
|
|
596
|
+
| `…/components/mdx/DoDont.astro` | Side-by-side Do / Don't image guidance panels | [README](src/components/mdx/DoDont/README.md) |
|
|
597
|
+
| `…/components/mdx/FigmaUiKits.astro` | "Check it out in our free Figma UI kits" banner linking to the kits | [README](src/components/mdx/FigmaUiKits/README.md) |
|
|
598
|
+
| `…/components/mdx/Faq.astro` | FAQ accordion | [README](src/components/mdx/Faq/README.md) |
|
|
599
|
+
| `…/components/mdx/FaqItem.astro` | One question/answer panel | [README](src/components/mdx/Faq/README.md) |
|
|
600
|
+
| `…/components/mdx/Faq/types` | `FaqEntry`, `FaqIndicatorPosition` | [README](src/components/mdx/Faq/README.md) |
|
|
601
|
+
|
|
602
|
+
#### Code snippets
|
|
603
|
+
|
|
604
|
+
| Export | Purpose | Docs |
|
|
605
|
+
| -------------- | -------------------------------------------------------------------------------- | ---------------------------------- |
|
|
606
|
+
| `…/code-theme` | Brand Shiki theme (Rosé Pine Moon recoloured) and the ready-made `igShikiConfig` | [README](src/code-theme/README.md) |
|
|
607
|
+
|
|
608
|
+
#### Build helpers
|
|
609
|
+
|
|
610
|
+
| Export | Purpose |
|
|
611
|
+
| ---------------------------------- | -------------------------------------------------------------------------------- |
|
|
612
|
+
| `…/platform` | `PlatformKey`, `NavLang`, `getPlatformHead()`, `getNavConfig()`, `PLATFORM_DEFS` |
|
|
613
|
+
| `…/content` | `createDocsCollection()` content collection helper |
|
|
614
|
+
| `…/content-config` | Default content collection schema |
|
|
615
|
+
| `…/llms` | `buildLlmsTxt()` — generates `llms.txt` files for a docs _site_ |
|
|
616
|
+
| `…/plugins/remark-env-vars` | Remark plugin — `{Environment.X}` token substitution |
|
|
617
|
+
| `…/plugins/remark-md-links` | Remark plugin — `.md` → slug link rewriting + `DOCS_BASE` prepending |
|
|
618
|
+
| `…/plugins/remark-html-transforms` | Remark plugin — divider→`<hr>`, code lang normalization, img src fixes |
|
|
619
|
+
| `…/plugins/rehype-heading-anchors` | Rehype plugin — anchor links on headings (used by every consumer) |
|
|
620
|
+
| `…/plugins/rehype-table-wrapper` | Rehype plugin — wraps tables for horizontal scrolling |
|
|
621
|
+
| `…/plugins/rehype-pagefind-ignore` | Rehype plugin — `data-pagefind-ignore` on code blocks |
|
|
622
|
+
|
|
623
|
+
#### Styles
|
|
624
|
+
|
|
625
|
+
| Export | Purpose |
|
|
626
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
627
|
+
| `…/styles/theme.scss` | The only stylesheet: igniteui-theming setup, layer order, `--igd-*` tokens, markdown and code-block styles. `DocsLayout` imports it. |
|
|
628
|
+
|
|
629
|
+
Design tokens are CSS custom properties prefixed `--igd-` and defined on
|
|
630
|
+
`:root` in [src/styles/global/\_variables.scss](src/styles/global/_variables.scss)
|
|
631
|
+
(fonts, accent, surfaces, spacing, radius, badges, asides, FAQ, tables, and
|
|
632
|
+
`--igd-code-*` for code snippets, see [src/code-theme/README.md](src/code-theme/README.md)).
|
|
633
|
+
Override them in the host's own stylesheet; there are no Sass `!default`
|
|
634
|
+
variables to configure.
|
|
635
|
+
|
|
636
|
+
---
|
|
637
|
+
|
|
638
|
+
### The Infragistics header and footer
|
|
639
|
+
|
|
640
|
+
The marketing site (Marketing-Infragistics) is the single source of the
|
|
641
|
+
Infragistics header and footer. It publishes them at
|
|
642
|
+
`/assets/chrome/fragment.html`: one versioned fragment (`ig-chrome v1`) with
|
|
643
|
+
scoped CSS and one classic script. tripwire renders it server-side; a site built
|
|
644
|
+
on this package keeps a **snapshot** of it in its own repo and renders it from
|
|
645
|
+
there.
|
|
646
|
+
|
|
647
|
+
#### Which header and footer a page gets
|
|
648
|
+
|
|
649
|
+
`DocsLayout` decides per build:
|
|
650
|
+
|
|
651
|
+
| Build | Renders | Source |
|
|
652
|
+
| ------------------------------------------- | ------------------------------------------------------------ | --------------------------------------------------------------- |
|
|
653
|
+
| the site registers `igChrome({ snapshot })` | the **marketing site's exported chrome** | the site's snapshot folder; nothing fetched at build or runtime |
|
|
654
|
+
| `navLang: 'jp'` | the legacy Japanese chrome (`GlobalNavBar` / `GlobalFooter`) | fetched from `jp.infragistics.com/navigation` at build |
|
|
655
|
+
| the site does not register `igChrome` | the legacy chrome (`GlobalNavBar` / `GlobalFooter`) | fetched from `www.infragistics.com/navigation` at build |
|
|
656
|
+
|
|
657
|
+
Japanese builds stay on the legacy chrome even with `igChrome`, until a
|
|
658
|
+
Japanese fragment is published.
|
|
659
|
+
|
|
660
|
+
#### Using the snapshot
|
|
661
|
+
|
|
662
|
+
**1. Keep a snapshot in the repo.** One folder, shared by every Astro project in
|
|
663
|
+
the repo, with one subfolder per source:
|
|
664
|
+
|
|
665
|
+
```
|
|
666
|
+
ig-chrome/
|
|
667
|
+
staging/ from https://astro-staging.infragistics.com/assets/chrome/fragment.html
|
|
668
|
+
production/ from https://www.infragistics.com/assets/chrome/fragment.html
|
|
669
|
+
manifest.json contract, build hash, source, sync time
|
|
670
|
+
fragment.html asset URLs written as %IG_CHROME_ASSETS%/…
|
|
671
|
+
assets/chrome.css
|
|
672
|
+
assets/chrome.js
|
|
673
|
+
assets/media/* every image the chrome loads from the marketing host
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
Each consumer repo owns the script that writes it (`scripts/chrome-sync.mjs` in
|
|
677
|
+
docs-template and api-docs). It validates the fragment with this package's
|
|
678
|
+
`igniteui-astro-components/chrome/contract`, the same checks the build and
|
|
679
|
+
tripwire apply, and writes nothing when the build hash is unchanged.
|
|
680
|
+
|
|
681
|
+
The **marketing site's deploy runs it**: after each deploy, its `sync-chrome` job
|
|
682
|
+
(Marketing-Infragistics, `.github/workflows/deploy.yml`) hands each docs repo the
|
|
683
|
+
export it just deployed, runs that repo's script, and opens a PR when the chrome
|
|
684
|
+
changed. Nothing in a docs repo has to reach the marketing site's hosts. To
|
|
685
|
+
sync by hand, run the script locally (see the docs repo's README).
|
|
686
|
+
|
|
687
|
+
**2. Register the integration**, with the snapshot for the build's environment:
|
|
688
|
+
|
|
689
|
+
```ts
|
|
690
|
+
import { igChrome } from 'igniteui-astro-components/chrome';
|
|
691
|
+
|
|
692
|
+
integrations: [
|
|
693
|
+
igChrome({ snapshot: isProduction ? './ig-chrome/production' : './ig-chrome/staging' }),
|
|
694
|
+
];
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
or `createDocsSite({ chrome: { snapshot } })`, which also drops the legacy
|
|
698
|
+
chrome's `navigation.css`, `footer.css`, jQuery, `plugins.nav.js` and
|
|
699
|
+
`navigation.js` from `<head>` (`getPlatformHead(platform, lang, { legacyChrome: false })`).
|
|
700
|
+
|
|
701
|
+
Per build, `igChrome`:
|
|
702
|
+
|
|
703
|
+
- validates the snapshot against the contract. A missing, broken or
|
|
704
|
+
incompatible snapshot **fails the build**, naming the folder;
|
|
705
|
+
- has `DocsLayout` render its head, header and footer parts;
|
|
706
|
+
- serves the CSS, JS and images from the site's own build, under its base path:
|
|
707
|
+
`{base}/_ig-chrome/{build}/…`. Every deployment is self-contained: nothing is
|
|
708
|
+
loaded from the marketing host at runtime except the Google Fonts stylesheet
|
|
709
|
+
the fragment links. Pages carry `<meta name="ig-chrome" content="v1 build=…">`.
|
|
710
|
+
|
|
711
|
+
#### How a nav change reaches a site
|
|
712
|
+
|
|
713
|
+
```
|
|
714
|
+
Marketing-Infragistics: push to staging / main
|
|
715
|
+
│
|
|
716
|
+
├─ deploy job ──► build ──► S3 (publishes /assets/chrome/fragment.html, build=abc123)
|
|
717
|
+
│ └──► uploads the export as an artifact
|
|
718
|
+
│
|
|
719
|
+
└─ sync-chrome job, for each docs repo (igniteui-documentation, api-docs)
|
|
720
|
+
│ checks out the repo, runs ITS scripts/chrome-sync.mjs on the export
|
|
721
|
+
│
|
|
722
|
+
├─ same build hash ──► nothing to do
|
|
723
|
+
└─ new build ────────► PR in the docs repo:
|
|
724
|
+
ig-chrome/staging (deploys from staging)
|
|
725
|
+
ig-chrome/production (deploys from main)
|
|
726
|
+
│
|
|
727
|
+
review, merge ──► the next docs build renders it
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
A sync changes only the snapshot folder. No release of this package is needed
|
|
731
|
+
when the marketing site changes its navigation. The `sync-chrome` job needs a
|
|
732
|
+
GitHub App with write access to the docs repos; until it is configured the job
|
|
733
|
+
is skipped and a sync is run locally.
|
|
734
|
+
|
|
735
|
+
#### Why the legacy chrome is still here
|
|
736
|
+
|
|
737
|
+
`GlobalNavBar` / `GlobalFooter` and their `/navigation` fetch stay for now:
|
|
738
|
+
|
|
739
|
+
- **Japanese** has no fragment yet, so Japanese builds use them.
|
|
740
|
+
- **Sites that haven't adopted `igChrome`** keep exactly the behaviour they had,
|
|
741
|
+
so adopting the snapshot is a per-site change, not a breaking release.
|
|
742
|
+
|
|
743
|
+
Once a Japanese fragment exists and every site using `DocsLayout` has a
|
|
744
|
+
snapshot, the legacy chrome and its fetch can be removed.
|
|
745
|
+
|
|
746
|
+
### Subpath exports
|
|
747
|
+
|
|
748
|
+
Every component is reachable through an explicit subpath in
|
|
749
|
+
[`package.json#exports`](package.json). Bare-specifier imports
|
|
750
|
+
(`igniteui-astro-components`) resolve to the JS/TS barrel
|
|
751
|
+
[`src/index.ts`](src/index.ts) which re-exports the runtime helpers only —
|
|
752
|
+
`.astro` files must always be imported via their full subpath because Astro
|
|
753
|
+
components are not plain ES modules. The barrel re-exports `./integration`,
|
|
754
|
+
which imports `pagefind` (not a declared dependency, #157), so a bare import
|
|
755
|
+
fails to resolve unless the host installs `pagefind`. Import the subpaths you
|
|
756
|
+
need (`igniteui-astro-components/sidebar`, `.../platform`, `.../lib/types`, …)
|
|
757
|
+
instead of the bare package.
|
|
758
|
+
|
|
759
|
+
---
|
|
760
|
+
|
|
761
|
+
### Using from another repo without publishing a package
|
|
762
|
+
|
|
763
|
+
You do not need to release a version to npm to consume these components. Use one of the two approaches below.
|
|
764
|
+
|
|
765
|
+
#### Option A — npm `file:` link (recommended for active development)
|
|
766
|
+
|
|
767
|
+
In the consumer repo, add a `file:` reference in `package.json`:
|
|
768
|
+
|
|
769
|
+
```json
|
|
770
|
+
{
|
|
771
|
+
"dependencies": {
|
|
772
|
+
"igniteui-astro-components": "file:../path/to/astro-components"
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
Run `npm install` in the consumer repo. npm creates a symlink so every save in the components repo is instantly visible. All `package.json#exports` subpaths work exactly as they would with a published package.
|
|
778
|
+
|
|
779
|
+
```sh
|
|
780
|
+
# Consumer repo
|
|
781
|
+
npm install
|
|
782
|
+
# or, to refresh after adding new exports:
|
|
783
|
+
npm install ../path/to/astro-components
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
> **Windows note:** symlinks require Developer Mode or running your terminal as Administrator.
|
|
787
|
+
|
|
788
|
+
#### Option B — TypeScript / Vite path alias (no install step)
|
|
789
|
+
|
|
790
|
+
Add a path alias in the consumer's `tsconfig.json` and `astro.config.ts` that maps the package name to the local source:
|
|
791
|
+
|
|
792
|
+
**`tsconfig.json`**
|
|
793
|
+
|
|
794
|
+
```json
|
|
795
|
+
{
|
|
796
|
+
"compilerOptions": {
|
|
797
|
+
"paths": {
|
|
798
|
+
"igniteui-astro-components": ["../astro-components/src/index.ts"],
|
|
799
|
+
"igniteui-astro-components/*": ["../astro-components/src/*"]
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
**`astro.config.ts`**
|
|
806
|
+
|
|
807
|
+
```ts
|
|
808
|
+
import path from 'node:path';
|
|
809
|
+
import { defineConfig } from 'astro/config';
|
|
810
|
+
|
|
811
|
+
export default defineConfig({
|
|
812
|
+
vite: {
|
|
813
|
+
resolve: {
|
|
814
|
+
alias: {
|
|
815
|
+
'igniteui-astro-components': path.resolve('../astro-components/src/index.ts'),
|
|
816
|
+
},
|
|
817
|
+
},
|
|
818
|
+
},
|
|
819
|
+
});
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
> The alias covers the JS/TS barrel. `.astro` component imports such as
|
|
823
|
+
> `'igniteui-astro-components/layouts/DocsLayout.astro'` resolve automatically
|
|
824
|
+
> through the `paths` wildcard in `tsconfig.json` — Astro's Vite pipeline
|
|
825
|
+
> handles them at build time.
|
|
826
|
+
|
|
827
|
+
#### Option C — direct relative imports (quick prototype)
|
|
828
|
+
|
|
829
|
+
Import component files directly by relative path without any alias or install:
|
|
830
|
+
|
|
831
|
+
```astro
|
|
832
|
+
---
|
|
833
|
+
import DocsLayout from '../../astro-components/src/layouts/DocsLayout/DocsLayout.astro';
|
|
834
|
+
import DocsSidebar from '../../astro-components/src/components/DocsSidebar/DocsSidebar.astro';
|
|
835
|
+
import ApiLink from '../../astro-components/src/components/mdx/ApiLink/ApiLink.astro';
|
|
836
|
+
---
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
This works immediately but ties your import paths to the internal folder structure. Switch to Option A or B before the project matures.
|
|
840
|
+
|
|
841
|
+
---
|
|
842
|
+
|
|
843
|
+
### Development
|
|
844
|
+
|
|
845
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup, the playground, tests,
|
|
846
|
+
lint/format, how to add a component, and how releases work. The short version:
|
|
847
|
+
|
|
848
|
+
```sh
|
|
849
|
+
npm ci
|
|
850
|
+
npm run playground # http://localhost:4567
|
|
851
|
+
npm run format:check && npm test && npm run lint && npm run playground:check && npm run playground:build
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
---
|
|
855
|
+
|
|
856
|
+
### License
|
|
857
|
+
|
|
858
|
+
[MIT](LICENSE)
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
## src/layouts/DocsLayout/README.md
|
|
862
|
+
|
|
863
|
+
## DocsLayout
|
|
864
|
+
|
|
865
|
+
Top-level page shell. Composes the global nav bar, sub-header, optional sidebar slot, main content area, "On this page" TOC slot, and footer into a single full-page layout.
|
|
866
|
+
|
|
867
|
+
### Import
|
|
868
|
+
|
|
869
|
+
```astro
|
|
870
|
+
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
### Props
|
|
874
|
+
|
|
875
|
+
| Prop | Type | Default | Description |
|
|
876
|
+
| ----------------- | ---------------- | -------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
877
|
+
| `title` | `string` | — | Page `<title>` prepended to the site name. Omit to show the site name only. |
|
|
878
|
+
| `description` | `string \| null` | — | `<meta name="description">` value. |
|
|
879
|
+
| `keywords` | `string \| null` | — | `<meta name="keywords">` value. |
|
|
880
|
+
| `hasSidebar` | `boolean` | `true` | Renders the sidebar rail when `true`. Provide content via `<… slot="sidebar">`. |
|
|
881
|
+
| `currentSlug` | `string` | `''` | Slug of the current page — used for the breadcrumb above the content. |
|
|
882
|
+
| `siteTitle` | `string` | virtual module | Override the site name used in `<title>` and the breadcrumb. Use this when not running `siteMetaIntegration`. |
|
|
883
|
+
| `license` | `string` | — | `license` frontmatter value. `'commercial'` shows a Premium badge, `'MIT'` an Open Source badge. |
|
|
884
|
+
| `is404` | `boolean` | `false` | Adds the `igd-page-layout--404` modifier class on 404 pages. |
|
|
885
|
+
| `packages` | `string[]` | — | Entries for the sub-header package selector. Hidden when omitted. |
|
|
886
|
+
| `selectedPackage` | `string` | — | Currently selected package (must match one of `packages`). |
|
|
887
|
+
| `packageLabel` | `string` | `'Package'` | `aria-label` of the sub-header package selector (not a visible label). |
|
|
888
|
+
| `versions` | `string[]` | — | Entries for the sub-header version selector. Hidden when omitted. |
|
|
889
|
+
| `selectedVersion` | `string` | — | Currently selected version (must match one of `versions`). |
|
|
890
|
+
| `versionLabel` | `string` | `'Version'` | `aria-label` of the sub-header version selector (not a visible label). |
|
|
891
|
+
| `showThemeToggle` | `boolean` | `false` | Forwarded to `DocsSubHeader`, which does not render a toggle; no effect today. |
|
|
892
|
+
| `themeStorageKey` | `string` | `'docs-theme'` | Forwarded to `DocsSubHeader` and unused; the layout's restore script reads the `'docs-theme'` key only. |
|
|
893
|
+
|
|
894
|
+
`hasToc` (`boolean`, default `true`) is also read at runtime and hides the `toc`
|
|
895
|
+
slot when `false`, but it is not yet declared in the `Props` interface (issue #161), so
|
|
896
|
+
TypeScript consumers must spread it in (`{...{ hasToc: false }}`).
|
|
897
|
+
|
|
898
|
+
### Slots
|
|
899
|
+
|
|
900
|
+
| Slot | Description |
|
|
901
|
+
| ------------ | ---------------------------------------------------------------------------------------------------------------------- |
|
|
902
|
+
| _(default)_ | Main page content, rendered inside `<main data-pagefind-body>`. |
|
|
903
|
+
| `sidebar` | Sidebar content — typically `<DocsSidebar>`. Only rendered when `hasSidebar={true}`. |
|
|
904
|
+
| `toc` | "On this page" column — pass `<DocsToc slot="toc" headings={headings} />` here. Omit to hide the TOC sidebar entirely. |
|
|
905
|
+
| `mobile-toc` | Mobile-only TOC row below the sub-header — pass `<MobileTocToggle slot="mobile-toc" headings={headings} />`. |
|
|
906
|
+
| `subheader` | Replaces the default `<DocsSubHeader>`; use it to mount your own sub-header (for example with `SearchAdvanced`). |
|
|
907
|
+
| `head` | Extra `<head>` entries injected after platform defaults. |
|
|
908
|
+
|
|
909
|
+
### What the layout brings in
|
|
910
|
+
|
|
911
|
+
- `styles/theme.scss` (the package's global stylesheet) and the JetBrains Mono
|
|
912
|
+
variable font from `@fontsource-variable/jetbrains-mono`. You do not need to
|
|
913
|
+
import either yourself.
|
|
914
|
+
- `GlobalNavBar`, `DocsSubHeader`, `DocsBreadcrumb`, `LicenseIndicator`,
|
|
915
|
+
`CopyCode` and `GlobalFooter`.
|
|
916
|
+
- `<html data-theme="light|dark">`, restored from `localStorage` before paint.
|
|
917
|
+
- Astro's `<ClientRouter>` for view transitions.
|
|
918
|
+
|
|
919
|
+
### Host requirements
|
|
920
|
+
|
|
921
|
+
- The two virtual modules below must resolve (stub them if you do not use the
|
|
922
|
+
integration).
|
|
923
|
+
- Components rendered inside the layout that read
|
|
924
|
+
`Astro.locals.platformContext` or `Astro.locals.envVars` (`ApiLink`,
|
|
925
|
+
`ApiRef`, `PlatformBlock`, `Sample`, `ThemingWidget`) need a middleware that
|
|
926
|
+
sets them — see [Quick start](README.md#quick-start) step 3.
|
|
927
|
+
|
|
928
|
+
### Example
|
|
929
|
+
|
|
930
|
+
#### With TOC (prop-driven, no `siteMetaIntegration` required)
|
|
931
|
+
|
|
932
|
+
Pass all data directly as props. The `virtual:docs-template/site-meta` module
|
|
933
|
+
still needs to be resolvable at Vite build time — supply a minimal stub (see
|
|
934
|
+
[Quick start](README.md#quick-start) step 2).
|
|
935
|
+
|
|
936
|
+
```astro
|
|
937
|
+
---
|
|
938
|
+
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
939
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
940
|
+
import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
941
|
+
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
942
|
+
import type { MarkdownHeading } from 'astro';
|
|
943
|
+
|
|
944
|
+
const { headings } = Astro.props as { headings: MarkdownHeading[] };
|
|
945
|
+
const slug = Astro.params.slug ?? '';
|
|
946
|
+
|
|
947
|
+
const sidebar: SidebarEntry[] = [
|
|
948
|
+
{ label: 'Getting Started', collapsed: false, items: [{ label: 'Introduction', slug: '' }] },
|
|
949
|
+
{ label: 'Components', collapsed: false, items: [{ label: 'Toast', slug: 'components/toast' }] },
|
|
950
|
+
];
|
|
951
|
+
---
|
|
952
|
+
|
|
953
|
+
<DocsLayout title="Toast" siteTitle="My Library" hasSidebar currentSlug={slug}>
|
|
954
|
+
<DocsSidebar slot="sidebar" items={sidebar} currentSlug={slug} />
|
|
955
|
+
<DocsToc slot="toc" headings={headings} />
|
|
956
|
+
<slot />
|
|
957
|
+
</DocsLayout>
|
|
958
|
+
```
|
|
959
|
+
|
|
960
|
+
#### Without TOC
|
|
961
|
+
|
|
962
|
+
Omit the `toc` slot entirely — the TOC sidebar collapses automatically via CSS.
|
|
963
|
+
|
|
964
|
+
```astro
|
|
965
|
+
---
|
|
966
|
+
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
967
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
968
|
+
|
|
969
|
+
const slug = Astro.params.slug ?? '';
|
|
970
|
+
---
|
|
971
|
+
|
|
972
|
+
<DocsLayout title="Changelog" siteTitle="My Library" hasSidebar currentSlug={slug}>
|
|
973
|
+
<DocsSidebar slot="sidebar" currentSlug={slug} />
|
|
974
|
+
<slot />
|
|
975
|
+
</DocsLayout>
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
#### With `siteMetaIntegration` (integration-driven)
|
|
979
|
+
|
|
980
|
+
When `createDocsSite()` / `siteMetaIntegration()` is configured, `siteTitle`
|
|
981
|
+
can be omitted — it is read from the virtual module automatically.
|
|
982
|
+
|
|
983
|
+
```astro
|
|
984
|
+
---
|
|
985
|
+
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
986
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
987
|
+
import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
988
|
+
|
|
989
|
+
const { headings } = Astro.props;
|
|
990
|
+
const slug = Astro.params.slug ?? '';
|
|
991
|
+
---
|
|
992
|
+
|
|
993
|
+
<DocsLayout title="Toast" description="Toast component documentation" hasSidebar currentSlug={slug}>
|
|
994
|
+
<DocsSidebar slot="sidebar" currentSlug={slug} />
|
|
995
|
+
<DocsToc slot="toc" headings={headings} />
|
|
996
|
+
<slot />
|
|
997
|
+
</DocsLayout>
|
|
998
|
+
```
|
|
999
|
+
|
|
1000
|
+
### Header and footer
|
|
1001
|
+
|
|
1002
|
+
`DocsLayout` renders the Infragistics header and footer itself; which one
|
|
1003
|
+
depends on the build:
|
|
1004
|
+
|
|
1005
|
+
| Build | Header / footer |
|
|
1006
|
+
| ------------------------------------------- | ---------------------------------------------------------------- |
|
|
1007
|
+
| the site registers `igChrome({ snapshot })` | the marketing site's exported chrome, from the site's snapshot |
|
|
1008
|
+
| `navLang: 'jp'` | the legacy chrome fetched from `jp.infragistics.com/navigation` |
|
|
1009
|
+
| otherwise | the legacy chrome fetched from `www.infragistics.com/navigation` |
|
|
1010
|
+
|
|
1011
|
+
With a snapshot, the head part goes into `<head>` (with
|
|
1012
|
+
`<meta name="ig-chrome" content="v1 build=…">`), the header into the sticky,
|
|
1013
|
+
persisted `global-nav-bar` wrapper, and the footer into a full-width grid cell
|
|
1014
|
+
with `data-igd-footer`, persisted across navigations. See
|
|
1015
|
+
[The Infragistics header and footer](README.md#the-infragistics-header-and-footer).
|
|
1016
|
+
|
|
1017
|
+
### Virtual module dependencies
|
|
1018
|
+
|
|
1019
|
+
`DocsLayout` imports from two virtual modules. Supply them with a Vite plugin
|
|
1020
|
+
(see [Quick start](README.md#quick-start) step 2; `siteMetaIntegration`
|
|
1021
|
+
does not emit `packages` and `selectedPackage`, so it cannot provide them
|
|
1022
|
+
today):
|
|
1023
|
+
|
|
1024
|
+
| Module | Used for | Can be overridden by prop |
|
|
1025
|
+
| --------------------------------- | ------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
|
|
1026
|
+
| `virtual:docs-template/site-meta` | `title`, `sidebar`, `productLinks`, `headEntries`, `trailingSlash`, `navLang`, `packages`, `selectedPackage` | `siteTitle` on `DocsLayout`, `items`/`trailingSlash` on `DocsSidebar`, `packages`/`selectedPackage` on `DocsSubHeader` |
|
|
1027
|
+
| `virtual:docs-template/nav-html` | Pre-fetched nav/footer HTML, widget script URL, platform key | — (not yet prop-overridable) |
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
## src/components/CopyCode/README.md
|
|
1031
|
+
|
|
1032
|
+
## CopyCode
|
|
1033
|
+
|
|
1034
|
+
Adds a "Copy code" icon button to every Shiki code block on the page. The
|
|
1035
|
+
component renders no markup of its own: a client script wraps each
|
|
1036
|
+
`pre.astro-code, pre.shiki` in `.copy-code-wrapper` and appends an
|
|
1037
|
+
`igc-icon-button.copy-btn` that copies the block's text to the clipboard.
|
|
1038
|
+
|
|
1039
|
+
### Import
|
|
1040
|
+
|
|
1041
|
+
```astro
|
|
1042
|
+
import CopyCode from 'igniteui-astro-components/components/CopyCode.astro';
|
|
1043
|
+
```
|
|
1044
|
+
|
|
1045
|
+
### Props
|
|
1046
|
+
|
|
1047
|
+
None.
|
|
1048
|
+
|
|
1049
|
+
### Behaviour
|
|
1050
|
+
|
|
1051
|
+
- Runs on `astro:page-load`, so it also covers pages reached through view
|
|
1052
|
+
transitions. Blocks that already have a wrapper are skipped.
|
|
1053
|
+
- Copies `<code>` text (falls back to the `<pre>` text). Uses
|
|
1054
|
+
`navigator.clipboard.writeText` with a hidden-textarea fallback.
|
|
1055
|
+
- The icon switches to a check mark and the `aria-label` to "Copied!" for
|
|
1056
|
+
1.5 s, or to "Copy failed".
|
|
1057
|
+
- Button styles live in `src/styles/global/_copy-button.scss`.
|
|
1058
|
+
|
|
1059
|
+
### Example
|
|
1060
|
+
|
|
1061
|
+
`DocsLayout` mounts it already. Mount it yourself only in a custom page shell:
|
|
1062
|
+
|
|
1063
|
+
```astro
|
|
1064
|
+
---
|
|
1065
|
+
import CopyCode from 'igniteui-astro-components/components/CopyCode.astro';
|
|
1066
|
+
---
|
|
1067
|
+
|
|
1068
|
+
<CopyCode />
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
## src/components/DocsBreadcrumb/README.md
|
|
1073
|
+
|
|
1074
|
+
## DocsBreadcrumb
|
|
1075
|
+
|
|
1076
|
+
Breadcrumb trail rendered inside the main content frame, above the page body. Shows the site title followed by the sidebar-derived crumb path for the current page.
|
|
1077
|
+
|
|
1078
|
+
The crumb list is built by walking the sidebar tree with `getBreadcrumb()`. Falls back to `pageTitle` when the current slug is not found in the tree.
|
|
1079
|
+
|
|
1080
|
+
> **Layout note:** This component is placed inside `.igd-main-content` in `DocsLayout`, not in the fixed subheader bar. See `DocsSubHeader` for the top bar.
|
|
1081
|
+
|
|
1082
|
+
### Import
|
|
1083
|
+
|
|
1084
|
+
```astro
|
|
1085
|
+
import DocsBreadcrumb from 'igniteui-astro-components/components/DocsBreadcrumb.astro';
|
|
1086
|
+
```
|
|
1087
|
+
|
|
1088
|
+
### Props
|
|
1089
|
+
|
|
1090
|
+
| Prop | Type | Default | Description |
|
|
1091
|
+
| -------------- | ---------------- | -------------- | ----------------------------------------------------------------------------------- |
|
|
1092
|
+
| `currentSlug` | `string` | `''` | Slug of the current page — used to derive the crumb path from the sidebar tree. |
|
|
1093
|
+
| `pageTitle` | `string \| null` | — | Fallback label shown as the last crumb when `currentSlug` is not found in the tree. |
|
|
1094
|
+
| `siteTitle` | `string` | virtual module | Override the site name shown as the first crumb. |
|
|
1095
|
+
| `sidebarItems` | `SidebarEntry[]` | virtual module | Override the sidebar tree used for crumb generation. |
|
|
1096
|
+
|
|
1097
|
+
### Behaviour
|
|
1098
|
+
|
|
1099
|
+
- Renders a semantic `<nav aria-label="Breadcrumb"><ol>` structure.
|
|
1100
|
+
- The first item is the site title (from `virtual:docs-template/site-meta` or the `siteTitle` prop).
|
|
1101
|
+
- Subsequent items are the ancestor labels from the sidebar tree leading to the current page.
|
|
1102
|
+
- The last crumb (current page) is visually emphasised.
|
|
1103
|
+
- Renders nothing when both `siteTitle` and the crumb list are empty.
|
|
1104
|
+
|
|
1105
|
+
### Example
|
|
1106
|
+
|
|
1107
|
+
#### Prop-driven (no `siteMetaIntegration` required)
|
|
1108
|
+
|
|
1109
|
+
```astro
|
|
1110
|
+
---
|
|
1111
|
+
import DocsBreadcrumb from 'igniteui-astro-components/components/DocsBreadcrumb.astro';
|
|
1112
|
+
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
1113
|
+
|
|
1114
|
+
const sidebar: SidebarEntry[] = [
|
|
1115
|
+
{ label: 'Components', collapsed: false, items: [{ label: 'Toast', slug: 'components/toast' }] },
|
|
1116
|
+
];
|
|
1117
|
+
---
|
|
1118
|
+
|
|
1119
|
+
<DocsBreadcrumb siteTitle="My Library" currentSlug="components/toast" sidebarItems={sidebar} />
|
|
1120
|
+
```
|
|
1121
|
+
|
|
1122
|
+
#### With `siteMetaIntegration` (integration-driven)
|
|
1123
|
+
|
|
1124
|
+
All props are optional when the virtual module provides the data:
|
|
1125
|
+
|
|
1126
|
+
```astro
|
|
1127
|
+
---
|
|
1128
|
+
import DocsBreadcrumb from 'igniteui-astro-components/components/DocsBreadcrumb.astro';
|
|
1129
|
+
---
|
|
1130
|
+
|
|
1131
|
+
<DocsBreadcrumb currentSlug="components/toast" pageTitle="Toast" />
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
This component is used automatically inside `DocsLayout` — you only need to
|
|
1135
|
+
mount it directly when building a custom page shell.
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
## src/components/DocsSidebar/README.md
|
|
1139
|
+
|
|
1140
|
+
## Sidebar suite
|
|
1141
|
+
|
|
1142
|
+
The sidebar is composed of a few focused pieces on top of the shared
|
|
1143
|
+
[`DocsTree`](src/components/DocsTree/README.md) component:
|
|
1144
|
+
|
|
1145
|
+
| File | Export path | Description |
|
|
1146
|
+
| -------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------- |
|
|
1147
|
+
| `DocsSidebar.astro` | `…/components/DocsSidebar/DocsSidebar.astro` | Composition root — logo, filter and the scrollable tree |
|
|
1148
|
+
| `SidebarFilterInput.astro` | `…/components/DocsSidebar/SidebarFilterInput.astro` | Filter `<input>` markup (`data-sidebar-filter-*` hooks) |
|
|
1149
|
+
| `SidebarLabel.astro` | `…/components/DocsSidebar/SidebarLabel.astro` | Label renderer passed to `DocsTree` (`node`, `depth`, `isLeaf`, `isActive`) |
|
|
1150
|
+
| `toTreeNodes.ts` | `…/components/DocsSidebar/toTreeNodes` | `SidebarEntry[]` → `TreeNode[]` adapter |
|
|
1151
|
+
| `sidebar-filter.ts` | `…/components/DocsSidebar/sidebar-filter` | `<sidebar-filter>` custom element |
|
|
1152
|
+
| `sidebar-tooltip.ts` | (internal) | Full-text tooltip for truncated labels |
|
|
1153
|
+
|
|
1154
|
+
---
|
|
1155
|
+
|
|
1156
|
+
### DocsSidebar
|
|
1157
|
+
|
|
1158
|
+
The only component you need to mount directly.
|
|
1159
|
+
|
|
1160
|
+
#### Import
|
|
1161
|
+
|
|
1162
|
+
```astro
|
|
1163
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
1164
|
+
```
|
|
1165
|
+
|
|
1166
|
+
#### Props
|
|
1167
|
+
|
|
1168
|
+
| Prop | Type | Default | Description |
|
|
1169
|
+
| -------------------- | ---------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1170
|
+
| `currentSlug` | `string` | `''` | Slug of the active page. Highlights the matching link and auto-expands ancestor groups. |
|
|
1171
|
+
| `items` | `SidebarEntry[]` | virtual module | Sidebar tree to render. **Overrides** the `virtual:docs-template/site-meta` value when provided. Use this when not running `siteMetaIntegration`. |
|
|
1172
|
+
| `showFilter` | `boolean` | `true` | Render the filter input above the tree. |
|
|
1173
|
+
| `trailingSlash` | `boolean` | from Astro config | Append a trailing slash to generated links. Derived from the site's `trailingSlash` setting via the virtual module; `true` when unknown. |
|
|
1174
|
+
| `logoText` | `string` | product family | Text in the slide-in sidebar's logo area. |
|
|
1175
|
+
| `platformLabel` | `string \| null` | from virtual module | Platform label under the logo text (for example `'Angular'`). Pass `null` to hide it. |
|
|
1176
|
+
| `singleBranchExpand` | `boolean` | `true` | Keep one branch open: only the current page's groups start open and expanding a group collapses the others. The filter still opens every match. With the default, a group's `collapsed` is ignored; set `false` to honour `collapsed`. |
|
|
1177
|
+
|
|
1178
|
+
#### Example
|
|
1179
|
+
|
|
1180
|
+
##### Prop-driven (no `siteMetaIntegration` required)
|
|
1181
|
+
|
|
1182
|
+
```astro
|
|
1183
|
+
---
|
|
1184
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
1185
|
+
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
1186
|
+
|
|
1187
|
+
// Define the tree inline or import from a shared config file.
|
|
1188
|
+
const sidebar: SidebarEntry[] = [
|
|
1189
|
+
{
|
|
1190
|
+
label: 'Getting Started',
|
|
1191
|
+
items: [
|
|
1192
|
+
{ label: 'Introduction', slug: '' },
|
|
1193
|
+
{ label: 'Installation', slug: 'installation' },
|
|
1194
|
+
],
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
label: 'Components',
|
|
1198
|
+
items: [
|
|
1199
|
+
{ label: 'Toast', slug: 'components/toast' },
|
|
1200
|
+
{
|
|
1201
|
+
label: 'Calendar',
|
|
1202
|
+
slug: 'components/calendar',
|
|
1203
|
+
badges: [{ text: 'New', variant: 'new' }],
|
|
1204
|
+
},
|
|
1205
|
+
],
|
|
1206
|
+
},
|
|
1207
|
+
];
|
|
1208
|
+
---
|
|
1209
|
+
|
|
1210
|
+
<DocsSidebar items={sidebar} currentSlug="components/toast" />
|
|
1211
|
+
```
|
|
1212
|
+
|
|
1213
|
+
Place it in the `sidebar` slot of `DocsLayout`:
|
|
1214
|
+
|
|
1215
|
+
```astro
|
|
1216
|
+
<DocsLayout siteTitle="My Library" hasSidebar currentSlug={slug}>
|
|
1217
|
+
<DocsSidebar slot="sidebar" items={sidebar} currentSlug={slug} />
|
|
1218
|
+
<slot />
|
|
1219
|
+
</DocsLayout>
|
|
1220
|
+
```
|
|
1221
|
+
|
|
1222
|
+
##### With `siteMetaIntegration` (integration-driven)
|
|
1223
|
+
|
|
1224
|
+
When `createDocsSite()` / `siteMetaIntegration()` is configured, omit
|
|
1225
|
+
`items` — the tree is read from the virtual module automatically.
|
|
1226
|
+
|
|
1227
|
+
```astro
|
|
1228
|
+
---
|
|
1229
|
+
import DocsSidebar from 'igniteui-astro-components/components/DocsSidebar/DocsSidebar.astro';
|
|
1230
|
+
---
|
|
1231
|
+
|
|
1232
|
+
<DocsSidebar currentSlug="components/toast" />
|
|
1233
|
+
```
|
|
1234
|
+
|
|
1235
|
+
#### Sidebar data
|
|
1236
|
+
|
|
1237
|
+
##### Prop-driven
|
|
1238
|
+
|
|
1239
|
+
Pass the tree directly via the `items` prop (see example above).
|
|
1240
|
+
A good pattern is to define the tree in a shared config file:
|
|
1241
|
+
|
|
1242
|
+
```ts
|
|
1243
|
+
// src/site-config.ts
|
|
1244
|
+
import type { SidebarEntry } from 'igniteui-astro-components/lib/sidebar/types';
|
|
1245
|
+
|
|
1246
|
+
export const SIDEBAR: SidebarEntry[] = [/* … */];
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
Then import it in every layout/page:
|
|
1250
|
+
|
|
1251
|
+
```astro
|
|
1252
|
+
import {SIDEBAR} from '../site-config'; // …
|
|
1253
|
+
<DocsSidebar items={SIDEBAR} currentSlug={slug} />
|
|
1254
|
+
```
|
|
1255
|
+
|
|
1256
|
+
##### Integration-driven
|
|
1257
|
+
|
|
1258
|
+
Build the tree at config time using `buildSidebarFromToc()` and pass it to
|
|
1259
|
+
`siteMetaIntegration` — it is then available automatically via the virtual
|
|
1260
|
+
module:
|
|
1261
|
+
|
|
1262
|
+
```ts
|
|
1263
|
+
// astro.config.ts
|
|
1264
|
+
import { buildSidebarFromToc, siteMetaIntegration } from 'igniteui-astro-components/integration';
|
|
1265
|
+
|
|
1266
|
+
const sidebar = buildSidebarFromToc({ tocPath: './docs/toc.json', docsDir: './docs/en' });
|
|
1267
|
+
|
|
1268
|
+
export default defineConfig({
|
|
1269
|
+
integrations: [siteMetaIntegration({ title: 'My Docs', sidebar })],
|
|
1270
|
+
});
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
#### SidebarEntry type
|
|
1274
|
+
|
|
1275
|
+
Import from `igniteui-astro-components/lib/sidebar/types`; the file is the
|
|
1276
|
+
source of truth, this is a summary:
|
|
1277
|
+
|
|
1278
|
+
```ts
|
|
1279
|
+
type SidebarBadge = { text: string; variant: 'new' | 'updated' | 'preview' | 'premium' };
|
|
1280
|
+
|
|
1281
|
+
type SidebarLink = {
|
|
1282
|
+
label: string;
|
|
1283
|
+
slug: string;
|
|
1284
|
+
badges?: SidebarBadge[];
|
|
1285
|
+
attrs?: Record<string, string | boolean | undefined>;
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
type SidebarGroup = {
|
|
1289
|
+
label: string;
|
|
1290
|
+
collapsed?: boolean; // closed by default when true; read only with singleBranchExpand={false}
|
|
1291
|
+
items: SidebarEntry[];
|
|
1292
|
+
};
|
|
1293
|
+
|
|
1294
|
+
type SidebarEntry = SidebarLink | SidebarGroup;
|
|
1295
|
+
```
|
|
1296
|
+
|
|
1297
|
+
`SIDEBAR_BADGE_VARIANTS` is exported from the same module. Helpers such as
|
|
1298
|
+
`isGroup`, `isActive`, `getBreadcrumb` and `joinPath` live in
|
|
1299
|
+
`igniteui-astro-components/lib/sidebar/helpers`.
|
|
1300
|
+
|
|
1301
|
+
#### Filter behaviour
|
|
1302
|
+
|
|
1303
|
+
The `<sidebar-filter>` custom element handles live filtering:
|
|
1304
|
+
|
|
1305
|
+
- Typing in the input adds `data-filtering` to the host element.
|
|
1306
|
+
- Items that match get `data-filter-match`; non-matching items are hidden via CSS.
|
|
1307
|
+
- "No results" text is set via `data-no-results` on the host element.
|
|
1308
|
+
- Filter state persists across Astro View Transitions navigations via `sessionStorage`.
|
|
1309
|
+
|
|
1310
|
+
#### Truncated labels
|
|
1311
|
+
|
|
1312
|
+
Leaf labels are clamped to two lines. When a label overflows the clamp, hovering
|
|
1313
|
+
or focusing its row shows the full text in a shared `<igc-tooltip>` (one per
|
|
1314
|
+
sidebar, re-anchored to the current row by `sidebar-tooltip.ts`). Rows whose
|
|
1315
|
+
label fits never show a tooltip; truncation is measured on each interaction, so
|
|
1316
|
+
it stays correct after the sidebar is resized. Style it via
|
|
1317
|
+
`.igd-sidebar-tooltip` and the `--ig-tooltip-*` variables. Below the tablet
|
|
1318
|
+
breakpoint (< 1280px, where the sidebar is a slide-in overlay) labels are not
|
|
1319
|
+
clamped and the tooltip is not shown.
|
|
1320
|
+
|
|
1321
|
+
---
|
|
1322
|
+
|
|
1323
|
+
### Building a custom sidebar
|
|
1324
|
+
|
|
1325
|
+
`DocsSidebar` converts `SidebarEntry[]` to `TreeNode[]` with `toTreeNodes()`
|
|
1326
|
+
and renders them through `DocsTree` with `SidebarLabel` as the label renderer.
|
|
1327
|
+
To build your own layout, reuse those pieces:
|
|
1328
|
+
|
|
1329
|
+
```astro
|
|
1330
|
+
---
|
|
1331
|
+
import DocsTree from 'igniteui-astro-components/components/DocsTree/DocsTree.astro';
|
|
1332
|
+
import SidebarLabel from 'igniteui-astro-components/components/DocsSidebar/SidebarLabel.astro';
|
|
1333
|
+
import { toTreeNodes } from 'igniteui-astro-components/components/DocsSidebar/toTreeNodes';
|
|
1334
|
+
import { normalizeSlug } from 'igniteui-astro-components/lib/sidebar/helpers';
|
|
1335
|
+
|
|
1336
|
+
const nodes = toTreeNodes(sidebar, currentSlug, { trailingSlash: true });
|
|
1337
|
+
---
|
|
1338
|
+
|
|
1339
|
+
<DocsTree
|
|
1340
|
+
nodes={nodes}
|
|
1341
|
+
variant="sidebar"
|
|
1342
|
+
activeId={normalizeSlug(currentSlug)}
|
|
1343
|
+
toggleNodeOnClick
|
|
1344
|
+
renderLabel={SidebarLabel}
|
|
1345
|
+
/>
|
|
1346
|
+
```
|
|
1347
|
+
|
|
1348
|
+
See the [DocsTree README](src/components/DocsTree/README.md) for the `TreeNode` shape and
|
|
1349
|
+
the `--docs-tree-*` styling tokens.
|
|
1350
|
+
|
|
1351
|
+
|
|
1352
|
+
## src/components/DocsSubHeader/README.md
|
|
1353
|
+
|
|
1354
|
+
## DocsSubHeader
|
|
1355
|
+
|
|
1356
|
+
Secondary fixed header bar rendered below the `GlobalNavBar`. Contains the logo, the search button and the package and version selectors.
|
|
1357
|
+
|
|
1358
|
+
> **Note:** The breadcrumb trail was extracted into the standalone [`DocsBreadcrumb`](src/components/DocsBreadcrumb/README.md) component and is now rendered inside the main content frame, above the page body — not in this bar.
|
|
1359
|
+
|
|
1360
|
+
### Import
|
|
1361
|
+
|
|
1362
|
+
```astro
|
|
1363
|
+
import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.astro';
|
|
1364
|
+
```
|
|
1365
|
+
|
|
1366
|
+
### Props
|
|
1367
|
+
|
|
1368
|
+
| Prop | Type | Default | Description |
|
|
1369
|
+
| ----------------- | ---------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1370
|
+
| `logoText` | `string` | by platform | Text shown in the logo area while `GlobalNavBar` is visible; `'Ignite UI'` or `'Ultimate UI'` by default. |
|
|
1371
|
+
| `packages` | `Array<string \| { label: string; value?: string; href?: string; base?: string }>` | virtual module | Entries for the package selector. A string is both label and value; `href` navigates on selection; `base` swaps the site base to keep the current page. Falls back to the virtual module's `packages`; the selector is hidden only when both are empty. |
|
|
1372
|
+
| `selectedPackage` | `string` | virtual module | Currently selected package (must match one of `packages`). Falls back to the virtual module's `selectedPackage`, then to the first entry. |
|
|
1373
|
+
| `packageLabel` | `string` | `'Package'` | `aria-label` of the package selector (not a visible label). |
|
|
1374
|
+
| `versions` | `string[]` | — | Version labels for the version selector dropdown. Hidden when omitted. |
|
|
1375
|
+
| `selectedVersion` | `string` | — | Currently selected version (must match one of `versions`). |
|
|
1376
|
+
| `versionLabel` | `string` | `'Version'` | `aria-label` of the version selector (not a visible label). |
|
|
1377
|
+
|
|
1378
|
+
Accepted but not rendered (kept for compatibility; see the DocsSubHeader dead-props issue):
|
|
1379
|
+
|
|
1380
|
+
| Prop | Why it has no effect |
|
|
1381
|
+
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
1382
|
+
| `siteTitle`, `pageTitle`, `currentSlug`, `sidebarItems` | Breadcrumb inputs. The breadcrumb moved to `DocsBreadcrumb`; the sub-header computes the crumbs and discards them. |
|
|
1383
|
+
| `productLinks` | The product-links markup is commented out. |
|
|
1384
|
+
| `showThemeToggle`, `themeStorageKey` | Destructured and never used. No toggle is rendered; `DocsLayout` hard-codes the `'docs-theme'` storage key. |
|
|
1385
|
+
|
|
1386
|
+
`PackageEntry` is `{ label: string; value?: string; href?: string; base?: string }`:
|
|
1387
|
+
|
|
1388
|
+
| Field | Description |
|
|
1389
|
+
| ------- | -------------------------------------------------------------------------------- |
|
|
1390
|
+
| `label` | Text shown in the dropdown. |
|
|
1391
|
+
| `value` | Value matched against `selectedPackage`. Defaults to `label`. |
|
|
1392
|
+
| `href` | Where selecting the entry navigates, e.g. the platform's getting started page. |
|
|
1393
|
+
| `base` | Root URL of the entry's docs site. Switching keeps the current page (see below). |
|
|
1394
|
+
|
|
1395
|
+
### Slots
|
|
1396
|
+
|
|
1397
|
+
| Slot | Default | Description |
|
|
1398
|
+
| -------- | ------------ | ----------------------------------------------------- |
|
|
1399
|
+
| `search` | `<Search />` | Override the search widget rendered in the subheader. |
|
|
1400
|
+
|
|
1401
|
+
### Behaviour
|
|
1402
|
+
|
|
1403
|
+
- Selecting a package navigates to its `href`. When the entry also has a `base`, it goes to the same
|
|
1404
|
+
page on that site instead: the current URL with this site's base (`import.meta.env.BASE_URL`)
|
|
1405
|
+
swapped for `base`, keeping the query and `#hash`. Nothing checks that the page exists there, so
|
|
1406
|
+
the server should redirect missing pages, e.g. to the platform's getting started page.
|
|
1407
|
+
- The search button opens the Pagefind dialog (see `Search` component).
|
|
1408
|
+
- `DocsLayout` sets `--docs-global-nav-height` on the wrapper from the measured nav height; no stylesheet in this package reads it or `--docs-subheader-height`.
|
|
1409
|
+
|
|
1410
|
+
### Example
|
|
1411
|
+
|
|
1412
|
+
```astro
|
|
1413
|
+
---
|
|
1414
|
+
import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.astro';
|
|
1415
|
+
---
|
|
1416
|
+
|
|
1417
|
+
<DocsSubHeader />
|
|
1418
|
+
```
|
|
1419
|
+
|
|
1420
|
+
This component is used automatically inside `DocsLayout` — you only need to
|
|
1421
|
+
mount it directly when building a custom page shell.
|
|
1422
|
+
|
|
1423
|
+
#### With package/version selectors
|
|
1424
|
+
|
|
1425
|
+
```astro
|
|
1426
|
+
---
|
|
1427
|
+
import DocsSubHeader from 'igniteui-astro-components/components/DocsSubHeader.astro';
|
|
1428
|
+
import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.astro';
|
|
1429
|
+
---
|
|
1430
|
+
|
|
1431
|
+
<DocsSubHeader
|
|
1432
|
+
packages={['igniteui-angular', 'igniteui-charts']}
|
|
1433
|
+
selectedPackage="igniteui-angular"
|
|
1434
|
+
packageLabel="Package"
|
|
1435
|
+
versions={['19.1 (latest)', '18.2', '18.1']}
|
|
1436
|
+
selectedVersion="19.1 (latest)"
|
|
1437
|
+
versionLabel="Version"
|
|
1438
|
+
>
|
|
1439
|
+
<SearchAdvanced slot="search" showScope tabs={[]} />
|
|
1440
|
+
</DocsSubHeader>
|
|
1441
|
+
```
|
|
1442
|
+
|
|
1443
|
+
`#package-select` and `#version-select` are `igc-select` elements and emit
|
|
1444
|
+
`igcChange` (not a native `change` event); attach your own navigation logic
|
|
1445
|
+
via `document.getElementById`.
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
## src/components/DocsToc/README.md
|
|
1449
|
+
|
|
1450
|
+
## DocsToc
|
|
1451
|
+
|
|
1452
|
+
"On this page" table of contents with scroll-spy. Builds a nested list from the page's `MarkdownHeading[]` and highlights the current section as the user scrolls.
|
|
1453
|
+
|
|
1454
|
+
The component renders a `<docs-toc>` custom element that manages all scroll-spy logic on the client. It supports sticky-header offset compensation, click-pin behaviour, and Astro View Transitions.
|
|
1455
|
+
|
|
1456
|
+
### Import
|
|
1457
|
+
|
|
1458
|
+
```astro
|
|
1459
|
+
import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
1460
|
+
```
|
|
1461
|
+
|
|
1462
|
+
### Props
|
|
1463
|
+
|
|
1464
|
+
| Prop | Type | Default | Description |
|
|
1465
|
+
| -------------- | ----------------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1466
|
+
| `headings` | `MarkdownHeading[]` | `[]` | Array of headings from Astro's `getHeadings()` or MDX frontmatter. |
|
|
1467
|
+
| `tocConfig` | `false \| { minHeadingLevel?: number; maxHeadingLevel?: number }` | — | Pass `false` to disable the TOC entirely. |
|
|
1468
|
+
| `label` | `string` | `'On this page'` | Heading label rendered above the list. |
|
|
1469
|
+
| `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. |
|
|
1470
|
+
|
|
1471
|
+
`tocConfig` defaults:
|
|
1472
|
+
|
|
1473
|
+
- `minHeadingLevel`: `2` (i.e. `##`)
|
|
1474
|
+
- `maxHeadingLevel`: `3` (i.e. `###`)
|
|
1475
|
+
|
|
1476
|
+
### Example
|
|
1477
|
+
|
|
1478
|
+
```astro
|
|
1479
|
+
---
|
|
1480
|
+
import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
1481
|
+
|
|
1482
|
+
const { headings } = Astro.props;
|
|
1483
|
+
---
|
|
1484
|
+
|
|
1485
|
+
<DocsToc headings={headings} />
|
|
1486
|
+
|
|
1487
|
+
<!-- Only h2 -->
|
|
1488
|
+
<DocsToc headings={headings} tocConfig={{ minHeadingLevel: 2, maxHeadingLevel: 2 }} />
|
|
1489
|
+
|
|
1490
|
+
<!-- Disabled -->
|
|
1491
|
+
<DocsToc headings={headings} tocConfig={false} />
|
|
1492
|
+
|
|
1493
|
+
<!-- Compensate for a sticky nav bar -->
|
|
1494
|
+
<DocsToc headings={headings} offsetTarget=".site-header" />
|
|
1495
|
+
```
|
|
1496
|
+
|
|
1497
|
+
Place it in the `toc` slot of `DocsLayout`: `<DocsToc slot="toc" headings={headings} />`.
|
|
1498
|
+
|
|
1499
|
+
### Scroll-spy behaviour
|
|
1500
|
+
|
|
1501
|
+
- 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).
|
|
1502
|
+
- At the bottom of the page the last heading is always highlighted, even if its section is too short to ever cross the threshold.
|
|
1503
|
+
- **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.
|
|
1504
|
+
- The component uses `requestAnimationFrame` batching so scroll and resize handlers are cheap.
|
|
1505
|
+
- `scroll-padding-top` is set dynamically via a `ResizeObserver` on the offset target element so anchor-jump scrolling always lands below the sticky header.
|
|
1506
|
+
|
|
1507
|
+
### Astro View Transitions
|
|
1508
|
+
|
|
1509
|
+
Because bundled `<script>` modules run only once, the component listens for `astro:page-load` at the document level. After every navigation it calls `init()` on each `<docs-toc>` element to re-attach listeners and re-run the initial highlight pass against the new page's headings.
|
|
1510
|
+
|
|
1511
|
+
### CSS
|
|
1512
|
+
|
|
1513
|
+
The component ships global styles. Place the TOC inside an element with the `.toc-sidebar` class to get the built-in fixed sidebar layout (visible above `84rem`).
|
|
1514
|
+
|
|
1515
|
+
| CSS custom property | Default | Description |
|
|
1516
|
+
| ------------------- | ------- | ------------------------------- |
|
|
1517
|
+
| `--ig-toc-width` | `24rem` | Width of the fixed TOC sidebar. |
|
|
1518
|
+
|
|
1519
|
+
`.toc-sidebar:not(:has(docs-toc))` is set to `display: none` so the sidebar collapses automatically when the TOC has no items to render.
|
|
1520
|
+
|
|
1521
|
+
|
|
1522
|
+
## src/components/DocsTree/README.md
|
|
1523
|
+
|
|
1524
|
+
## DocsTree
|
|
1525
|
+
|
|
1526
|
+
Base tree component shared by `DocsSidebar` and `DocsToc`. Wraps
|
|
1527
|
+
`<igc-tree>` from `igniteui-webcomponents` and recursively renders
|
|
1528
|
+
`<igc-tree-item>`s from a generic `TreeNode[]`.
|
|
1529
|
+
|
|
1530
|
+
The single styling locus is [`docs-tree.scss`](src/components/DocsTree/docs-tree.scss). Designers
|
|
1531
|
+
tune values via the `--docs-tree-*` CSS custom properties; per-variant
|
|
1532
|
+
tweaks live at the bottom of the file under `[data-variant="sidebar"]`
|
|
1533
|
+
and `[data-variant="toc"]` selectors.
|
|
1534
|
+
|
|
1535
|
+
### Usage
|
|
1536
|
+
|
|
1537
|
+
```astro
|
|
1538
|
+
---
|
|
1539
|
+
import DocsTree from 'igniteui-astro-components/components/DocsTree/DocsTree.astro';
|
|
1540
|
+
import type { TreeNode } from 'igniteui-astro-components/components/DocsTree/types';
|
|
1541
|
+
import MyLabel from './MyLabel.astro';
|
|
1542
|
+
|
|
1543
|
+
const nodes: TreeNode[] = [/* your tree */];
|
|
1544
|
+
---
|
|
1545
|
+
|
|
1546
|
+
<DocsTree
|
|
1547
|
+
nodes={nodes}
|
|
1548
|
+
variant="sidebar"
|
|
1549
|
+
activeId="getting-started"
|
|
1550
|
+
toggleNodeOnClick
|
|
1551
|
+
renderLabel={MyLabel}
|
|
1552
|
+
/>
|
|
1553
|
+
```
|
|
1554
|
+
|
|
1555
|
+
### Props
|
|
1556
|
+
|
|
1557
|
+
| Prop | Type | Notes |
|
|
1558
|
+
| ------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
1559
|
+
| `nodes` | `TreeNode[]` | Required. Root of the tree. |
|
|
1560
|
+
| `variant` | `'sidebar' \| 'toc'` | Required. Drives variant CSS rules. |
|
|
1561
|
+
| `activeId` | `string` | Optional. SSR-time match against `TreeNode.id`. **See active-state contract below.** |
|
|
1562
|
+
| `toggleNodeOnClick` | `boolean` | Optional. Forwarded to `<igc-tree>`. |
|
|
1563
|
+
| `renderLabel` | Astro component | Optional. Receives `{ node, depth, isLeaf, isActive }`. Falls back to a plain `<span>{node.label}</span>` when omitted. |
|
|
1564
|
+
| `ariaLabel` | `string` | Optional. Accessible name for the tree's `nav` role. Skip it when an outer `<nav aria-labelledby>` already names the region. |
|
|
1565
|
+
|
|
1566
|
+
`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.
|
|
1567
|
+
|
|
1568
|
+
### TreeNode shape
|
|
1569
|
+
|
|
1570
|
+
```ts
|
|
1571
|
+
interface TreeNode {
|
|
1572
|
+
id: string; // → data-tree-id
|
|
1573
|
+
label: string; // plain-text fallback
|
|
1574
|
+
href?: string; // when set, label is wrapped in <a href>
|
|
1575
|
+
expanded?: boolean; // SSR expand hint
|
|
1576
|
+
children?: TreeNode[];
|
|
1577
|
+
itemData?: Record<string, string>; // → kebab-case data-* attrs on <igc-tree-item>
|
|
1578
|
+
linkAttrs?: Record<string, string | number | boolean | undefined>; // spread on leaf <a>
|
|
1579
|
+
meta?: Record<string, unknown>; // free-form, read by renderLabel
|
|
1580
|
+
}
|
|
1581
|
+
```
|
|
1582
|
+
|
|
1583
|
+
A node with both `href` and `children` (e.g. a TOC h2 with h3 subheadings)
|
|
1584
|
+
renders as a clickable parent — the `<a>` carries the `href`, and child
|
|
1585
|
+
nodes render as nested `<igc-tree-item>`s.
|
|
1586
|
+
|
|
1587
|
+
### Active-state contract
|
|
1588
|
+
|
|
1589
|
+
DocsTree supports two non-overlapping ways to mark the active node:
|
|
1590
|
+
|
|
1591
|
+
1. **SSR (sidebar style):** pass `activeId`. The matching node's `<a>`
|
|
1592
|
+
gets `aria-current="page"` at render. The component never mutates
|
|
1593
|
+
`aria-current` after hydration.
|
|
1594
|
+
|
|
1595
|
+
2. **Runtime (toc style):** omit `activeId` and let a wrapper custom
|
|
1596
|
+
element (e.g. `<docs-toc>`) set `aria-current="true"` on links it
|
|
1597
|
+
selects via scroll-spy.
|
|
1598
|
+
|
|
1599
|
+
**Do not pass `activeId` AND mutate `aria-current` at runtime in the
|
|
1600
|
+
same tree.** The two paths use different attribute _values_ and would
|
|
1601
|
+
flicker.
|
|
1602
|
+
|
|
1603
|
+
### Styling
|
|
1604
|
+
|
|
1605
|
+
All structural and per-variant rules are in
|
|
1606
|
+
[`docs-tree.scss`](src/components/DocsTree/docs-tree.scss). The file is imported once by
|
|
1607
|
+
`DocsTree.astro`; Astro hoists and dedupes it.
|
|
1608
|
+
|
|
1609
|
+
Sidebar layout tokens (set on `igc-tree[data-variant="sidebar"]`):
|
|
1610
|
+
|
|
1611
|
+
```
|
|
1612
|
+
--docs-tree-row-inset leading space on every row before chevron/label (6px)
|
|
1613
|
+
--docs-tree-indent one indentation step per nesting level (16px)
|
|
1614
|
+
--docs-tree-expand-col width of the leading chevron column (14px)
|
|
1615
|
+
--docs-tree-expand-icon-size chevron glyph size inside the column (14px)
|
|
1616
|
+
--docs-tree-expand-gap gap between the chevron and the group label (8px)
|
|
1617
|
+
--docs-tree-leaf-inset extra inset of a leaf label (6px)
|
|
1618
|
+
```
|
|
1619
|
+
|
|
1620
|
+
The chevron is rendered in the label slot _before_ the text; nesting uses
|
|
1621
|
+
`igc-tree-item`'s native `indentation` part. Keep the invariant
|
|
1622
|
+
`indent + leaf inset == expand column + gap`: it makes a leaf directly under a
|
|
1623
|
+
root group line up with that group's label, and puts a nested group's chevron
|
|
1624
|
+
in its parent's label column.
|
|
1625
|
+
|
|
1626
|
+
### Adapters
|
|
1627
|
+
|
|
1628
|
+
Consumers convert their domain types to `TreeNode[]` via small adapters:
|
|
1629
|
+
|
|
1630
|
+
- [`src/components/DocsSidebar/toTreeNodes.ts`](src/components/DocsSidebar/toTreeNodes.ts)
|
|
1631
|
+
for `SidebarEntry[]`.
|
|
1632
|
+
- [`src/components/DocsToc/toTreeNodes.ts`](src/components/DocsToc/toTreeNodes.ts) for
|
|
1633
|
+
`MarkdownHeading[]`.
|
|
1634
|
+
|
|
1635
|
+
|
|
1636
|
+
## src/components/GlobalFooter/README.md
|
|
1637
|
+
|
|
1638
|
+
## GlobalFooter
|
|
1639
|
+
|
|
1640
|
+
Renders the global footer in the light DOM.
|
|
1641
|
+
|
|
1642
|
+
### Import
|
|
1643
|
+
|
|
1644
|
+
```astro
|
|
1645
|
+
import GlobalFooter from 'igniteui-astro-components/components/GlobalFooter.astro';
|
|
1646
|
+
```
|
|
1647
|
+
|
|
1648
|
+
### Props
|
|
1649
|
+
|
|
1650
|
+
| Prop | Type | Description |
|
|
1651
|
+
| ------ | --------- | -------------------------------------------------- |
|
|
1652
|
+
| `lang` | `NavLang` | **Required.** Locale — `'en'` \| `'jp'` \| `'kr'`. |
|
|
1653
|
+
|
|
1654
|
+
### Behaviour
|
|
1655
|
+
|
|
1656
|
+
- Fetches the IG footer HTML at build time via `fetchIgNav(lang)`.
|
|
1657
|
+
|
|
1658
|
+
### Example
|
|
1659
|
+
|
|
1660
|
+
```astro
|
|
1661
|
+
---
|
|
1662
|
+
import GlobalFooter from 'igniteui-astro-components/components/GlobalFooter.astro';
|
|
1663
|
+
---
|
|
1664
|
+
|
|
1665
|
+
<GlobalFooter lang="en" />
|
|
1666
|
+
```
|
|
1667
|
+
|
|
1668
|
+
### Configuration
|
|
1669
|
+
|
|
1670
|
+
Same as `GlobalNavBar` — `lang` is provided automatically by `DocsLayout` from `navLang` in `virtual:docs-template/site-meta`.
|
|
1671
|
+
|
|
1672
|
+
|
|
1673
|
+
## src/components/GlobalNavBar/README.md
|
|
1674
|
+
|
|
1675
|
+
## GlobalNavBar
|
|
1676
|
+
|
|
1677
|
+
Renders the global navigation bar in the light DOM. Supports IG-family platforms (`angular`, `react`, `blazor`, `web-components`, `slingshot`, `igniteui`).
|
|
1678
|
+
|
|
1679
|
+
### Import
|
|
1680
|
+
|
|
1681
|
+
```astro
|
|
1682
|
+
import GlobalNavBar from 'igniteui-astro-components/components/GlobalNavBar.astro';
|
|
1683
|
+
```
|
|
1684
|
+
|
|
1685
|
+
### Props
|
|
1686
|
+
|
|
1687
|
+
| Prop | Type | Description |
|
|
1688
|
+
| ------ | --------- | -------------------------------------------------- |
|
|
1689
|
+
| `lang` | `NavLang` | **Required.** Locale — `'en'` \| `'jp'` \| `'kr'`. |
|
|
1690
|
+
|
|
1691
|
+
`NavLang`: `'en' | 'jp' | 'kr'`
|
|
1692
|
+
|
|
1693
|
+
### Behaviour
|
|
1694
|
+
|
|
1695
|
+
- Fetches the IG header HTML at build time via `fetchIgNav(lang)`.
|
|
1696
|
+
- The nav bar is marked `transition:persist="global-nav-bar"` so it does not re-render during Astro View Transitions navigation.
|
|
1697
|
+
|
|
1698
|
+
### Example
|
|
1699
|
+
|
|
1700
|
+
```astro
|
|
1701
|
+
---
|
|
1702
|
+
import GlobalNavBar from 'igniteui-astro-components/components/GlobalNavBar.astro';
|
|
1703
|
+
---
|
|
1704
|
+
|
|
1705
|
+
<GlobalNavBar lang="en" />
|
|
1706
|
+
```
|
|
1707
|
+
|
|
1708
|
+
### Configuration
|
|
1709
|
+
|
|
1710
|
+
`lang` is provided automatically by `DocsLayout` from the `navLang` value in the `virtual:docs-template/site-meta` virtual module, which is set in `astro.config.ts`:
|
|
1711
|
+
|
|
1712
|
+
```ts
|
|
1713
|
+
createDocsSite({
|
|
1714
|
+
navLang: 'en',
|
|
1715
|
+
// …
|
|
1716
|
+
});
|
|
1717
|
+
```
|
|
1718
|
+
|
|
1719
|
+
|
|
1720
|
+
## src/components/MobileSidebarToggle/README.md
|
|
1721
|
+
|
|
1722
|
+
## MobileSidebarToggle
|
|
1723
|
+
|
|
1724
|
+
Mobile-only fixed disclosure button that toggles the sidebar overlay. Hidden on desktop via CSS.
|
|
1725
|
+
|
|
1726
|
+
### Import
|
|
1727
|
+
|
|
1728
|
+
```astro
|
|
1729
|
+
import MobileSidebarToggle from 'igniteui-astro-components/components/MobileSidebarToggle.astro';
|
|
1730
|
+
```
|
|
1731
|
+
|
|
1732
|
+
### Props
|
|
1733
|
+
|
|
1734
|
+
| Prop | Type | Default | Description |
|
|
1735
|
+
| ------- | -------- | ------------------- | ----------------------------------------------------------------------------- |
|
|
1736
|
+
| `label` | `string` | `'Components List'` | Visible button text and aria-label suffix. Typically the active section name. |
|
|
1737
|
+
|
|
1738
|
+
### Behaviour
|
|
1739
|
+
|
|
1740
|
+
- Sets `aria-expanded` and controls `#docs-sidebar` via `aria-controls`.
|
|
1741
|
+
- The sidebar overlay open/close CSS is driven by a custom element or a script that toggles a class on the `<nav>`.
|
|
1742
|
+
|
|
1743
|
+
### Example
|
|
1744
|
+
|
|
1745
|
+
```astro
|
|
1746
|
+
---
|
|
1747
|
+
import MobileSidebarToggle from 'igniteui-astro-components/components/MobileSidebarToggle.astro';
|
|
1748
|
+
---
|
|
1749
|
+
|
|
1750
|
+
<MobileSidebarToggle label="Components" />
|
|
1751
|
+
```
|
|
1752
|
+
|
|
1753
|
+
Used automatically inside `DocsLayout` when `hasSidebar={true}`.
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
## src/components/MobileTocToggle/README.md
|
|
1757
|
+
|
|
1758
|
+
## MobileTocToggle
|
|
1759
|
+
|
|
1760
|
+
Mobile-only sticky row rendered below the sub-header. Shows "On this page"
|
|
1761
|
+
with the current active heading and a chevron; tapping it opens a dropdown with
|
|
1762
|
+
the table-of-contents links rendered through `DocsTree`. Hidden on tablet and
|
|
1763
|
+
above, where the full `DocsToc` sidebar is shown instead.
|
|
1764
|
+
|
|
1765
|
+
### Import
|
|
1766
|
+
|
|
1767
|
+
```astro
|
|
1768
|
+
import MobileTocToggle from 'igniteui-astro-components/components/MobileTocToggle.astro';
|
|
1769
|
+
```
|
|
1770
|
+
|
|
1771
|
+
### Props
|
|
1772
|
+
|
|
1773
|
+
| Prop | Type | Default | Description |
|
|
1774
|
+
| ----------- | ------------------- | ---------------- | ------------------------------------------------------------------------------ |
|
|
1775
|
+
| `headings` | `MarkdownHeading[]` | `[]` | Astro's `headings` for the page. Renders nothing when empty. |
|
|
1776
|
+
| `tocConfig` | `TocConfig` | — | Depth filter, same shape `DocsToc` accepts (`components/DocsToc/toTreeNodes`). |
|
|
1777
|
+
| `label` | `string` | `'On this page'` | Trigger text. |
|
|
1778
|
+
|
|
1779
|
+
### Example
|
|
1780
|
+
|
|
1781
|
+
```astro
|
|
1782
|
+
---
|
|
1783
|
+
import DocsLayout from 'igniteui-astro-components/layouts/DocsLayout.astro';
|
|
1784
|
+
import DocsToc from 'igniteui-astro-components/components/DocsToc.astro';
|
|
1785
|
+
import MobileTocToggle from 'igniteui-astro-components/components/MobileTocToggle.astro';
|
|
1786
|
+
|
|
1787
|
+
const { headings } = Astro.props;
|
|
1788
|
+
---
|
|
1789
|
+
|
|
1790
|
+
<DocsLayout title="Grid">
|
|
1791
|
+
<MobileTocToggle slot="mobile-toc" headings={headings} />
|
|
1792
|
+
<DocsToc slot="toc" headings={headings} />
|
|
1793
|
+
<slot />
|
|
1794
|
+
</DocsLayout>
|
|
1795
|
+
```
|
|
1796
|
+
|
|
1797
|
+
### Markup
|
|
1798
|
+
|
|
1799
|
+
`.mobile-toc` → `button.mobile-toc__trigger#mobile-toc-trigger` (`aria-expanded`,
|
|
1800
|
+
`aria-controls="mobile-toc-dropdown"`) with `.mobile-toc__label`,
|
|
1801
|
+
`.mobile-toc__active` and `.mobile-toc__chevron`, followed by the dropdown.
|
|
1802
|
+
Styles are in `MobileTocToggle.scss`.
|
|
1803
|
+
|
|
1804
|
+
|
|
1805
|
+
## src/components/Search/README.md
|
|
1806
|
+
|
|
1807
|
+
## Search
|
|
1808
|
+
|
|
1809
|
+
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.
|
|
1810
|
+
|
|
1811
|
+
### Import
|
|
1812
|
+
|
|
1813
|
+
```astro
|
|
1814
|
+
import Search from 'igniteui-astro-components/components/Search.astro';
|
|
1815
|
+
```
|
|
1816
|
+
|
|
1817
|
+
### Props
|
|
1818
|
+
|
|
1819
|
+
None — the component is self-contained.
|
|
1820
|
+
|
|
1821
|
+
### Behaviour
|
|
1822
|
+
|
|
1823
|
+
- 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`.
|
|
1824
|
+
- In development the button renders but the dynamic Pagefind import resolves as a no-op — no runtime errors.
|
|
1825
|
+
- Keyboard shortcut: `Ctrl+K` / `⌘K` to open, `Escape` to close.
|
|
1826
|
+
|
|
1827
|
+
### Example
|
|
1828
|
+
|
|
1829
|
+
`Search` is included automatically inside `DocsSubHeader` / `DocsLayout`. Mount it directly if you build a custom header:
|
|
1830
|
+
|
|
1831
|
+
```astro
|
|
1832
|
+
---
|
|
1833
|
+
import Search from 'igniteui-astro-components/components/Search.astro';
|
|
1834
|
+
---
|
|
1835
|
+
|
|
1836
|
+
<Search />
|
|
1837
|
+
```
|
|
1838
|
+
|
|
1839
|
+
### Build setup
|
|
1840
|
+
|
|
1841
|
+
The package imports `pagefind` but does not declare it as a dependency (issue #157), so the
|
|
1842
|
+
host site must install it:
|
|
1843
|
+
|
|
1844
|
+
```sh
|
|
1845
|
+
npm install --save-dev pagefind
|
|
1846
|
+
```
|
|
1847
|
+
|
|
1848
|
+
If you do not use `siteMetaIntegration`, build the index yourself after
|
|
1849
|
+
`astro build`, for example `pagefind --site dist`, or call the JS API from your
|
|
1850
|
+
own integration.
|
|
1851
|
+
|
|
1852
|
+
|
|
1853
|
+
## src/components/SearchAdvanced/README.md
|
|
1854
|
+
|
|
1855
|
+
## SearchAdvanced
|
|
1856
|
+
|
|
1857
|
+
Client-side API search dialog that loads a JSON search index and performs all matching against symbol and member names. Supports configurable result tabs and optional package-scope filtering.
|
|
1858
|
+
|
|
1859
|
+
### Import
|
|
1860
|
+
|
|
1861
|
+
```astro
|
|
1862
|
+
import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.astro';
|
|
1863
|
+
```
|
|
1864
|
+
|
|
1865
|
+
### Props
|
|
1866
|
+
|
|
1867
|
+
| Prop | Type | Default | Description |
|
|
1868
|
+
| ------------- | ------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1869
|
+
| `class` | `string` | — | CSS class for the outer element |
|
|
1870
|
+
| `indexUrl` | `string` | `${BASE_URL}api-search-index/manifest.json` | URL of the search index: a single JSON file or a manifest (see "Index format") |
|
|
1871
|
+
| `placeholder` | `string` | `"Search"` | Search input placeholder text |
|
|
1872
|
+
| `showScope` | `boolean` | `false` | Show scope selector (current package / all packages) |
|
|
1873
|
+
| `tabs` | `SearchTab[]` | `[]` | Tab categories (besides the always-present "All" tab) |
|
|
1874
|
+
| `allTabLimit` | `number` | `10` | Max results per category in the "All" tab |
|
|
1875
|
+
| `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>`). |
|
|
1876
|
+
|
|
1877
|
+
`indexUrl` accepts two shapes. A **single file** is a JSON document with
|
|
1878
|
+
`{ pages: [...] }`. A **manifest** is `{ files: ["pkg/version.json", ...] }`;
|
|
1879
|
+
every listed file is fetched relative to the manifest URL and their `pages`
|
|
1880
|
+
are merged. The host generates and serves the index; `playground/public/api-search-index/`
|
|
1881
|
+
holds a sample manifest.
|
|
1882
|
+
|
|
1883
|
+
#### `SearchTab`
|
|
1884
|
+
|
|
1885
|
+
```ts
|
|
1886
|
+
interface SearchTab {
|
|
1887
|
+
/** Unique identifier for this tab/category */
|
|
1888
|
+
id: string;
|
|
1889
|
+
/** Display label for the tab */
|
|
1890
|
+
label: string;
|
|
1891
|
+
/**
|
|
1892
|
+
* Kind codes from the index that map to this category.
|
|
1893
|
+
* Use '__name__' for the page-names category.
|
|
1894
|
+
* Member kind codes: 'p' = property, 'a' = accessor, 'm' = method, 'e' = event, 'c' = constructor.
|
|
1895
|
+
*/
|
|
1896
|
+
kindCodes: string[];
|
|
1897
|
+
}
|
|
1898
|
+
```
|
|
1899
|
+
|
|
1900
|
+
### Examples
|
|
1901
|
+
|
|
1902
|
+
#### Minimal (single "All" tab, no scope)
|
|
1903
|
+
|
|
1904
|
+
```astro
|
|
1905
|
+
---
|
|
1906
|
+
import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.astro';
|
|
1907
|
+
---
|
|
1908
|
+
|
|
1909
|
+
<SearchAdvanced indexUrl="/api-search-index.json" />
|
|
1910
|
+
```
|
|
1911
|
+
|
|
1912
|
+
#### With scope and full tab set (like api-docs)
|
|
1913
|
+
|
|
1914
|
+
```astro
|
|
1915
|
+
---
|
|
1916
|
+
import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.astro';
|
|
1917
|
+
|
|
1918
|
+
const tabs = [
|
|
1919
|
+
{ id: 'names', label: 'Names', kindCodes: ['__name__'] },
|
|
1920
|
+
{ id: 'properties', label: 'Properties', kindCodes: ['p'] },
|
|
1921
|
+
{ id: 'accessors', label: 'Accessors', kindCodes: ['a'] },
|
|
1922
|
+
{ id: 'methods', label: 'Methods', kindCodes: ['m'] },
|
|
1923
|
+
{ id: 'events', label: 'Events', kindCodes: ['e'] },
|
|
1924
|
+
{ id: 'constructors', label: 'Constructors', kindCodes: ['c'] },
|
|
1925
|
+
];
|
|
1926
|
+
---
|
|
1927
|
+
|
|
1928
|
+
<SearchAdvanced showScope tabs={tabs} />
|
|
1929
|
+
```
|
|
1930
|
+
|
|
1931
|
+
#### Custom subset of tabs
|
|
1932
|
+
|
|
1933
|
+
```astro
|
|
1934
|
+
---
|
|
1935
|
+
import SearchAdvanced from 'igniteui-astro-components/components/SearchAdvanced.astro';
|
|
1936
|
+
|
|
1937
|
+
const tabs = [
|
|
1938
|
+
{ id: 'names', label: 'Types', kindCodes: ['__name__'] },
|
|
1939
|
+
{ id: 'members', label: 'Members', kindCodes: ['p', 'a', 'm', 'e', 'c'] },
|
|
1940
|
+
];
|
|
1941
|
+
---
|
|
1942
|
+
|
|
1943
|
+
<SearchAdvanced tabs={tabs} indexUrl="/my-index.json" />
|
|
1944
|
+
```
|
|
1945
|
+
|
|
1946
|
+
### Index Format
|
|
1947
|
+
|
|
1948
|
+
The component expects a JSON file with the following structure:
|
|
1949
|
+
|
|
1950
|
+
```json
|
|
1951
|
+
{
|
|
1952
|
+
"pages": [
|
|
1953
|
+
{
|
|
1954
|
+
"u": "/path/to/page",
|
|
1955
|
+
"n": "ClassName",
|
|
1956
|
+
"k": "class",
|
|
1957
|
+
"v": "1.0.0",
|
|
1958
|
+
"p": "angular",
|
|
1959
|
+
"g": "package-name",
|
|
1960
|
+
"m": [
|
|
1961
|
+
["memberName", "p"],
|
|
1962
|
+
["onClick", "e"]
|
|
1963
|
+
]
|
|
1964
|
+
}
|
|
1965
|
+
]
|
|
1966
|
+
}
|
|
1967
|
+
```
|
|
1968
|
+
|
|
1969
|
+
### Keyboard Shortcuts
|
|
1970
|
+
|
|
1971
|
+
- `Ctrl+K` / `⌘K` — open/close the search dialog
|
|
1972
|
+
- `Escape` — close the dialog
|
|
1973
|
+
|
|
1974
|
+
|
|
1975
|
+
## src/components/ThemingWidget/README.md
|
|
1976
|
+
|
|
1977
|
+
## ThemingWidget
|
|
1978
|
+
|
|
1979
|
+
A compact theme picker dropdown for sample viewers. An `igc-select` shows the
|
|
1980
|
+
active theme with its multi-dot swatch. Its menu includes an optional **MODE**
|
|
1981
|
+
row with Light and Dark icon buttons, followed by selectable theme options.
|
|
1982
|
+
|
|
1983
|
+
The widget uses `igniteui-webcomponents`: `igc-select`, `igc-select-item`,
|
|
1984
|
+
`igc-select-header`, `igc-icon-button`, and `igc-icon`. A small client script
|
|
1985
|
+
synchronizes widget state and publishes changes to sample iframes.
|
|
1986
|
+
|
|
1987
|
+
### Usage
|
|
1988
|
+
|
|
1989
|
+
```astro
|
|
1990
|
+
---
|
|
1991
|
+
import ThemingWidget from 'igniteui-astro-components/components/ThemingWidget.astro';
|
|
1992
|
+
---
|
|
1993
|
+
|
|
1994
|
+
<ThemingWidget target="#sample-preview" />
|
|
1995
|
+
```
|
|
1996
|
+
|
|
1997
|
+
On change the widget:
|
|
1998
|
+
|
|
1999
|
+
- dispatches a bubbling `igd-theme-change` `CustomEvent` with
|
|
2000
|
+
`{ theme, mode, modePreference }`, and
|
|
2001
|
+
- reflects `data-igd-theme` / `data-igd-mode` on every element matching `target`.
|
|
2002
|
+
|
|
2003
|
+
The selection is not persisted — the widget resets to its initial props on every
|
|
2004
|
+
page load.
|
|
2005
|
+
|
|
2006
|
+
### Color mode
|
|
2007
|
+
|
|
2008
|
+
The MODE row exposes **Light** and **Dark** controls. A `system` value remains
|
|
2009
|
+
accepted as an initial prop for compatibility; it resolves against
|
|
2010
|
+
`prefers-color-scheme` before it is emitted or reflected onto `target`.
|
|
2011
|
+
|
|
2012
|
+
### Panel placement
|
|
2013
|
+
|
|
2014
|
+
`igc-select` owns the popup. Its built-in `igc-popover` anchors the menu to the
|
|
2015
|
+
input, flips it when necessary, and keeps the menu aligned with the select.
|
|
2016
|
+
|
|
2017
|
+
```js
|
|
2018
|
+
document.addEventListener('igd-theme-change', (e) => {
|
|
2019
|
+
// e.g. { theme: 'fluent', mode: 'dark', modePreference: 'system' }
|
|
2020
|
+
const { theme, mode, modePreference } = e.detail;
|
|
2021
|
+
});
|
|
2022
|
+
```
|
|
2023
|
+
|
|
2024
|
+
### Props
|
|
2025
|
+
|
|
2026
|
+
| Prop | Type | Default | Description |
|
|
2027
|
+
| --------------- | ------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
2028
|
+
| `themes` | `ThemeOption[]` | Material, Fluent, Bootstrap, Indigo | Selectable themes. Each has `name`, optional `label`, and a `swatch` array. |
|
|
2029
|
+
| `selectedTheme` | `string` | env, then first theme | Active theme `name`. See [Ambient defaults](#ambient-defaults). |
|
|
2030
|
+
| `mode` | `'light' \| 'dark' \| 'system'` | env, then `'light'` | Active color mode. See [Color mode](#color-mode) and [Ambient defaults](#ambient-defaults). |
|
|
2031
|
+
| `showMode` | `boolean` | `true` | Show the MODE (Light / Dark) control row. |
|
|
2032
|
+
| `target` | `string` | — | CSS selector to reflect `data-igd-theme` / `data-igd-mode` onto. |
|
|
2033
|
+
| `label` | `string` | `'Select theme'` | Accessible label for the select. |
|
|
2034
|
+
| `id` | `string` | auto | Root element id. |
|
|
2035
|
+
| `class` | `string` | — | Extra class(es) forwarded to the root. |
|
|
2036
|
+
|
|
2037
|
+
#### `ThemeOption`
|
|
2038
|
+
|
|
2039
|
+
```ts
|
|
2040
|
+
interface ThemeOption {
|
|
2041
|
+
name: string; // stable id, used as the event/storage value
|
|
2042
|
+
label?: string; // display label (defaults to a title-cased `name`)
|
|
2043
|
+
swatch: string[]; // dot colors, left → right (the design uses three)
|
|
2044
|
+
}
|
|
2045
|
+
```
|
|
2046
|
+
|
|
2047
|
+
#### Ambient defaults
|
|
2048
|
+
|
|
2049
|
+
`selectedTheme` and `mode` fall back to the host site's configuration before
|
|
2050
|
+
they fall back to the built-in defaults, so a docs site picks its starting theme
|
|
2051
|
+
once instead of at every call site. The host publishes it on
|
|
2052
|
+
`Astro.locals.envVars` from its middleware — the same channel `Sample.astro`
|
|
2053
|
+
already reads its demo URLs from:
|
|
2054
|
+
|
|
2055
|
+
```ts
|
|
2056
|
+
// docs host middleware
|
|
2057
|
+
ctx.locals.envVars = { defaultSampleTheme: 'bootstrap', defaultSampleMode: 'light' };
|
|
2058
|
+
```
|
|
2059
|
+
|
|
2060
|
+
| Key | Falls back to |
|
|
2061
|
+
| -------------------- | ------------------------ |
|
|
2062
|
+
| `defaultSampleTheme` | the first `themes` entry |
|
|
2063
|
+
| `defaultSampleMode` | `'light'` |
|
|
2064
|
+
|
|
2065
|
+
An explicit prop always wins. An unrecognized `defaultSampleMode` is ignored, and
|
|
2066
|
+
a `defaultSampleTheme` matching no entry in `themes` falls through to the first
|
|
2067
|
+
one. Consumers without middleware get an empty `Astro.locals` and the built-in
|
|
2068
|
+
defaults.
|
|
2069
|
+
|
|
2070
|
+
`Sample.astro` adds one step on top: when it renders the widget it derives the
|
|
2071
|
+
theme from the current platform — Angular → Material, React / Web Components /
|
|
2072
|
+
Blazor → Bootstrap, with a `wc` sample taking the Web Components default on
|
|
2073
|
+
any platform — unless `defaultSampleTheme` is set. That default is
|
|
2074
|
+
functional, not cosmetic: the picker's selection is posted into the sample
|
|
2075
|
+
iframe on every load, so it decides how the demo actually renders.
|
|
2076
|
+
|
|
2077
|
+
### Styling
|
|
2078
|
+
|
|
2079
|
+
The widget exposes CSS custom properties for retuning per context — override
|
|
2080
|
+
them from an ancestor or via `class`:
|
|
2081
|
+
|
|
2082
|
+
| Variable | Default |
|
|
2083
|
+
| ------------------------ | ---------------------------- |
|
|
2084
|
+
| `--igd-theming-radius` | `5px` |
|
|
2085
|
+
| `--igd-theming-border` | `var(--ig-gray-300)` |
|
|
2086
|
+
| `--igd-theming-bg` | `light-dark(#fff, gray-100)` |
|
|
2087
|
+
| `--igd-theming-fg` | `var(--ig-gray-900)` |
|
|
2088
|
+
| `--igd-theming-muted` | `var(--ig-gray-500)` |
|
|
2089
|
+
| `--igd-theming-hover-bg` | `var(--ig-gray-100)` |
|
|
2090
|
+
| `--igd-theming-accent` | `var(--igd-accent)` |
|
|
2091
|
+
|
|
2092
|
+
|
|
2093
|
+
## src/components/mdx/Anatomy/README.md
|
|
2094
|
+
|
|
2095
|
+
## Anatomy
|
|
2096
|
+
|
|
2097
|
+
Framed, padded container for a component anatomy diagram. Use it in MDX pages
|
|
2098
|
+
where a labelled screenshot explains the parts of a component.
|
|
2099
|
+
|
|
2100
|
+
### Import
|
|
2101
|
+
|
|
2102
|
+
```astro
|
|
2103
|
+
import Anatomy from 'igniteui-astro-components/components/mdx/Anatomy.astro';
|
|
2104
|
+
```
|
|
2105
|
+
|
|
2106
|
+
### Props
|
|
2107
|
+
|
|
2108
|
+
| Prop | Type | Default | Description |
|
|
2109
|
+
| ------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------ |
|
|
2110
|
+
| `src` | `string` | _(required)_ | Image URL. |
|
|
2111
|
+
| `alt` | `string` | _(required)_ | Accessible description, forwarded to the `<img>`. Describe the parts the diagram labels, not the name. |
|
|
2112
|
+
| `class` | `string` | — | Extra class(es) on the frame. |
|
|
2113
|
+
|
|
2114
|
+
### Example
|
|
2115
|
+
|
|
2116
|
+
```mdx
|
|
2117
|
+
import Anatomy from 'igniteui-astro-components/components/mdx/Anatomy.astro';
|
|
2118
|
+
|
|
2119
|
+
<Anatomy
|
|
2120
|
+
src="/images/button-anatomy.png"
|
|
2121
|
+
alt="Button anatomy: label text, optional prefix icon, optional suffix icon"
|
|
2122
|
+
/>
|
|
2123
|
+
```
|
|
2124
|
+
|
|
2125
|
+
### Styling
|
|
2126
|
+
|
|
2127
|
+
Tokens are declared on `.igd-anatomy` itself, so a value set on `:root` or another ancestor is overridden. Retune them on `.igd-anatomy` (or a more specific selector):
|
|
2128
|
+
|
|
2129
|
+
```
|
|
2130
|
+
--igd-anatomy-padding (60px 24px)
|
|
2131
|
+
--igd-anatomy-bg light-dark() surface
|
|
2132
|
+
--igd-anatomy-border-color light-dark(gray-300, surface-700)
|
|
2133
|
+
--igd-anatomy-radius (4px)
|
|
2134
|
+
```
|
|
2135
|
+
|
|
2136
|
+
|
|
2137
|
+
## src/components/mdx/ApiLink/README.md
|
|
2138
|
+
|
|
2139
|
+
## ApiLink
|
|
2140
|
+
|
|
2141
|
+
Renders an inline API documentation link with platform-aware resolution.
|
|
2142
|
+
|
|
2143
|
+
For TypeDoc symbols, `ApiLink` first queries the generated api-docs link index.
|
|
2144
|
+
That index contains the real symbol names, packages, URL segments, and member
|
|
2145
|
+
anchors produced by api-docs. If the index is unavailable, or if a symbol is
|
|
2146
|
+
missing from it, `ApiLink` renders plain code text instead of generating a
|
|
2147
|
+
guessed URL.
|
|
2148
|
+
|
|
2149
|
+
Sass links are separate and still use `kind="sass"`.
|
|
2150
|
+
|
|
2151
|
+
### Import
|
|
2152
|
+
|
|
2153
|
+
```astro
|
|
2154
|
+
import ApiLink from 'igniteui-astro-components/components/mdx/ApiLink.astro';
|
|
2155
|
+
```
|
|
2156
|
+
|
|
2157
|
+
### Preferred Usage
|
|
2158
|
+
|
|
2159
|
+
Author MDX with the unprefixed API name:
|
|
2160
|
+
|
|
2161
|
+
```mdx
|
|
2162
|
+
<ApiLink type="Grid" />
|
|
2163
|
+
<ApiLink type="Grid" member="rowSelection" />
|
|
2164
|
+
<ApiLink type="CategoryChart" />
|
|
2165
|
+
```
|
|
2166
|
+
|
|
2167
|
+
The resolver handles platform prefix/suffix candidates, package lookup, kind
|
|
2168
|
+
lookup, URL segment lookup, and member anchor lookup.
|
|
2169
|
+
|
|
2170
|
+
Omitting `pkg` relies on `platformContext.apiLinkIndex` being available. When
|
|
2171
|
+
the index is unavailable, `ApiLink` renders code text and does not guess a URL.
|
|
2172
|
+
|
|
2173
|
+
### TypeDoc Props
|
|
2174
|
+
|
|
2175
|
+
| Prop | Type | Default | Description |
|
|
2176
|
+
| ---------- | ------------------------------------------------------------------------ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2177
|
+
| `type` | `string` | _(required)_ | Short symbol name without platform prefix, e.g. `"Grid"` instead of `"IgrGrid"`. |
|
|
2178
|
+
| `member` | `string` | — | Optional member name. Resolved through the generated member map when available. |
|
|
2179
|
+
| `label` | `string` | auto | Override the display text. |
|
|
2180
|
+
| `pkg` | `string` | — | Ambiguity override only. Use when the same symbol exists in multiple packages and the combined index cannot choose safely. |
|
|
2181
|
+
| `kind` | `'class' \| 'interface' \| 'enum' \| 'type' \| 'variable' \| 'function'` | auto | Optional narrowing. Usually unnecessary when the index is available. |
|
|
2182
|
+
| `prefixed` | `boolean` | `true` | Candidate-name override for symbols that are never platform-prefixed. Avoid for new docs when the index can resolve the symbol. |
|
|
2183
|
+
| `suffix` | `boolean` | `true` | Candidate-name override for symbols that never use the platform class suffix. Avoid for new docs when the index can resolve the symbol. |
|
|
2184
|
+
| `raw` | `boolean` | `false` | Marks a deliberately authored raw link in strict xplat documentation, so tooling does not flag it. |
|
|
2185
|
+
|
|
2186
|
+
Platform names use `PlatformContext.name`: `Angular`, `React`,
|
|
2187
|
+
`WebComponents`, or `Blazor`.
|
|
2188
|
+
|
|
2189
|
+
### Examples
|
|
2190
|
+
|
|
2191
|
+
```mdx
|
|
2192
|
+
{/* Let the generated index find package, kind, and exact symbol name. */}
|
|
2193
|
+
|
|
2194
|
+
<ApiLink type="Grid" />
|
|
2195
|
+
|
|
2196
|
+
{/* Member anchors are resolved from the generated member map. */}
|
|
2197
|
+
|
|
2198
|
+
<ApiLink type="Grid" member="rowSelection" />
|
|
2199
|
+
|
|
2200
|
+
{/* Use pkg only when the symbol name is ambiguous across packages. */}
|
|
2201
|
+
|
|
2202
|
+
<ApiLink type="Workbook" pkg="excel" />
|
|
2203
|
+
```
|
|
2204
|
+
|
|
2205
|
+
### ApiLink Index
|
|
2206
|
+
|
|
2207
|
+
`ApiLink` resolves TypeDoc symbols from `platformContext.apiLinkIndex`, a compact
|
|
2208
|
+
registry generated from api-docs TypeDoc data and stored by the docs host. The
|
|
2209
|
+
component does not fetch api-docs during the documentation build.
|
|
2210
|
+
|
|
2211
|
+
The docs host loads one latest registry per platform, for example:
|
|
2212
|
+
|
|
2213
|
+
```txt
|
|
2214
|
+
src/data/api-link-index/angular/staging-latest.json
|
|
2215
|
+
src/data/api-link-index/webcomponents/staging-latest.json
|
|
2216
|
+
```
|
|
2217
|
+
|
|
2218
|
+
Registry symbol fields are intentionally short because the files are large:
|
|
2219
|
+
|
|
2220
|
+
| Field | Meaning |
|
|
2221
|
+
| ----- | ------------------------------------------------------- |
|
|
2222
|
+
| `p` | Package id that owns the symbol. |
|
|
2223
|
+
| `u` | Root-relative API URL path for the symbol page. |
|
|
2224
|
+
| `k` | Symbol kind, e.g. `class`, `interface`, `enum`, `type`. |
|
|
2225
|
+
| `m` | Member name to anchor map. |
|
|
2226
|
+
|
|
2227
|
+
When `pkg` is present, `ApiLink` uses it only as a package filter for ambiguous
|
|
2228
|
+
symbol names; package URLs and kinds still come from the registry.
|
|
2229
|
+
When a symbol is ambiguous, omitting `pkg` or `kind` causes `ApiLink` to throw
|
|
2230
|
+
during rendering instead of guessing a URL.
|
|
2231
|
+
When a symbol is not found, `ApiLink` renders code text instead of generating a
|
|
2232
|
+
guessed URL.
|
|
2233
|
+
When a registry symbol exists but the requested member does not, `ApiLink`
|
|
2234
|
+
renders code text instead of generating a guessed member URL.
|
|
2235
|
+
|
|
2236
|
+
### Sass Props
|
|
2237
|
+
|
|
2238
|
+
Use `kind="sass"` for Sass API reference links. Sass links do not use the
|
|
2239
|
+
api-docs link index; they read their base URL from `platformContext.sassApiUrl`.
|
|
2240
|
+
|
|
2241
|
+
| Prop | Type | Default | Description |
|
|
2242
|
+
| -------- | --------- | ------------ | ---------------------------------------------------------------------------------------------- |
|
|
2243
|
+
| `kind` | `'sass'` | _(required)_ | Enables Sass API link mode. |
|
|
2244
|
+
| `module` | `string` | — | Sass module path segment, e.g. `"animations"` or `"themes"`. |
|
|
2245
|
+
| `type` | `string` | — | Anchor fragment without `#`, e.g. `"mixin-slide-in-left"`. Omit it to link to the module page. |
|
|
2246
|
+
| `label` | `string` | auto | Override the display text. Defaults to `type`, then `module`, then an empty string. |
|
|
2247
|
+
| `code` | `boolean` | `true` | Wrap the label in `<code>`. Set `false` for prose labels. |
|
|
2248
|
+
|
|
2249
|
+
```mdx
|
|
2250
|
+
<ApiLink kind="sass" module="animations" label="animations Sass module" code={false} />
|
|
2251
|
+
<ApiLink kind="sass" module="animations" type="mixin-slide-in-left" label="slide-in-left" />
|
|
2252
|
+
```
|
|
2253
|
+
|
|
2254
|
+
Sass URL shape:
|
|
2255
|
+
|
|
2256
|
+
```txt
|
|
2257
|
+
{sassApiUrl}/{module}#{type}
|
|
2258
|
+
```
|
|
2259
|
+
|
|
2260
|
+
|
|
2261
|
+
## src/components/mdx/ApiRef/README.md
|
|
2262
|
+
|
|
2263
|
+
## ApiRef
|
|
2264
|
+
|
|
2265
|
+
Renders a block "API References" section listing one or more types as hyperlinks. Typically placed at the bottom of a component documentation page.
|
|
2266
|
+
|
|
2267
|
+
### Import
|
|
2268
|
+
|
|
2269
|
+
```astro
|
|
2270
|
+
import ApiRef from 'igniteui-astro-components/components/mdx/ApiRef.astro';
|
|
2271
|
+
```
|
|
2272
|
+
|
|
2273
|
+
### Props
|
|
2274
|
+
|
|
2275
|
+
| Prop | Type | Default | Description |
|
|
2276
|
+
| ---------- | ------------------------------------------------------------------------ | ------------ | ------------------------------------------------------------------------------------ |
|
|
2277
|
+
| `types` | `string[]` | _(required)_ | Short symbol names without platform prefix. All types must be from the same package. |
|
|
2278
|
+
| `kind` | `'class' \| 'interface' \| 'enum' \| 'type' \| 'variable' \| 'function'` | `'class'` | TypeDoc symbol kind shared by all `types` in this call. |
|
|
2279
|
+
| `pkg` | `string` | `'core'` | Package key — same options as `ApiLink`. |
|
|
2280
|
+
| `prefixed` | `boolean` | `true` | Prepend the platform prefix automatically. Set `false` for already-qualified names. |
|
|
2281
|
+
| `suffix` | `boolean` | `true` | Append the platform class suffix. Set `false` for utility classes. |
|
|
2282
|
+
|
|
2283
|
+
### Examples
|
|
2284
|
+
|
|
2285
|
+
```mdx
|
|
2286
|
+
{/* Core classes */}
|
|
2287
|
+
|
|
2288
|
+
<ApiRef types={['Toast', 'Combo', 'Calendar']} />
|
|
2289
|
+
|
|
2290
|
+
{/* Charts sub-package */}
|
|
2291
|
+
|
|
2292
|
+
<ApiRef pkg="charts" types={['CategoryChart', 'FinancialChart']} />
|
|
2293
|
+
|
|
2294
|
+
{/* Interface — no prefix */}
|
|
2295
|
+
|
|
2296
|
+
<ApiRef kind="interface" types={['ComboTemplateProps']} prefixed={false} />
|
|
2297
|
+
|
|
2298
|
+
{/* Enum */}
|
|
2299
|
+
|
|
2300
|
+
<ApiRef kind="enum" types={['CalendarSelection']} />
|
|
2301
|
+
|
|
2302
|
+
{/* Fully-qualified names (Blazor) */}
|
|
2303
|
+
|
|
2304
|
+
<ApiRef types={['IgbToast']} prefixed={false} />
|
|
2305
|
+
```
|
|
2306
|
+
|
|
2307
|
+
### Platform context
|
|
2308
|
+
|
|
2309
|
+
Same as `ApiLink` — read from `Astro.locals.platformContext` (`PlatformContext` from `igniteui-astro-components/lib/types`), which the host site's middleware must set. Without it the render throws, because the component destructures the context.
|
|
2310
|
+
|
|
2311
|
+
When a page mixes types from different packages or different kinds, use separate `<ApiRef>` blocks:
|
|
2312
|
+
|
|
2313
|
+
```mdx
|
|
2314
|
+
<ApiRef types={['Toast']} />
|
|
2315
|
+
<ApiRef kind="enum" types={['CalendarSelection']} />
|
|
2316
|
+
<ApiRef pkg="charts" types={['CategoryChart']} />
|
|
2317
|
+
```
|
|
2318
|
+
|
|
2319
|
+
|
|
2320
|
+
## src/components/mdx/Badge/README.md
|
|
2321
|
+
|
|
2322
|
+
## Badge
|
|
2323
|
+
|
|
2324
|
+
Renders the docs status badge via `igc-badge`. It uses the same base styling that was previously defined for sidebar badges, with five semantic variants: `preview`, `new`, `updated`, `premium`, and `opensource`.
|
|
2325
|
+
|
|
2326
|
+
### Import
|
|
2327
|
+
|
|
2328
|
+
```astro
|
|
2329
|
+
import Badge from 'igniteui-astro-components/components/mdx/Badge.astro';
|
|
2330
|
+
```
|
|
2331
|
+
|
|
2332
|
+
### Props
|
|
2333
|
+
|
|
2334
|
+
| Prop | Type | Default | Description |
|
|
2335
|
+
| ------------- | -------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------- |
|
|
2336
|
+
| `variant` | `'preview' \| 'new' \| 'updated' \| 'premium' \| 'opensource'` | `'preview'` | Visual variant controlling color. |
|
|
2337
|
+
| `class` | `string` | — | Extra CSS classes forwarded to the `igc-badge` element. |
|
|
2338
|
+
| `aria-hidden` | `boolean \| string` | — | Hides the badge from assistive technology. Useful for purely decorative badges. |
|
|
2339
|
+
| `aria-label` | `string` | — | Override the accessible label. |
|
|
2340
|
+
|
|
2341
|
+
### Examples
|
|
2342
|
+
|
|
2343
|
+
```mdx
|
|
2344
|
+
{/* Default — preview variant */}
|
|
2345
|
+
|
|
2346
|
+
<Badge />
|
|
2347
|
+
|
|
2348
|
+
{/* Explicit variants */}
|
|
2349
|
+
|
|
2350
|
+
<Badge variant="new" />
|
|
2351
|
+
<Badge variant="updated" />
|
|
2352
|
+
<Badge variant="premium" />
|
|
2353
|
+
<Badge variant="opensource" />
|
|
2354
|
+
|
|
2355
|
+
{/* Inside a heading: `### My Feature <Badge variant="new" />` */}
|
|
2356
|
+
|
|
2357
|
+
{/* Custom slot content */}
|
|
2358
|
+
|
|
2359
|
+
<Badge variant="preview">Coming Soon</Badge>
|
|
2360
|
+
|
|
2361
|
+
{/* Decorative — hidden from screen readers */}
|
|
2362
|
+
|
|
2363
|
+
<Badge variant="new" aria-hidden="true" />
|
|
2364
|
+
```
|
|
2365
|
+
|
|
2366
|
+
### Variants
|
|
2367
|
+
|
|
2368
|
+
| `variant` | Default text | Color token group |
|
|
2369
|
+
| ------------ | ------------ | -------------------- |
|
|
2370
|
+
| `preview` | Preview | `--igd-preview-*` |
|
|
2371
|
+
| `new` | New | `--igd-new-*` |
|
|
2372
|
+
| `updated` | Updated | `--igd-updated-*` |
|
|
2373
|
+
| `premium` | Premium | `--igd-premium-*` |
|
|
2374
|
+
| `opensource` | Open Source | `--igd-opensource-*` |
|
|
2375
|
+
|
|
2376
|
+
### Styling
|
|
2377
|
+
|
|
2378
|
+
Colors are driven by CSS custom properties set on the `igc-badge` host:
|
|
2379
|
+
|
|
2380
|
+
| Property | Purpose |
|
|
2381
|
+
| -------------------- | ------------------------------------ |
|
|
2382
|
+
| `--background-color` | Fill color of the badge chip |
|
|
2383
|
+
| `--text-color` | Label text color |
|
|
2384
|
+
| `--icon-color` | Icon color (if an icon is projected) |
|
|
2385
|
+
| `--border-color` | Border color of the badge chip |
|
|
2386
|
+
|
|
2387
|
+
Token values are defined in `Badge.scss` via per-variant classes (`preview`, `new`, `updated`, `premium`, `opensource`) and reference the `--igd-*-bg`, `--igd-*-color`, and `--igd-*-border` theme tokens. The base badge style in `Badge.scss` matches the sidebar badge style so sidebar badges can reuse the component without local badge styling.
|
|
2388
|
+
|
|
2389
|
+
|
|
2390
|
+
## src/components/mdx/DoDont/README.md
|
|
2391
|
+
|
|
2392
|
+
## DoDont
|
|
2393
|
+
|
|
2394
|
+
Renders a side-by-side "Do" / "Don't" pair of component screenshots. Each panel is a framed image with a status badge pinned to its top-inline corner — a green check for the recommended usage, a red clear for the one to avoid — and a required description below it that says why.
|
|
2395
|
+
|
|
2396
|
+
The frame supplies the padding around each screenshot, so the source images stay bare crops with no baked-in margin, and it centers anything smaller than its content box rather than blowing it up to fill. Panels share a subgrid, so every frame is as tall as the tallest screenshot in the row and the captions start on a common baseline.
|
|
2397
|
+
|
|
2398
|
+
The block is always 100% of its container and stacks into one column as soon as a panel would fall below `--igd-dodont-min-panel-width`, so it responds to the space it is given rather than to the viewport.
|
|
2399
|
+
|
|
2400
|
+
### Import
|
|
2401
|
+
|
|
2402
|
+
```astro
|
|
2403
|
+
import DoDont from 'igniteui-astro-components/components/mdx/DoDont.astro';
|
|
2404
|
+
```
|
|
2405
|
+
|
|
2406
|
+
### Props
|
|
2407
|
+
|
|
2408
|
+
| Prop | Type | Default | Description |
|
|
2409
|
+
| ----------- | ------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
2410
|
+
| `doSrc` | `ImageMetadata \| string` | _(required)_ | The recommended-usage image. An `astro:assets` import or a URL. |
|
|
2411
|
+
| `doAlt` | `string` | _(required)_ | The recommended-usage image's accessible description. Becomes the inner `<img>` `alt`. |
|
|
2412
|
+
| `dontSrc` | `ImageMetadata \| string` | _(required)_ | The usage-to-avoid image. An `astro:assets` import or a URL. |
|
|
2413
|
+
| `dontAlt` | `string` | _(required)_ | The usage-to-avoid image's accessible description. Becomes the inner `<img>` `alt`. |
|
|
2414
|
+
| `doLabel` | `string` | `'Do'` | Label for the recommended panel. Localized by default — see [Localization](#localization). |
|
|
2415
|
+
| `dontLabel` | `string` | `"Don't"` | Label for the panel to avoid. Localized by default. |
|
|
2416
|
+
| `loading` | `'lazy' \| 'eager'` | `'lazy'` | Image loading strategy. Use `'eager'` when the block is the first content on the page. |
|
|
2417
|
+
| `errorText` | `string` | _(localized)_ | Notice shown with a broken-image icon inside a frame whose image failed to load. Hidden from assistive tech, which still gets the image's `alt`. |
|
|
2418
|
+
| `class` | `string` | — | Extra CSS classes forwarded to the container. |
|
|
2419
|
+
|
|
2420
|
+
#### Imports vs. URLs
|
|
2421
|
+
|
|
2422
|
+
Pass an `astro:assets` import whenever you can. An import is rendered through Astro's `<Image>`, which converts the format (WebP by default), emits a `srcset` with 1x/2x/3x candidates clamped to the source size, and writes the intrinsic `width`/`height` so the frame holds its final size before the file arrives.
|
|
2423
|
+
|
|
2424
|
+
A plain URL string is rendered as a bare `<img>`. Astro cannot inspect a URL at build time, so it gets no `srcset` and **no dimensions**, and the frame grows when the image loads — a layout shift. Reserve URLs for assets that genuinely live outside the build.
|
|
2425
|
+
|
|
2426
|
+
#### Loading
|
|
2427
|
+
|
|
2428
|
+
The default `loading="lazy"` is right for a block somewhere down a topic. If the block is the first thing on the page, pass `loading="eager"`: a lazy image above the fold delays the largest contentful paint. Eager images are also fetched with `fetchpriority="high"`.
|
|
2429
|
+
|
|
2430
|
+
While an image is pending, a soft shimmer sweeps the frame's canvas. A small client script marks a frame whose image has not loaded and clears the mark on load or error; without JavaScript nothing is marked and the frame is simply static. The animation is disabled under `prefers-reduced-motion`.
|
|
2431
|
+
|
|
2432
|
+
If an image fails to load, the frame gets `data-error` and shows a broken-image icon with a short notice ("Sorry, this image could not be loaded.", localized like the labels, or your own `errorText`). The notice is `aria-hidden` — it only explains the empty box to a sighted reader, and the `<img>` keeps exposing its `alt` to assistive tech. The label and description are unaffected. A URL cannot be checked at build time, which is one more reason to prefer an `astro:assets` import: a missing imported file fails the build instead of the page.
|
|
2433
|
+
|
|
2434
|
+
The image props are `doSrc` / `dontSrc` rather than `do` / `dont` because Astro merges named slots into props ([`jsx-runtime`](https://github.com/withastro/astro) does `Object.assign(vnode.props, slots)`), so a prop sharing a slot's name is silently overwritten by that slot.
|
|
2435
|
+
|
|
2436
|
+
### Slots
|
|
2437
|
+
|
|
2438
|
+
| Slot | Description |
|
|
2439
|
+
| ------ | ------------------------------------------------------------- |
|
|
2440
|
+
| `do` | **Required.** Why the recommended panel is the one to follow. |
|
|
2441
|
+
| `dont` | **Required.** Why the other panel is the one to avoid. |
|
|
2442
|
+
|
|
2443
|
+
Both slots are validated at build time — a missing, empty or whitespace-only slot throws, exactly like a missing `alt`. A screenshot is never self-explanatory: the slot text is what search engines index, translators translate and screen readers read, and it is the only place the _reason_ for the guidance lives.
|
|
2444
|
+
|
|
2445
|
+
### Examples
|
|
2446
|
+
|
|
2447
|
+
```mdx
|
|
2448
|
+
{/* Blank lines inside each Fragment so the content parses as markdown */}
|
|
2449
|
+
|
|
2450
|
+
<DoDont
|
|
2451
|
+
doSrc={virtualScrollDo}
|
|
2452
|
+
doAlt="Virtual Scroll showing a list of 100,000 employees"
|
|
2453
|
+
dontSrc={virtualScrollDoNot}
|
|
2454
|
+
dontAlt="Virtual Scroll used for a list of only five employees"
|
|
2455
|
+
>
|
|
2456
|
+
<Fragment slot="do">
|
|
2457
|
+
|
|
2458
|
+
Use the Virtual Scroll for a long list that is too large to render at once.
|
|
2459
|
+
|
|
2460
|
+
</Fragment>
|
|
2461
|
+
<Fragment slot="dont">
|
|
2462
|
+
|
|
2463
|
+
Render a short list directly with the [List](src/components/mdx/list.mdx).
|
|
2464
|
+
|
|
2465
|
+
</Fragment>
|
|
2466
|
+
</DoDont>
|
|
2467
|
+
|
|
2468
|
+
{/* Custom labels */}
|
|
2469
|
+
|
|
2470
|
+
<DoDont doSrc={good} doAlt="…" dontSrc={bad} dontAlt="…" doLabel="Recommended" dontLabel="Avoid">
|
|
2471
|
+
<Fragment slot="do">…</Fragment>
|
|
2472
|
+
<Fragment slot="dont">…</Fragment>
|
|
2473
|
+
</DoDont>
|
|
2474
|
+
```
|
|
2475
|
+
|
|
2476
|
+
### Localization
|
|
2477
|
+
|
|
2478
|
+
The default labels follow the site language, so a Japanese topic does not ship with English "Do" / "Don't" baked in:
|
|
2479
|
+
|
|
2480
|
+
| Language | `doLabel` | `dontLabel` |
|
|
2481
|
+
| -------------- | --------- | ----------- |
|
|
2482
|
+
| `en` (default) | Do | Don't |
|
|
2483
|
+
| `jp` / `ja` | 推奨 | 非推奨 |
|
|
2484
|
+
| `kr` / `ko` | 권장 | 비권장 |
|
|
2485
|
+
|
|
2486
|
+
The broken-image notice (`errorText`) is localized the same way.
|
|
2487
|
+
|
|
2488
|
+
The language is the docs integration's `navLang`, read from `virtual:docs-template/site-meta` — the same value `DocsLayout` passes to the nav bar and footer — then `Astro.currentLocale`, then English. Pass `doLabel` / `dontLabel` to override on any page.
|
|
2489
|
+
|
|
2490
|
+
### Accessibility
|
|
2491
|
+
|
|
2492
|
+
`doAlt` and `dontAlt` are required and are validated at build time — an absent, empty or whitespace-only value throws. Describe what each screenshot shows rather than merely naming the component. The `do` / `dont` slots are required for the same reason: the alt says what the picture shows, the slot says why it is right or wrong, and a reader who cannot see the image needs both.
|
|
2493
|
+
|
|
2494
|
+
Each panel is a `<figure>` whose `<figcaption>` holds the label and description, so assistive tech announces the panel as, e.g., "figure, Do: Use the Virtual Scroll for a long list…" and then the image's `alt`. The colon is a visually hidden separator; without it the label and description read as one run-on phrase.
|
|
2495
|
+
|
|
2496
|
+
The badges are decorative: the labels already name each panel, so the badges are `aria-hidden` and add no duplicate announcement. That also means the block does not rely on color alone.
|
|
2497
|
+
|
|
2498
|
+
The label colors meet WCAG AA for normal-size text in both themes. The "Don't" accent is `--ig-error-800` in the light theme rather than the design's `--ig-error-700`, which measures 4.1:1 on white and fails the 4.5:1 minimum. In forced-colors mode the frame keeps an outline, since box-shadow is dropped there.
|
|
2499
|
+
|
|
2500
|
+
### Styling
|
|
2501
|
+
|
|
2502
|
+
The component reads these tokens but never sets them — its defaults are fallbacks — so a value set on any ancestor, or on the block itself through `class`, reaches every element that uses it. `--igd-dodont-accent` and `--igd-dodont-frame-accent` default per panel: set on the block they recolor both panels, set on `.igd-dodont__panel--do` or `.igd-dodont__panel--dont` just one.
|
|
2503
|
+
|
|
2504
|
+
| Property | Purpose |
|
|
2505
|
+
| ------------------------------ | ------------------------------------------------------------------------ |
|
|
2506
|
+
| `--igd-dodont-gap` | Gap between the panels and between a frame and its caption |
|
|
2507
|
+
| `--igd-dodont-min-panel-width` | Width below which the panels stack into one column |
|
|
2508
|
+
| `--igd-dodont-padding-block` | Space above and below a screenshot (the design leaves 86px) |
|
|
2509
|
+
| `--igd-dodont-padding-inline` | Minimum space either side of a screenshot (20px) |
|
|
2510
|
+
| `--igd-dodont-image-width` | Width the screenshots are laid out at (the design default is 360px) |
|
|
2511
|
+
| `--igd-dodont-radius` | Corner radius of the image frame |
|
|
2512
|
+
| `--igd-dodont-badge-size` | Size of the pinned badge |
|
|
2513
|
+
| `--igd-dodont-badge-inset` | Distance of the badge from the frame's top and inline-start edges (30px) |
|
|
2514
|
+
| `--igd-dodont-caption-gap` | Space between a label and its description (16px) |
|
|
2515
|
+
| `--igd-dodont-stack-extra` | Added between panels when they stack, so the 26px gap becomes 46px |
|
|
2516
|
+
| `--igd-dodont-bg` | Frame canvas, drawn by an `::after` at 0.7 opacity behind the content |
|
|
2517
|
+
| `--igd-dodont-border-width` | Frame border (1px) |
|
|
2518
|
+
| `--igd-dodont-accent-width` | Top accent border (2px), colored like the panel's badge |
|
|
2519
|
+
| `--igd-dodont-frame-accent` | Top accent color — `success-500` on Do, `error-500` on Don't |
|
|
2520
|
+
| `--igd-dodont-border-color` | Frame border color |
|
|
2521
|
+
| `--igd-dodont-accent` | Label color — success tokens on the Do panel, error tokens on Don't |
|
|
2522
|
+
|
|
2523
|
+
The stylesheet is deliberately **unlayered**. `.igd-main-content__markdown img` and `figure` live in `@layer components` and set a block margin and a corner radius on every image; unlayered rules beat all layers, so the panel's own `margin: 0` and the frame-owned radius win.
|
|
2524
|
+
|
|
2525
|
+
Images are drawn at full opacity. The frame canvas is an `::after` pseudo-element (`gray-100` in the light theme, `surface-500` in the dark) at 0.7 opacity behind the content, inside a `gray-300` border whose top edge is a 2px accent in the panel's badge color. The borders are subtracted from the padding and badge inset, so the spec distances are measured from the frame's outer edge.
|
|
2526
|
+
|
|
2527
|
+
|
|
2528
|
+
## src/components/mdx/DocsAside/README.md
|
|
2529
|
+
|
|
2530
|
+
## DocsAside
|
|
2531
|
+
|
|
2532
|
+
Renders a styled callout block (note, info or warning) with a type-specific icon, colour accent and accessible label. Use it in MDX pages to surface important information inline.
|
|
2533
|
+
|
|
2534
|
+
### Import
|
|
2535
|
+
|
|
2536
|
+
```astro
|
|
2537
|
+
import DocsAside from 'igniteui-astro-components/components/mdx/DocsAside.astro';
|
|
2538
|
+
```
|
|
2539
|
+
|
|
2540
|
+
### Props
|
|
2541
|
+
|
|
2542
|
+
| Prop | Type | Default | Description |
|
|
2543
|
+
| ------- | ------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
2544
|
+
| `type` | `'note' \| 'info' \| 'warning'` | `'note'` | Semantic variant — controls the colour accent, the default title and the default icon. |
|
|
2545
|
+
| `title` | `string` | auto | Override the heading text. Defaults to `Note`, `Info` or `Warning`. |
|
|
2546
|
+
| `icon` | `string` | auto | Name of an icon registered in the `docs` collection (`src/scripts/icon-manifest.ts`). Pass `""` to hide the icon. |
|
|
2547
|
+
| `class` | `string` | — | Additional CSS class(es) added to the container. |
|
|
2548
|
+
|
|
2549
|
+
The component also declares a `color` prop, but nothing reads it (issue #162); use the CSS
|
|
2550
|
+
custom properties below to change the accent instead.
|
|
2551
|
+
|
|
2552
|
+
### Examples
|
|
2553
|
+
|
|
2554
|
+
```mdx
|
|
2555
|
+
{/* Default note */}
|
|
2556
|
+
|
|
2557
|
+
<DocsAside>This is a general note.</DocsAside>
|
|
2558
|
+
|
|
2559
|
+
{/* Info */}
|
|
2560
|
+
|
|
2561
|
+
<DocsAside type="info">The grid virtualises rows by default.</DocsAside>
|
|
2562
|
+
|
|
2563
|
+
{/* Warning with custom title */}
|
|
2564
|
+
|
|
2565
|
+
<DocsAside type="warning" title="Breaking change">
|
|
2566
|
+
The `foo` prop was removed in v2. Use `bar` instead.
|
|
2567
|
+
</DocsAside>
|
|
2568
|
+
|
|
2569
|
+
{/* No icon */}
|
|
2570
|
+
|
|
2571
|
+
<DocsAside type="info" icon="">
|
|
2572
|
+
This callout has no icon.
|
|
2573
|
+
</DocsAside>
|
|
2574
|
+
```
|
|
2575
|
+
|
|
2576
|
+
### Variants
|
|
2577
|
+
|
|
2578
|
+
| `type` | Accent | Default title |
|
|
2579
|
+
| --------- | ----------------- | ------------- |
|
|
2580
|
+
| `note` | Gray | Note |
|
|
2581
|
+
| `info` | Primary (blue) | Info |
|
|
2582
|
+
| `warning` | Secondary (amber) | Warning |
|
|
2583
|
+
|
|
2584
|
+
### Markup
|
|
2585
|
+
|
|
2586
|
+
```html
|
|
2587
|
+
<div class="igd-aside igd-aside--info" role="note" aria-label="Info">
|
|
2588
|
+
<igc-icon class="igd-aside__icon" name="info" collection="docs" aria-hidden="true"></igc-icon>
|
|
2589
|
+
<span class="igd-aside__title" aria-hidden="true">Info</span>
|
|
2590
|
+
<div class="igd-aside__content">…</div>
|
|
2591
|
+
</div>
|
|
2592
|
+
```
|
|
2593
|
+
|
|
2594
|
+
### Styling
|
|
2595
|
+
|
|
2596
|
+
Layout tokens, defined on `:root` in `src/styles/global/_variables.scss`:
|
|
2597
|
+
|
|
2598
|
+
```
|
|
2599
|
+
--igd-aside-padding --igd-aside-row-gap --igd-aside-column-gap
|
|
2600
|
+
--igd-aside-border-width --igd-aside-border-style --igd-aside-border-radius
|
|
2601
|
+
--igd-aside-margin-bottom
|
|
2602
|
+
```
|
|
2603
|
+
|
|
2604
|
+
Per-variant colour tokens, one set each for `note`, `info` and `warning`:
|
|
2605
|
+
|
|
2606
|
+
```
|
|
2607
|
+
--igd-aside-{type}-bg --igd-aside-{type}-border --igd-aside-{type}-title
|
|
2608
|
+
--igd-aside-{type}-content --igd-aside-{type}-icon
|
|
2609
|
+
```
|
|
2610
|
+
|
|
2611
|
+
`--igd-aside-{type}-code-background` is declared in `_variables.scss` but no stylesheet reads it yet.
|
|
2612
|
+
|
|
2613
|
+
Each colour token uses `light-dark()` so it follows the page's `data-theme`.
|
|
2614
|
+
|
|
2615
|
+
|
|
2616
|
+
## src/components/mdx/Faq/README.md
|
|
2617
|
+
|
|
2618
|
+
## Faq
|
|
2619
|
+
|
|
2620
|
+
Question / answer list built on `<igc-accordion>` +
|
|
2621
|
+
`<igc-expansion-panel>` from `igniteui-webcomponents`.
|
|
2622
|
+
|
|
2623
|
+
Two components ship together:
|
|
2624
|
+
|
|
2625
|
+
- **`Faq.astro`** — owns the `<igc-accordion>` (grouping + keyboard navigation).
|
|
2626
|
+
- **`FaqItem.astro`** — one `<igc-expansion-panel>`; the question is the header,
|
|
2627
|
+
the default slot is the answer.
|
|
2628
|
+
|
|
2629
|
+
Styling is driven entirely by `--igd-faq-*` custom properties declared in
|
|
2630
|
+
`src/styles/global/_variables.scss`. `Faq.scss` maps each of them onto the
|
|
2631
|
+
corresponding `--ig-expansion-panel-*` theme property, so consumers never
|
|
2632
|
+
touch the Ignite UI variables directly.
|
|
2633
|
+
|
|
2634
|
+
### Usage — slot mode (preferred)
|
|
2635
|
+
|
|
2636
|
+
Rich answers: markdown, links, code blocks, other components.
|
|
2637
|
+
|
|
2638
|
+
```astro
|
|
2639
|
+
---
|
|
2640
|
+
import Faq from 'igniteui-astro-components/components/mdx/Faq.astro';
|
|
2641
|
+
import FaqItem from 'igniteui-astro-components/components/mdx/FaqItem.astro';
|
|
2642
|
+
---
|
|
2643
|
+
|
|
2644
|
+
<Faq singleExpand>
|
|
2645
|
+
<FaqItem question="How do I install the package?" open>
|
|
2646
|
+
Run <code>npm install igniteui-webcomponents</code>.
|
|
2647
|
+
</FaqItem>
|
|
2648
|
+
<FaqItem question="Is it free?" subtitle="Licensing" indicatorPosition="end">
|
|
2649
|
+
The core components are open source; some are part of a paid license.
|
|
2650
|
+
</FaqItem>
|
|
2651
|
+
</Faq>
|
|
2652
|
+
```
|
|
2653
|
+
|
|
2654
|
+
### Usage — data mode
|
|
2655
|
+
|
|
2656
|
+
Short, static copy. `answer` is injected as an HTML string.
|
|
2657
|
+
|
|
2658
|
+
> **`answer` is not sanitized.** It goes straight through `set:html`, so pass
|
|
2659
|
+
> only trusted, author-controlled markup. Anything untrusted or user-generated
|
|
2660
|
+
> belongs in the default slot (slot mode), which Astro escapes.
|
|
2661
|
+
|
|
2662
|
+
```astro
|
|
2663
|
+
---
|
|
2664
|
+
import Faq from 'igniteui-astro-components/components/mdx/Faq.astro';
|
|
2665
|
+
import type { FaqEntry } from 'igniteui-astro-components/components/mdx/Faq/types';
|
|
2666
|
+
|
|
2667
|
+
const items: FaqEntry[] = [
|
|
2668
|
+
{ question: 'How do I install the package?', answer: 'Run <code>npm i</code>.' },
|
|
2669
|
+
{ question: 'Is it free?', answer: 'The core components are open source.' },
|
|
2670
|
+
];
|
|
2671
|
+
---
|
|
2672
|
+
|
|
2673
|
+
<Faq {items} singleExpand indicatorPosition="end" />
|
|
2674
|
+
```
|
|
2675
|
+
|
|
2676
|
+
Both modes render into the same accordion, so they can be mixed — `items`
|
|
2677
|
+
entries render first, slotted `<FaqItem>`s after.
|
|
2678
|
+
|
|
2679
|
+
### Usage in MDX
|
|
2680
|
+
|
|
2681
|
+
Import the components in the MDX body, then use them as JSX. Leave a blank
|
|
2682
|
+
line around markdown content so it is parsed as markdown rather than raw text.
|
|
2683
|
+
|
|
2684
|
+
````mdx
|
|
2685
|
+
---
|
|
2686
|
+
title: FAQ
|
|
2687
|
+
---
|
|
2688
|
+
|
|
2689
|
+
import Faq from 'igniteui-astro-components/components/mdx/Faq.astro';
|
|
2690
|
+
import FaqItem from 'igniteui-astro-components/components/mdx/FaqItem.astro';
|
|
2691
|
+
|
|
2692
|
+
## Frequently asked questions
|
|
2693
|
+
|
|
2694
|
+
<Faq singleExpand>
|
|
2695
|
+
<FaqItem question="How do I install the package?" open>
|
|
2696
|
+
|
|
2697
|
+
Install it from npm:
|
|
2698
|
+
|
|
2699
|
+
```bash
|
|
2700
|
+
npm install igniteui-webcomponents
|
|
2701
|
+
```
|
|
2702
|
+
|
|
2703
|
+
</FaqItem>
|
|
2704
|
+
|
|
2705
|
+
<FaqItem question="Which browsers are supported?">
|
|
2706
|
+
|
|
2707
|
+
The last two versions of every evergreen browser. See the
|
|
2708
|
+
[browser support](/getting-started) page.
|
|
2709
|
+
|
|
2710
|
+
</FaqItem>
|
|
2711
|
+
</Faq>
|
|
2712
|
+
````
|
|
2713
|
+
|
|
2714
|
+
### Props — `Faq`
|
|
2715
|
+
|
|
2716
|
+
| Prop | Type | Default | Notes |
|
|
2717
|
+
| --------------------------------------------------- | ----------------------------- | ------- | -------------------------------------------------------------------------------- |
|
|
2718
|
+
| `items` | `FaqEntry[]` | — | Data-driven entries. Omit for slot mode. |
|
|
2719
|
+
| `singleExpand` | `boolean` | `false` | → `igc-accordion[single-expand]`. Only one answer open at once. |
|
|
2720
|
+
| `indicatorPosition` | `'start' \| 'end' \| 'none'` | `end` | Applies to `items` entries only — see the note below. |
|
|
2721
|
+
| `class` | `string` | — | Forwarded to `<igc-accordion>`. |
|
|
2722
|
+
| `id` | `string` | — | Spread onto `<igc-accordion>`. |
|
|
2723
|
+
| `aria-label`, `aria-labelledby`, `aria-describedby` | `string` | — | Spread onto `<igc-accordion>`. Typed for autocomplete — see the caveat below. |
|
|
2724
|
+
| `data-*` | `string \| number \| boolean` | — | Spread onto `<igc-accordion>` via a ``[key: `data-${string}`]`` index signature. |
|
|
2725
|
+
|
|
2726
|
+
### Props — `FaqItem`
|
|
2727
|
+
|
|
2728
|
+
| Prop | Type | Default | Notes |
|
|
2729
|
+
| --------------------------------------------------- | ----------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
2730
|
+
| `question` | `string` | — | Required. Rendered in the panel's `title` slot. |
|
|
2731
|
+
| `subtitle` | `string` | — | Optional second header line (`subtitle` slot). |
|
|
2732
|
+
| `answer` | `string` | — | HTML string answer, rendered as the slot's fallback — slotted content always wins. **Not sanitized**, see above. |
|
|
2733
|
+
| `open` | `boolean` | `false` | → `igc-expansion-panel[open]`. |
|
|
2734
|
+
| `disabled` | `boolean` | `false` | → `igc-expansion-panel[disabled]`. Skipped by keyboard nav. |
|
|
2735
|
+
| `indicatorPosition` | `'start' \| 'end' \| 'none'` | `end` | → `igc-expansion-panel[indicator-position]`. |
|
|
2736
|
+
| `class` | `string` | — | Forwarded to `<igc-expansion-panel>`. |
|
|
2737
|
+
| `id` | `string` | — | Spread onto `<igc-expansion-panel>`. |
|
|
2738
|
+
| `aria-label`, `aria-labelledby`, `aria-describedby` | `string` | — | Spread onto `<igc-expansion-panel>`. Typed for autocomplete — see the caveat below. |
|
|
2739
|
+
| `data-*` | `string \| number \| boolean` | — | Spread onto `<igc-expansion-panel>` via a ``[key: `data-${string}`]`` index signature. |
|
|
2740
|
+
|
|
2741
|
+
`Props` deliberately has **no** open `[key: string]: unknown` index signature —
|
|
2742
|
+
that is what keeps a misspelt `indicatorPostion` (or a stray `datatestid`) a
|
|
2743
|
+
type error. Anything outside the rows above needs adding to `Props` first.
|
|
2744
|
+
|
|
2745
|
+
**Caveat:** TypeScript exempts JSX attribute names that are not valid JS
|
|
2746
|
+
identifiers — i.e. every hyphenated name, so all `aria-*` and `data-*` — from
|
|
2747
|
+
excess-property checking. A misspelt `aria-describedbyy` therefore passes
|
|
2748
|
+
silently no matter what `Props` declares. The enumerated ARIA props exist for
|
|
2749
|
+
autocomplete and intent, not enforcement; only identifier-style props
|
|
2750
|
+
(`singleExpand`, `indicatorPosition`, `question`, …) are spell-checked by the
|
|
2751
|
+
compiler.
|
|
2752
|
+
|
|
2753
|
+
The `indicator` and `indicator-expanded` slots are forwarded, so the default
|
|
2754
|
+
chevron can be replaced per item:
|
|
2755
|
+
|
|
2756
|
+
```astro
|
|
2757
|
+
<FaqItem question="Custom indicator">
|
|
2758
|
+
<igc-icon slot="indicator" name="chevron" collection="docs"></igc-icon>
|
|
2759
|
+
Answer body.
|
|
2760
|
+
</FaqItem>
|
|
2761
|
+
```
|
|
2762
|
+
|
|
2763
|
+
#### Why `indicatorPosition` on `Faq` only covers `items`
|
|
2764
|
+
|
|
2765
|
+
`indicator-position` is a property of each panel, and Astro cannot pass props
|
|
2766
|
+
into slotted children at build time. In slot mode set it on each `<FaqItem>`;
|
|
2767
|
+
in data mode `Faq` forwards its value (an entry's own `indicatorPosition`
|
|
2768
|
+
wins).
|
|
2769
|
+
|
|
2770
|
+
### Runtime API
|
|
2771
|
+
|
|
2772
|
+
`Faq` renders a real `<igc-accordion>`, so the library API is available on the
|
|
2773
|
+
element itself:
|
|
2774
|
+
|
|
2775
|
+
```ts
|
|
2776
|
+
const faq = document.querySelector('igc-accordion.igd-faq')!;
|
|
2777
|
+
faq.showAll();
|
|
2778
|
+
faq.hideAll();
|
|
2779
|
+
faq.singleExpand = true;
|
|
2780
|
+
faq.panels; // IgcExpansionPanelComponent[]
|
|
2781
|
+
```
|
|
2782
|
+
|
|
2783
|
+
Each panel emits `igcOpening` / `igcOpened` / `igcClosing` / `igcClosed`.
|
|
2784
|
+
|
|
2785
|
+
### Theming tokens
|
|
2786
|
+
|
|
2787
|
+
| Token | Purpose |
|
|
2788
|
+
| --------------------------------- | ------------------------------------------ |
|
|
2789
|
+
| `--igd-faq-gap` | Vertical gap between questions. |
|
|
2790
|
+
| `--igd-faq-margin-bottom` | Space below the whole list. |
|
|
2791
|
+
| `--igd-faq-spacing` | Density — see below. |
|
|
2792
|
+
| `--igd-faq-border-*` | Width / style / colour / radius of a card. |
|
|
2793
|
+
| `--igd-faq-open-border-color` | Border colour while a panel is open. |
|
|
2794
|
+
| `--igd-faq-header-bg` | Question row background. |
|
|
2795
|
+
| `--igd-faq-header-focus-bg` | Question row background on focus. |
|
|
2796
|
+
| `--igd-faq-body-bg` | Answer background. |
|
|
2797
|
+
| `--igd-faq-question-color` | Question text colour. |
|
|
2798
|
+
| `--igd-faq-subtitle-color` | Subtitle text colour. |
|
|
2799
|
+
| `--igd-faq-answer-color` | Answer text colour. |
|
|
2800
|
+
| `--igd-faq-indicator-color` | Chevron colour. |
|
|
2801
|
+
| `--igd-faq-disabled-color` | Question / chevron colour when disabled. |
|
|
2802
|
+
| `--igd-faq-disabled-bg` | Card background when disabled. |
|
|
2803
|
+
| `--igd-faq-disabled-border-color` | Card border when disabled. |
|
|
2804
|
+
|
|
2805
|
+
#### Never re-state a bridged colour in the light DOM
|
|
2806
|
+
|
|
2807
|
+
`Faq.scss` sets colours **only** as `--ig-expansion-panel-*` bridge values. The
|
|
2808
|
+
panel paints `[part=title]`, `[part=subtitle]`, and `[part~=indicator]` from
|
|
2809
|
+
those, and swaps them for `--disabled-text-color` under `:host([disabled])`.
|
|
2810
|
+
|
|
2811
|
+
Two things silently defeat that disabled state, so both are avoided:
|
|
2812
|
+
|
|
2813
|
+
- `color` on the slotted `.igd-faq__question` / `.igd-faq__subtitle` — an
|
|
2814
|
+
explicit colour beats the inheritance coming from `[part=title]`.
|
|
2815
|
+
- `::part(indicator) { color }` — outer-tree `::part()` rules always win over
|
|
2816
|
+
the shadow tree's own rules, regardless of specificity.
|
|
2817
|
+
|
|
2818
|
+
If a colour looks wrong, change the `--igd-faq-*` token, never add a
|
|
2819
|
+
declaration to the light-DOM element.
|
|
2820
|
+
|
|
2821
|
+
#### Density — why there is no padding token
|
|
2822
|
+
|
|
2823
|
+
`igc-expansion-panel` derives its header padding, body padding, and indicator
|
|
2824
|
+
margin from the Ignite UI layout scale (`--ig-size`, `--ig-spacing`), and its
|
|
2825
|
+
real body padding lives on `[part~=content] > slot` — an element that is not
|
|
2826
|
+
an exposed CSS part. Overriding `::part(content) { padding }` therefore stacks
|
|
2827
|
+
on top of the built-in padding instead of replacing it, and any hard-coded
|
|
2828
|
+
`::part(header) { padding }` freezes the component at one density.
|
|
2829
|
+
|
|
2830
|
+
So the FAQ scales density instead of setting padding:
|
|
2831
|
+
|
|
2832
|
+
```css
|
|
2833
|
+
.my-faq {
|
|
2834
|
+
--igd-faq-spacing: 0.75; /* 0 = flush, 1 = default, 2 = double */
|
|
2835
|
+
}
|
|
2836
|
+
```
|
|
2837
|
+
|
|
2838
|
+
`--igd-faq-spacing` feeds `--ig-spacing` on each panel; `--ig-size` on the
|
|
2839
|
+
panel (or an ancestor) still works as usual. Verified against the
|
|
2840
|
+
`igniteui-theming` MCP (`theming://docs/spacing-and-sizing`).
|
|
2841
|
+
|
|
2842
|
+
|
|
2843
|
+
## src/components/mdx/FigmaUiKits/README.md
|
|
2844
|
+
|
|
2845
|
+
## FigmaUiKits
|
|
2846
|
+
|
|
2847
|
+
Renders the "Check it out in our free Figma UI kits" call-to-action banner that links a component topic to the Ignite UI kits in Figma. It belongs between a topic's description and its live demo.
|
|
2848
|
+
|
|
2849
|
+
It links to the Indigo.Design UI kits for Material, Fluent, Bootstrap and Indigo out of the box, so a topic only needs `<FigmaUiKits />`. When a kit is republished, update its URL once in `kits.ts` (`DEFAULT_FIGMA_UI_KITS`) and every topic picks it up.
|
|
2850
|
+
|
|
2851
|
+
### Import
|
|
2852
|
+
|
|
2853
|
+
```astro
|
|
2854
|
+
import FigmaUiKits from 'igniteui-astro-components/components/mdx/FigmaUiKits.astro';
|
|
2855
|
+
```
|
|
2856
|
+
|
|
2857
|
+
### Props
|
|
2858
|
+
|
|
2859
|
+
| Prop | Type | Default | Description |
|
|
2860
|
+
| -------------- | --------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
|
2861
|
+
| `kits` | `FigmaUiKit[]` | `DEFAULT_FIGMA_UI_KITS` | One link per kit, in display order. Each is `{ label: string; href: string }`. |
|
|
2862
|
+
| `title` | `string` | `'Check it out in our free Figma UI kits'` | Text before the links. Localized by default. |
|
|
2863
|
+
| `compactTitle` | `string` | `'Check it in our free Figma UI kits'` | Text for the compact (mobile) layout. Defaults to `title` when that is set. |
|
|
2864
|
+
| `variant` | `'auto' \| 'compact'` | `'auto'` | `'auto'` wraps to fit and uses the compact layout on narrow containers; `'compact'` always does. |
|
|
2865
|
+
| `class` | `string` | — | Extra CSS classes for the container. |
|
|
2866
|
+
|
|
2867
|
+
It throws at build time when `kits` is an empty array or a kit has an empty `label` or `href`.
|
|
2868
|
+
|
|
2869
|
+
`kits.ts` exports the `FigmaUiKit` type and `DEFAULT_FIGMA_UI_KITS`. Pass `kits` only to show a different set, for example a single kit on a theme-specific topic:
|
|
2870
|
+
|
|
2871
|
+
```astro
|
|
2872
|
+
---
|
|
2873
|
+
import FigmaUiKits from 'igniteui-astro-components/components/mdx/FigmaUiKits.astro';
|
|
2874
|
+
import { DEFAULT_FIGMA_UI_KITS } from 'igniteui-astro-components/components/mdx/FigmaUiKits/kits';
|
|
2875
|
+
|
|
2876
|
+
const materialOnly = DEFAULT_FIGMA_UI_KITS.filter((kit) => kit.label === 'Material');
|
|
2877
|
+
---
|
|
2878
|
+
|
|
2879
|
+
<FigmaUiKits kits={materialOnly} />
|
|
2880
|
+
```
|
|
2881
|
+
|
|
2882
|
+
Give every kit its own URL: several links with different names but the same destination fail WCAG 2.4.4 (link purpose).
|
|
2883
|
+
|
|
2884
|
+
### Layout
|
|
2885
|
+
|
|
2886
|
+
- **One row** when it fits: the Figma logo and title at the start, the links at the end.
|
|
2887
|
+
- **Wrapped** when it doesn't: flexbox moves the whole link list to a second row. Nothing switches at a fixed width, so the banner adapts to the copy, the font and the language. For example, the English row needs about 744px, Japanese 737px and Korean 717px.
|
|
2888
|
+
- **Compact** below 480px (a phone): the text changes to "Check it in our free Figma UI kits", the links stack under it, and the padding tightens. This is a container query on the banner, so it follows the width the banner is given, not the viewport. `variant="compact"` uses this layout at any width.
|
|
2889
|
+
|
|
2890
|
+
The outer `.igd-figma-kits` element is the query container and the inner `.igd-figma-kits__banner` is the visible frame, because a container can't restyle itself from its own query. The container has `inline-size: 100%` because size containment ignores its content's width, so it would otherwise collapse inside a shrink-to-fit parent.
|
|
2891
|
+
|
|
2892
|
+
### Examples
|
|
2893
|
+
|
|
2894
|
+
```mdx
|
|
2895
|
+
{/* Default: the four kits */}
|
|
2896
|
+
|
|
2897
|
+
<FigmaUiKits />
|
|
2898
|
+
|
|
2899
|
+
{/* Always compact */}
|
|
2900
|
+
|
|
2901
|
+
<FigmaUiKits variant="compact" />
|
|
2902
|
+
|
|
2903
|
+
{/* Custom wording */}
|
|
2904
|
+
|
|
2905
|
+
<FigmaUiKits title="Start from a ready-made kit" />
|
|
2906
|
+
```
|
|
2907
|
+
|
|
2908
|
+
### Localization
|
|
2909
|
+
|
|
2910
|
+
The default `title` and `compactTitle` and the hidden link text follow the site language. The language comes from the docs integration's `navLang` (from `virtual:docs-template/site-meta`), then `Astro.currentLocale`, then English. Kit names are product names and are not translated.
|
|
2911
|
+
|
|
2912
|
+
| Language | `title` | `compactTitle` | Kit link name read out |
|
|
2913
|
+
| -------------- | -------------------------------------- | ---------------------------------- | ----------------------------------------------- |
|
|
2914
|
+
| `en` (default) | Check it out in our free Figma UI kits | Check it in our free Figma UI kits | Material Figma UI kit (opens in a new tab) |
|
|
2915
|
+
| `jp` / `ja` | 無料の Figma UI キットでチェック | Same as `title` | Material Figma UI キット (新しいタブで開きます) |
|
|
2916
|
+
| `kr` / `ko` | 무료 Figma UI 키트에서 확인하세요 | Same as `title` | Material Figma UI 키트 (새 탭에서 열림) |
|
|
2917
|
+
|
|
2918
|
+
### Accessibility
|
|
2919
|
+
|
|
2920
|
+
- Every link opens in a new tab and says so in visually hidden text. Each link also names what it opens, so "Material Figma UI kit (opens in a new tab)" makes sense in a screen reader's links list. The external-link icon and the Figma logo are `aria-hidden`.
|
|
2921
|
+
- The links are a real `<ul>` with `role="list"`, so assistive tech announces how many there are. The explicit role is needed because Safari drops list semantics from a list styled with `list-style: none`.
|
|
2922
|
+
- The banner is a plain `<div>`, not an `<aside>` or `<nav>`. It repeats on every topic, and a landmark on every page would clutter the landmark list.
|
|
2923
|
+
- Links meet the WCAG 2.2 target size and have a visible `:focus-visible` outline. They use the same colours as markdown links (`--igd-link-color`: 5.25:1 on the page and 4.77:1 on the banner in light mode, 12.5:1 or more in dark mode).
|
|
2924
|
+
- In forced-colors mode the frame keeps a `CanvasText` border.
|
|
2925
|
+
- The hidden-text class is a local copy of the standard sr-only pattern. Switch to the shared `.visually-hidden` once #177 is fixed.
|
|
2926
|
+
|
|
2927
|
+
### Icons
|
|
2928
|
+
|
|
2929
|
+
Both icons come from `src/assets/icons/` and are inlined at build time with `?raw` and `set:html`, so the banner needs no client JavaScript:
|
|
2930
|
+
|
|
2931
|
+
- `open-link-blank.svg` is the same external-link icon that markdown links use.
|
|
2932
|
+
- `figma-logo.svg` draws the logo on its white tile, so the brand colours stay in the asset. It is listed under Brand in the icon gallery.
|
|
2933
|
+
|
|
2934
|
+
### Styling
|
|
2935
|
+
|
|
2936
|
+
The styles are unlayered, so they win over the `@layer components` markdown styles. Those style every `p`, `ul`, `li` and `a`, and add an icon after `a[target=_blank]`.
|
|
2937
|
+
|
|
2938
|
+
All values are `--igd-figma-kits-*` tokens on `:root` in `src/styles/global/_variables.scss`. Override them on an ancestor or through `class`:
|
|
2939
|
+
|
|
2940
|
+
| Token | Default |
|
|
2941
|
+
| ---------------------------------------------------- | ------------------------------------------------------------------------- |
|
|
2942
|
+
| `--igd-figma-kits-padding-block` / `-inline` | Regular padding; inline is `--igd-padding-sm` |
|
|
2943
|
+
| `--igd-figma-kits-compact-padding-block` / `-inline` | Compact (phone) padding |
|
|
2944
|
+
| `--igd-figma-kits-gap` | `--igd-padding-md`, between links and title ↔ links |
|
|
2945
|
+
| `--igd-figma-kits-row-gap` | Gap between rows once the banner wraps |
|
|
2946
|
+
| `--igd-figma-kits-item-gap` | Logo ↔ title and label ↔ icon |
|
|
2947
|
+
| `--igd-figma-kits-margin-bottom` | Same as the other blocks (aside, FAQ, code) |
|
|
2948
|
+
| `--igd-figma-kits-radius` | `--igd-border-radius` |
|
|
2949
|
+
| `--igd-figma-kits-border-width` / `-style` | `--igd-app-outline-size` / `-style` |
|
|
2950
|
+
| `--igd-figma-kits-logo-size` | Logo height |
|
|
2951
|
+
| `--igd-figma-kits-target-size` | Minimum link height |
|
|
2952
|
+
| `--igd-figma-kits-underline-offset` | Hover underline offset |
|
|
2953
|
+
| `--igd-figma-kits-focus-width` / `-offset` | Focus outline |
|
|
2954
|
+
| `--igd-figma-kits-link-weight` | Link font weight |
|
|
2955
|
+
| `--igd-figma-kits-bg` / `-border-color` | `gray-100` / `gray-300` light, `gray-50` / `gray-200` dark |
|
|
2956
|
+
| `--igd-figma-kits-title-color` | `gray-600` |
|
|
2957
|
+
| `--igd-figma-kits-link-color` / `-link-hover-color` | `--igd-link-color` / `--igd-link-hover-color`, shared with markdown links |
|
|
2958
|
+
|
|
2959
|
+
The dark gray scale is inverted, so `gray-50` and `gray-200` are the dark counterparts of the light `gray-100` and `gray-300`.
|
|
2960
|
+
|
|
2961
|
+
|
|
2962
|
+
## src/components/mdx/PlatformBlock/README.md
|
|
2963
|
+
|
|
2964
|
+
## PlatformBlock
|
|
2965
|
+
|
|
2966
|
+
Conditionally renders its slotted content only when the current build platform matches one of the specified platform names. Replaces the legacy comment-block pattern (`<!-- Angular, React -->…<!-- end: Angular, React -->`).
|
|
2967
|
+
|
|
2968
|
+
### Import
|
|
2969
|
+
|
|
2970
|
+
```astro
|
|
2971
|
+
import PlatformBlock from 'igniteui-astro-components/components/mdx/PlatformBlock.astro';
|
|
2972
|
+
```
|
|
2973
|
+
|
|
2974
|
+
### Props
|
|
2975
|
+
|
|
2976
|
+
| Prop | Type | Description |
|
|
2977
|
+
| ----- | -------- | ----------------------------------------------------------- |
|
|
2978
|
+
| `for` | `string` | Comma-separated list of platform names to show content for. |
|
|
2979
|
+
|
|
2980
|
+
Valid platform names: `Angular`, `React`, `WebComponents`, `Blazor`
|
|
2981
|
+
|
|
2982
|
+
### Examples
|
|
2983
|
+
|
|
2984
|
+
```mdx
|
|
2985
|
+
{/* Single platform */}
|
|
2986
|
+
|
|
2987
|
+
<PlatformBlock for="Angular">This paragraph only appears in Angular docs.</PlatformBlock>
|
|
2988
|
+
|
|
2989
|
+
{/* Multiple platforms */}
|
|
2990
|
+
|
|
2991
|
+
<PlatformBlock for="Angular, React">Visible in Angular and React docs only.</PlatformBlock>
|
|
2992
|
+
|
|
2993
|
+
{/* All platforms (just write the content without PlatformBlock) */}
|
|
2994
|
+
```
|
|
2995
|
+
|
|
2996
|
+
### Platform context
|
|
2997
|
+
|
|
2998
|
+
The active platform is `Astro.locals.platformContext.name`, set by the host site's middleware (see the root README, Quick start step 3). Names in `for` must match `platformContext.name` exactly (`Angular`, `React`, `WebComponents`, `Blazor`, `WinUI`, `Uno`). Without the middleware the render throws, because the component destructures the context.
|
|
2999
|
+
|
|
3000
|
+
The xplat docs build additionally inlines and strips `<PlatformBlock>` at build time (a Vite plugin in that repo), so the component never reaches the browser there.
|
|
3001
|
+
|
|
3002
|
+
### Registering in MDX
|
|
3003
|
+
|
|
3004
|
+
Nothing is registered automatically. Import the component at the top of each
|
|
3005
|
+
MDX file, or pass it through the `components` map of a `<Content />` render.
|
|
3006
|
+
|
|
3007
|
+
|
|
3008
|
+
## src/components/mdx/Sample/README.md
|
|
3009
|
+
|
|
3010
|
+
## Sample
|
|
3011
|
+
|
|
3012
|
+
Renders a live demo widget with an embedded iframe, source code tabs, and live-edit buttons (StackBlitz / CodeSandbox). The HTML shell is rendered server-side; client interactivity is handled by the `sample-widget` script loaded once per page.
|
|
3013
|
+
|
|
3014
|
+
### Import
|
|
3015
|
+
|
|
3016
|
+
```astro
|
|
3017
|
+
import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
3018
|
+
```
|
|
3019
|
+
|
|
3020
|
+
### Props
|
|
3021
|
+
|
|
3022
|
+
| Prop | Type | Default | Description |
|
|
3023
|
+
| ----------------- | -------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
3024
|
+
| `src` | `string` | _(required)_ | Sample path relative to the demos base URL, e.g. `"/charts/data-chart/axis-crossing"`. |
|
|
3025
|
+
| `height` | `number` | `150` (`50` if `fitContent`) | iframe height in pixels. With `fitContent` it is only the loading placeholder / cross-origin fallback. |
|
|
3026
|
+
| `alt` | `string` | `''` | `title` attribute for the iframe (accessibility). |
|
|
3027
|
+
| `lob` | `boolean` | `false` | Use `lobDemosBaseUrl` instead of `demosBaseUrl` (LOB/grid-dynamic demos). |
|
|
3028
|
+
| `dv` | `boolean` | `false` | Force use of `dvDemosBaseUrl` (data-viz demos). Auto-detected for paths starting with `charts/`, `gauges/`, `maps/`, `excel/`. |
|
|
3029
|
+
| `crm` | `boolean` | `false` | Use `crmDemoBaseUrl` (CRM demo samples). |
|
|
3030
|
+
| `wc` | `boolean` | `false` | Load the sample from the Web Components samples browser (`wcDemosBaseUrl`) on every platform's docs, for demos the platforms share. Falls back to `demosBaseUrl`. Code tabs and live editing follow it. |
|
|
3031
|
+
| `chrome` | `'widget' \| 'demo' \| 'bare'` | `'widget'` | What the widget draws around the demo. `widget`: the EXAMPLE and code tabs, and a footer with the live-edit and full-screen buttons. `demo`: the widget's frame without the tabs and the code viewer; the footer carries only the theme picker, and without one there is no footer. For demos whose code is not a usage example, e.g. ones that fake interaction states. `bare`: only the iframe, in a plain container. See [Chrome](#chrome). |
|
|
3032
|
+
| `showThemePicker` | `boolean` | `false` | Add the in-sample theme picker to the footer. Its initial theme comes from the site, not from the usage. `widget` and `demo` only: `bare` has no footer to put it in. |
|
|
3033
|
+
| `fullscreenBtn` | `boolean` | `false` | Render a "View in full screen" button below the iframe. `bare` only: the `widget` footer already has one, and `demo` leaves full screen out on purpose. |
|
|
3034
|
+
| `fitContent` | `boolean` | `false` | Size the iframe to fit its content — the embedded page dictates the size. Same-origin demos are measured directly; cross-origin demos must report via `postMessage`. Demos with ink overflow (shadows, glows, focus rings) must reserve room for it in their own layout, since an iframe clips at its edge. |
|
|
3035
|
+
| `spacing` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'none'` | Padding around the iframe inside the container: `none` = 0, `sm` = 8px, `md` = 16px, `lg` = 32px. Applied by the host container, never inside the embedded page. |
|
|
3036
|
+
| `position` | `string` | — | Where the iframe sits inside the container when it doesn't fill it. Accepts a horizontal token (`start`, `center`, `end`) and/or a vertical token (`top`, `center`, `bottom`), space-separated in any order — e.g. `"center"`, `"start top"`, `"end bottom"`. |
|
|
3037
|
+
| `resizable` | `boolean` | `false` | Show a drag handle on the right edge that resizes the iframe's width so responsive demos can be previewed at different widths. Left/right arrow keys resize it when focused. Combines with `fitContent`: the drag owns the width, the content keeps dictating the height. |
|
|
3038
|
+
| `noBorder` | `boolean` | `true` | Drop the 1px border drawn around the iframe/container. Pass `noBorder={false}` to draw it — recommended whenever the tabs, the footer or the `fullscreenBtn` bar render. |
|
|
3039
|
+
| `noBackground` | `boolean` | `true` (`false` with a theme picker) | Hide the grid-pattern backdrop drawn behind the iframe, keeping the container fully transparent. Pass `noBackground={false}` to show it. Defaults to `false` when a theme picker renders (`showThemePicker` with `widget` or `demo`), so a demo whose theme and mode the reader can switch has a surface of its own. An explicit value always wins. |
|
|
3040
|
+
| `whiteBackground` | `boolean` | `false` | Paint the backdrop behind the iframe pure white (`#fff`) instead of the default light gray. Only the light side changes — dark mode (the site's, or the in-sample theming widget's) is left as is. Implies a painted background, so it also overrides the transparency `noBackground` leaves behind in light mode. |
|
|
3041
|
+
| `iframeOnly` | `boolean` | `false` | **Deprecated**, removed in 2.0.0. Use `chrome="bare"`. See [Deprecated props](#deprecated-props). |
|
|
3042
|
+
| `hideCode` | `boolean` | `false` | **Deprecated**, removed in 2.0.0. Use `chrome="demo"`. See [Deprecated props](#deprecated-props). |
|
|
3043
|
+
|
|
3044
|
+
### Chrome
|
|
3045
|
+
|
|
3046
|
+
`chrome` picks what surrounds the demo, and `showThemePicker` and `fullscreenBtn` add to it where they apply:
|
|
3047
|
+
|
|
3048
|
+
| `chrome` | Tabs and code | Footer | `showThemePicker` | `fullscreenBtn` |
|
|
3049
|
+
| -------------------- | ------------- | -------------------------------------- | ----------------- | --------------- |
|
|
3050
|
+
| `widget` _(default)_ | Yes | Live-edit and full-screen buttons | Yes | No |
|
|
3051
|
+
| `demo` | No | Only the theme picker, if there is one | Yes | No |
|
|
3052
|
+
| `bare` | No | None | No | Yes |
|
|
3053
|
+
|
|
3054
|
+
A modifier the chrome ignores, or a `chrome` value that is not one of the three, logs a build warning. The types only reject an unknown `chrome` value: they accept every modifier with every chrome, as MDX, where most samples live, is not type-checked anyway.
|
|
3055
|
+
|
|
3056
|
+
#### Deprecated props
|
|
3057
|
+
|
|
3058
|
+
`iframeOnly` and `hideCode`, the 1.x spellings of `chrome="bare"` and `chrome="demo"`, still work, but they are deprecated and 2.0.0 removes them. Editors strike them through, and each sample that uses one logs a build warning, once per build, that names the replacement:
|
|
3059
|
+
|
|
3060
|
+
| Deprecated | Use instead |
|
|
3061
|
+
| -------------------------- | ----------------------------- |
|
|
3062
|
+
| `iframeOnly` | `chrome="bare"` |
|
|
3063
|
+
| `iframeOnly fullscreenBtn` | `chrome="bare" fullscreenBtn` |
|
|
3064
|
+
| `hideCode` | `chrome="demo"` |
|
|
3065
|
+
|
|
3066
|
+
As in 1.x, `iframeOnly` wins over `hideCode`. A valid `chrome` wins over both, and the warning says the deprecated prop is ignored. A `chrome` that is not one of the three is ignored itself, so the deprecated prop still applies.
|
|
3067
|
+
|
|
3068
|
+
### Examples
|
|
3069
|
+
|
|
3070
|
+
```mdx
|
|
3071
|
+
{/* Standard widget */}
|
|
3072
|
+
|
|
3073
|
+
<Sample src="/charts/data-chart/axis-crossing" height={500} alt="Angular Data Chart Example" />
|
|
3074
|
+
|
|
3075
|
+
{/* DV sample (auto-detected) */}
|
|
3076
|
+
|
|
3077
|
+
<Sample src="/gauges/radial-gauge/needle" height={350} />
|
|
3078
|
+
|
|
3079
|
+
{/* LOB demo */}
|
|
3080
|
+
|
|
3081
|
+
<Sample src="/grid/grid/filtering" lob />
|
|
3082
|
+
|
|
3083
|
+
{/* Web Components sample shared by every platform's docs */}
|
|
3084
|
+
|
|
3085
|
+
<Sample src="/themes/palettes/scales" wc fitContent chrome="bare" />
|
|
3086
|
+
|
|
3087
|
+
{/* Bare iframe for embedding */}
|
|
3088
|
+
|
|
3089
|
+
<Sample src="/charts/bar-chart/overview" chrome="bare" height={300} />
|
|
3090
|
+
|
|
3091
|
+
{/* Bare iframe + fullscreen link */}
|
|
3092
|
+
|
|
3093
|
+
<Sample src="/charts/bar-chart/overview" chrome="bare" fullscreenBtn height={300} />
|
|
3094
|
+
|
|
3095
|
+
{/* Demo only, with the theme picker: no code tabs or live-edit buttons */}
|
|
3096
|
+
|
|
3097
|
+
<Sample src="/inputs/radio/interaction-state" chrome="demo" showThemePicker height={400} />
|
|
3098
|
+
```
|
|
3099
|
+
|
|
3100
|
+
### Environment configuration
|
|
3101
|
+
|
|
3102
|
+
The base URLs are read from `Astro.locals.envVars`, a plain `Record<string, string>` that the host site's middleware must set (the docs sites load it from their `environment.json`; the root README's Quick start step 3 shows a minimal version). The platform (`Astro.locals.platformContext`) comes from the same middleware:
|
|
3103
|
+
|
|
3104
|
+
| Key | Used by |
|
|
3105
|
+
| -------------------- | ------------------------------------------------------------------------------------ |
|
|
3106
|
+
| `demosBaseUrl` | Default demos |
|
|
3107
|
+
| `dvDemosBaseUrl` | Charts / gauges / maps / excel |
|
|
3108
|
+
| `lobDemosBaseUrl` | LOB / grids |
|
|
3109
|
+
| `crmDemoBaseUrl` | CRM demos |
|
|
3110
|
+
| `wcDemosBaseUrl` | `wc` samples, on any platform |
|
|
3111
|
+
| `defaultSampleTheme` | Starting theme of the code tabs and theme picker; falls back to the platform default |
|
|
3112
|
+
|
|
3113
|
+
Outside the Web Components site, a `wc` sample needs `wcDemosBaseUrl`: without it the sample falls back to `demosBaseUrl`, the page's own platform browser, and the build logs a warning. Leave unused keys out rather than setting them to `""`: an empty string doesn't fall back, it produces a relative URL.
|
|
3114
|
+
|
|
3115
|
+
### Code highlighting
|
|
3116
|
+
|
|
3117
|
+
Code tabs are syntax-highlighted client-side using [Shiki](https://shiki.style/) (lazy-loaded via dynamic import and pre-warmed at widget init). Supported languages: `typescript`, `tsx`, `javascript`, `html`, `css`, `scss`, `csharp`, `razor`.
|
|
3118
|
+
|
|
3119
|
+
The tabs use the package's brand code theme (`igCodeTheme`, the same one `createDocsSite()` applies to fenced blocks), so a code tab and a fenced block look identical. See [`src/code-theme/README.md`](src/code-theme/README.md).
|
|
3120
|
+
|
|
3121
|
+
### Registering in MDX
|
|
3122
|
+
|
|
3123
|
+
Nothing is registered automatically. Either import the component at the top of
|
|
3124
|
+
each MDX file (the convention in the docs repos):
|
|
3125
|
+
|
|
3126
|
+
```mdx
|
|
3127
|
+
import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
3128
|
+
```
|
|
3129
|
+
|
|
3130
|
+
or pass it through the `components` map of a `<Content />` render when the MDX
|
|
3131
|
+
is authored without imports (CMS content, for example).
|
|
3132
|
+
|
|
3133
|
+
|
|
3134
|
+
## src/code-theme/README.md
|
|
3135
|
+
|
|
3136
|
+
## Code theme
|
|
3137
|
+
|
|
3138
|
+
Brand syntax-highlighting theme for code snippets: Shiki's bundled **Rosé Pine
|
|
3139
|
+
Moon** recoloured with Shiki's `colorReplacements` to match the API Docs Figma
|
|
3140
|
+
design (`api-snippet`, dark). Fenced Markdown/MDX blocks, Astro's `<Code>` and
|
|
3141
|
+
the Sample component's code tabs all use it.
|
|
3142
|
+
|
|
3143
|
+
| Export | What it is |
|
|
3144
|
+
| --------------- | ------------------------------------------------------------ |
|
|
3145
|
+
| `igCodeTheme` | The Shiki theme object (`ig-dark`). |
|
|
3146
|
+
| `igShikiConfig` | Drop-in Astro `markdown.shikiConfig`: `igCodeTheme`, `wrap`. |
|
|
3147
|
+
|
|
3148
|
+
Import them from `igniteui-astro-components/code-theme`.
|
|
3149
|
+
|
|
3150
|
+
### Quick start
|
|
3151
|
+
|
|
3152
|
+
Sites built with `createDocsSite()` get it automatically. Any other Astro site:
|
|
3153
|
+
|
|
3154
|
+
```js
|
|
3155
|
+
// astro.config.mjs
|
|
3156
|
+
import { defineConfig } from 'astro/config';
|
|
3157
|
+
import { igShikiConfig } from 'igniteui-astro-components/code-theme';
|
|
3158
|
+
|
|
3159
|
+
export default defineConfig({
|
|
3160
|
+
markdown: { shikiConfig: igShikiConfig },
|
|
3161
|
+
});
|
|
3162
|
+
```
|
|
3163
|
+
|
|
3164
|
+
`<Code>` component:
|
|
3165
|
+
|
|
3166
|
+
```astro
|
|
3167
|
+
---
|
|
3168
|
+
import { Code } from 'astro:components';
|
|
3169
|
+
import { igCodeTheme } from 'igniteui-astro-components/code-theme';
|
|
3170
|
+
---
|
|
3171
|
+
|
|
3172
|
+
<Code code={snippet} lang="ts" theme={igCodeTheme} wrap />
|
|
3173
|
+
```
|
|
3174
|
+
|
|
3175
|
+
Shiki directly:
|
|
3176
|
+
|
|
3177
|
+
```ts
|
|
3178
|
+
import { createHighlighter } from 'shiki';
|
|
3179
|
+
import { igCodeTheme } from 'igniteui-astro-components/code-theme';
|
|
3180
|
+
|
|
3181
|
+
const highlighter = await createHighlighter({ themes: [igCodeTheme], langs: ['ts'] });
|
|
3182
|
+
const html = highlighter.codeToHtml(code, { lang: 'ts', theme: igCodeTheme.name });
|
|
3183
|
+
```
|
|
3184
|
+
|
|
3185
|
+
Shiki writes the background, default text and token colours inline. The
|
|
3186
|
+
surface (border, radius, padding, font, copy button) comes from the package
|
|
3187
|
+
stylesheet (`igniteui-astro-components/styles/theme.scss`).
|
|
3188
|
+
|
|
3189
|
+
### Tokens
|
|
3190
|
+
|
|
3191
|
+
Set on `:root` in `src/styles/global/_variables.scss`; override them from any
|
|
3192
|
+
stylesheet loaded after the package theme.
|
|
3193
|
+
|
|
3194
|
+
| Token | Default | Purpose |
|
|
3195
|
+
| ------------------------------- | -------------------------- | ---------------------------------------- |
|
|
3196
|
+
| `--igd-code-border` | `1px solid #002b5c` | Snippet border. |
|
|
3197
|
+
| `--igd-code-radius` | `var(--igd-border-radius)` | Corner radius. |
|
|
3198
|
+
| `--igd-code-padding` | `36px` (`20px` on mobile) | Inner padding. |
|
|
3199
|
+
| `--igd-code-font-family` | `var(--font-mono)` | Code font. |
|
|
3200
|
+
| `--igd-code-font-size` | `14px` | Code font size. |
|
|
3201
|
+
| `--igd-code-line-height` | `24px` | Code line height. |
|
|
3202
|
+
| `--igd-code-margin-bottom` | `26px` | Space below a snippet. |
|
|
3203
|
+
| `--igd-code-copy-color` | `#d2dbe8` | Copy button icon. |
|
|
3204
|
+
| `--igd-code-copy-hover-color` | `#0176ff` | Copy button icon on hover / focus. |
|
|
3205
|
+
| `--igd-code-copy-hover-bg` | `#002b5c` | Copy button background on hover / focus. |
|
|
3206
|
+
| `--igd-code-copy-success-color` | `var(--ig-success-500)` | Icon colour after a successful copy. |
|
|
3207
|
+
| `--igd-code-copy-inset` | `12px` | Copy button offset from the corner. |
|