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.
Files changed (64) hide show
  1. package/README.md +322 -158
  2. package/llms-full.txt +3207 -0
  3. package/llms.txt +103 -0
  4. package/package.json +17 -5
  5. package/src/assets/icons/figma-logo.svg +10 -0
  6. package/src/code-theme/README.md +72 -0
  7. package/src/code-theme/index.ts +57 -0
  8. package/src/components/CopyCode/CopyCode.astro +6 -1
  9. package/src/components/CopyCode/README.md +38 -0
  10. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +28 -30
  11. package/src/components/DocsSidebar/DocsSidebar.astro +14 -2
  12. package/src/components/DocsSidebar/README.md +58 -30
  13. package/src/components/DocsSidebar/SidebarLabel.astro +34 -36
  14. package/src/components/DocsSidebar/sidebar-filter.ts +53 -5
  15. package/src/components/DocsSidebar/toTreeNodes.ts +21 -5
  16. package/src/components/DocsSubHeader/DocsSubHeader.astro +22 -9
  17. package/src/components/DocsSubHeader/README.md +37 -31
  18. package/src/components/DocsToc/DocsToc.astro +12 -14
  19. package/src/components/DocsToc/README.md +7 -7
  20. package/src/components/DocsTree/DocsTree.astro +9 -11
  21. package/src/components/DocsTree/DocsTreeItem.astro +36 -40
  22. package/src/components/DocsTree/README.md +12 -9
  23. package/src/components/GlobalFooter/GlobalFooter.astro +6 -8
  24. package/src/components/GlobalNavBar/GlobalNavBar.astro +2 -4
  25. package/src/components/LicenseIndicator/LicenseIndicator.astro +6 -8
  26. package/src/components/MobileTocToggle/MobileTocToggle.astro +31 -33
  27. package/src/components/MobileTocToggle/README.md +45 -0
  28. package/src/components/Search/README.md +10 -10
  29. package/src/components/Search/Search.astro +12 -6
  30. package/src/components/SearchAdvanced/README.md +15 -8
  31. package/src/components/SearchAdvanced/SearchAdvanced.astro +17 -15
  32. package/src/components/ThemingWidget/ThemingWidget.astro +62 -60
  33. package/src/components/mdx/Anatomy/Anatomy.scss +1 -1
  34. package/src/components/mdx/Anatomy/README.md +40 -0
  35. package/src/components/mdx/ApiLink/ApiLink.astro +7 -9
  36. package/src/components/mdx/ApiLink/README.md +1 -0
  37. package/src/components/mdx/ApiRef/ApiRef.astro +7 -9
  38. package/src/components/mdx/ApiRef/README.md +1 -1
  39. package/src/components/mdx/Badge/Badge.astro +3 -1
  40. package/src/components/mdx/Badge/README.md +1 -3
  41. package/src/components/mdx/DocsAside/DocsAside.astro +3 -5
  42. package/src/components/mdx/DocsAside/README.md +47 -29
  43. package/src/components/mdx/Faq/Faq.astro +11 -13
  44. package/src/components/mdx/Faq/FaqItem.astro +20 -26
  45. package/src/components/mdx/FigmaUiKits/FigmaUiKits.astro +126 -0
  46. package/src/components/mdx/FigmaUiKits/FigmaUiKits.scss +165 -0
  47. package/src/components/mdx/FigmaUiKits/README.md +115 -0
  48. package/src/components/mdx/FigmaUiKits/kits.ts +26 -0
  49. package/src/components/mdx/PlatformBlock/README.md +5 -18
  50. package/src/components/mdx/Sample/README.md +67 -50
  51. package/src/components/mdx/Sample/Sample.astro +108 -33
  52. package/src/components/mdx/Sample/Sample.scss +38 -17
  53. package/src/integration.ts +6 -21
  54. package/src/layouts/DocsLayout/README.md +63 -28
  55. package/src/lib/warn-once.ts +8 -0
  56. package/src/scripts/copy-status.ts +35 -0
  57. package/src/scripts/icon-manifest.ts +1 -0
  58. package/src/scripts/sample-widget.ts +109 -42
  59. package/src/styles/global/_code-blocks.scss +58 -36
  60. package/src/styles/global/_copy-button.scss +18 -25
  61. package/src/styles/global/_markdown.scss +15 -8
  62. package/src/styles/global/_variables.scss +57 -0
  63. package/src/styles/theme.scss +4 -1
  64. 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"></igc-icon>
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"></igc-icon>
154
+ aria-hidden="true"
155
+ ></igc-icon>
154
156
  <span slot="prefix" class="igd-theming__swatch" data-swatch>
155
- {active?.swatch.map((c) => <span class="igd-theming__dot" style={`--dot: ${c}`} />)}
157
+ {active?.swatch.map((c) => (
158
+ <span class="igd-theming__dot" style={`--dot: ${c}`} />
159
+ ))}
156
160
  </span>
157
- {
158
- showMode && (
159
- <igc-select-header slot="header" class="igd-theming__mode-row">
160
- <span class="igd-theming__section-label">Mode</span>
161
- <div class="igd-theming__mode-buttons" role="group" aria-label="Color mode">
162
- {MODES.map((m) => (
163
- <igc-icon-button
164
- variant="flat"
165
- name={m === 'light' ? 'sun' : 'moon'}
166
- collection="theming-widget"
167
- class="igd-theming__mode-btn"
168
- id={modeButtonId(m)}
169
- data-mode-btn={m}
170
- aria-pressed={m === mode ? 'true' : 'false'}
171
- aria-label={modeLabels[m]}
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
- </div>
175
- </igc-select-header>
176
- )
177
- }
178
- {
179
- themes.map((t) => {
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
- showMode &&
203
- MODES.map((m) => (
204
- <igc-tooltip
205
- anchor={modeButtonId(m)}
206
- class="igd-theming__mode-tooltip"
207
- placement="bottom"
208
- with-arrow
209
- >
210
- {modeLabels[m]}
211
- </igc-tooltip>
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>{activeLabel}</span>
216
- <span class="igd-theming__selected-mode" data-selected-mode>{modeLabels[mode]}</span>
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
- // Retunable from any ancestor, e.g. :root { --igd-anatomy-padding: 32px; }
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
- renderLink ? (
174
- <a href={url}>{renderCode ? <code>{displayLabel}</code> : displayLabel}</a>
175
- ) : renderCode ? (
176
- <code>{displayLabel}</code>
177
- ) : (
178
- displayLabel
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
- items.map(({ label, url }) => (
88
- <li>
89
- <a href={url}>
90
- <code>{label}</code>
91
- </a>
92
- </li>
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` — resolved from the `Platform` env var via `getPlatformContext()`.
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
 
@@ -21,7 +21,9 @@ const defaultText =
21
21
  ---
22
22
 
23
23
  <igc-badge class:list={['igd-badge', variant, className]} {...rest}>
24
- <slot><span>{defaultText}</span></slot>
24
+ <slot>
25
+ <span>{defaultText}</span>
26
+ </slot>
25
27
  </igc-badge>
26
28
 
27
29
  <script>
@@ -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
- <igc-icon class="igd-aside__icon" name={resolvedIcon} collection="docs" aria-hidden="true" />
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, tip, warning, or danger) with a type-specific icon, color accent, and accessible label. Use it in MDX pages to surface important information inline.
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 | Default | Description |
14
- | ------- | ------------------------------------------ | -------- | --------------------------------------------------------------------------------------------------------- |
15
- | `type` | `'note' \| 'tip' \| 'warning' \| 'danger'` | `'note'` | Semantic variant — controls the color accent and default icon. |
16
- | `title` | `string` | auto | Override the heading text. Defaults to the capitalised `type` name (`Note`, `Tip`, `Warning`, `Danger`). |
17
- | `color` | `string` | — | Override the accent color via the `--aside-color` CSS custom property. Accepts any valid CSS color value. |
18
- | `icon` | `string` | auto | Override the icon with raw SVG markup. Pass an empty string `""` to suppress the icon entirely. |
19
- | `class` | `string` | — | Additional CSS class(es) to add to the `<aside>` element. |
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
- {/* Tip variant */}
30
+ {/* Info */}
29
31
 
30
- <DocsAside type="tip">Use keyboard shortcuts to speed up your workflow.</DocsAside>
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
- {/* Danger */}
40
+ {/* No icon */}
39
41
 
40
- <DocsAside type="danger">Deleting this record is irreversible.</DocsAside>
42
+ <DocsAside type="info" icon="">
43
+ This callout has no icon.
44
+ </DocsAside>
45
+ ```
41
46
 
42
- {/* Custom accent color */}
47
+ ## Variants
43
48
 
44
- <DocsAside type="note" color="hsl(280, 80%, 50%)">
45
- A purple-accented callout.
46
- </DocsAside>
49
+ | `type` | Accent | Default title |
50
+ | --------- | ----------------- | ------------- |
51
+ | `note` | Gray | Note |
52
+ | `info` | Primary (blue) | Info |
53
+ | `warning` | Secondary (amber) | Warning |
47
54
 
48
- {/* No icon */}
55
+ ## Markup
49
56
 
50
- <DocsAside type="tip" icon="">
51
- This tip has no icon.
52
- </DocsAside>
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
- ## Variants
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
- | `type` | Accent color | Default title |
58
- | --------- | ------------ | ------------- |
59
- | `note` | Blue | Note |
60
- | `tip` | Green | Tip |
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
- ## Icons
82
+ `--igd-aside-{type}-code-background` is declared in `_variables.scss` but no stylesheet reads it yet.
65
83
 
66
- The built-in icons live in `src/icons/aside/` as raw SVG files. They are imported with Astro's `?raw` query and injected inline so they inherit the current `color` via `fill: currentColor`.
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
- items?.map((item) => (
67
- <FaqItem
68
- question={item.question}
69
- subtitle={item.subtitle}
70
- answer={item.answer}
71
- open={item.open}
72
- disabled={item.disabled}
73
- indicatorPosition={item.indicatorPosition ?? indicatorPosition}
74
- id={item.id}
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">{question}</span>
73
- {
74
- subtitle && (
75
- <span slot="subtitle" class="igd-faq__subtitle">
76
- {subtitle}
77
- </span>
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
- Astro.slots.has('indicator') && (
92
- <div slot="indicator" class="igd-faq__indicator">
93
- <slot name="indicator" />
94
- </div>
95
- )
96
- }
97
- {
98
- Astro.slots.has('indicator-expanded') && (
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>