igniteui-astro-components 0.0.12 → 0.0.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-astro-components",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Reusable Astro components, layouts, and integrations for Infragistics / Ignite UI documentation sites. Replaces the Starlight defaults with project-specific implementations.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -62,6 +62,7 @@
62
62
  "./components/mdx/ApiRef.astro": "./src/components/mdx/ApiRef/ApiRef.astro",
63
63
  "./components/mdx/ApiLink.astro": "./src/components/mdx/ApiLink/ApiLink.astro",
64
64
  "./components/mdx/DocsAside.astro": "./src/components/mdx/DocsAside/DocsAside.astro",
65
+ "./components/mdx/Badge.astro": "./src/components/mdx/Badge/Badge.astro",
65
66
  "./components/mdx/PlatformBlock.astro": "./src/components/mdx/PlatformBlock/PlatformBlock.astro",
66
67
  "./components/mdx/Sample.astro": "./src/components/mdx/Sample/Sample.astro",
67
68
  "./lib/sidebar/types": "./src/lib/sidebar/types.ts",
@@ -62,67 +62,6 @@
62
62
  scrollbar-gutter: stable;
63
63
  }
64
64
 
65
- .sidebar-badge {
66
- --border-radius: #{rem(4px)};
67
- --elevation: none;
68
-
69
- &::part(base) {
70
- @include type-style('overline') {
71
- margin: 0;
72
- };
73
-
74
- border-radius: var(--border-radius);
75
- border-width: rem(1px);
76
- border-style: solid;
77
- border-color: var(--border-color);
78
- }
79
-
80
- igc-icon {
81
- --size: #{rem(18px)}
82
- }
83
-
84
- // TODO, This has to be fixed inside the component
85
- span {
86
- position: relative;
87
- padding-inline: rem(3px);
88
- }
89
- }
90
-
91
- .updated {
92
- --background-color: var(--igd-updated-bg);
93
- --text-color: var(--igd-updated-color);
94
- --icon-color: var(--igd-updated-color);
95
- --border-color: var(--igd-updated-border);
96
- }
97
-
98
- .new {
99
- --background-color: var(--igd-new-bg);
100
- --text-color: var(--igd-new-color);
101
- --icon-color: var(--igd-new-color);
102
- --border-color: var(--igd-new-border);
103
- }
104
-
105
- .preview {
106
- --background-color: var(--igd-preview-bg);
107
- --text-color: var(--igd-preview-color);
108
- --icon-color: var(--igd-preview-color);
109
- --border-color: var(--igd-preview-border);
110
- }
111
-
112
- .premium {
113
- --background-color: var(--igd-premium-bg);
114
- --text-color: var(--igd-premium-color);
115
- --icon-color: var(--igd-premium-color);
116
- --border-color: var(--igd-premium-border);
117
- }
118
-
119
- .opensource {
120
- --background-color: var(--igd-opensource-bg);
121
- --text-color: var(--igd-opensource-color);
122
- --icon-color: var(--igd-opensource-color);
123
- --border-color: var(--igd-opensource-border);
124
- }
125
-
126
65
  .sidebar-premium-icon {
127
66
  --size: #{rem(24px)};
128
67
 
@@ -13,6 +13,7 @@
13
13
  */
14
14
  import type { TreeNode } from '../DocsTree/types';
15
15
  import type { SidebarBadge } from '../../lib/sidebar/types';
16
+ import Badge from '../mdx/Badge/Badge.astro';
16
17
 
17
18
  interface Props {
18
19
  node: TreeNode;
@@ -34,7 +35,7 @@ const badges = (node.meta?.badges ?? []) as SidebarBadge[];
34
35
  <div class="igd-badge-container">
35
36
  {badges.filter(b => b.variant !== 'premium').map((badge) => (
36
37
  <>
37
- <igc-badge class={`sidebar-badge ${badge.variant}`} aria-hidden="true"><span>{badge.text}</span></igc-badge>
38
+ <Badge variant={badge.variant} class="sidebar-badge" aria-hidden="true"><span>{badge.text}</span></Badge>
38
39
  <span class="visually-hidden">, {badge.text}</span>
39
40
  </>
40
41
  ))}
@@ -13,7 +13,7 @@
13
13
  * moved to the `DocsBreadcrumb` component, rendered inside the main frame.
14
14
  */
15
15
  import { platform as virtualPlatform } from 'virtual:docs-template/nav-html';
16
- import { productLinks, sidebar as sidebarData, title as siteTitle } from 'virtual:docs-template/site-meta';
16
+ import { productLinks, sidebar as sidebarData, title as siteTitle, packages as virtualPackages, selectedPackage as virtualSelectedPackage } from 'virtual:docs-template/site-meta';
17
17
  import Search from '../Search/Search.astro';
18
18
  import type { SidebarEntry } from '../../lib/sidebar/types';
19
19
  import { getBreadcrumb } from '../../lib/sidebar/helpers';
@@ -55,9 +55,13 @@ interface Props {
55
55
  * Defaults to the virtual module value.
56
56
  */
57
57
  sidebarItems?: SidebarEntry[];
58
- /** Package names for the package selector dropdown. When omitted the selector is hidden. */
59
- packages?: string[];
60
- /** Currently selected package (must match one of `packages`). */
58
+ /**
59
+ * Items for the package/platform selector dropdown. When omitted the selector is hidden.
60
+ * Each entry is either a plain string label, or an object with a `label`, optional `value`
61
+ * (defaults to `label`), and optional `href` to navigate to when selected.
62
+ */
63
+ packages?: Array<string | { label: string; value?: string; href?: string }>;
64
+ /** Currently selected package value (must match one of `packages`). */
61
65
  selectedPackage?: string;
62
66
  /** Label rendered before the package selector. Defaults to `'Package'`. */
63
67
  packageLabel?: string;
@@ -85,8 +89,8 @@ const {
85
89
  siteTitle: siteTitleProp,
86
90
  productLinks: productLinksProp,
87
91
  sidebarItems,
88
- packages,
89
- selectedPackage,
92
+ packages: packagesProp,
93
+ selectedPackage: selectedPackageProp,
90
94
  packageLabel = 'Package',
91
95
  versions,
92
96
  selectedVersion,
@@ -97,9 +101,15 @@ const {
97
101
  } = Astro.props;
98
102
  const resolvedSiteTitle = siteTitleProp ?? siteTitle;
99
103
  const currentPlatform = virtualPlatform ?? null;
100
- const platformIcon = currentPlatform ? (PLATFORM_ICONS[currentPlatform] ?? null) : null;
101
104
  const resolvedLinks = (productLinksProp ?? productLinks) as ProductLink[];
102
105
  const filteredLinks = resolvedLinks.filter((l: ProductLink) => l.platform !== currentPlatform);
106
+ type PackageEntry = string | { label: string; value?: string; href?: string };
107
+ const rawPackages = packagesProp ?? (virtualPackages.length > 0 ? virtualPackages : undefined);
108
+ const packages = (rawPackages as PackageEntry[] | undefined)?.map((p: PackageEntry) =>
109
+ typeof p === 'string' ? { label: p, value: p, href: undefined } : { label: p.label, value: p.value ?? p.label, href: p.href }
110
+ );
111
+ const selectedPackage = selectedPackageProp ?? (virtualSelectedPackage || undefined);
112
+ const platformIcon = PLATFORM_ICONS[selectedPackage ?? ''] ?? PLATFORM_ICONS[currentPlatform ?? ''] ?? null;
103
113
 
104
114
  const resolvedSidebar = (sidebarItems ?? sidebarData) as SidebarEntry[];
105
115
  const sidebarCrumbs = currentSlug ? getBreadcrumb(resolvedSidebar, currentSlug) : [];
@@ -119,13 +129,18 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
119
129
 
120
130
  <!-- Package selector (optional) -->
121
131
  {packages && packages.length > 0 && (
122
- <igc-select distance="17" placement="bottom-end" id="package-select" class="igd-package-select" outlined value={selectedPackage} aria-label={packageLabel}>
132
+ <igc-select distance="17" id="package-select" class="igd-package-select" outlined value={selectedPackage} aria-label={packageLabel}>
123
133
  {platformIcon && <igc-icon name={platformIcon} collection="docs" slot="prefix" aria-hidden="true"></igc-icon>}
124
134
  {packages.map((p) => (
125
- <igc-select-item value={p}>{p}</igc-select-item>
135
+ <igc-select-item value={p.value} data-href={p.href}>{p.label}</igc-select-item>
126
136
  ))}
127
137
  </igc-select>
128
138
  )}
139
+ {packages && packages.length > 0 && (
140
+ <igc-tooltip anchor="package-select" id="package-tooltip" placement="bottom-end" with-arrow>
141
+ {packages.find(p => p.value === selectedPackage)?.label ?? selectedPackage ?? ''}
142
+ </igc-tooltip>
143
+ )}
129
144
 
130
145
  <!-- Version selector (optional) -->
131
146
  {versions && versions.length > 0 && (
@@ -180,6 +195,32 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
180
195
  if (!customElements.get('docs-subheader-menu')) {
181
196
  class DocsSubHeaderMenu extends HTMLElement {
182
197
  connectedCallback() {
198
+ // Package selector navigation
199
+ const packageSelect = this.querySelector('#package-select');
200
+ const packageTooltip = this.querySelector<any>('#package-tooltip');
201
+ if (packageSelect) {
202
+ packageSelect.addEventListener('igcChange', (e: Event) => {
203
+ const val = (e as CustomEvent).detail?.value ?? (packageSelect as any).value;
204
+ const item = packageSelect.querySelector<HTMLElement>(`igc-select-item[value="${val}"]`);
205
+ const href = item?.dataset?.href;
206
+ if (href) window.location.href = href;
207
+ // Sync tooltip content with the new selection label
208
+ if (packageTooltip) {
209
+ packageTooltip.textContent = item?.textContent?.trim() ?? val;
210
+ }
211
+ });
212
+ }
213
+ // Only show the package tooltip when the label is visually truncated
214
+ if (packageTooltip && packageSelect) {
215
+ packageTooltip.addEventListener('igcOpening', (e: Event) => {
216
+ const igcInput = (packageSelect as any).shadowRoot?.querySelector('igc-input');
217
+ const nativeInput = igcInput?.shadowRoot?.querySelector('input');
218
+ if (!nativeInput || nativeInput.scrollWidth <= nativeInput.clientWidth) {
219
+ e.preventDefault();
220
+ }
221
+ });
222
+ }
223
+
183
224
  // Sidebar toggle
184
225
  const sidebarBtn = this.querySelector<HTMLButtonElement>('[data-sidebar-toggle]');
185
226
  if (sidebarBtn) {
@@ -243,6 +284,32 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
243
284
  this.classList.remove('igd-docs-subheader--pinned');
244
285
  });
245
286
  }
287
+
288
+ // Close open selects on scroll, and prevent the browser's
289
+ // focus-triggered scrollIntoView from jumping the page when a
290
+ // select is clicked while the user is scrolled down.
291
+ const selectsForScroll = Array.from(
292
+ this.querySelectorAll<HTMLElement>('#package-select, #version-select')
293
+ );
294
+ selectsForScroll.forEach(select => {
295
+ let savedY: number | null = null;
296
+ let guardTimer: ReturnType<typeof setTimeout> | null = null;
297
+
298
+ // pointerdown fires before focus is assigned to save scroll position
299
+ select.addEventListener('pointerdown', () => {
300
+ savedY = window.scrollY;
301
+ if (guardTimer) clearTimeout(guardTimer);
302
+ guardTimer = setTimeout(() => { savedY = null; guardTimer = null; }, 300);
303
+ });
304
+
305
+ window.addEventListener('scroll', () => {
306
+ if (savedY !== null) {
307
+ window.scrollTo({ top: savedY, left: 0, behavior: 'instant' });
308
+ return;
309
+ }
310
+ if ((select as any).open) (select as any).hide();
311
+ }, { passive: true });
312
+ });
246
313
  }
247
314
  }
248
315
 
@@ -251,8 +318,8 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
251
318
  </script>
252
319
 
253
320
  <script>
254
- import { defineComponents, IgcIconComponent, IgcIconButtonComponent } from 'igniteui-webcomponents';
321
+ import { defineComponents, IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent, IgcTooltipComponent } from 'igniteui-webcomponents';
255
322
  import '../../scripts/icon-registry';
256
- defineComponents(IgcIconComponent, IgcIconButtonComponent);
323
+ defineComponents(IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent, IgcTooltipComponent);
257
324
  </script>
258
325
 
@@ -75,6 +75,7 @@
75
75
  align-items: center;
76
76
  height: 100%;
77
77
  gap: rem(16px);
78
+ min-width: 0;
78
79
 
79
80
  > igc-select:first-of-type {
80
81
  margin-inline-start: auto;
@@ -85,6 +86,48 @@
85
86
  }
86
87
  }
87
88
 
89
+ .igd-package-select,
90
+ .igd-version-select {
91
+ flex-shrink: 0;
92
+ position: relative;
93
+ width: fit-content;
94
+ max-width: rem(180px);
95
+
96
+ &::part(base) {
97
+ position: absolute;
98
+ inset-block-start: 100%;
99
+ inset-inline-end: 0;
100
+ width: max-content;
101
+ min-width: 100%;
102
+ z-index: 100;
103
+ }
104
+ }
105
+
106
+ .igd-version-select {
107
+ &::part(native-input) {
108
+ field-sizing: content;
109
+ }
110
+ }
111
+
112
+ .igd-package-select {
113
+ &::part(prefix),
114
+ &::part(toggle-icon) {
115
+ flex-shrink: 0;
116
+ }
117
+
118
+ &::part(input) {
119
+ min-width: 0;
120
+ overflow: hidden;
121
+ }
122
+
123
+ &::part(native-input) {
124
+ min-width: 0;
125
+ overflow: hidden;
126
+ text-overflow: ellipsis;
127
+ white-space: nowrap;
128
+ }
129
+ }
130
+
88
131
  // Hidden by default. DocsLayout.scss reveals it on tablet/mobile (when the sidebar is hidden).
89
132
  .subheader-sidebar-toggle {
90
133
  display: none;
@@ -162,5 +205,19 @@
162
205
  }
163
206
  }
164
207
 
208
+ #package-tooltip {
209
+ --ig-tooltip-background: #D2DBE8;
210
+ --ig-tooltip-text-color: #112031;
211
+ --ig-tooltip-border-radius: #{rem(4px)};
212
+
213
+ &::part(base) {
214
+ font-family: var(--igd-font-sans);
215
+ font-size: #{rem(12px)};
216
+ font-weight: 500;
217
+ line-height: #{rem(18px)};
218
+ letter-spacing: 0;
219
+ }
220
+ }
221
+
165
222
  }
166
223
 
@@ -172,7 +172,12 @@ igc-tree-item[data-has-children] {
172
172
  }
173
173
 
174
174
  .docs-tree-label {
175
+ display: -webkit-box;
176
+ -webkit-line-clamp: 2;
177
+ -webkit-box-orient: vertical;
178
+ overflow: hidden;
175
179
  white-space: normal;
180
+ word-break: break-word;
176
181
  }
177
182
 
178
183
  /* Hover accent applies to leaf items (sidebar) and all linked items (TOC) */
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import './LicenseIndicator.scss';
3
+ import Badge from '../mdx/Badge/Badge.astro';
3
4
 
4
5
  export interface Props {
5
6
  /** 'premium' shows a purple Premium badge; 'opensource' shows a green Open Source badge; false/undefined hides the badge. */
@@ -11,9 +12,9 @@ const label = license === 'premium' ? 'Premium' : 'Open Source';
11
12
  ---
12
13
 
13
14
  {license && (
14
- <igc-badge class={`sidebar-badge ${license}`}>
15
+ <Badge variant={license} class="license-indicator-badge">
15
16
  <span>{label}</span>
16
17
 
17
- {license === 'premium' && <igc-icon name="premium" collection="docs" class="sidebar-premium-icon" aria-hidden="true"></igc-icon>}
18
- </igc-badge>
18
+ {license === 'premium' && <igc-icon name="premium" collection="docs" aria-hidden="true"></igc-icon>}
19
+ </Badge>
19
20
  )}
@@ -1,5 +1,7 @@
1
1
  @use 'igniteui-theming/sass/typography/functions' as *;
2
2
 
3
- .sidebar-badge::part(base) {
4
- padding-inline: rem(4px);
3
+ .license-indicator-badge {
4
+ &::part(base) {
5
+ padding-inline: rem(4px);
6
+ }
5
7
  }
@@ -2,17 +2,20 @@
2
2
  @use '../../styles/global/search-shared' as *;
3
3
 
4
4
  @layer components {
5
- api-search-advanced { display: contents; }
5
+ api-search-advanced {
6
+ display: contents;
7
+
8
+
9
+ // Advanced header has a scope selector before the input, needs start padding
10
+ .igd-search-header {
11
+ padding-inline-start: rem(16px);
12
+ }
13
+ }
6
14
 
7
15
  .search-trigger {
8
16
  color: light-dark(var(--ig-gray-600), var(--ig-gray-400));
9
17
  }
10
18
 
11
- // Advanced header has a scope selector before the input, needs start padding
12
- .igd-search-header {
13
- padding-inline-start: rem(16px);
14
- }
15
-
16
19
  // TODO BUG IN THE TAB COMPONENT
17
20
  igc-tabs::part(inner) {
18
21
  flex-grow: 1;
@@ -98,6 +98,35 @@ type TypeDocProps = {
98
98
  * @default true
99
99
  */
100
100
  suffix?: boolean;
101
+ /**
102
+ * Comma-separated list of platforms (e.g. "React" or "React,Blazor") for
103
+ * which the API link does NOT exist on the documentation site. When the
104
+ * current platform matches any entry the component renders the type name
105
+ * as plain inline code (no link), preserving the symbol reference for the
106
+ * reader without producing a broken URL.
107
+ *
108
+ * Use this instead of wrapping a single <ApiLink> in a <PlatformBlock>
109
+ * just to hide it from a specific platform.
110
+ */
111
+ exclude?: string;
112
+ /**
113
+ * Comma-separated list of platforms for which the package classSuffix
114
+ * (e.g. "Component") should NOT be appended, overriding the package default.
115
+ * Useful when the same type is a plain class on some platforms but carries
116
+ * a framework suffix on others (e.g. "Angular,WebComponents").
117
+ *
118
+ * Does not suppress the link — combine with `exclude` to suppress entirely.
119
+ */
120
+ excludeSuffixFor?: string;
121
+ /**
122
+ * Comma-separated list of platforms for which the platform prefix
123
+ * (Igr/Igx/Igc/Igb) should NOT be prepended, overriding the package default.
124
+ * Useful when a symbol has no prefix on certain platforms.
125
+ *
126
+ * Does not suppress the link — combine with `exclude` to suppress entirely.
127
+ */
128
+ excludePrefixFor?: string;
129
+
101
130
  };
102
131
 
103
132
  type Props = SassProps | TypeDocProps;
@@ -112,12 +141,15 @@ const KIND_SEGMENT: Record<Exclude<ApiKind, 'sass'>, string> = {
112
141
  };
113
142
 
114
143
  const ctx = Astro.locals.platformContext as PlatformContext;
115
- const { prefix, apiPackages } = ctx;
144
+ const { name: platformName, prefix, apiPackages } = ctx;
116
145
  const label = Astro.props.label;
117
146
 
147
+ const splitList = (s?: string) => s ? s.split(',').map(p => p.trim()).filter(Boolean) : [];
148
+
118
149
  let url: string;
119
150
  let displayLabel: string;
120
151
  let renderCode: boolean;
152
+ let isExcluded = false;
121
153
 
122
154
  if (Astro.props.kind === 'sass') {
123
155
  const { type, module, code = true } = Astro.props;
@@ -133,12 +165,22 @@ if (Astro.props.kind === 'sass') {
133
165
  displayLabel = label ?? type ?? module ?? '';
134
166
  renderCode = code;
135
167
  } else {
136
- const { type, kind = 'class', member, pkg = 'core', prefixed = true, suffix = true } = Astro.props;
168
+ const {
169
+ type, kind = 'class', member, pkg = 'core',
170
+ prefixed = true, suffix = true,
171
+ exclude, excludeSuffixFor, excludePrefixFor,
172
+ } = Astro.props;
173
+ isExcluded = splitList(exclude).includes(platformName);
174
+ const isSuffixExcluded = splitList(excludeSuffixFor).includes(platformName);
175
+ const isPrefixExcluded = splitList(excludePrefixFor).includes(platformName);
176
+ const effectivePrefixed = prefixed && !isPrefixExcluded;
177
+ const effectiveSuffix = suffix && !isSuffixExcluded;
178
+
137
179
  const pkgConfig = apiPackages[pkg] ?? apiPackages['core'];
138
- const baseType = prefixed ? `${prefix}${type}` : type;
180
+ const baseType = effectivePrefixed ? `${prefix}${type}` : type;
139
181
  const segment = KIND_SEGMENT[kind];
140
182
  if (kind === 'class') {
141
- const fullType = (suffix && pkgConfig.classSuffix) ? `${baseType}${pkgConfig.classSuffix}` : baseType;
183
+ const fullType = (effectiveSuffix && pkgConfig.classSuffix) ? `${baseType}${pkgConfig.classSuffix}` : baseType;
142
184
  const cased = pkgConfig.preserveCase ? fullType : fullType.toLowerCase();
143
185
  const classSlug = pkgConfig.noPackagePrefix
144
186
  ? cased
@@ -152,7 +194,13 @@ if (Astro.props.kind === 'sass') {
152
194
  ? baseType
153
195
  : `${pkgConfig.packageId}.${baseType}`;
154
196
  const memberAnchorNonClass = member
155
- ? `#${pkgConfig.pascalCaseMembers ? member.charAt(0).toUpperCase() + member.slice(1) : member.toLowerCase()}`
197
+ ? `#${
198
+ kind === 'enum'
199
+ ? member
200
+ : pkgConfig.pascalCaseMembers
201
+ ? member.charAt(0).toUpperCase() + member.slice(1)
202
+ : member.toLowerCase()
203
+ }`
156
204
  : '';
157
205
  url = `${pkgConfig.docRoot}/${segment}/${slug}${memberAnchorNonClass}`;
158
206
  }
@@ -160,4 +208,6 @@ if (Astro.props.kind === 'sass') {
160
208
  renderCode = true;
161
209
  }
162
210
  ---
163
- <a href={url}>{renderCode ? <code>{displayLabel}</code> : displayLabel}</a>
211
+ {isExcluded
212
+ ? <code>{displayLabel}</code>
213
+ : <a href={url}>{renderCode ? <code>{displayLabel}</code> : displayLabel}</a>}
@@ -1,6 +1,10 @@
1
1
  # ApiLink
2
2
 
3
- Renders an inline `<a><code>` link pointing to the TypeDoc API reference for a class, interface, enum, type alias, variable, or function — with platform-aware URL generation.
3
+ Renders an inline API link with platform-aware URL generation.
4
+
5
+ For TypeDoc symbols, it renders an inline `<a><code>` link to a class,
6
+ interface, enum, type alias, variable, or function. It can also render Sass API
7
+ links when `kind="sass"`.
4
8
 
5
9
  ## Import
6
10
 
@@ -8,7 +12,7 @@ Renders an inline `<a><code>` link pointing to the TypeDoc API reference for a c
8
12
  import ApiLink from 'igniteui-astro-components/components/mdx/ApiLink.astro';
9
13
  ```
10
14
 
11
- ## Props
15
+ ## TypeDoc props
12
16
 
13
17
  | Prop | Type | Default | Description |
14
18
  |------|------|---------|-------------|
@@ -19,6 +23,25 @@ import ApiLink from 'igniteui-astro-components/components/mdx/ApiLink.astro';
19
23
  | `label` | `string` | auto | Override the display text. Defaults to the prefixed name (+ `.member` when provided). |
20
24
  | `prefixed` | `boolean` | `true` | When `true`, prepends the platform prefix (`Igr`/`Igx`/`Igc`/`Igb`) to `type`. Set `false` for already-qualified names or non-prefixed symbols like function names. |
21
25
  | `suffix` | `boolean` | `true` | When `true`, appends the platform class suffix (e.g. `Component` for Angular). Set `false` for utility classes that do not carry a suffix. |
26
+ | `exclude` | `string` | — | Comma-separated platform names where the link should not render. Matching platforms render the label as plain inline `<code>`. |
27
+ | `excludeSuffixFor` | `string` | — | Comma-separated platform names where `classSuffix` should not be appended, even when `suffix` is `true`. |
28
+ | `excludePrefixFor` | `string` | — | Comma-separated platform names where the platform prefix should not be prepended, even when `prefixed` is `true`. |
29
+
30
+ Platform names use the display form from `PlatformContext.name`: `Angular`,
31
+ `React`, `WebComponents`, or `Blazor`.
32
+
33
+ ## Sass props
34
+
35
+ Use `kind="sass"` for Sass API reference links. Sass links read their base URL
36
+ from `platformContext.sassApiUrl`.
37
+
38
+ | Prop | Type | Default | Description |
39
+ |------|------|---------|-------------|
40
+ | `kind` | `'sass'` | *(required)* | Enables Sass API link mode. |
41
+ | `module` | `string` | — | Sass module path segment, e.g. `"animations"` or `"themes"`. |
42
+ | `type` | `string` | — | Anchor fragment without `#`, e.g. `"mixin-slide-in-left"`. Omit it to link to the module page. |
43
+ | `label` | `string` | auto | Override the display text. Defaults to `type`, then `module`, then an empty string. |
44
+ | `code` | `boolean` | `true` | Wrap the label in `<code>`. Set `false` for prose labels. |
22
45
 
23
46
  ## Examples
24
47
 
@@ -47,6 +70,21 @@ import ApiLink from 'igniteui-astro-components/components/mdx/ApiLink.astro';
47
70
 
48
71
  {/* Utility class without platform suffix */}
49
72
  <ApiLink type="SortingStrategy" suffix={false} />
73
+
74
+ {/* Hide a broken API link on selected platforms */}
75
+ <ApiLink type="Toast" member="show" exclude="Blazor,WebComponents" />
76
+
77
+ {/* Keep the symbol unprefixed only for React */}
78
+ <ApiLink kind="interface" type="ComboTemplateProps" excludePrefixFor="React" />
79
+
80
+ {/* Suppress the Angular class suffix for this symbol */}
81
+ <ApiLink type="FilteringOperand" excludeSuffixFor="Angular" />
82
+
83
+ {/* Sass module page */}
84
+ <ApiLink kind="sass" module="animations" label="animations Sass module" code={false} />
85
+
86
+ {/* Sass symbol anchor */}
87
+ <ApiLink kind="sass" module="animations" type="mixin-slide-in-left" label="slide-in-left" />
50
88
  ```
51
89
 
52
90
  ## Platform context
@@ -66,3 +104,10 @@ Supported platforms and their prefixes:
66
104
  | `React` | `Igr` | — |
67
105
  | `WebComponents` | `Igc` | — |
68
106
  | `Blazor` | `Igb` | — |
107
+
108
+ For Sass links, make sure `platformContext.sassApiUrl` is configured. The URL is
109
+ assembled as:
110
+
111
+ ```txt
112
+ {sassApiUrl}/{module}#{type}
113
+ ```
@@ -0,0 +1,30 @@
1
+ ---
2
+ import './Badge.scss';
3
+
4
+ export type BadgeVariant = 'preview' | 'new' | 'updated' | 'premium' | 'opensource';
5
+
6
+ export interface Props {
7
+ /**
8
+ * Visual variant controlling colour.
9
+ * @default 'preview'
10
+ */
11
+ variant?: BadgeVariant;
12
+ /** Extra CSS classes forwarded to the igc-badge element. */
13
+ class?: string;
14
+ 'aria-hidden'?: boolean | string | undefined;
15
+ 'aria-label'?: string;
16
+ }
17
+
18
+ const { variant = 'preview', class: className, ...rest } = Astro.props;
19
+ const defaultText = variant === 'opensource' ? 'Open Source'
20
+ : variant.charAt(0).toUpperCase() + variant.slice(1);
21
+ ---
22
+
23
+ <igc-badge class:list={['igd-badge', variant, className]} {...rest}>
24
+ <slot><span>{defaultText}</span></slot>
25
+ </igc-badge>
26
+
27
+ <script>
28
+ import { defineComponents, IgcBadgeComponent } from 'igniteui-webcomponents';
29
+ defineComponents(IgcBadgeComponent);
30
+ </script>
@@ -0,0 +1,73 @@
1
+ @use 'igniteui-theming/sass/typography' as *;
2
+
3
+ @layer components {
4
+ igc-badge {
5
+ &.preview {
6
+ --background-color: var(--igd-preview-bg);
7
+ --text-color: var(--igd-preview-color);
8
+ --icon-color: var(--igd-preview-color);
9
+ --border-color: var(--igd-preview-border);
10
+ }
11
+
12
+ &.new {
13
+ --background-color: var(--igd-new-bg);
14
+ --text-color: var(--igd-new-color);
15
+ --icon-color: var(--igd-new-color);
16
+ --border-color: var(--igd-new-border);
17
+ }
18
+
19
+ &.updated {
20
+ --background-color: var(--igd-updated-bg);
21
+ --text-color: var(--igd-updated-color);
22
+ --icon-color: var(--igd-updated-color);
23
+ --border-color: var(--igd-updated-border);
24
+ }
25
+
26
+ &.premium {
27
+ --background-color: var(--igd-premium-bg);
28
+ --text-color: var(--igd-premium-color);
29
+ --icon-color: var(--igd-premium-color);
30
+ --border-color: var(--igd-premium-border);
31
+ }
32
+
33
+ &.opensource {
34
+ --background-color: var(--igd-opensource-bg);
35
+ --text-color: var(--igd-opensource-color);
36
+ --icon-color: var(--igd-opensource-color);
37
+ --border-color: var(--igd-opensource-border);
38
+ }
39
+ }
40
+
41
+ .igd-badge {
42
+ --border-radius: #{rem(4px)};
43
+ --elevation: none;
44
+ vertical-align: middle;
45
+
46
+ &::part(base) {
47
+ @include type-style('overline') {
48
+ margin: 0;
49
+ };
50
+
51
+ border-radius: var(--border-radius);
52
+ border-width: rem(1px);
53
+ border-style: solid;
54
+ border-color: var(--border-color);
55
+ }
56
+
57
+ igc-icon {
58
+ --size: #{rem(18px)}
59
+ }
60
+
61
+ // TODO, This has to be fixed inside the component
62
+ span {
63
+ position: relative;
64
+ padding-inline: rem(3px);
65
+ }
66
+ }
67
+
68
+ h1, h2, h3, h4, h5, h6 {
69
+ > .igd-badge {
70
+ align-self: center;
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,63 @@
1
+ # Badge
2
+
3
+ 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`.
4
+
5
+ ## Import
6
+
7
+ ```astro
8
+ import Badge from 'igniteui-astro-components/components/mdx/Badge.astro';
9
+ ```
10
+
11
+ ## Props
12
+
13
+ | Prop | Type | Default | Description |
14
+ |------|------|---------|-------------|
15
+ | `variant` | `'preview' \| 'new' \| 'updated' \| 'premium' \| 'opensource'` | `'preview'` | Visual variant controlling color. |
16
+ | `class` | `string` | — | Extra CSS classes forwarded to the `igc-badge` element. |
17
+ | `aria-hidden` | `boolean \| string` | — | Hides the badge from assistive technology. Useful for purely decorative badges. |
18
+ | `aria-label` | `string` | — | Override the accessible label. |
19
+
20
+ ## Examples
21
+
22
+ ```mdx
23
+ {/* Default — preview variant */}
24
+ <Badge />
25
+
26
+ {/* Explicit variants */}
27
+ <Badge variant="new" />
28
+ <Badge variant="updated" />
29
+ <Badge variant="premium" />
30
+ <Badge variant="opensource" />
31
+
32
+ {/* Inside a heading */}
33
+ ## My Feature <Badge variant="new" />
34
+
35
+ {/* Custom slot content */}
36
+ <Badge variant="preview">Coming Soon</Badge>
37
+
38
+ {/* Decorative — hidden from screen readers */}
39
+ <Badge variant="new" aria-hidden="true" />
40
+ ```
41
+
42
+ ## Variants
43
+
44
+ | `variant` | Default text | Color token group |
45
+ |-----------|-------------|-------------------|
46
+ | `preview` | Preview | `--igd-preview-*` |
47
+ | `new` | New | `--igd-new-*` |
48
+ | `updated` | Updated | `--igd-updated-*` |
49
+ | `premium` | Premium | `--igd-premium-*` |
50
+ | `opensource` | Open Source | `--igd-opensource-*` |
51
+
52
+ ## Styling
53
+
54
+ Colors are driven by CSS custom properties set on the `igc-badge` host:
55
+
56
+ | Property | Purpose |
57
+ |----------|---------|
58
+ | `--background-color` | Fill color of the badge chip |
59
+ | `--text-color` | Label text color |
60
+ | `--icon-color` | Icon color (if an icon is projected) |
61
+ | `--border-color` | Border color of the badge chip |
62
+
63
+ 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.
@@ -26,6 +26,7 @@ blockquote {
26
26
  .igd-aside__title {
27
27
  grid-row: 1;
28
28
  grid-column: 2;
29
+ align-self: center;
29
30
  }
30
31
 
31
32
  .igd-aside__icon {
@@ -37,8 +38,9 @@ blockquote {
37
38
  grid-column: 2;
38
39
  grid-row: 2;
39
40
 
40
- > p:only-child {
41
- margin-inline-end: 0;
41
+ > p:only-child,
42
+ > p:last-child {
43
+ margin-block-end: 0;
42
44
  }
43
45
  }
44
46
 
@@ -35,9 +35,25 @@ export interface Props {
35
35
  license?: string;
36
36
  /** Set to true on 404 pages to add the `igd-page-layout--404` modifier class. */
37
37
  is404?: boolean;
38
+ /** Package names for the subheader package selector. When omitted the selector is hidden. */
39
+ packages?: string[];
40
+ /** Currently selected package (must match one of `packages`). */
41
+ selectedPackage?: string;
42
+ /** Label rendered before the package selector. Defaults to `'Package'`. */
43
+ packageLabel?: string;
44
+ /** Version labels for the subheader version selector. When omitted the selector is hidden. */
45
+ versions?: string[];
46
+ /** Currently selected version (must match one of `versions`). */
47
+ selectedVersion?: string;
48
+ /** Label rendered before the version selector. Defaults to `'Version'`. */
49
+ versionLabel?: string;
50
+ /** Show a light/dark theme toggle button in the subheader. */
51
+ showThemeToggle?: boolean;
52
+ /** `localStorage` key for persisting the theme. Defaults to `'docs-theme'`. */
53
+ themeStorageKey?: string;
38
54
  }
39
55
 
40
- const { title, description, keywords, hasToc = true, hasSidebar = true, currentSlug = '', siteTitle: siteTitleProp, license, is404 = false } = Astro.props;
56
+ const { title, description, keywords, hasToc = true, hasSidebar = true, currentSlug = '', siteTitle: siteTitleProp, license, is404 = false, packages, selectedPackage, packageLabel, versions, selectedVersion, versionLabel, showThemeToggle, themeStorageKey } = Astro.props;
41
57
  const resolvedSiteTitle = siteTitleProp ?? siteTitle;
42
58
  const licenseType = license === 'commercial' ? 'premium' : license === 'MIT' ? 'opensource' : false;
43
59
  const navTheme = (virtualPlatform ?? import.meta.env.VITE_NAV_THEME ?? 'igniteui') as string;
@@ -224,7 +240,7 @@ type HeadEntry = { tag: string; attrs?: Record<string, string | boolean | undefi
224
240
  <!-- TODO: WE DONT NEED TO CALCULAtE THE IG HEADER HEIGHT ANYMORE - REMOVE IT -->
225
241
  <!-- <DocsSubHeader style={ `--docs-global-nav-height: ${ showGlobalNav ? '4.7rem': '0' }` } data-nav-height-wrapper/> -->
226
242
  <slot name="subheader">
227
- <DocsSubHeader pageTitle={title} currentSlug={currentSlug} siteTitle={siteTitleProp} />
243
+ <DocsSubHeader pageTitle={title} currentSlug={currentSlug} siteTitle={siteTitleProp} packages={packages} selectedPackage={selectedPackage} packageLabel={packageLabel} versions={versions} selectedVersion={selectedVersion} versionLabel={versionLabel} showThemeToggle={showThemeToggle} themeStorageKey={themeStorageKey} />
228
244
  </slot>
229
245
 
230
246
 
@@ -338,12 +338,4 @@
338
338
  justify-content: center;
339
339
  }
340
340
 
341
- .igd-package-select::part(native-input),
342
- .igd-version-select::part(native-input) {
343
- field-sizing: content;
344
-
345
- &::part(base) {
346
- min-width: 100%;
347
- }
348
- }
349
341
  }
@@ -354,7 +354,9 @@ class XplatCodeService {
354
354
  try {
355
355
  // Blazor's local dev server uses a self-signed cert on a non-4200 port,
356
356
  // causing CORS errors. Use a relative URL so Vite's proxy handles it.
357
- const jsonUrl = this.platform === 'blazor'
357
+ // On staging/production, use the full demosBaseUrl like other xplat platforms.
358
+ const isLocalDev = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
359
+ const jsonUrl = (this.platform === 'blazor' && isLocalDev)
358
360
  ? `${this.codeBase}${samplePath}.json`
359
361
  : `${demosBaseUrl}${this.codeBase}${samplePath}.json`;
360
362
 
@@ -5,40 +5,56 @@
5
5
  // generated by typography() but type-style() only accepts standard names.
6
6
  // Read the generated --ig-* vars directly to avoid the warning.
7
7
  .igd-main-content__markdown {
8
- .sidebar-badge {
8
+ .license-indicator-badge {
9
9
  margin-block-end: rem(26px);
10
10
 
11
11
  // TODO, This has to be fixed inside the component
12
12
  span {
13
- top:1px
13
+ top: rem(1px);
14
14
  }
15
15
  }
16
-
17
- p {
16
+
17
+ p,
18
+ .igd-p {
18
19
  @include type-style('body-1');
20
+
21
+ code {
22
+ white-space: nowrap;
23
+ /* Optional: allows the user to scroll horizontally if the code is too long */
24
+ max-width: 100%;
25
+ overflow-x: auto;
26
+ display: inline-block;
27
+ vertical-align: middle;
28
+ }
19
29
  }
20
30
 
21
- h1 {
31
+ h1,
32
+ .igd-h1 {
22
33
  @include type-style('h1');
23
34
  }
24
35
 
25
- h2 {
36
+ h2,
37
+ .igd-h2 {
26
38
  @include type-style('h2');
27
39
  }
28
40
 
29
- h3 {
41
+ h3,
42
+ .igd-h3 {
30
43
  @include type-style('h3');
31
44
  }
32
45
 
33
- h4 {
46
+ h4,
47
+ .igd-h4 {
34
48
  @include type-style('h4');
35
49
  }
36
50
 
37
- h5 {
51
+ h5,
52
+ .igd-h5 {
38
53
  @include type-style('h5');
39
54
  }
40
55
 
41
- h6 {
56
+ h6,
57
+ .igd-h6 {
42
58
  @include type-style('h6');
43
59
  }
44
60
 
@@ -59,8 +75,10 @@
59
75
  };
60
76
 
61
77
  border: rem(1px) solid light-dark(var(--ig-gray-200), var(--ig-primary-900));
78
+ border-radius: rem(4px);
62
79
  background-color: light-dark(var(--ig-gray-50), var(--ig-gray-50)) !important;
63
80
  color: light-dark(var(--ig-gray-900), var(--ig-gray-800));
81
+ padding: rem(32px);
64
82
  }
65
83
 
66
84
  pre,
@@ -94,7 +112,7 @@
94
112
  color: light-dark(var(--ig-gray-600), var(--ig-gray-400));
95
113
  border: rem(1px) solid light-dark(var(--ig-gray-300), #1A314A);
96
114
 
97
- padding: rem(4px) rem(8px);
115
+ padding: 0 rem(4px);
98
116
  border-radius: rem(4px);
99
117
  }
100
118
 
@@ -154,6 +172,10 @@
154
172
  }
155
173
 
156
174
  dl {
175
+ display: flex;
176
+ flex-direction: column;
177
+ gap: 8px;
178
+
157
179
  padding-inline-start: 0;
158
180
 
159
181
  dt {
@@ -286,10 +308,12 @@
286
308
  img {
287
309
  display: block;
288
310
  max-width: 100%;
311
+ width: 100%;
289
312
  height: auto;
290
313
  margin-block-end: rem(26px);
291
314
  border-radius: var(--igd-border-radius);
292
315
  content-visibility: auto;
316
+ object-fit: cover;
293
317
  }
294
318
 
295
319
  // Image wrapped in a link — no underline, contain the block margin