igniteui-astro-components 0.0.13 → 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.13",
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
  ))}
@@ -109,7 +109,7 @@ const packages = (rawPackages as PackageEntry[] | undefined)?.map((p: PackageEnt
109
109
  typeof p === 'string' ? { label: p, value: p, href: undefined } : { label: p.label, value: p.value ?? p.label, href: p.href }
110
110
  );
111
111
  const selectedPackage = selectedPackageProp ?? (virtualSelectedPackage || undefined);
112
- const platformIcon = PLATFORM_ICONS[selectedPackage ?? currentPlatform ?? ''] ?? null;
112
+ const platformIcon = PLATFORM_ICONS[selectedPackage ?? ''] ?? PLATFORM_ICONS[currentPlatform ?? ''] ?? null;
113
113
 
114
114
  const resolvedSidebar = (sidebarItems ?? sidebarData) as SidebarEntry[];
115
115
  const sidebarCrumbs = currentSlug ? getBreadcrumb(resolvedSidebar, currentSlug) : [];
@@ -136,6 +136,11 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
136
136
  ))}
137
137
  </igc-select>
138
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
+ )}
139
144
 
140
145
  <!-- Version selector (optional) -->
141
146
  {versions && versions.length > 0 && (
@@ -192,12 +197,27 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
192
197
  connectedCallback() {
193
198
  // Package selector navigation
194
199
  const packageSelect = this.querySelector('#package-select');
200
+ const packageTooltip = this.querySelector<any>('#package-tooltip');
195
201
  if (packageSelect) {
196
202
  packageSelect.addEventListener('igcChange', (e: Event) => {
197
203
  const val = (e as CustomEvent).detail?.value ?? (packageSelect as any).value;
198
204
  const item = packageSelect.querySelector<HTMLElement>(`igc-select-item[value="${val}"]`);
199
205
  const href = item?.dataset?.href;
200
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
+ }
201
221
  });
202
222
  }
203
223
 
@@ -298,8 +318,8 @@ const crumbs = sidebarCrumbs.length > 0 ? sidebarCrumbs : (pageTitle ? [pageTitl
298
318
  </script>
299
319
 
300
320
  <script>
301
- import { defineComponents, IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent } from 'igniteui-webcomponents';
321
+ import { defineComponents, IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent, IgcTooltipComponent } from 'igniteui-webcomponents';
302
322
  import '../../scripts/icon-registry';
303
- defineComponents(IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent);
323
+ defineComponents(IgcIconComponent, IgcIconButtonComponent, IgcSelectComponent, IgcSelectItemComponent, IgcTooltipComponent);
304
324
  </script>
305
325
 
@@ -103,6 +103,31 @@
103
103
  }
104
104
  }
105
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
+
106
131
  // Hidden by default. DocsLayout.scss reveals it on tablet/mobile (when the sidebar is hidden).
107
132
  .subheader-sidebar-toggle {
108
133
  display: none;
@@ -180,5 +205,19 @@
180
205
  }
181
206
  }
182
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
+
183
222
  }
184
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
 
@@ -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