igniteui-astro-components 0.0.27 → 0.0.28

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 (93) hide show
  1. package/README.md +82 -74
  2. package/package.json +15 -2
  3. package/src/components/CopyCode/CopyCode.astro +21 -7
  4. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +33 -21
  5. package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +44 -43
  6. package/src/components/DocsBreadcrumb/README.md +10 -14
  7. package/src/components/DocsSidebar/DocsSidebar.astro +47 -45
  8. package/src/components/DocsSidebar/DocsSidebar.scss +120 -122
  9. package/src/components/DocsSidebar/README.md +25 -21
  10. package/src/components/DocsSidebar/SidebarFilterInput.astro +24 -29
  11. package/src/components/DocsSidebar/SidebarFilterInput.scss +90 -89
  12. package/src/components/DocsSidebar/SidebarLabel.astro +35 -26
  13. package/src/components/DocsSidebar/sidebar-filter.ts +93 -56
  14. package/src/components/DocsSubHeader/DocsSubHeader.astro +256 -195
  15. package/src/components/DocsSubHeader/DocsSubHeader.scss +181 -178
  16. package/src/components/DocsSubHeader/README.md +18 -16
  17. package/src/components/DocsToc/DocsToc.astro +301 -280
  18. package/src/components/DocsToc/DocsToc.scss +20 -21
  19. package/src/components/DocsToc/README.md +11 -9
  20. package/src/components/DocsToc/toTreeNodes.ts +3 -8
  21. package/src/components/DocsTree/DocsTree.astro +32 -20
  22. package/src/components/DocsTree/DocsTreeItem.astro +35 -30
  23. package/src/components/DocsTree/README.md +16 -15
  24. package/src/components/DocsTree/docs-tree.scss +267 -268
  25. package/src/components/GlobalFooter/GlobalFooter.astro +10 -10
  26. package/src/components/GlobalFooter/README.md +3 -2
  27. package/src/components/GlobalNavBar/GlobalNavBar.astro +4 -2
  28. package/src/components/GlobalNavBar/GlobalNavBar.module.scss +222 -222
  29. package/src/components/GlobalNavBar/README.md +3 -2
  30. package/src/components/LicenseIndicator/LicenseIndicator.astro +7 -5
  31. package/src/components/LicenseIndicator/LicenseIndicator.scss +3 -3
  32. package/src/components/MobileSidebarToggle/MobileSidebarToggle.astro +16 -17
  33. package/src/components/MobileSidebarToggle/README.md +3 -2
  34. package/src/components/MobileTocToggle/MobileTocToggle.astro +75 -61
  35. package/src/components/MobileTocToggle/MobileTocToggle.scss +65 -59
  36. package/src/components/Search/README.md +1 -0
  37. package/src/components/Search/Search.astro +137 -109
  38. package/src/components/Search/Search.scss +20 -20
  39. package/src/components/SearchAdvanced/README.md +21 -15
  40. package/src/components/SearchAdvanced/SearchAdvanced.astro +205 -133
  41. package/src/components/SearchAdvanced/SearchAdvanced.scss +152 -153
  42. package/src/components/mdx/ApiLink/ApiLink.astro +133 -113
  43. package/src/components/mdx/ApiLink/ApiLink.scss +9 -9
  44. package/src/components/mdx/ApiLink/README.md +26 -22
  45. package/src/components/mdx/ApiLink/api-link-index.ts +196 -173
  46. package/src/components/mdx/ApiRef/ApiRef.astro +54 -51
  47. package/src/components/mdx/ApiRef/README.md +20 -15
  48. package/src/components/mdx/Badge/Badge.astro +14 -14
  49. package/src/components/mdx/Badge/Badge.scss +61 -56
  50. package/src/components/mdx/Badge/README.md +24 -19
  51. package/src/components/mdx/DocsAside/DocsAside.astro +30 -37
  52. package/src/components/mdx/DocsAside/DocsAside.scss +82 -82
  53. package/src/components/mdx/DocsAside/README.md +22 -22
  54. package/src/components/mdx/Faq/Faq.astro +86 -0
  55. package/src/components/mdx/Faq/Faq.scss +105 -0
  56. package/src/components/mdx/Faq/FaqItem.astro +117 -0
  57. package/src/components/mdx/Faq/README.md +223 -0
  58. package/src/components/mdx/Faq/types.ts +34 -0
  59. package/src/components/mdx/PlatformBlock/PlatformBlock.astro +3 -2
  60. package/src/components/mdx/PlatformBlock/README.md +6 -8
  61. package/src/components/mdx/Sample/README.md +21 -16
  62. package/src/components/mdx/Sample/Sample.astro +97 -74
  63. package/src/components/mdx/Sample/Sample.scss +132 -132
  64. package/src/content-helper.ts +71 -72
  65. package/src/content.config.ts +1 -6
  66. package/src/integration.ts +566 -512
  67. package/src/layouts/DocsLayout/DocsLayout.astro +228 -182
  68. package/src/layouts/DocsLayout/DocsLayout.scss +261 -261
  69. package/src/layouts/DocsLayout/README.md +24 -35
  70. package/src/lib/nav-helpers.ts +88 -82
  71. package/src/lib/types.ts +76 -76
  72. package/src/llms.ts +205 -166
  73. package/src/platform.ts +312 -162
  74. package/src/plugins/rehype-heading-anchors.ts +45 -45
  75. package/src/plugins/rehype-pagefind-ignore.ts +19 -19
  76. package/src/plugins/rehype-table-wrapper.ts +30 -30
  77. package/src/plugins/remark-docfx.ts +12 -0
  78. package/src/plugins/remark-env-vars.ts +12 -4
  79. package/src/plugins/remark-md-links.ts +10 -4
  80. package/src/scripts/icon-manifest.ts +13 -5
  81. package/src/scripts/sample-widget.ts +557 -501
  82. package/src/sidebar.ts +103 -97
  83. package/src/styles/global/_code-blocks.scss +43 -44
  84. package/src/styles/global/_component-themes.scss +151 -153
  85. package/src/styles/global/_icon-gallery.scss +81 -81
  86. package/src/styles/global/_index.scss +0 -1
  87. package/src/styles/global/_markdown.scss +816 -787
  88. package/src/styles/global/_palette.scss +456 -110
  89. package/src/styles/global/_search-shared.scss +402 -398
  90. package/src/styles/global/_type-scale.scss +127 -127
  91. package/src/styles/global/_variables.scss +138 -111
  92. package/src/styles/theme.scss +41 -41
  93. package/src/virtual-modules.d.ts +11 -2
@@ -10,43 +10,43 @@ 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' \| '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. |
20
20
 
21
21
  ## Examples
22
22
 
23
23
  ```mdx
24
24
  {/* Default note */}
25
- <DocsAside>
26
- This is a general note.
27
- </DocsAside>
25
+
26
+ <DocsAside>This is a general note.</DocsAside>
28
27
 
29
28
  {/* Tip variant */}
30
- <DocsAside type="tip">
31
- Use keyboard shortcuts to speed up your workflow.
32
- </DocsAside>
29
+
30
+ <DocsAside type="tip">Use keyboard shortcuts to speed up your workflow.</DocsAside>
33
31
 
34
32
  {/* Warning with custom title */}
33
+
35
34
  <DocsAside type="warning" title="Breaking change">
36
35
  The `foo` prop was removed in v2. Use `bar` instead.
37
36
  </DocsAside>
38
37
 
39
38
  {/* Danger */}
40
- <DocsAside type="danger">
41
- Deleting this record is irreversible.
42
- </DocsAside>
39
+
40
+ <DocsAside type="danger">Deleting this record is irreversible.</DocsAside>
43
41
 
44
42
  {/* Custom accent color */}
43
+
45
44
  <DocsAside type="note" color="hsl(280, 80%, 50%)">
46
45
  A purple-accented callout.
47
46
  </DocsAside>
48
47
 
49
48
  {/* No icon */}
49
+
50
50
  <DocsAside type="tip" icon="">
51
51
  This tip has no icon.
52
52
  </DocsAside>
@@ -54,12 +54,12 @@ import DocsAside from 'igniteui-astro-components/components/mdx/DocsAside.astro'
54
54
 
55
55
  ## Variants
56
56
 
57
- | `type` | Accent color | Default title |
58
- |--------|-------------|---------------|
59
- | `note` | Blue | Note |
60
- | `tip` | Green | Tip |
61
- | `warning` | Amber | Warning |
62
- | `danger` | Red | Danger |
57
+ | `type` | Accent color | Default title |
58
+ | --------- | ------------ | ------------- |
59
+ | `note` | Blue | Note |
60
+ | `tip` | Green | Tip |
61
+ | `warning` | Amber | Warning |
62
+ | `danger` | Red | Danger |
63
63
 
64
64
  ## Icons
65
65
 
@@ -0,0 +1,86 @@
1
+ ---
2
+ /**
3
+ * Faq - a question / answer list built on <igc-accordion>.
4
+ *
5
+ * Two authoring modes, both usable from `.astro` and `.mdx`:
6
+ *
7
+ * 1. Slot mode (preferred in MDX) — nest <FaqItem> children so the answer
8
+ * body can contain rich markdown, links, code blocks, other components.
9
+ * 2. Data mode — pass `items={[{ question, answer }]}`. `answer` is injected
10
+ * as an unsanitized HTML string (see FaqEntry.answer), so it is only
11
+ * suitable for short, static, author-controlled copy.
12
+ *
13
+ * Both modes render into the same <igc-accordion>, so the two can be mixed.
14
+ *
15
+ * Every prop that maps to an underlying Ignite UI property is forwarded
16
+ * verbatim; anything not covered by a named prop is spread onto the
17
+ * <igc-accordion> element (`id`, `data-*`, `aria-*`, …).
18
+ *
19
+ * NOTE on `indicatorPosition`: Astro cannot pass props into slotted children,
20
+ * so the value set here applies to `items` entries only. In slot mode set it
21
+ * per <FaqItem>.
22
+ */
23
+ import './Faq.scss';
24
+ import FaqItem from './FaqItem.astro';
25
+ import type { FaqEntry, FaqIndicatorPosition } from './types';
26
+
27
+ export type { FaqEntry, FaqIndicatorPosition };
28
+
29
+ export interface Props {
30
+ /** Data-driven entries. Omit and nest <FaqItem> children instead for rich answers. */
31
+ items?: FaqEntry[];
32
+ /**
33
+ * Allows only one question to be expanded at a time.
34
+ * Forwarded to `igc-accordion[single-expand]`.
35
+ * @default false
36
+ */
37
+ singleExpand?: boolean;
38
+ /**
39
+ * Indicator position forwarded to each panel rendered from `items`.
40
+ * @default 'start' (the igc-expansion-panel default)
41
+ */
42
+ indicatorPosition?: FaqIndicatorPosition;
43
+ /** Extra CSS classes forwarded to the igc-accordion element. */
44
+ class?: string;
45
+
46
+ // Pass-through attributes, enumerated rather than an open
47
+ // `[key: string]: unknown` index signature so a misspelt named prop
48
+ // (`singleExpland`) is still a type error.
49
+ /** Forwarded to the igc-accordion element. */
50
+ id?: string;
51
+ 'aria-label'?: string;
52
+ 'aria-labelledby'?: string;
53
+ 'aria-describedby'?: string;
54
+ [key: `data-${string}`]: string | number | boolean | undefined;
55
+ }
56
+
57
+ const { items, singleExpand = false, indicatorPosition, class: className, ...rest } = Astro.props;
58
+ ---
59
+
60
+ <igc-accordion
61
+ class:list={['igd-faq', className]}
62
+ single-expand={singleExpand ? '' : undefined}
63
+ {...rest}
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
+ }
78
+ <slot />
79
+ </igc-accordion>
80
+
81
+ <script>
82
+ // Only the accordion — FaqItem.astro registers the panel.
83
+ import { defineComponents, IgcAccordionComponent } from 'igniteui-webcomponents';
84
+
85
+ defineComponents(IgcAccordionComponent);
86
+ </script>
@@ -0,0 +1,105 @@
1
+ @use 'igniteui-theming/sass/typography' as *;
2
+
3
+ // STRUCTURE STYLES
4
+
5
+ .igd-faq {
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: var(--igd-faq-gap);
9
+ margin-block-end: var(--igd-faq-margin-bottom);
10
+ }
11
+
12
+ .igd-faq__item {
13
+ // Bridge: every igd-* FAQ token feeds the matching igc-expansion-panel
14
+ // theme property, so consumers only ever set --igd-faq-* variables.
15
+ //
16
+ // Geometry is deliberately NOT overridden here. igc-expansion-panel derives
17
+ // its header padding, body padding, and indicator margin from the layout
18
+ // scale (--ig-size / --ig-spacing); hard-coding padding on ::part(header)
19
+ // and ::part(content) would freeze the component at one density and — for
20
+ // the body — double up, because the real body padding lives on the inner
21
+ // `[part~=content] > slot`, which is not an exposed part. Scale the density
22
+ // through --igd-faq-spacing instead.
23
+ --ig-spacing: var(--igd-faq-spacing);
24
+
25
+ --ig-expansion-panel-header-background: var(--igd-faq-header-bg);
26
+ --ig-expansion-panel-header-focus-background: var(--igd-faq-header-focus-bg);
27
+ --ig-expansion-panel-header-title-color: var(--igd-faq-question-color);
28
+ --ig-expansion-panel-header-description-color: var(--igd-faq-subtitle-color);
29
+ --ig-expansion-panel-header-icon-color: var(--igd-faq-indicator-color);
30
+ --ig-expansion-panel-body-background: var(--igd-faq-body-bg);
31
+ --ig-expansion-panel-body-color: var(--igd-faq-answer-color);
32
+ --ig-expansion-panel-disabled-text-color: var(--igd-faq-disabled-color);
33
+ --ig-expansion-panel-disabled-description-color: var(--igd-faq-disabled-color);
34
+ --ig-expansion-panel-border-radius: var(--igd-faq-border-radius);
35
+ // The accordion's own gap owns the vertical rhythm — see .igd-faq { gap }.
36
+ --ig-expansion-panel-expanded-margin: 0;
37
+
38
+ border: var(--igd-faq-border-width) var(--igd-faq-border-style) var(--igd-faq-border-color);
39
+ border-radius: var(--igd-faq-border-radius);
40
+ background: var(--igd-faq-header-bg);
41
+
42
+ // Clip the header/body backgrounds to the rounded corners.
43
+ overflow: hidden;
44
+
45
+ // NOTE: do not colour ::part(indicator) / the slotted title from here. The
46
+ // panel already paints them from the bridged tokens above, and it swaps them
47
+ // for --disabled-text-color under :host([disabled]). An outer-tree ::part()
48
+ // rule always beats the shadow tree's own rules, so re-stating the colour
49
+ // here would silently defeat the disabled state.
50
+ }
51
+
52
+ // Wrapper around a caller-supplied indicator — must not affect the layout the
53
+ // panel's own indicator part sets up.
54
+ .igd-faq__indicator {
55
+ display: contents;
56
+ }
57
+
58
+ // THEME STYLES
59
+
60
+ .igd-faq__item[open] {
61
+ border-color: var(--igd-faq-open-border-color);
62
+ }
63
+
64
+ // The panel only greys its own text under [disabled] — mute the card the docs
65
+ // theme draws around it too, otherwise a disabled question still reads as live.
66
+ .igd-faq__item[disabled] {
67
+ --ig-expansion-panel-header-background: var(--igd-faq-disabled-bg);
68
+ --ig-expansion-panel-body-background: var(--igd-faq-disabled-bg);
69
+
70
+ border-color: var(--igd-faq-disabled-border-color);
71
+ }
72
+
73
+ // TYPOGRAPHY STYLES
74
+
75
+ // Type only — colour is inherited from the panel's [part=title] / [part=subtitle],
76
+ // which is what lets the disabled state grey them out. Setting `color` here
77
+ // would win over that inheritance and pin the text to its enabled colour.
78
+ .igd-faq__question {
79
+ @include type-style('h6') {
80
+ margin: 0;
81
+ }
82
+ }
83
+
84
+ .igd-faq__subtitle {
85
+ @include type-style('caption') {
86
+ margin: 0;
87
+ }
88
+ }
89
+
90
+ .igd-faq__answer {
91
+ @include type-style('body-2') {
92
+ margin: 0;
93
+ font-weight: 400;
94
+ }
95
+
96
+ // Colour inherited from :host { color: var(--body-color) } — bridged from
97
+ // --igd-faq-answer-color above.
98
+
99
+ // Long links / wide code samples must not stretch the panel.
100
+ overflow: auto;
101
+
102
+ > :last-child {
103
+ margin-block-end: 0;
104
+ }
105
+ }
@@ -0,0 +1,117 @@
1
+ ---
2
+ /**
3
+ * FaqItem — a single question / answer pair.
4
+ *
5
+ * Wraps <igc-expansion-panel> and exposes its public properties as props
6
+ * (`open`, `disabled`, `indicatorPosition`). Intended to be nested inside
7
+ * <Faq>, which owns the <igc-accordion> and the keyboard navigation.
8
+ *
9
+ * The question goes into the panel's `title` slot as a plain <span>: the
10
+ * panel header already carries `role="button"`, and a heading nested inside
11
+ * a button role is dropped from the accessibility tree anyway.
12
+ *
13
+ * The default slot is the answer. Pass `answer` instead when the content is
14
+ * a static HTML string (used by <Faq items={…}>).
15
+ */
16
+ import './Faq.scss';
17
+ import type { FaqIndicatorPosition } from './types';
18
+
19
+ export interface Props {
20
+ /** Header text — the question. Required. */
21
+ question: string;
22
+ /** Secondary header line rendered under the question. */
23
+ subtitle?: string;
24
+ /**
25
+ * Answer body as an HTML string. Rendered as the default slot's fallback,
26
+ * so slotted content always wins.
27
+ *
28
+ * SECURITY: injected verbatim via `set:html` — it is NOT sanitized. Only
29
+ * pass trusted, author-controlled markup. For untrusted or user-generated
30
+ * content use the default slot, which Astro escapes.
31
+ */
32
+ answer?: string;
33
+ /** Renders the panel expanded. @default false */
34
+ open?: boolean;
35
+ /** Non-interactive panel — skipped by accordion keyboard navigation. @default false */
36
+ disabled?: boolean;
37
+ /** Where the expand indicator sits. @default 'start' */
38
+ indicatorPosition?: FaqIndicatorPosition;
39
+ /** Extra CSS classes forwarded to the igc-expansion-panel element. */
40
+ class?: string;
41
+
42
+ // Pass-through attributes, enumerated rather than an open
43
+ // `[key: string]: unknown` index signature so a misspelt named prop
44
+ // (`indicatorPostion`) is still a type error.
45
+ /** Forwarded to the igc-expansion-panel element. */
46
+ id?: string;
47
+ 'aria-label'?: string;
48
+ 'aria-labelledby'?: string;
49
+ 'aria-describedby'?: string;
50
+ [key: `data-${string}`]: string | number | boolean | undefined;
51
+ }
52
+
53
+ const {
54
+ question,
55
+ subtitle,
56
+ answer,
57
+ open = false,
58
+ disabled = false,
59
+ indicatorPosition,
60
+ class: className,
61
+ ...rest
62
+ } = Astro.props;
63
+ ---
64
+
65
+ <igc-expansion-panel
66
+ class:list={['igd-faq__item', className]}
67
+ open={open ? '' : undefined}
68
+ disabled={disabled ? '' : undefined}
69
+ indicator-position={indicatorPosition}
70
+ {...rest}
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
+ }
80
+
81
+ {
82
+ /*
83
+ Forward the panel's indicator slots so callers can swap the chevron.
84
+ The wrapper is required: `slot=` on an Astro <slot> only forwards to another
85
+ Astro component, not to a custom element's light DOM. It is rendered only
86
+ when content was passed — an empty wrapper would count as assigned content
87
+ 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
+ }
104
+
105
+ {/* Slot content wins; `answer` is the fallback the data-driven API renders. */}
106
+ <div class="igd-faq__answer">
107
+ <slot>{answer && <Fragment set:html={answer} />}</slot>
108
+ </div>
109
+ </igc-expansion-panel>
110
+
111
+ <script>
112
+ // Only the panel — Faq.astro registers the accordion. Splitting the two
113
+ // keeps Astro from emitting two identical hoisted script bundles.
114
+ import { defineComponents, IgcExpansionPanelComponent } from 'igniteui-webcomponents';
115
+
116
+ defineComponents(IgcExpansionPanelComponent);
117
+ </script>
@@ -0,0 +1,223 @@
1
+ # Faq
2
+
3
+ Question / answer list built on `<igc-accordion>` +
4
+ `<igc-expansion-panel>` from `igniteui-webcomponents`.
5
+
6
+ Two components ship together:
7
+
8
+ - **`Faq.astro`** — owns the `<igc-accordion>` (grouping + keyboard navigation).
9
+ - **`FaqItem.astro`** — one `<igc-expansion-panel>`; the question is the header,
10
+ the default slot is the answer.
11
+
12
+ Styling is driven entirely by `--igd-faq-*` custom properties declared in
13
+ `src/styles/global/_variables.scss`. `Faq.scss` maps each of them onto the
14
+ corresponding `--ig-expansion-panel-*` theme property, so consumers never
15
+ touch the Ignite UI variables directly.
16
+
17
+ ## Usage — slot mode (preferred)
18
+
19
+ Rich answers: markdown, links, code blocks, other components.
20
+
21
+ ```astro
22
+ ---
23
+ import Faq from 'igniteui-astro-components/components/mdx/Faq.astro';
24
+ import FaqItem from 'igniteui-astro-components/components/mdx/FaqItem.astro';
25
+ ---
26
+
27
+ <Faq singleExpand>
28
+ <FaqItem question="How do I install the package?" open>
29
+ Run <code>npm install igniteui-webcomponents</code>.
30
+ </FaqItem>
31
+ <FaqItem question="Is it free?" subtitle="Licensing" indicatorPosition="end">
32
+ The core components are open source; some are part of a paid license.
33
+ </FaqItem>
34
+ </Faq>
35
+ ```
36
+
37
+ ## Usage — data mode
38
+
39
+ Short, static copy. `answer` is injected as an HTML string.
40
+
41
+ > **`answer` is not sanitized.** It goes straight through `set:html`, so pass
42
+ > only trusted, author-controlled markup. Anything untrusted or user-generated
43
+ > belongs in the default slot (slot mode), which Astro escapes.
44
+
45
+ ```astro
46
+ ---
47
+ import Faq from 'igniteui-astro-components/components/mdx/Faq.astro';
48
+ import type { FaqEntry } from 'igniteui-astro-components/components/mdx/Faq/types';
49
+
50
+ const items: FaqEntry[] = [
51
+ { question: 'How do I install the package?', answer: 'Run <code>npm i</code>.' },
52
+ { question: 'Is it free?', answer: 'The core components are open source.' },
53
+ ];
54
+ ---
55
+
56
+ <Faq {items} singleExpand indicatorPosition="end" />
57
+ ```
58
+
59
+ Both modes render into the same accordion, so they can be mixed — `items`
60
+ entries render first, slotted `<FaqItem>`s after.
61
+
62
+ ## Usage in MDX
63
+
64
+ Import the components in the MDX body, then use them as JSX. Leave a blank
65
+ line around markdown content so it is parsed as markdown rather than raw text.
66
+
67
+ ````mdx
68
+ ---
69
+ title: FAQ
70
+ ---
71
+
72
+ import Faq from 'igniteui-astro-components/components/mdx/Faq.astro';
73
+ import FaqItem from 'igniteui-astro-components/components/mdx/FaqItem.astro';
74
+
75
+ ## Frequently asked questions
76
+
77
+ <Faq singleExpand>
78
+ <FaqItem question="How do I install the package?" open>
79
+
80
+ Install it from npm:
81
+
82
+ ```bash
83
+ npm install igniteui-webcomponents
84
+ ```
85
+
86
+ </FaqItem>
87
+
88
+ <FaqItem question="Which browsers are supported?">
89
+
90
+ The last two versions of every evergreen browser. See the
91
+ [browser support](/getting-started) page.
92
+
93
+ </FaqItem>
94
+ </Faq>
95
+ ````
96
+
97
+ ## Props — `Faq`
98
+
99
+ | Prop | Type | Default | Notes |
100
+ | --------------------------------------------------- | ----------------------------- | ------- | -------------------------------------------------------------------------------- |
101
+ | `items` | `FaqEntry[]` | — | Data-driven entries. Omit for slot mode. |
102
+ | `singleExpand` | `boolean` | `false` | → `igc-accordion[single-expand]`. Only one answer open at once. |
103
+ | `indicatorPosition` | `'start' \| 'end' \| 'none'` | `start` | Applies to `items` entries only — see the note below. |
104
+ | `class` | `string` | — | Forwarded to `<igc-accordion>`. |
105
+ | `id` | `string` | — | Spread onto `<igc-accordion>`. |
106
+ | `aria-label`, `aria-labelledby`, `aria-describedby` | `string` | — | Spread onto `<igc-accordion>`. Typed for autocomplete — see the caveat below. |
107
+ | `data-*` | `string \| number \| boolean` | — | Spread onto `<igc-accordion>` via a ``[key: `data-${string}`]`` index signature. |
108
+
109
+ ## Props — `FaqItem`
110
+
111
+ | Prop | Type | Default | Notes |
112
+ | --------------------------------------------------- | ----------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------- |
113
+ | `question` | `string` | — | Required. Rendered in the panel's `title` slot. |
114
+ | `subtitle` | `string` | — | Optional second header line (`subtitle` slot). |
115
+ | `answer` | `string` | — | HTML string answer, rendered as the slot's fallback — slotted content always wins. **Not sanitized**, see above. |
116
+ | `open` | `boolean` | `false` | → `igc-expansion-panel[open]`. |
117
+ | `disabled` | `boolean` | `false` | → `igc-expansion-panel[disabled]`. Skipped by keyboard nav. |
118
+ | `indicatorPosition` | `'start' \| 'end' \| 'none'` | `start` | → `igc-expansion-panel[indicator-position]`. |
119
+ | `class` | `string` | — | Forwarded to `<igc-expansion-panel>`. |
120
+ | `id` | `string` | — | Spread onto `<igc-expansion-panel>`. |
121
+ | `aria-label`, `aria-labelledby`, `aria-describedby` | `string` | — | Spread onto `<igc-expansion-panel>`. Typed for autocomplete — see the caveat below. |
122
+ | `data-*` | `string \| number \| boolean` | — | Spread onto `<igc-expansion-panel>` via a ``[key: `data-${string}`]`` index signature. |
123
+
124
+ `Props` deliberately has **no** open `[key: string]: unknown` index signature —
125
+ that is what keeps a misspelt `indicatorPostion` (or a stray `datatestid`) a
126
+ type error. Anything outside the rows above needs adding to `Props` first.
127
+
128
+ **Caveat:** TypeScript exempts JSX attribute names that are not valid JS
129
+ identifiers — i.e. every hyphenated name, so all `aria-*` and `data-*` — from
130
+ excess-property checking. A misspelt `aria-describedbyy` therefore passes
131
+ silently no matter what `Props` declares. The enumerated ARIA props exist for
132
+ autocomplete and intent, not enforcement; only identifier-style props
133
+ (`singleExpand`, `indicatorPosition`, `question`, …) are spell-checked by the
134
+ compiler.
135
+
136
+ The `indicator` and `indicator-expanded` slots are forwarded, so the default
137
+ chevron can be replaced per item:
138
+
139
+ ```astro
140
+ <FaqItem question="Custom indicator">
141
+ <igc-icon slot="indicator" name="chevron" collection="docs"></igc-icon>
142
+ Answer body.
143
+ </FaqItem>
144
+ ```
145
+
146
+ ### Why `indicatorPosition` on `Faq` only covers `items`
147
+
148
+ `indicator-position` is a property of each panel, and Astro cannot pass props
149
+ into slotted children at build time. In slot mode set it on each `<FaqItem>`;
150
+ in data mode `Faq` forwards its value (an entry's own `indicatorPosition`
151
+ wins).
152
+
153
+ ## Runtime API
154
+
155
+ `Faq` renders a real `<igc-accordion>`, so the library API is available on the
156
+ element itself:
157
+
158
+ ```ts
159
+ const faq = document.querySelector('igc-accordion.igd-faq')!;
160
+ faq.showAll();
161
+ faq.hideAll();
162
+ faq.singleExpand = true;
163
+ faq.panels; // IgcExpansionPanelComponent[]
164
+ ```
165
+
166
+ Each panel emits `igcOpening` / `igcOpened` / `igcClosing` / `igcClosed`.
167
+
168
+ ## Theming tokens
169
+
170
+ | Token | Purpose |
171
+ | --------------------------------- | ------------------------------------------ |
172
+ | `--igd-faq-gap` | Vertical gap between questions. |
173
+ | `--igd-faq-margin-bottom` | Space below the whole list. |
174
+ | `--igd-faq-spacing` | Density — see below. |
175
+ | `--igd-faq-border-*` | Width / style / colour / radius of a card. |
176
+ | `--igd-faq-open-border-color` | Border colour while a panel is open. |
177
+ | `--igd-faq-header-bg` | Question row background. |
178
+ | `--igd-faq-header-focus-bg` | Question row background on focus. |
179
+ | `--igd-faq-body-bg` | Answer background. |
180
+ | `--igd-faq-question-color` | Question text colour. |
181
+ | `--igd-faq-subtitle-color` | Subtitle text colour. |
182
+ | `--igd-faq-answer-color` | Answer text colour. |
183
+ | `--igd-faq-indicator-color` | Chevron colour. |
184
+ | `--igd-faq-disabled-color` | Question / chevron colour when disabled. |
185
+ | `--igd-faq-disabled-bg` | Card background when disabled. |
186
+ | `--igd-faq-disabled-border-color` | Card border when disabled. |
187
+
188
+ ### Never re-state a bridged colour in the light DOM
189
+
190
+ `Faq.scss` sets colours **only** as `--ig-expansion-panel-*` bridge values. The
191
+ panel paints `[part=title]`, `[part=subtitle]`, and `[part~=indicator]` from
192
+ those, and swaps them for `--disabled-text-color` under `:host([disabled])`.
193
+
194
+ Two things silently defeat that disabled state, so both are avoided:
195
+
196
+ - `color` on the slotted `.igd-faq__question` / `.igd-faq__subtitle` — an
197
+ explicit colour beats the inheritance coming from `[part=title]`.
198
+ - `::part(indicator) { color }` — outer-tree `::part()` rules always win over
199
+ the shadow tree's own rules, regardless of specificity.
200
+
201
+ If a colour looks wrong, change the `--igd-faq-*` token, never add a
202
+ declaration to the light-DOM element.
203
+
204
+ ### Density — why there is no padding token
205
+
206
+ `igc-expansion-panel` derives its header padding, body padding, and indicator
207
+ margin from the Ignite UI layout scale (`--ig-size`, `--ig-spacing`), and its
208
+ real body padding lives on `[part~=content] > slot` — an element that is not
209
+ an exposed CSS part. Overriding `::part(content) { padding }` therefore stacks
210
+ on top of the built-in padding instead of replacing it, and any hard-coded
211
+ `::part(header) { padding }` freezes the component at one density.
212
+
213
+ So the FAQ scales density instead of setting padding:
214
+
215
+ ```css
216
+ .my-faq {
217
+ --igd-faq-spacing: 0.75; /* 0 = flush, 1 = default, 2 = double */
218
+ }
219
+ ```
220
+
221
+ `--igd-faq-spacing` feeds `--ig-spacing` on each panel; `--ig-size` on the
222
+ panel (or an ancestor) still works as usual. Verified against the
223
+ `igniteui-theming` MCP (`theming://docs/spacing-and-sizing`).
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Shared types for the Faq / FaqItem pair.
3
+ *
4
+ * Kept in a plain module (instead of exported from Faq.astro) so FaqItem can
5
+ * import them without creating a circular component import.
6
+ */
7
+
8
+ /** Mirrors `ExpansionPanelIndicatorPosition` from igniteui-webcomponents. */
9
+ export type FaqIndicatorPosition = 'start' | 'end' | 'none';
10
+
11
+ /** A single question / answer pair in the data-driven `items` API. */
12
+ export interface FaqEntry {
13
+ /** Header text — the question. */
14
+ question: string;
15
+ /**
16
+ * Answer body as an HTML string. Rendered as the default slot's fallback,
17
+ * so slotted content always wins. Use slot mode for rich content.
18
+ *
19
+ * SECURITY: injected verbatim via `set:html` — it is NOT sanitized. Only
20
+ * pass trusted, author-controlled markup. For untrusted or user-generated
21
+ * content use the default slot, which Astro escapes.
22
+ */
23
+ answer?: string;
24
+ /** Secondary header line rendered under the question. */
25
+ subtitle?: string;
26
+ /** Renders the panel expanded. @default false */
27
+ open?: boolean;
28
+ /** Non-interactive panel. @default false */
29
+ disabled?: boolean;
30
+ /** Overrides the list-level `indicatorPosition` for this entry. */
31
+ indicatorPosition?: FaqIndicatorPosition;
32
+ /** Forwarded to the `<igc-expansion-panel>` element. */
33
+ id?: string;
34
+ }
@@ -13,12 +13,13 @@
13
13
  import type { PlatformContext } from '../../../lib/types';
14
14
 
15
15
  interface Props {
16
- /** Comma-separated list of platform names to show content for. */
17
- for: string;
16
+ /** Comma-separated list of platform names to show content for. */
17
+ for: string;
18
18
  }
19
19
 
20
20
  const { for: forProp } = Astro.props;
21
21
  const allowed = forProp.split(',').map((s) => s.trim());
22
22
  const { name } = Astro.locals.platformContext as PlatformContext;
23
23
  ---
24
+
24
25
  {allowed.includes(name) && <slot />}