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
|
@@ -144,76 +144,78 @@ const modeLabels: Record<ThemeMode, string> = {
|
|
|
144
144
|
name="chevron"
|
|
145
145
|
collection="theming-widget"
|
|
146
146
|
class="igd-theming__toggle-icon igd-theming__toggle-icon--collapsed"
|
|
147
|
-
aria-hidden="true"
|
|
147
|
+
aria-hidden="true"
|
|
148
|
+
></igc-icon>
|
|
148
149
|
<igc-icon
|
|
149
150
|
slot="toggle-icon-expanded"
|
|
150
151
|
name="chevron"
|
|
151
152
|
collection="theming-widget"
|
|
152
153
|
class="igd-theming__toggle-icon"
|
|
153
|
-
aria-hidden="true"
|
|
154
|
+
aria-hidden="true"
|
|
155
|
+
></igc-icon>
|
|
154
156
|
<span slot="prefix" class="igd-theming__swatch" data-swatch>
|
|
155
|
-
{active?.swatch.map((c) =>
|
|
157
|
+
{active?.swatch.map((c) => (
|
|
158
|
+
<span class="igd-theming__dot" style={`--dot: ${c}`} />
|
|
159
|
+
))}
|
|
156
160
|
</span>
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
161
|
+
{showMode && (
|
|
162
|
+
<igc-select-header slot="header" class="igd-theming__mode-row">
|
|
163
|
+
<span class="igd-theming__section-label">Mode</span>
|
|
164
|
+
<div class="igd-theming__mode-buttons" role="group" aria-label="Color mode">
|
|
165
|
+
{MODES.map((m) => (
|
|
166
|
+
<igc-icon-button
|
|
167
|
+
variant="flat"
|
|
168
|
+
name={m === 'light' ? 'sun' : 'moon'}
|
|
169
|
+
collection="theming-widget"
|
|
170
|
+
class="igd-theming__mode-btn"
|
|
171
|
+
id={modeButtonId(m)}
|
|
172
|
+
data-mode-btn={m}
|
|
173
|
+
aria-pressed={m === mode ? 'true' : 'false'}
|
|
174
|
+
aria-label={modeLabels[m]}
|
|
175
|
+
/>
|
|
176
|
+
))}
|
|
177
|
+
</div>
|
|
178
|
+
</igc-select-header>
|
|
179
|
+
)}
|
|
180
|
+
{themes.map((t) => {
|
|
181
|
+
const name = t.label ?? titleCase(t.name);
|
|
182
|
+
return (
|
|
183
|
+
<igc-select-item
|
|
184
|
+
class="igd-theming__option"
|
|
185
|
+
value={t.name}
|
|
186
|
+
data-option={t.name}
|
|
187
|
+
data-label={name}
|
|
188
|
+
data-swatch={t.swatch.join(',')}
|
|
189
|
+
>
|
|
190
|
+
<span slot="prefix" class="igd-theming__swatch">
|
|
191
|
+
{t.swatch.map((c) => (
|
|
192
|
+
<span class="igd-theming__dot" style={`--dot: ${c}`} />
|
|
173
193
|
))}
|
|
174
|
-
</
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const name = t.label ?? titleCase(t.name);
|
|
181
|
-
return (
|
|
182
|
-
<igc-select-item
|
|
183
|
-
class="igd-theming__option"
|
|
184
|
-
value={t.name}
|
|
185
|
-
data-option={t.name}
|
|
186
|
-
data-label={name}
|
|
187
|
-
data-swatch={t.swatch.join(',')}
|
|
188
|
-
>
|
|
189
|
-
<span slot="prefix" class="igd-theming__swatch">
|
|
190
|
-
{t.swatch.map((c) => (
|
|
191
|
-
<span class="igd-theming__dot" style={`--dot: ${c}`} />
|
|
192
|
-
))}
|
|
193
|
-
</span>
|
|
194
|
-
<span class="igd-theming__option-name">{name}</span>
|
|
195
|
-
<igc-icon slot="suffix" name="check" collection="theming-widget" aria-hidden="true" />
|
|
196
|
-
</igc-select-item>
|
|
197
|
-
);
|
|
198
|
-
})
|
|
199
|
-
}
|
|
194
|
+
</span>
|
|
195
|
+
<span class="igd-theming__option-name">{name}</span>
|
|
196
|
+
<igc-icon slot="suffix" name="check" collection="theming-widget" aria-hidden="true" />
|
|
197
|
+
</igc-select-item>
|
|
198
|
+
);
|
|
199
|
+
})}
|
|
200
200
|
</igc-select>
|
|
201
|
-
{
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
))
|
|
213
|
-
}
|
|
201
|
+
{showMode &&
|
|
202
|
+
MODES.map((m) => (
|
|
203
|
+
<igc-tooltip
|
|
204
|
+
anchor={modeButtonId(m)}
|
|
205
|
+
class="igd-theming__mode-tooltip"
|
|
206
|
+
placement="bottom"
|
|
207
|
+
with-arrow
|
|
208
|
+
>
|
|
209
|
+
{modeLabels[m]}
|
|
210
|
+
</igc-tooltip>
|
|
211
|
+
))}
|
|
214
212
|
<span class="igd-theming__selected-value" aria-hidden="true">
|
|
215
|
-
<span class="igd-theming__selected-theme" data-selected-theme>
|
|
216
|
-
|
|
213
|
+
<span class="igd-theming__selected-theme" data-selected-theme>
|
|
214
|
+
{activeLabel}
|
|
215
|
+
</span>
|
|
216
|
+
<span class="igd-theming__selected-mode" data-selected-mode>
|
|
217
|
+
{modeLabels[mode]}
|
|
218
|
+
</span>
|
|
217
219
|
</span>
|
|
218
220
|
</div>
|
|
219
221
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// because the image's max-width is 100% of the content box (inside the padding)
|
|
7
7
|
// and there is no negative margin to break out of it.
|
|
8
8
|
.igd-anatomy {
|
|
9
|
-
//
|
|
9
|
+
// Declared here, so overrides target .igd-anatomy: .igd-anatomy { --igd-anatomy-padding: 32px; }
|
|
10
10
|
--igd-anatomy-padding: #{rem(60px)} #{rem(24px)};
|
|
11
11
|
--igd-anatomy-bg: light-dark(
|
|
12
12
|
#{color($color: gray, $variant: 100, $opacity: 0.8)},
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Anatomy
|
|
2
|
+
|
|
3
|
+
Framed, padded container for a component anatomy diagram. Use it in MDX pages
|
|
4
|
+
where a labelled screenshot explains the parts of a component.
|
|
5
|
+
|
|
6
|
+
## Import
|
|
7
|
+
|
|
8
|
+
```astro
|
|
9
|
+
import Anatomy from 'igniteui-astro-components/components/mdx/Anatomy.astro';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Props
|
|
13
|
+
|
|
14
|
+
| Prop | Type | Default | Description |
|
|
15
|
+
| ------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------ |
|
|
16
|
+
| `src` | `string` | _(required)_ | Image URL. |
|
|
17
|
+
| `alt` | `string` | _(required)_ | Accessible description, forwarded to the `<img>`. Describe the parts the diagram labels, not the name. |
|
|
18
|
+
| `class` | `string` | — | Extra class(es) on the frame. |
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
```mdx
|
|
23
|
+
import Anatomy from 'igniteui-astro-components/components/mdx/Anatomy.astro';
|
|
24
|
+
|
|
25
|
+
<Anatomy
|
|
26
|
+
src="/images/button-anatomy.png"
|
|
27
|
+
alt="Button anatomy: label text, optional prefix icon, optional suffix icon"
|
|
28
|
+
/>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Styling
|
|
32
|
+
|
|
33
|
+
Tokens are declared on `.igd-anatomy` itself, so a value set on `:root` or another ancestor is overridden. Retune them on `.igd-anatomy` (or a more specific selector):
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
--igd-anatomy-padding (60px 24px)
|
|
37
|
+
--igd-anatomy-bg light-dark() surface
|
|
38
|
+
--igd-anatomy-border-color light-dark(gray-300, surface-700)
|
|
39
|
+
--igd-anatomy-radius (4px)
|
|
40
|
+
```
|
|
@@ -169,12 +169,10 @@ if (Astro.props.kind === 'sass') {
|
|
|
169
169
|
}
|
|
170
170
|
---
|
|
171
171
|
|
|
172
|
-
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
)
|
|
180
|
-
}
|
|
172
|
+
{renderLink ? (
|
|
173
|
+
<a href={url}>{renderCode ? <code>{displayLabel}</code> : displayLabel}</a>
|
|
174
|
+
) : renderCode ? (
|
|
175
|
+
<code>{displayLabel}</code>
|
|
176
|
+
) : (
|
|
177
|
+
displayLabel
|
|
178
|
+
)}
|
|
@@ -43,6 +43,7 @@ the index is unavailable, `ApiLink` renders code text and does not guess a URL.
|
|
|
43
43
|
| `kind` | `'class' \| 'interface' \| 'enum' \| 'type' \| 'variable' \| 'function'` | auto | Optional narrowing. Usually unnecessary when the index is available. |
|
|
44
44
|
| `prefixed` | `boolean` | `true` | Candidate-name override for symbols that are never platform-prefixed. Avoid for new docs when the index can resolve the symbol. |
|
|
45
45
|
| `suffix` | `boolean` | `true` | Candidate-name override for symbols that never use the platform class suffix. Avoid for new docs when the index can resolve the symbol. |
|
|
46
|
+
| `raw` | `boolean` | `false` | Marks a deliberately authored raw link in strict xplat documentation, so tooling does not flag it. |
|
|
46
47
|
|
|
47
48
|
Platform names use `PlatformContext.name`: `Angular`, `React`,
|
|
48
49
|
`WebComponents`, or `Blazor`.
|
|
@@ -83,13 +83,11 @@ const items = types.map((t) => {
|
|
|
83
83
|
---
|
|
84
84
|
|
|
85
85
|
<ul>
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
<
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
))
|
|
94
|
-
}
|
|
86
|
+
{items.map(({ label, url }) => (
|
|
87
|
+
<li>
|
|
88
|
+
<a href={url}>
|
|
89
|
+
<code>{label}</code>
|
|
90
|
+
</a>
|
|
91
|
+
</li>
|
|
92
|
+
))}
|
|
95
93
|
</ul>
|
|
@@ -44,7 +44,7 @@ import ApiRef from 'igniteui-astro-components/components/mdx/ApiRef.astro';
|
|
|
44
44
|
|
|
45
45
|
## Platform context
|
|
46
46
|
|
|
47
|
-
Same as `ApiLink` —
|
|
47
|
+
Same as `ApiLink` — read from `Astro.locals.platformContext` (`PlatformContext` from `igniteui-astro-components/lib/types`), which the host site's middleware must set. Without it the render throws, because the component destructures the context.
|
|
48
48
|
|
|
49
49
|
When a page mixes types from different packages or different kinds, use separate `<ApiRef>` blocks:
|
|
50
50
|
|
|
@@ -31,9 +31,7 @@ import Badge from 'igniteui-astro-components/components/mdx/Badge.astro';
|
|
|
31
31
|
<Badge variant="premium" />
|
|
32
32
|
<Badge variant="opensource" />
|
|
33
33
|
|
|
34
|
-
{/* Inside a heading */}
|
|
35
|
-
|
|
36
|
-
## My Feature <Badge variant="new" />
|
|
34
|
+
{/* Inside a heading: `### My Feature <Badge variant="new" />` */}
|
|
37
35
|
|
|
38
36
|
{/* Custom slot content */}
|
|
39
37
|
|
|
@@ -29,11 +29,9 @@ const resolvedIcon = icon !== undefined ? icon : defaultIcons[type];
|
|
|
29
29
|
---
|
|
30
30
|
|
|
31
31
|
<div class:list={['igd-aside', `igd-aside--${type}`, className]} aria-label={label} role="note">
|
|
32
|
-
{
|
|
33
|
-
resolvedIcon
|
|
34
|
-
|
|
35
|
-
)
|
|
36
|
-
}
|
|
32
|
+
{resolvedIcon && (
|
|
33
|
+
<igc-icon class="igd-aside__icon" name={resolvedIcon} collection="docs" aria-hidden="true" />
|
|
34
|
+
)}
|
|
37
35
|
|
|
38
36
|
<span class="igd-aside__title" aria-hidden="true">
|
|
39
37
|
{label}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DocsAside
|
|
2
2
|
|
|
3
|
-
Renders a styled callout block (note,
|
|
3
|
+
Renders a styled callout block (note, info or warning) with a type-specific icon, colour accent and accessible label. Use it in MDX pages to surface important information inline.
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
@@ -10,13 +10,15 @@ import DocsAside from 'igniteui-astro-components/components/mdx/DocsAside.astro'
|
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
13
|
-
| Prop | Type
|
|
14
|
-
| ------- |
|
|
15
|
-
| `type` | `'note' \| '
|
|
16
|
-
| `title` | `string`
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| ------- | ------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| `type` | `'note' \| 'info' \| 'warning'` | `'note'` | Semantic variant — controls the colour accent, the default title and the default icon. |
|
|
16
|
+
| `title` | `string` | auto | Override the heading text. Defaults to `Note`, `Info` or `Warning`. |
|
|
17
|
+
| `icon` | `string` | auto | Name of an icon registered in the `docs` collection (`src/scripts/icon-manifest.ts`). Pass `""` to hide the icon. |
|
|
18
|
+
| `class` | `string` | — | Additional CSS class(es) added to the container. |
|
|
19
|
+
|
|
20
|
+
The component also declares a `color` prop, but nothing reads it (issue #162); use the CSS
|
|
21
|
+
custom properties below to change the accent instead.
|
|
20
22
|
|
|
21
23
|
## Examples
|
|
22
24
|
|
|
@@ -25,9 +27,9 @@ import DocsAside from 'igniteui-astro-components/components/mdx/DocsAside.astro'
|
|
|
25
27
|
|
|
26
28
|
<DocsAside>This is a general note.</DocsAside>
|
|
27
29
|
|
|
28
|
-
{/*
|
|
30
|
+
{/* Info */}
|
|
29
31
|
|
|
30
|
-
<DocsAside type="
|
|
32
|
+
<DocsAside type="info">The grid virtualises rows by default.</DocsAside>
|
|
31
33
|
|
|
32
34
|
{/* Warning with custom title */}
|
|
33
35
|
|
|
@@ -35,32 +37,48 @@ import DocsAside from 'igniteui-astro-components/components/mdx/DocsAside.astro'
|
|
|
35
37
|
The `foo` prop was removed in v2. Use `bar` instead.
|
|
36
38
|
</DocsAside>
|
|
37
39
|
|
|
38
|
-
{/*
|
|
40
|
+
{/* No icon */}
|
|
39
41
|
|
|
40
|
-
<DocsAside type="
|
|
42
|
+
<DocsAside type="info" icon="">
|
|
43
|
+
This callout has no icon.
|
|
44
|
+
</DocsAside>
|
|
45
|
+
```
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
## Variants
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
| `type` | Accent | Default title |
|
|
50
|
+
| --------- | ----------------- | ------------- |
|
|
51
|
+
| `note` | Gray | Note |
|
|
52
|
+
| `info` | Primary (blue) | Info |
|
|
53
|
+
| `warning` | Secondary (amber) | Warning |
|
|
47
54
|
|
|
48
|
-
|
|
55
|
+
## Markup
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
```html
|
|
58
|
+
<div class="igd-aside igd-aside--info" role="note" aria-label="Info">
|
|
59
|
+
<igc-icon class="igd-aside__icon" name="info" collection="docs" aria-hidden="true"></igc-icon>
|
|
60
|
+
<span class="igd-aside__title" aria-hidden="true">Info</span>
|
|
61
|
+
<div class="igd-aside__content">…</div>
|
|
62
|
+
</div>
|
|
53
63
|
```
|
|
54
64
|
|
|
55
|
-
##
|
|
65
|
+
## Styling
|
|
66
|
+
|
|
67
|
+
Layout tokens, defined on `:root` in `src/styles/global/_variables.scss`:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
--igd-aside-padding --igd-aside-row-gap --igd-aside-column-gap
|
|
71
|
+
--igd-aside-border-width --igd-aside-border-style --igd-aside-border-radius
|
|
72
|
+
--igd-aside-margin-bottom
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Per-variant colour tokens, one set each for `note`, `info` and `warning`:
|
|
56
76
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
| `warning` | Amber | Warning |
|
|
62
|
-
| `danger` | Red | Danger |
|
|
77
|
+
```
|
|
78
|
+
--igd-aside-{type}-bg --igd-aside-{type}-border --igd-aside-{type}-title
|
|
79
|
+
--igd-aside-{type}-content --igd-aside-{type}-icon
|
|
80
|
+
```
|
|
63
81
|
|
|
64
|
-
|
|
82
|
+
`--igd-aside-{type}-code-background` is declared in `_variables.scss` but no stylesheet reads it yet.
|
|
65
83
|
|
|
66
|
-
|
|
84
|
+
Each colour token uses `light-dark()` so it follows the page's `data-theme`.
|
|
@@ -62,19 +62,17 @@ const { items, singleExpand = false, indicatorPosition, class: className, ...res
|
|
|
62
62
|
single-expand={singleExpand ? '' : undefined}
|
|
63
63
|
{...rest}
|
|
64
64
|
>
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
))
|
|
77
|
-
}
|
|
65
|
+
{items?.map((item) => (
|
|
66
|
+
<FaqItem
|
|
67
|
+
question={item.question}
|
|
68
|
+
subtitle={item.subtitle}
|
|
69
|
+
answer={item.answer}
|
|
70
|
+
open={item.open}
|
|
71
|
+
disabled={item.disabled}
|
|
72
|
+
indicatorPosition={item.indicatorPosition ?? indicatorPosition}
|
|
73
|
+
id={item.id}
|
|
74
|
+
/>
|
|
75
|
+
))}
|
|
78
76
|
<slot />
|
|
79
77
|
</igc-accordion>
|
|
80
78
|
|
|
@@ -69,38 +69,32 @@ const {
|
|
|
69
69
|
indicator-position={indicatorPosition ?? 'end'}
|
|
70
70
|
{...rest}
|
|
71
71
|
>
|
|
72
|
-
<span slot="title" class="igd-faq__question">
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
72
|
+
<span slot="title" class="igd-faq__question">
|
|
73
|
+
{question}
|
|
74
|
+
</span>
|
|
75
|
+
{subtitle && (
|
|
76
|
+
<span slot="subtitle" class="igd-faq__subtitle">
|
|
77
|
+
{subtitle}
|
|
78
|
+
</span>
|
|
79
|
+
)}
|
|
80
80
|
|
|
81
|
-
{
|
|
82
|
-
/*
|
|
81
|
+
{/*
|
|
83
82
|
Forward the panel's indicator slots so callers can swap the chevron.
|
|
84
83
|
The wrapper is required: `slot=` on an Astro <slot> only forwards to another
|
|
85
84
|
Astro component, not to a custom element's light DOM. It is rendered only
|
|
86
85
|
when content was passed — an empty wrapper would count as assigned content
|
|
87
86
|
and suppress the panel's default indicator.
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<div slot="indicator-expanded" class="igd-faq__indicator">
|
|
100
|
-
<slot name="indicator-expanded" />
|
|
101
|
-
</div>
|
|
102
|
-
)
|
|
103
|
-
}
|
|
87
|
+
*/}
|
|
88
|
+
{Astro.slots.has('indicator') && (
|
|
89
|
+
<div slot="indicator" class="igd-faq__indicator">
|
|
90
|
+
<slot name="indicator" />
|
|
91
|
+
</div>
|
|
92
|
+
)}
|
|
93
|
+
{Astro.slots.has('indicator-expanded') && (
|
|
94
|
+
<div slot="indicator-expanded" class="igd-faq__indicator">
|
|
95
|
+
<slot name="indicator-expanded" />
|
|
96
|
+
</div>
|
|
97
|
+
)}
|
|
104
98
|
|
|
105
99
|
{/* Slot content wins; `answer` is the fallback the data-driven API renders. */}
|
|
106
100
|
<div class="igd-faq__answer">
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
/** "Check it out in our free Figma UI kits" banner that links a topic to the Ignite UI kits in Figma. */
|
|
3
|
+
import { navLang } from 'virtual:docs-template/site-meta';
|
|
4
|
+
import figmaLogo from '../../../assets/icons/figma-logo.svg?raw';
|
|
5
|
+
import openLinkIcon from '../../../assets/icons/open-link-blank.svg?raw';
|
|
6
|
+
import { DEFAULT_FIGMA_UI_KITS, type FigmaUiKit } from './kits';
|
|
7
|
+
import './FigmaUiKits.scss';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
/**
|
|
11
|
+
* One link per kit, in display order.
|
|
12
|
+
* @default the Material, Fluent, Bootstrap and Indigo kits (`DEFAULT_FIGMA_UI_KITS`)
|
|
13
|
+
*/
|
|
14
|
+
kits?: FigmaUiKit[];
|
|
15
|
+
/**
|
|
16
|
+
* Text before the links.
|
|
17
|
+
* @default 'Check it out in our free Figma UI kits' (localized for jp / kr)
|
|
18
|
+
*/
|
|
19
|
+
title?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Text for the compact (mobile) layout. Defaults to `title` when that is set.
|
|
22
|
+
* @default 'Check it in our free Figma UI kits' (jp / kr: same as `title`)
|
|
23
|
+
*/
|
|
24
|
+
compactTitle?: string;
|
|
25
|
+
/**
|
|
26
|
+
* `'auto'` wraps to fit and uses the compact layout below 480px; `'compact'` always does.
|
|
27
|
+
* @default 'auto'
|
|
28
|
+
*/
|
|
29
|
+
variant?: 'auto' | 'compact';
|
|
30
|
+
/** Extra class(es) for the container. */
|
|
31
|
+
class?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface Text {
|
|
35
|
+
title: string;
|
|
36
|
+
compactTitle: string;
|
|
37
|
+
kit: string;
|
|
38
|
+
newTab: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const JAPANESE: Text = {
|
|
42
|
+
title: '無料の Figma UI キットでチェック',
|
|
43
|
+
compactTitle: '無料の Figma UI キットでチェック',
|
|
44
|
+
kit: 'Figma UI キット',
|
|
45
|
+
newTab: '(新しいタブで開きます)',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const KOREAN: Text = {
|
|
49
|
+
title: '무료 Figma UI 키트에서 확인하세요',
|
|
50
|
+
compactTitle: '무료 Figma UI 키트에서 확인하세요',
|
|
51
|
+
kit: 'Figma UI 키트',
|
|
52
|
+
newTab: '(새 탭에서 열림)',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Default copy per site language; unknown languages use English.
|
|
56
|
+
const DEFAULT_TEXT: Record<string, Text> = {
|
|
57
|
+
en: {
|
|
58
|
+
title: 'Check it out in our free Figma UI kits',
|
|
59
|
+
compactTitle: 'Check it in our free Figma UI kits',
|
|
60
|
+
kit: 'Figma UI kit',
|
|
61
|
+
newTab: '(opens in a new tab)',
|
|
62
|
+
},
|
|
63
|
+
jp: JAPANESE,
|
|
64
|
+
ja: JAPANESE,
|
|
65
|
+
kr: KOREAN,
|
|
66
|
+
ko: KOREAN,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const lang = (navLang ?? Astro.currentLocale ?? 'en').toLowerCase();
|
|
70
|
+
const defaults = DEFAULT_TEXT[lang] ?? DEFAULT_TEXT.en;
|
|
71
|
+
|
|
72
|
+
const {
|
|
73
|
+
kits = DEFAULT_FIGMA_UI_KITS,
|
|
74
|
+
title = defaults.title,
|
|
75
|
+
variant = 'auto',
|
|
76
|
+
class: className,
|
|
77
|
+
} = Astro.props;
|
|
78
|
+
const compactTitle =
|
|
79
|
+
Astro.props.compactTitle ?? (Astro.props.title === undefined ? defaults.compactTitle : title);
|
|
80
|
+
|
|
81
|
+
if (kits.length === 0) {
|
|
82
|
+
throw new Error('<FigmaUiKits> requires at least one kit.');
|
|
83
|
+
}
|
|
84
|
+
for (const kit of kits) {
|
|
85
|
+
if (!kit.label?.trim() || !kit.href?.trim()) {
|
|
86
|
+
throw new Error('<FigmaUiKits> requires every kit to have a non-empty `label` and `href`.');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
<div class:list={['igd-figma-kits', className]} data-variant={variant}>
|
|
92
|
+
<div class="igd-figma-kits__banner">
|
|
93
|
+
<p class="igd-figma-kits__heading">
|
|
94
|
+
<span class="igd-figma-kits__logo" aria-hidden="true" set:html={figmaLogo} />
|
|
95
|
+
<span class="igd-figma-kits__text">
|
|
96
|
+
{/* Both texts render when they differ; CSS shows one per layout. */}
|
|
97
|
+
<span class="igd-figma-kits__title">
|
|
98
|
+
{compactTitle === title ? (
|
|
99
|
+
title
|
|
100
|
+
) : (
|
|
101
|
+
<>
|
|
102
|
+
<span class="igd-figma-kits__title-full">{title}</span>
|
|
103
|
+
<span class="igd-figma-kits__title-compact">{compactTitle}</span>
|
|
104
|
+
</>
|
|
105
|
+
)}
|
|
106
|
+
</span>
|
|
107
|
+
</span>
|
|
108
|
+
</p>
|
|
109
|
+
|
|
110
|
+
{/* role="list" keeps the list announced in Safari VoiceOver. */}
|
|
111
|
+
<ul class="igd-figma-kits__list" role="list">
|
|
112
|
+
{kits.map((kit) => (
|
|
113
|
+
<li class="igd-figma-kits__item">
|
|
114
|
+
<a class="igd-figma-kits__link" href={kit.href} target="_blank" rel="noopener noreferrer">
|
|
115
|
+
{kit.label}
|
|
116
|
+
<span class="igd-figma-kits__sr-only">
|
|
117
|
+
{' '}
|
|
118
|
+
{defaults.kit} {defaults.newTab}
|
|
119
|
+
</span>
|
|
120
|
+
<span class="igd-figma-kits__icon" aria-hidden="true" set:html={openLinkIcon} />
|
|
121
|
+
</a>
|
|
122
|
+
</li>
|
|
123
|
+
))}
|
|
124
|
+
</ul>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|