igniteui-astro-components 0.0.13 → 0.0.15
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 +3 -1
- package/src/components/DocsSidebar/DocsSidebar.scss +16 -78
- package/src/components/DocsSidebar/SidebarFilterInput.scss +1 -2
- package/src/components/DocsSidebar/SidebarLabel.astro +3 -2
- package/src/components/DocsSubHeader/DocsSubHeader.astro +57 -4
- package/src/components/DocsSubHeader/DocsSubHeader.scss +42 -1
- package/src/components/DocsToc/DocsToc.scss +1 -1
- package/src/components/DocsTree/docs-tree.scss +139 -32
- package/src/components/LicenseIndicator/LicenseIndicator.astro +4 -3
- package/src/components/LicenseIndicator/LicenseIndicator.scss +4 -2
- package/src/components/Search/Search.scss +8 -0
- package/src/components/SearchAdvanced/SearchAdvanced.astro +48 -1
- package/src/components/SearchAdvanced/SearchAdvanced.scss +51 -6
- package/src/components/mdx/ApiLink/ApiLink.astro +57 -6
- package/src/components/mdx/ApiLink/ApiLink.scss +13 -0
- package/src/components/mdx/ApiLink/README.md +47 -2
- package/src/components/mdx/Badge/Badge.astro +30 -0
- package/src/components/mdx/Badge/Badge.scss +73 -0
- package/src/components/mdx/Badge/README.md +63 -0
- package/src/components/mdx/DocsAside/DocsAside.scss +4 -2
- package/src/components/mdx/Sample/Sample.scss +4 -3
- package/src/layouts/DocsLayout/DocsLayout.astro +2 -2
- package/src/layouts/DocsLayout/DocsLayout.scss +4 -8
- package/src/scripts/sample-widget.ts +3 -1
- package/src/styles/global/_code-blocks.scss +6 -20
- package/src/styles/global/_markdown.scss +98 -41
- package/src/styles/global/_search-shared.scss +2 -9
- package/src/styles/global/_type-scale.scss +17 -19
- package/src/styles/global/_variables.scss +7 -7
- package/src/styles/theme.scss +30 -2
- package/src/virtual-modules.d.ts +4 -0
|
@@ -114,13 +114,14 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
114
114
|
<igc-dialog aria-label={placeholder} class="igd-search-dialog" hide-default-action close-on-outside-click>
|
|
115
115
|
<div class="igd-search-shell">
|
|
116
116
|
<header class="igd-search-header">
|
|
117
|
-
<igc-select placement="bottom-start" distance="17" slot="prefix" class="igd-search-scope" outlined aria-label="Search scope" value="current">
|
|
117
|
+
<igc-select placement="bottom-start" distance="17" id="search-scope-select" slot="prefix" class="igd-search-scope" outlined aria-label="Search scope" value="current">
|
|
118
118
|
{platformIcon && <igc-icon id="search-scope-trigger-icon" name={platformIcon} collection="docs" slot="prefix" aria-hidden="true"></igc-icon>}
|
|
119
119
|
<igc-select-item value="current">
|
|
120
120
|
<span data-scope-label>Current package</span>
|
|
121
121
|
</igc-select-item>
|
|
122
122
|
<igc-select-item value="all">All packages</igc-select-item>
|
|
123
123
|
</igc-select>
|
|
124
|
+
<igc-tooltip anchor="search-scope-select" class="igd-search-scope-tooltip" placement="bottom" with-arrow></igc-tooltip>
|
|
124
125
|
|
|
125
126
|
<igc-divider vertical></igc-divider>
|
|
126
127
|
|
|
@@ -170,6 +171,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
170
171
|
IgcListComponent,
|
|
171
172
|
IgcListItemComponent,
|
|
172
173
|
IgcDividerComponent,
|
|
174
|
+
IgcTooltipComponent,
|
|
173
175
|
} from 'igniteui-webcomponents';
|
|
174
176
|
import '../../scripts/icon-registry';
|
|
175
177
|
|
|
@@ -185,6 +187,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
185
187
|
IgcListComponent,
|
|
186
188
|
IgcListItemComponent,
|
|
187
189
|
IgcDividerComponent,
|
|
190
|
+
IgcTooltipComponent,
|
|
188
191
|
);
|
|
189
192
|
|
|
190
193
|
type IndexedPage = {
|
|
@@ -246,6 +249,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
246
249
|
private input!: IgcInputComponent;
|
|
247
250
|
private clearBtn!: IgcIconButtonComponent;
|
|
248
251
|
private scopeSelect: IgcSelectComponent | null = null;
|
|
252
|
+
private scopeTooltip: HTMLElement | null = null;
|
|
249
253
|
private scopeTriggerIcon: HTMLElement | null = null;
|
|
250
254
|
private platformIconName: string = '';
|
|
251
255
|
private tabsEl!: IgcTabsComponent;
|
|
@@ -296,6 +300,7 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
296
300
|
this.input = this.querySelector<IgcInputComponent>('igc-input.igd-search-input')!;
|
|
297
301
|
this.clearBtn = this.querySelector<IgcIconButtonComponent>('.igd-search-clear')!;
|
|
298
302
|
this.scopeSelect = this.querySelector<IgcSelectComponent>('igc-select.igd-search-scope');
|
|
303
|
+
this.scopeTooltip = this.querySelector<HTMLElement>('.igd-search-scope-tooltip');
|
|
299
304
|
this.scopeTriggerIcon = this.querySelector('#search-scope-trigger-icon');
|
|
300
305
|
this.platformIconName = this.dataset.platformIcon || '';
|
|
301
306
|
this.tabsEl = this.querySelector<IgcTabsComponent>('igc-tabs.igd-search-tabs')!;
|
|
@@ -391,6 +396,30 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
391
396
|
this.scopeSelect.addEventListener('igcChange', () => {
|
|
392
397
|
this.scope = this.scopeSelect!.value === 'all' ? 'all' : 'current';
|
|
393
398
|
if (this.currentQuery) this.runSearch();
|
|
399
|
+
this.syncScopeTooltip();
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
// igcInput re-renders with full text after the dropdown closes; re-apply truncation.
|
|
403
|
+
this.scopeSelect.addEventListener('igcClosed', () =>
|
|
404
|
+
requestAnimationFrame(() => this.applyScopeTruncation())
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// Apply truncation once the dialog is fully open and the select has real dimensions.
|
|
409
|
+
this.dialog.addEventListener('igcOpened', () =>
|
|
410
|
+
requestAnimationFrame(() => requestAnimationFrame(() => this.applyScopeTruncation()))
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
// Only show the scope tooltip when the label is visually truncated
|
|
414
|
+
if (this.scopeTooltip && this.scopeSelect) {
|
|
415
|
+
this.scopeTooltip.addEventListener('igcOpening', (e: Event) => {
|
|
416
|
+
const igcInput = (this.scopeSelect as any).shadowRoot?.querySelector('igc-input');
|
|
417
|
+
const nativeInput = igcInput?.shadowRoot?.querySelector('input');
|
|
418
|
+
const truncated = nativeInput?.value?.endsWith('\u2026');
|
|
419
|
+
const overflows = nativeInput && nativeInput.scrollWidth > nativeInput.clientWidth;
|
|
420
|
+
if (!truncated && !overflows) {
|
|
421
|
+
e.preventDefault();
|
|
422
|
+
}
|
|
394
423
|
});
|
|
395
424
|
}
|
|
396
425
|
}
|
|
@@ -422,6 +451,24 @@ const resolvedIndexUrl = indexUrl ?? `${basePath}api-search-index/manifest.json`
|
|
|
422
451
|
this.scopeSelect.value = 'all';
|
|
423
452
|
this.scope = 'all';
|
|
424
453
|
}
|
|
454
|
+
this.syncScopeTooltip();
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
private syncScopeTooltip() {
|
|
458
|
+
if (!this.scopeTooltip || !this.scopeSelect) return;
|
|
459
|
+
const val = this.scopeSelect.value;
|
|
460
|
+
const item = this.scopeSelect.querySelector<HTMLElement>(`igc-select-item[value="${val}"]`);
|
|
461
|
+
this.scopeTooltip.textContent = item?.textContent?.trim() ?? val ?? '';
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
private applyScopeTruncation() {
|
|
465
|
+
if (!this.scopeSelect) return;
|
|
466
|
+
const igcInput = (this.scopeSelect as any).shadowRoot?.querySelector('igc-input');
|
|
467
|
+
const nativeInput = igcInput?.shadowRoot?.querySelector('input') as HTMLInputElement | null;
|
|
468
|
+
if (!nativeInput || !nativeInput.value) return;
|
|
469
|
+
nativeInput.style.overflow = 'hidden';
|
|
470
|
+
nativeInput.style.textOverflow = 'ellipsis';
|
|
471
|
+
nativeInput.style.whiteSpace = 'nowrap';
|
|
425
472
|
}
|
|
426
473
|
|
|
427
474
|
private closeModal() {
|
|
@@ -2,15 +2,30 @@
|
|
|
2
2
|
@use '../../styles/global/search-shared' as *;
|
|
3
3
|
|
|
4
4
|
@layer components {
|
|
5
|
-
api-search-advanced {
|
|
5
|
+
api-search-advanced {
|
|
6
|
+
display: contents;
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
.igd-search-header {
|
|
10
|
+
igc-input::part(container) {
|
|
11
|
+
&:focus-within {
|
|
12
|
+
box-shadow:
|
|
13
|
+
0 0 0 1px var(--igd-accent),
|
|
14
|
+
inset 0 1px 0 var(--igd-accent),
|
|
15
|
+
inset 0 -1px 0 var(--igd-accent),
|
|
16
|
+
inset -1px 0 0 var(--igd-accent);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
6
21
|
|
|
7
|
-
|
|
8
|
-
|
|
22
|
+
#search-scope-trigger-icon {
|
|
23
|
+
margin-inline-start: rem(16px);
|
|
24
|
+
}
|
|
9
25
|
}
|
|
10
26
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
padding-inline-start: rem(16px);
|
|
27
|
+
.search-trigger {
|
|
28
|
+
color: light-dark(var(--ig-gray-600), var(--ig-gray-400));
|
|
14
29
|
}
|
|
15
30
|
|
|
16
31
|
// TODO BUG IN THE TAB COMPONENT
|
|
@@ -97,5 +112,35 @@
|
|
|
97
112
|
igc-divider {
|
|
98
113
|
--color: light-dark(var(--ig-gray-400), var(--ig-gray-300));
|
|
99
114
|
}
|
|
115
|
+
|
|
116
|
+
.igd-search-scope {
|
|
117
|
+
max-width: rem(250px);
|
|
118
|
+
|
|
119
|
+
&::part(input) {
|
|
120
|
+
min-width: 0;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&::part(native-input) {
|
|
125
|
+
min-width: 0;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
text-overflow: ellipsis;
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.igd-search-scope-tooltip {
|
|
133
|
+
--ig-tooltip-background: #D2DBE8;
|
|
134
|
+
--ig-tooltip-text-color: #112031;
|
|
135
|
+
--ig-tooltip-border-radius: #{rem(4px)};
|
|
136
|
+
|
|
137
|
+
&::part(base) {
|
|
138
|
+
font-family: var(--igd-font-sans);
|
|
139
|
+
font-size: #{rem(12px)};
|
|
140
|
+
font-weight: 500;
|
|
141
|
+
line-height: #{rem(18px)};
|
|
142
|
+
letter-spacing: 0;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
100
145
|
}
|
|
101
146
|
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
* → <a href="…/enums/igniteui-react.igrcalendarselection.html">…</a>
|
|
40
40
|
*/
|
|
41
41
|
import type { PlatformContext } from '../../../lib/types.ts';
|
|
42
|
+
import './ApiLink.scss';
|
|
42
43
|
|
|
43
44
|
type ApiKind = 'class' | 'interface' | 'enum' | 'type' | 'variable' | 'function' | 'sass';
|
|
44
45
|
|
|
@@ -98,6 +99,35 @@ type TypeDocProps = {
|
|
|
98
99
|
* @default true
|
|
99
100
|
*/
|
|
100
101
|
suffix?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Comma-separated list of platforms (e.g. "React" or "React,Blazor") for
|
|
104
|
+
* which the API link does NOT exist on the documentation site. When the
|
|
105
|
+
* current platform matches any entry the component renders the type name
|
|
106
|
+
* as plain inline code (no link), preserving the symbol reference for the
|
|
107
|
+
* reader without producing a broken URL.
|
|
108
|
+
*
|
|
109
|
+
* Use this instead of wrapping a single <ApiLink> in a <PlatformBlock>
|
|
110
|
+
* just to hide it from a specific platform.
|
|
111
|
+
*/
|
|
112
|
+
exclude?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Comma-separated list of platforms for which the package classSuffix
|
|
115
|
+
* (e.g. "Component") should NOT be appended, overriding the package default.
|
|
116
|
+
* Useful when the same type is a plain class on some platforms but carries
|
|
117
|
+
* a framework suffix on others (e.g. "Angular,WebComponents").
|
|
118
|
+
*
|
|
119
|
+
* Does not suppress the link — combine with `exclude` to suppress entirely.
|
|
120
|
+
*/
|
|
121
|
+
excludeSuffixFor?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Comma-separated list of platforms for which the platform prefix
|
|
124
|
+
* (Igr/Igx/Igc/Igb) should NOT be prepended, overriding the package default.
|
|
125
|
+
* Useful when a symbol has no prefix on certain platforms.
|
|
126
|
+
*
|
|
127
|
+
* Does not suppress the link — combine with `exclude` to suppress entirely.
|
|
128
|
+
*/
|
|
129
|
+
excludePrefixFor?: string;
|
|
130
|
+
|
|
101
131
|
};
|
|
102
132
|
|
|
103
133
|
type Props = SassProps | TypeDocProps;
|
|
@@ -112,12 +142,15 @@ const KIND_SEGMENT: Record<Exclude<ApiKind, 'sass'>, string> = {
|
|
|
112
142
|
};
|
|
113
143
|
|
|
114
144
|
const ctx = Astro.locals.platformContext as PlatformContext;
|
|
115
|
-
const { prefix, apiPackages } = ctx;
|
|
145
|
+
const { name: platformName, prefix, apiPackages } = ctx;
|
|
116
146
|
const label = Astro.props.label;
|
|
117
147
|
|
|
148
|
+
const splitList = (s?: string) => s ? s.split(',').map(p => p.trim()).filter(Boolean) : [];
|
|
149
|
+
|
|
118
150
|
let url: string;
|
|
119
151
|
let displayLabel: string;
|
|
120
152
|
let renderCode: boolean;
|
|
153
|
+
let isExcluded = false;
|
|
121
154
|
|
|
122
155
|
if (Astro.props.kind === 'sass') {
|
|
123
156
|
const { type, module, code = true } = Astro.props;
|
|
@@ -133,12 +166,22 @@ if (Astro.props.kind === 'sass') {
|
|
|
133
166
|
displayLabel = label ?? type ?? module ?? '';
|
|
134
167
|
renderCode = code;
|
|
135
168
|
} else {
|
|
136
|
-
const {
|
|
169
|
+
const {
|
|
170
|
+
type, kind = 'class', member, pkg = 'core',
|
|
171
|
+
prefixed = true, suffix = true,
|
|
172
|
+
exclude, excludeSuffixFor, excludePrefixFor,
|
|
173
|
+
} = Astro.props;
|
|
174
|
+
isExcluded = splitList(exclude).includes(platformName);
|
|
175
|
+
const isSuffixExcluded = splitList(excludeSuffixFor).includes(platformName);
|
|
176
|
+
const isPrefixExcluded = splitList(excludePrefixFor).includes(platformName);
|
|
177
|
+
const effectivePrefixed = prefixed && !isPrefixExcluded;
|
|
178
|
+
const effectiveSuffix = suffix && !isSuffixExcluded;
|
|
179
|
+
|
|
137
180
|
const pkgConfig = apiPackages[pkg] ?? apiPackages['core'];
|
|
138
|
-
const baseType =
|
|
181
|
+
const baseType = effectivePrefixed ? `${prefix}${type}` : type;
|
|
139
182
|
const segment = KIND_SEGMENT[kind];
|
|
140
183
|
if (kind === 'class') {
|
|
141
|
-
const fullType = (
|
|
184
|
+
const fullType = (effectiveSuffix && pkgConfig.classSuffix) ? `${baseType}${pkgConfig.classSuffix}` : baseType;
|
|
142
185
|
const cased = pkgConfig.preserveCase ? fullType : fullType.toLowerCase();
|
|
143
186
|
const classSlug = pkgConfig.noPackagePrefix
|
|
144
187
|
? cased
|
|
@@ -152,7 +195,13 @@ if (Astro.props.kind === 'sass') {
|
|
|
152
195
|
? baseType
|
|
153
196
|
: `${pkgConfig.packageId}.${baseType}`;
|
|
154
197
|
const memberAnchorNonClass = member
|
|
155
|
-
? `#${
|
|
198
|
+
? `#${
|
|
199
|
+
kind === 'enum'
|
|
200
|
+
? member
|
|
201
|
+
: pkgConfig.pascalCaseMembers
|
|
202
|
+
? member.charAt(0).toUpperCase() + member.slice(1)
|
|
203
|
+
: member.toLowerCase()
|
|
204
|
+
}`
|
|
156
205
|
: '';
|
|
157
206
|
url = `${pkgConfig.docRoot}/${segment}/${slug}${memberAnchorNonClass}`;
|
|
158
207
|
}
|
|
@@ -160,4 +209,6 @@ if (Astro.props.kind === 'sass') {
|
|
|
160
209
|
renderCode = true;
|
|
161
210
|
}
|
|
162
211
|
---
|
|
163
|
-
|
|
212
|
+
{isExcluded
|
|
213
|
+
? <code>{displayLabel}</code>
|
|
214
|
+
: <a href={url}>{renderCode ? <code>{displayLabel}</code> : displayLabel}</a>}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# ApiLink
|
|
2
2
|
|
|
3
|
-
Renders an inline
|
|
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
|
-
##
|
|
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
|
-
|
|
41
|
+
> p:only-child,
|
|
42
|
+
> p:last-child {
|
|
43
|
+
margin-block-end: 0;
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -80,13 +80,14 @@ igc-tab {
|
|
|
80
80
|
|
|
81
81
|
// TODO Log issue in the component this is not suppose to be affected by the ig-typography
|
|
82
82
|
igc-tab::part(content) {
|
|
83
|
-
@include type-style('
|
|
83
|
+
@include type-style('detail-1', false) {
|
|
84
84
|
margin: 0;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
igc-tab::part(tab-header) {
|
|
89
|
-
min-height: rem(
|
|
89
|
+
min-height: rem(30px);
|
|
90
|
+
padding: rem(4px) rem(16px)
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
.igd-code-view {
|
|
@@ -145,7 +146,7 @@ igc-tab::part(tab-header) {
|
|
|
145
146
|
align-items: center;
|
|
146
147
|
justify-content: flex-end;
|
|
147
148
|
position: relative;
|
|
148
|
-
padding: rem(16px)
|
|
149
|
+
padding: rem(16px);
|
|
149
150
|
gap: rem(16px);
|
|
150
151
|
}
|
|
151
152
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { ClientRouter } from 'astro:transitions';
|
|
3
|
-
import '@fontsource-variable/
|
|
4
|
-
import '@fontsource-variable/
|
|
3
|
+
import '@fontsource-variable/inter/wght.css';
|
|
4
|
+
import '@fontsource-variable/inter/wght-italic.css';
|
|
5
5
|
import '@fontsource-variable/jetbrains-mono/wght.css';
|
|
6
6
|
import '@fontsource-variable/jetbrains-mono/wght-italic.css';
|
|
7
7
|
import GlobalNavBar from '../../components/GlobalNavBar/GlobalNavBar.astro';
|
|
@@ -313,6 +313,10 @@
|
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
igc-divider:not([variant="vertical"]) {
|
|
317
|
+
margin-block: rem(24px);
|
|
318
|
+
}
|
|
319
|
+
|
|
316
320
|
@media (max-width: #{$bp-hide-toc}) {
|
|
317
321
|
.igd-main-content__inner {
|
|
318
322
|
aside {
|
|
@@ -338,12 +342,4 @@
|
|
|
338
342
|
justify-content: center;
|
|
339
343
|
}
|
|
340
344
|
|
|
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
345
|
}
|
|
@@ -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
|
-
|
|
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
|
|