igniteui-astro-components 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +322 -158
- package/llms-full.txt +3207 -0
- package/llms.txt +103 -0
- package/package.json +17 -5
- package/src/assets/icons/figma-logo.svg +10 -0
- package/src/code-theme/README.md +72 -0
- package/src/code-theme/index.ts +57 -0
- package/src/components/CopyCode/CopyCode.astro +6 -1
- package/src/components/CopyCode/README.md +38 -0
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +28 -30
- package/src/components/DocsSidebar/DocsSidebar.astro +14 -2
- package/src/components/DocsSidebar/README.md +58 -30
- package/src/components/DocsSidebar/SidebarLabel.astro +34 -36
- package/src/components/DocsSidebar/sidebar-filter.ts +53 -5
- package/src/components/DocsSidebar/toTreeNodes.ts +21 -5
- package/src/components/DocsSubHeader/DocsSubHeader.astro +22 -9
- package/src/components/DocsSubHeader/README.md +37 -31
- package/src/components/DocsToc/DocsToc.astro +12 -14
- package/src/components/DocsToc/README.md +7 -7
- package/src/components/DocsTree/DocsTree.astro +9 -11
- package/src/components/DocsTree/DocsTreeItem.astro +36 -40
- package/src/components/DocsTree/README.md +12 -9
- package/src/components/GlobalFooter/GlobalFooter.astro +6 -8
- package/src/components/GlobalNavBar/GlobalNavBar.astro +2 -4
- package/src/components/LicenseIndicator/LicenseIndicator.astro +6 -8
- package/src/components/MobileTocToggle/MobileTocToggle.astro +31 -33
- package/src/components/MobileTocToggle/README.md +45 -0
- package/src/components/Search/README.md +10 -10
- package/src/components/Search/Search.astro +12 -6
- package/src/components/SearchAdvanced/README.md +15 -8
- package/src/components/SearchAdvanced/SearchAdvanced.astro +17 -15
- package/src/components/ThemingWidget/ThemingWidget.astro +62 -60
- package/src/components/mdx/Anatomy/Anatomy.scss +1 -1
- package/src/components/mdx/Anatomy/README.md +40 -0
- package/src/components/mdx/ApiLink/ApiLink.astro +7 -9
- package/src/components/mdx/ApiLink/README.md +1 -0
- package/src/components/mdx/ApiRef/ApiRef.astro +7 -9
- package/src/components/mdx/ApiRef/README.md +1 -1
- package/src/components/mdx/Badge/Badge.astro +3 -1
- package/src/components/mdx/Badge/README.md +1 -3
- package/src/components/mdx/DocsAside/DocsAside.astro +3 -5
- package/src/components/mdx/DocsAside/README.md +47 -29
- package/src/components/mdx/Faq/Faq.astro +11 -13
- package/src/components/mdx/Faq/FaqItem.astro +20 -26
- package/src/components/mdx/FigmaUiKits/FigmaUiKits.astro +126 -0
- package/src/components/mdx/FigmaUiKits/FigmaUiKits.scss +165 -0
- package/src/components/mdx/FigmaUiKits/README.md +115 -0
- package/src/components/mdx/FigmaUiKits/kits.ts +26 -0
- package/src/components/mdx/PlatformBlock/README.md +5 -18
- package/src/components/mdx/Sample/README.md +67 -50
- package/src/components/mdx/Sample/Sample.astro +108 -33
- package/src/components/mdx/Sample/Sample.scss +38 -17
- package/src/integration.ts +6 -21
- package/src/layouts/DocsLayout/README.md +63 -28
- package/src/lib/warn-once.ts +8 -0
- package/src/scripts/copy-status.ts +35 -0
- package/src/scripts/icon-manifest.ts +1 -0
- package/src/scripts/sample-widget.ts +109 -42
- package/src/styles/global/_code-blocks.scss +58 -36
- package/src/styles/global/_copy-button.scss +18 -25
- package/src/styles/global/_markdown.scss +15 -8
- package/src/styles/global/_variables.scss +57 -0
- package/src/styles/theme.scss +4 -1
- package/src/virtual-modules.d.ts +2 -2
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
@use 'igniteui-theming/sass/typography' as *;
|
|
2
|
+
|
|
3
|
+
// Values come from the --igd-figma-kits-* tokens in global/_variables.scss.
|
|
4
|
+
|
|
5
|
+
.igd-figma-kits {
|
|
6
|
+
container: igd-figma-kits / inline-size;
|
|
7
|
+
inline-size: 100%;
|
|
8
|
+
margin: 0 0 var(--igd-figma-kits-margin-bottom);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.igd-figma-kits__banner {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-wrap: wrap;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
gap: var(--igd-figma-kits-row-gap) var(--igd-figma-kits-gap);
|
|
17
|
+
padding: var(--igd-figma-kits-padding-block) var(--igd-figma-kits-padding-inline);
|
|
18
|
+
background: var(--igd-figma-kits-bg);
|
|
19
|
+
border: var(--igd-figma-kits-border-width) var(--igd-figma-kits-border-style)
|
|
20
|
+
var(--igd-figma-kits-border-color);
|
|
21
|
+
border-radius: var(--igd-figma-kits-radius);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.igd-figma-kits__heading {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: var(--igd-figma-kits-item-gap);
|
|
28
|
+
margin: 0;
|
|
29
|
+
min-inline-size: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Logo and link icon: the SVG fills the wrapper's height, width follows its viewBox.
|
|
33
|
+
.igd-figma-kits__logo,
|
|
34
|
+
.igd-figma-kits__icon {
|
|
35
|
+
display: block;
|
|
36
|
+
flex: none;
|
|
37
|
+
|
|
38
|
+
svg {
|
|
39
|
+
display: block;
|
|
40
|
+
inline-size: auto;
|
|
41
|
+
block-size: 100%;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.igd-figma-kits__logo {
|
|
46
|
+
block-size: var(--igd-figma-kits-logo-size);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.igd-figma-kits__icon {
|
|
50
|
+
block-size: 1lh;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.igd-figma-kits__text {
|
|
54
|
+
min-inline-size: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.igd-figma-kits__list {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-wrap: wrap;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: var(--igd-figma-kits-row-gap) var(--igd-figma-kits-gap);
|
|
62
|
+
margin: 0;
|
|
63
|
+
padding: 0;
|
|
64
|
+
list-style: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.igd-figma-kits__item {
|
|
68
|
+
margin: 0;
|
|
69
|
+
padding: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.igd-figma-kits__link {
|
|
73
|
+
display: inline-flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: var(--igd-figma-kits-item-gap);
|
|
76
|
+
min-block-size: var(--igd-figma-kits-target-size);
|
|
77
|
+
vertical-align: middle;
|
|
78
|
+
border-radius: var(--igd-figma-kits-radius);
|
|
79
|
+
text-decoration: none;
|
|
80
|
+
|
|
81
|
+
// Hide the markdown external-link icon; the link renders its own.
|
|
82
|
+
&::after {
|
|
83
|
+
content: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&:hover {
|
|
87
|
+
text-decoration: underline;
|
|
88
|
+
text-underline-offset: var(--igd-figma-kits-underline-offset);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&:focus-visible {
|
|
92
|
+
outline: var(--igd-figma-kits-focus-width) solid currentColor;
|
|
93
|
+
outline-offset: var(--igd-figma-kits-focus-offset);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Visually hidden, still read by screen readers.
|
|
98
|
+
.igd-figma-kits__sr-only {
|
|
99
|
+
position: absolute;
|
|
100
|
+
inline-size: 1px;
|
|
101
|
+
block-size: 1px;
|
|
102
|
+
padding: 0;
|
|
103
|
+
margin: -1px;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
clip-path: inset(50%);
|
|
106
|
+
white-space: nowrap;
|
|
107
|
+
border: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.igd-figma-kits__title-compact {
|
|
111
|
+
display: none;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Compact layout: title over links, compact padding, mobile text.
|
|
115
|
+
@mixin compact {
|
|
116
|
+
.igd-figma-kits__banner {
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
align-items: stretch;
|
|
119
|
+
padding: var(--igd-figma-kits-compact-padding-block)
|
|
120
|
+
var(--igd-figma-kits-compact-padding-inline);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.igd-figma-kits__title-full {
|
|
124
|
+
display: none;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.igd-figma-kits__title-compact {
|
|
128
|
+
display: inline;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.igd-figma-kits[data-variant='compact'] {
|
|
133
|
+
@include compact;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Phone layout: title over links, tighter padding, mobile text.
|
|
137
|
+
@container igd-figma-kits (width < 480px) {
|
|
138
|
+
.igd-figma-kits {
|
|
139
|
+
@include compact;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// TYPOGRAPHY
|
|
144
|
+
|
|
145
|
+
.igd-figma-kits__title {
|
|
146
|
+
@include type-style('body-1') {
|
|
147
|
+
margin: 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
color: var(--igd-figma-kits-title-color);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.igd-figma-kits__link {
|
|
154
|
+
@include type-style('body-2') {
|
|
155
|
+
margin: 0;
|
|
156
|
+
font-weight: var(--igd-figma-kits-link-weight);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
color: var(--igd-figma-kits-link-color);
|
|
160
|
+
|
|
161
|
+
&:hover,
|
|
162
|
+
&:focus-visible {
|
|
163
|
+
color: var(--igd-figma-kits-link-hover-color);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# FigmaUiKits
|
|
2
|
+
|
|
3
|
+
Renders the "Check it out in our free Figma UI kits" call-to-action banner that links a component topic to the Ignite UI kits in Figma. It belongs between a topic's description and its live demo.
|
|
4
|
+
|
|
5
|
+
It links to the Indigo.Design UI kits for Material, Fluent, Bootstrap and Indigo out of the box, so a topic only needs `<FigmaUiKits />`. When a kit is republished, update its URL once in `kits.ts` (`DEFAULT_FIGMA_UI_KITS`) and every topic picks it up.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```astro
|
|
10
|
+
import FigmaUiKits from 'igniteui-astro-components/components/mdx/FigmaUiKits.astro';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| -------------- | --------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
|
17
|
+
| `kits` | `FigmaUiKit[]` | `DEFAULT_FIGMA_UI_KITS` | One link per kit, in display order. Each is `{ label: string; href: string }`. |
|
|
18
|
+
| `title` | `string` | `'Check it out in our free Figma UI kits'` | Text before the links. Localized by default. |
|
|
19
|
+
| `compactTitle` | `string` | `'Check it in our free Figma UI kits'` | Text for the compact (mobile) layout. Defaults to `title` when that is set. |
|
|
20
|
+
| `variant` | `'auto' \| 'compact'` | `'auto'` | `'auto'` wraps to fit and uses the compact layout on narrow containers; `'compact'` always does. |
|
|
21
|
+
| `class` | `string` | — | Extra CSS classes for the container. |
|
|
22
|
+
|
|
23
|
+
It throws at build time when `kits` is an empty array or a kit has an empty `label` or `href`.
|
|
24
|
+
|
|
25
|
+
`kits.ts` exports the `FigmaUiKit` type and `DEFAULT_FIGMA_UI_KITS`. Pass `kits` only to show a different set, for example a single kit on a theme-specific topic:
|
|
26
|
+
|
|
27
|
+
```astro
|
|
28
|
+
---
|
|
29
|
+
import FigmaUiKits from 'igniteui-astro-components/components/mdx/FigmaUiKits.astro';
|
|
30
|
+
import { DEFAULT_FIGMA_UI_KITS } from 'igniteui-astro-components/components/mdx/FigmaUiKits/kits';
|
|
31
|
+
|
|
32
|
+
const materialOnly = DEFAULT_FIGMA_UI_KITS.filter((kit) => kit.label === 'Material');
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
<FigmaUiKits kits={materialOnly} />
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Give every kit its own URL: several links with different names but the same destination fail WCAG 2.4.4 (link purpose).
|
|
39
|
+
|
|
40
|
+
## Layout
|
|
41
|
+
|
|
42
|
+
- **One row** when it fits: the Figma logo and title at the start, the links at the end.
|
|
43
|
+
- **Wrapped** when it doesn't: flexbox moves the whole link list to a second row. Nothing switches at a fixed width, so the banner adapts to the copy, the font and the language. For example, the English row needs about 744px, Japanese 737px and Korean 717px.
|
|
44
|
+
- **Compact** below 480px (a phone): the text changes to "Check it in our free Figma UI kits", the links stack under it, and the padding tightens. This is a container query on the banner, so it follows the width the banner is given, not the viewport. `variant="compact"` uses this layout at any width.
|
|
45
|
+
|
|
46
|
+
The outer `.igd-figma-kits` element is the query container and the inner `.igd-figma-kits__banner` is the visible frame, because a container can't restyle itself from its own query. The container has `inline-size: 100%` because size containment ignores its content's width, so it would otherwise collapse inside a shrink-to-fit parent.
|
|
47
|
+
|
|
48
|
+
## Examples
|
|
49
|
+
|
|
50
|
+
```mdx
|
|
51
|
+
{/* Default: the four kits */}
|
|
52
|
+
|
|
53
|
+
<FigmaUiKits />
|
|
54
|
+
|
|
55
|
+
{/* Always compact */}
|
|
56
|
+
|
|
57
|
+
<FigmaUiKits variant="compact" />
|
|
58
|
+
|
|
59
|
+
{/* Custom wording */}
|
|
60
|
+
|
|
61
|
+
<FigmaUiKits title="Start from a ready-made kit" />
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Localization
|
|
65
|
+
|
|
66
|
+
The default `title` and `compactTitle` and the hidden link text follow the site language. The language comes from the docs integration's `navLang` (from `virtual:docs-template/site-meta`), then `Astro.currentLocale`, then English. Kit names are product names and are not translated.
|
|
67
|
+
|
|
68
|
+
| Language | `title` | `compactTitle` | Kit link name read out |
|
|
69
|
+
| -------------- | -------------------------------------- | ---------------------------------- | ----------------------------------------------- |
|
|
70
|
+
| `en` (default) | Check it out in our free Figma UI kits | Check it in our free Figma UI kits | Material Figma UI kit (opens in a new tab) |
|
|
71
|
+
| `jp` / `ja` | 無料の Figma UI キットでチェック | Same as `title` | Material Figma UI キット (新しいタブで開きます) |
|
|
72
|
+
| `kr` / `ko` | 무료 Figma UI 키트에서 확인하세요 | Same as `title` | Material Figma UI 키트 (새 탭에서 열림) |
|
|
73
|
+
|
|
74
|
+
## Accessibility
|
|
75
|
+
|
|
76
|
+
- Every link opens in a new tab and says so in visually hidden text. Each link also names what it opens, so "Material Figma UI kit (opens in a new tab)" makes sense in a screen reader's links list. The external-link icon and the Figma logo are `aria-hidden`.
|
|
77
|
+
- The links are a real `<ul>` with `role="list"`, so assistive tech announces how many there are. The explicit role is needed because Safari drops list semantics from a list styled with `list-style: none`.
|
|
78
|
+
- The banner is a plain `<div>`, not an `<aside>` or `<nav>`. It repeats on every topic, and a landmark on every page would clutter the landmark list.
|
|
79
|
+
- Links meet the WCAG 2.2 target size and have a visible `:focus-visible` outline. They use the same colours as markdown links (`--igd-link-color`: 5.25:1 on the page and 4.77:1 on the banner in light mode, 12.5:1 or more in dark mode).
|
|
80
|
+
- In forced-colors mode the frame keeps a `CanvasText` border.
|
|
81
|
+
- The hidden-text class is a local copy of the standard sr-only pattern. Switch to the shared `.visually-hidden` once #177 is fixed.
|
|
82
|
+
|
|
83
|
+
## Icons
|
|
84
|
+
|
|
85
|
+
Both icons come from `src/assets/icons/` and are inlined at build time with `?raw` and `set:html`, so the banner needs no client JavaScript:
|
|
86
|
+
|
|
87
|
+
- `open-link-blank.svg` is the same external-link icon that markdown links use.
|
|
88
|
+
- `figma-logo.svg` draws the logo on its white tile, so the brand colours stay in the asset. It is listed under Brand in the icon gallery.
|
|
89
|
+
|
|
90
|
+
## Styling
|
|
91
|
+
|
|
92
|
+
The styles are unlayered, so they win over the `@layer components` markdown styles. Those style every `p`, `ul`, `li` and `a`, and add an icon after `a[target=_blank]`.
|
|
93
|
+
|
|
94
|
+
All values are `--igd-figma-kits-*` tokens on `:root` in `src/styles/global/_variables.scss`. Override them on an ancestor or through `class`:
|
|
95
|
+
|
|
96
|
+
| Token | Default |
|
|
97
|
+
| ---------------------------------------------------- | ------------------------------------------------------------------------- |
|
|
98
|
+
| `--igd-figma-kits-padding-block` / `-inline` | Regular padding; inline is `--igd-padding-sm` |
|
|
99
|
+
| `--igd-figma-kits-compact-padding-block` / `-inline` | Compact (phone) padding |
|
|
100
|
+
| `--igd-figma-kits-gap` | `--igd-padding-md`, between links and title ↔ links |
|
|
101
|
+
| `--igd-figma-kits-row-gap` | Gap between rows once the banner wraps |
|
|
102
|
+
| `--igd-figma-kits-item-gap` | Logo ↔ title and label ↔ icon |
|
|
103
|
+
| `--igd-figma-kits-margin-bottom` | Same as the other blocks (aside, FAQ, code) |
|
|
104
|
+
| `--igd-figma-kits-radius` | `--igd-border-radius` |
|
|
105
|
+
| `--igd-figma-kits-border-width` / `-style` | `--igd-app-outline-size` / `-style` |
|
|
106
|
+
| `--igd-figma-kits-logo-size` | Logo height |
|
|
107
|
+
| `--igd-figma-kits-target-size` | Minimum link height |
|
|
108
|
+
| `--igd-figma-kits-underline-offset` | Hover underline offset |
|
|
109
|
+
| `--igd-figma-kits-focus-width` / `-offset` | Focus outline |
|
|
110
|
+
| `--igd-figma-kits-link-weight` | Link font weight |
|
|
111
|
+
| `--igd-figma-kits-bg` / `-border-color` | `gray-100` / `gray-300` light, `gray-50` / `gray-200` dark |
|
|
112
|
+
| `--igd-figma-kits-title-color` | `gray-600` |
|
|
113
|
+
| `--igd-figma-kits-link-color` / `-link-hover-color` | `--igd-link-color` / `--igd-link-hover-color`, shared with markdown links |
|
|
114
|
+
|
|
115
|
+
The dark gray scale is inverted, so `gray-50` and `gray-200` are the dark counterparts of the light `gray-100` and `gray-300`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface FigmaUiKit {
|
|
2
|
+
/** Visible link text: the theme name, e.g. `Material`. */
|
|
3
|
+
label: string;
|
|
4
|
+
/** Absolute URL of that kit's Figma Community file. */
|
|
5
|
+
href: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** The Indigo.Design UI kits in the Figma Community, one per theme. */
|
|
9
|
+
export const DEFAULT_FIGMA_UI_KITS: FigmaUiKit[] = [
|
|
10
|
+
{
|
|
11
|
+
label: 'Material',
|
|
12
|
+
href: 'https://www.figma.com/community/file/1185626590778033159/indigo-design-ui-kit-for-material-1-6',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: 'Fluent',
|
|
16
|
+
href: 'https://www.figma.com/community/file/1462017953809232530/indigo-design-ui-kit-for-fluent-1-6',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: 'Bootstrap',
|
|
20
|
+
href: 'https://www.figma.com/community/file/1462018085772322451/indigo-design-ui-kit-for-bootstrap-1-6',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: 'Indigo',
|
|
24
|
+
href: 'https://www.figma.com/community/file/1462018383079963285/indigo-design-ui-kit-for-indigo-1-6',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
@@ -32,24 +32,11 @@ Valid platform names: `Angular`, `React`, `WebComponents`, `Blazor`
|
|
|
32
32
|
|
|
33
33
|
## Platform context
|
|
34
34
|
|
|
35
|
-
The active platform is
|
|
35
|
+
The active platform is `Astro.locals.platformContext.name`, set by the host site's middleware (see the root README, Quick start step 3). Names in `for` must match `platformContext.name` exactly (`Angular`, `React`, `WebComponents`, `Blazor`, `WinUI`, `Uno`). Without the middleware the render throws, because the component destructures the context.
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
createDocsSite({ platform: 'angular' });
|
|
39
|
-
// → only <PlatformBlock for="Angular"> blocks render
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Or in the environment directly:
|
|
43
|
-
|
|
44
|
-
```sh
|
|
45
|
-
PLATFORM=React astro build
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## MDX global registration
|
|
37
|
+
The xplat docs build additionally inlines and strips `<PlatformBlock>` at build time (a Vite plugin in that repo), so the component never reaches the browser there.
|
|
49
38
|
|
|
50
|
-
|
|
39
|
+
## Registering in MDX
|
|
51
40
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
export { default as PlatformBlock } from 'igniteui-astro-components/components/mdx/PlatformBlock.astro';
|
|
55
|
-
```
|
|
41
|
+
Nothing is registered automatically. Import the component at the top of each
|
|
42
|
+
MDX file, or pass it through the `components` map of a `<Content />` render.
|
|
@@ -10,25 +10,51 @@ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
13
|
-
| Prop | Type | Default
|
|
14
|
-
| ----------------- | -------------------------------- |
|
|
15
|
-
| `src` | `string` | _(required)_
|
|
16
|
-
| `height` | `number` | `150` (`50` if `fitContent`)
|
|
17
|
-
| `alt` | `string` | `''`
|
|
18
|
-
| `lob` | `boolean` | `false`
|
|
19
|
-
| `dv` | `boolean` | `false`
|
|
20
|
-
| `crm` | `boolean` | `false`
|
|
21
|
-
| `wc` | `boolean` | `false`
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
25
|
-
| `fitContent` | `boolean` | `false`
|
|
26
|
-
| `spacing` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'none'`
|
|
27
|
-
| `position` | `string` | —
|
|
28
|
-
| `resizable` | `boolean` | `false`
|
|
29
|
-
| `noBorder` | `boolean` | `true`
|
|
30
|
-
| `noBackground` | `boolean` | `true`
|
|
31
|
-
| `whiteBackground` | `boolean` | `false`
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| ----------------- | -------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| `src` | `string` | _(required)_ | Sample path relative to the demos base URL, e.g. `"/charts/data-chart/axis-crossing"`. |
|
|
16
|
+
| `height` | `number` | `150` (`50` if `fitContent`) | iframe height in pixels. With `fitContent` it is only the loading placeholder / cross-origin fallback. |
|
|
17
|
+
| `alt` | `string` | `''` | `title` attribute for the iframe (accessibility). |
|
|
18
|
+
| `lob` | `boolean` | `false` | Use `lobDemosBaseUrl` instead of `demosBaseUrl` (LOB/grid-dynamic demos). |
|
|
19
|
+
| `dv` | `boolean` | `false` | Force use of `dvDemosBaseUrl` (data-viz demos). Auto-detected for paths starting with `charts/`, `gauges/`, `maps/`, `excel/`. |
|
|
20
|
+
| `crm` | `boolean` | `false` | Use `crmDemoBaseUrl` (CRM demo samples). |
|
|
21
|
+
| `wc` | `boolean` | `false` | Load the sample from the Web Components samples browser (`wcDemosBaseUrl`) on every platform's docs, for demos the platforms share. Falls back to `demosBaseUrl`. Code tabs and live editing follow it. |
|
|
22
|
+
| `chrome` | `'widget' \| 'demo' \| 'bare'` | `'widget'` | What the widget draws around the demo. `widget`: the EXAMPLE and code tabs, and a footer with the live-edit and full-screen buttons. `demo`: the widget's frame without the tabs and the code viewer; the footer carries only the theme picker, and without one there is no footer. For demos whose code is not a usage example, e.g. ones that fake interaction states. `bare`: only the iframe, in a plain container. See [Chrome](#chrome). |
|
|
23
|
+
| `showThemePicker` | `boolean` | `false` | Add the in-sample theme picker to the footer. Its initial theme comes from the site, not from the usage. `widget` and `demo` only: `bare` has no footer to put it in. |
|
|
24
|
+
| `fullscreenBtn` | `boolean` | `false` | Render a "View in full screen" button below the iframe. `bare` only: the `widget` footer already has one, and `demo` leaves full screen out on purpose. |
|
|
25
|
+
| `fitContent` | `boolean` | `false` | Size the iframe to fit its content — the embedded page dictates the size. Same-origin demos are measured directly; cross-origin demos must report via `postMessage`. Demos with ink overflow (shadows, glows, focus rings) must reserve room for it in their own layout, since an iframe clips at its edge. |
|
|
26
|
+
| `spacing` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'none'` | Padding around the iframe inside the container: `none` = 0, `sm` = 8px, `md` = 16px, `lg` = 32px. Applied by the host container, never inside the embedded page. |
|
|
27
|
+
| `position` | `string` | — | Where the iframe sits inside the container when it doesn't fill it. Accepts a horizontal token (`start`, `center`, `end`) and/or a vertical token (`top`, `center`, `bottom`), space-separated in any order — e.g. `"center"`, `"start top"`, `"end bottom"`. |
|
|
28
|
+
| `resizable` | `boolean` | `false` | Show a drag handle on the right edge that resizes the iframe's width so responsive demos can be previewed at different widths. Left/right arrow keys resize it when focused. Combines with `fitContent`: the drag owns the width, the content keeps dictating the height. |
|
|
29
|
+
| `noBorder` | `boolean` | `true` | Drop the 1px border drawn around the iframe/container. Pass `noBorder={false}` to draw it — recommended whenever the tabs, the footer or the `fullscreenBtn` bar render. |
|
|
30
|
+
| `noBackground` | `boolean` | `true` (`false` with a theme picker) | Hide the grid-pattern backdrop drawn behind the iframe, keeping the container fully transparent. Pass `noBackground={false}` to show it. Defaults to `false` when a theme picker renders (`showThemePicker` with `widget` or `demo`), so a demo whose theme and mode the reader can switch has a surface of its own. An explicit value always wins. |
|
|
31
|
+
| `whiteBackground` | `boolean` | `false` | Paint the backdrop behind the iframe pure white (`#fff`) instead of the default light gray. Only the light side changes — dark mode (the site's, or the in-sample theming widget's) is left as is. Implies a painted background, so it also overrides the transparency `noBackground` leaves behind in light mode. |
|
|
32
|
+
| `iframeOnly` | `boolean` | `false` | **Deprecated**, removed in 2.0.0. Use `chrome="bare"`. See [Deprecated props](#deprecated-props). |
|
|
33
|
+
| `hideCode` | `boolean` | `false` | **Deprecated**, removed in 2.0.0. Use `chrome="demo"`. See [Deprecated props](#deprecated-props). |
|
|
34
|
+
|
|
35
|
+
## Chrome
|
|
36
|
+
|
|
37
|
+
`chrome` picks what surrounds the demo, and `showThemePicker` and `fullscreenBtn` add to it where they apply:
|
|
38
|
+
|
|
39
|
+
| `chrome` | Tabs and code | Footer | `showThemePicker` | `fullscreenBtn` |
|
|
40
|
+
| -------------------- | ------------- | -------------------------------------- | ----------------- | --------------- |
|
|
41
|
+
| `widget` _(default)_ | Yes | Live-edit and full-screen buttons | Yes | No |
|
|
42
|
+
| `demo` | No | Only the theme picker, if there is one | Yes | No |
|
|
43
|
+
| `bare` | No | None | No | Yes |
|
|
44
|
+
|
|
45
|
+
A modifier the chrome ignores, or a `chrome` value that is not one of the three, logs a build warning. The types only reject an unknown `chrome` value: they accept every modifier with every chrome, as MDX, where most samples live, is not type-checked anyway.
|
|
46
|
+
|
|
47
|
+
### Deprecated props
|
|
48
|
+
|
|
49
|
+
`iframeOnly` and `hideCode`, the 1.x spellings of `chrome="bare"` and `chrome="demo"`, still work, but they are deprecated and 2.0.0 removes them. Editors strike them through, and each sample that uses one logs a build warning, once per build, that names the replacement:
|
|
50
|
+
|
|
51
|
+
| Deprecated | Use instead |
|
|
52
|
+
| -------------------------- | ----------------------------- |
|
|
53
|
+
| `iframeOnly` | `chrome="bare"` |
|
|
54
|
+
| `iframeOnly fullscreenBtn` | `chrome="bare" fullscreenBtn` |
|
|
55
|
+
| `hideCode` | `chrome="demo"` |
|
|
56
|
+
|
|
57
|
+
As in 1.x, `iframeOnly` wins over `hideCode`. A valid `chrome` wins over both, and the warning says the deprecated prop is ignored. A `chrome` that is not one of the three is ignored itself, so the deprecated prop still applies.
|
|
32
58
|
|
|
33
59
|
## Examples
|
|
34
60
|
|
|
@@ -47,32 +73,33 @@ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
|
47
73
|
|
|
48
74
|
{/* Web Components sample shared by every platform's docs */}
|
|
49
75
|
|
|
50
|
-
<Sample src="/themes/palettes/scales" wc fitContent
|
|
76
|
+
<Sample src="/themes/palettes/scales" wc fitContent chrome="bare" />
|
|
51
77
|
|
|
52
78
|
{/* Bare iframe for embedding */}
|
|
53
79
|
|
|
54
|
-
<Sample src="/charts/bar-chart/overview"
|
|
80
|
+
<Sample src="/charts/bar-chart/overview" chrome="bare" height={300} />
|
|
55
81
|
|
|
56
82
|
{/* Bare iframe + fullscreen link */}
|
|
57
83
|
|
|
58
|
-
<Sample src="/charts/bar-chart/overview"
|
|
84
|
+
<Sample src="/charts/bar-chart/overview" chrome="bare" fullscreenBtn height={300} />
|
|
59
85
|
|
|
60
86
|
{/* Demo only, with the theme picker: no code tabs or live-edit buttons */}
|
|
61
87
|
|
|
62
|
-
<Sample src="/inputs/radio/interaction-state"
|
|
88
|
+
<Sample src="/inputs/radio/interaction-state" chrome="demo" showThemePicker height={400} />
|
|
63
89
|
```
|
|
64
90
|
|
|
65
91
|
## Environment configuration
|
|
66
92
|
|
|
67
|
-
The base URLs are
|
|
93
|
+
The base URLs are read from `Astro.locals.envVars`, a plain `Record<string, string>` that the host site's middleware must set (the docs sites load it from their `environment.json`; the root README's Quick start step 3 shows a minimal version). The platform (`Astro.locals.platformContext`) comes from the same middleware:
|
|
68
94
|
|
|
69
|
-
| Key
|
|
70
|
-
|
|
|
71
|
-
| `demosBaseUrl`
|
|
72
|
-
| `dvDemosBaseUrl`
|
|
73
|
-
| `lobDemosBaseUrl`
|
|
74
|
-
| `crmDemoBaseUrl`
|
|
75
|
-
| `wcDemosBaseUrl`
|
|
95
|
+
| Key | Used by |
|
|
96
|
+
| -------------------- | ------------------------------------------------------------------------------------ |
|
|
97
|
+
| `demosBaseUrl` | Default demos |
|
|
98
|
+
| `dvDemosBaseUrl` | Charts / gauges / maps / excel |
|
|
99
|
+
| `lobDemosBaseUrl` | LOB / grids |
|
|
100
|
+
| `crmDemoBaseUrl` | CRM demos |
|
|
101
|
+
| `wcDemosBaseUrl` | `wc` samples, on any platform |
|
|
102
|
+
| `defaultSampleTheme` | Starting theme of the code tabs and theme picker; falls back to the platform default |
|
|
76
103
|
|
|
77
104
|
Outside the Web Components site, a `wc` sample needs `wcDemosBaseUrl`: without it the sample falls back to `demosBaseUrl`, the page's own platform browser, and the build logs a warning. Leave unused keys out rather than setting them to `""`: an empty string doesn't fall back, it produces a relative URL.
|
|
78
105
|
|
|
@@ -80,26 +107,16 @@ Outside the Web Components site, a `wc` sample needs `wcDemosBaseUrl`: without i
|
|
|
80
107
|
|
|
81
108
|
Code tabs are syntax-highlighted client-side using [Shiki](https://shiki.style/) (lazy-loaded via dynamic import and pre-warmed at widget init). Supported languages: `typescript`, `tsx`, `javascript`, `html`, `css`, `scss`, `csharp`, `razor`.
|
|
82
109
|
|
|
83
|
-
The theme
|
|
84
|
-
|
|
85
|
-
```js
|
|
86
|
-
// astro.config.mjs
|
|
87
|
-
export default defineConfig({
|
|
88
|
-
vite: {
|
|
89
|
-
define: {
|
|
90
|
-
__IGD_SAMPLE_CODE_THEME__: JSON.stringify('github-dark'),
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Any [Shiki bundled theme](https://shiki.style/themes) name is accepted. If the define is absent the default `dark-plus` is used.
|
|
110
|
+
The tabs use the package's brand code theme (`igCodeTheme`, the same one `createDocsSite()` applies to fenced blocks), so a code tab and a fenced block look identical. See [`src/code-theme/README.md`](../../../code-theme/README.md).
|
|
97
111
|
|
|
98
|
-
|
|
112
|
+
## Registering in MDX
|
|
99
113
|
|
|
100
|
-
|
|
114
|
+
Nothing is registered automatically. Either import the component at the top of
|
|
115
|
+
each MDX file (the convention in the docs repos):
|
|
101
116
|
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
export { default as Sample } from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
117
|
+
```mdx
|
|
118
|
+
import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
105
119
|
```
|
|
120
|
+
|
|
121
|
+
or pass it through the `components` map of a `<Content />` render when the MDX
|
|
122
|
+
is authored without imports (CMS content, for example).
|