igniteui-astro-components 0.0.28 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-astro-components",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "Reusable Astro components, layouts, and integrations for Infragistics / Ignite UI documentation sites. Replaces the Starlight defaults with project-specific implementations.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -60,6 +60,7 @@
60
60
  "./components/DocsTree/DocsTreeItem.astro": "./src/components/DocsTree/DocsTreeItem.astro",
61
61
  "./components/DocsTree/types": "./src/components/DocsTree/types.ts",
62
62
  "./components/DocsTree/docs-tree.css": "./src/components/DocsTree/docs-tree.css",
63
+ "./components/mdx/Anatomy.astro": "./src/components/mdx/Anatomy/Anatomy.astro",
63
64
  "./components/mdx/ApiRef.astro": "./src/components/mdx/ApiRef/ApiRef.astro",
64
65
  "./components/mdx/ApiLink.astro": "./src/components/mdx/ApiLink/ApiLink.astro",
65
66
  "./components/mdx/DocsAside.astro": "./src/components/mdx/DocsAside/DocsAside.astro",
@@ -0,0 +1,51 @@
1
+ ---
2
+ /**
3
+ * Renders a framed image that illustrates the anatomy of a component.
4
+ *
5
+ * Usage:
6
+ * <Anatomy src="/images/anatomy/button.png" alt="Button anatomy: label, prefix icon, and suffix icon" />
7
+ *
8
+ * The frame is a light-gray, bordered canvas with internal padding. The image
9
+ * inside can never exceed that padding — its max-width is 100% of the frame's
10
+ * content box (the box inside the padding) and its height scales to keep the
11
+ * aspect ratio. The frame is a centering grid, so an image smaller than the
12
+ * frame sits centered rather than pinned to a corner.
13
+ *
14
+ * Accessibility: `alt` is required and propagates to the inner <img>. Anatomy
15
+ * diagrams are informative, so the alt text should describe what the diagram
16
+ * conveys (the parts it labels), not merely name the component. The <img> also
17
+ * gets native lazy loading and async decoding.
18
+ */
19
+ import './Anatomy.scss';
20
+
21
+ interface Props {
22
+ /** The image URL. Required. */
23
+ src: string;
24
+ /**
25
+ * The image's accessible description. Required — it becomes the inner
26
+ * <img>'s `alt`. Describe the parts the diagram labels, e.g.
27
+ * "Button anatomy: label text, optional prefix icon, optional suffix icon".
28
+ */
29
+ alt: string;
30
+ /** Optional extra class(es) forwarded to the frame. */
31
+ class?: string;
32
+ }
33
+
34
+ const { src, alt, class: className } = Astro.props;
35
+
36
+ if (!src?.trim()) {
37
+ throw new Error('<Anatomy> requires a `src` (image URL).');
38
+ }
39
+ // Anatomy diagrams are informative, not decorative — an absent, empty or
40
+ // whitespace-only alt would hide the diagram's meaning from screen-reader
41
+ // users. Fail loudly in dev.
42
+ if (!alt?.trim()) {
43
+ throw new Error(
44
+ '<Anatomy> requires a non-empty `alt` describing the diagram for screen readers.',
45
+ );
46
+ }
47
+ ---
48
+
49
+ <figure class:list={['igd-anatomy', className]}>
50
+ <img class="igd-anatomy__image" src={src} alt={alt} loading="lazy" decoding="async" />
51
+ </figure>
@@ -0,0 +1,40 @@
1
+ @use 'igniteui-theming/sass/typography' as *;
2
+ @use 'igniteui-theming/sass/color' as *;
3
+
4
+ // Framed canvas for component anatomy images. A centering grid so a small image
5
+ // sits in the middle of the frame; padding the image can never spill past
6
+ // because the image's max-width is 100% of the content box (inside the padding)
7
+ // and there is no negative margin to break out of it.
8
+ .igd-anatomy {
9
+ // Retunable from any ancestor, e.g. :root { --igd-anatomy-padding: 32px; }
10
+ --igd-anatomy-padding: #{rem(60px)} #{rem(24px)};
11
+ --igd-anatomy-bg: light-dark(
12
+ #{color($color: gray, $variant: 100, $opacity: 0.8)},
13
+ #{color($color: surface, $variant: 500, $opacity: 0.8)}
14
+ );
15
+ --igd-anatomy-border-color: light-dark(var(--ig-gray-300), var(--ig-surface-700));
16
+ --igd-anatomy-radius: #{rem(4px)};
17
+
18
+ display: grid;
19
+ place-items: center;
20
+ padding: var(--igd-anatomy-padding);
21
+ background-color: var(--igd-anatomy-bg);
22
+ border: rem(1px) solid var(--igd-anatomy-border-color);
23
+ border-radius: var(--igd-anatomy-radius);
24
+ margin: 0 0 rem(26px);
25
+
26
+ // Never let the frame itself overflow its column.
27
+ max-width: 100%;
28
+ overflow: hidden;
29
+ }
30
+
31
+ .igd-anatomy__image {
32
+ display: block;
33
+
34
+ // The image can grow to — but never past — the frame's content box (the
35
+ // area inside the padding). Smaller images keep their intrinsic size and
36
+ // are centered by the grid above.
37
+ max-width: 100%;
38
+ height: auto;
39
+ margin: 0;
40
+ }
@@ -37,7 +37,7 @@ export interface Props {
37
37
  singleExpand?: boolean;
38
38
  /**
39
39
  * Indicator position forwarded to each panel rendered from `items`.
40
- * @default 'start' (the igc-expansion-panel default)
40
+ * @default 'end'
41
41
  */
42
42
  indicatorPosition?: FaqIndicatorPosition;
43
43
  /** Extra CSS classes forwarded to the igc-accordion element. */
@@ -34,7 +34,7 @@ export interface Props {
34
34
  open?: boolean;
35
35
  /** Non-interactive panel — skipped by accordion keyboard navigation. @default false */
36
36
  disabled?: boolean;
37
- /** Where the expand indicator sits. @default 'start' */
37
+ /** Where the expand indicator sits. @default 'end' */
38
38
  indicatorPosition?: FaqIndicatorPosition;
39
39
  /** Extra CSS classes forwarded to the igc-expansion-panel element. */
40
40
  class?: string;
@@ -66,7 +66,7 @@ const {
66
66
  class:list={['igd-faq__item', className]}
67
67
  open={open ? '' : undefined}
68
68
  disabled={disabled ? '' : undefined}
69
- indicator-position={indicatorPosition}
69
+ indicator-position={indicatorPosition ?? 'end'}
70
70
  {...rest}
71
71
  >
72
72
  <span slot="title" class="igd-faq__question">{question}</span>
@@ -100,7 +100,7 @@ import FaqItem from 'igniteui-astro-components/components/mdx/FaqItem.astro';
100
100
  | --------------------------------------------------- | ----------------------------- | ------- | -------------------------------------------------------------------------------- |
101
101
  | `items` | `FaqEntry[]` | — | Data-driven entries. Omit for slot mode. |
102
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. |
103
+ | `indicatorPosition` | `'start' \| 'end' \| 'none'` | `end` | Applies to `items` entries only — see the note below. |
104
104
  | `class` | `string` | — | Forwarded to `<igc-accordion>`. |
105
105
  | `id` | `string` | — | Spread onto `<igc-accordion>`. |
106
106
  | `aria-label`, `aria-labelledby`, `aria-describedby` | `string` | — | Spread onto `<igc-accordion>`. Typed for autocomplete — see the caveat below. |
@@ -115,7 +115,7 @@ import FaqItem from 'igniteui-astro-components/components/mdx/FaqItem.astro';
115
115
  | `answer` | `string` | — | HTML string answer, rendered as the slot's fallback — slotted content always wins. **Not sanitized**, see above. |
116
116
  | `open` | `boolean` | `false` | → `igc-expansion-panel[open]`. |
117
117
  | `disabled` | `boolean` | `false` | → `igc-expansion-panel[disabled]`. Skipped by keyboard nav. |
118
- | `indicatorPosition` | `'start' \| 'end' \| 'none'` | `start` | → `igc-expansion-panel[indicator-position]`. |
118
+ | `indicatorPosition` | `'start' \| 'end' \| 'none'` | `end` | → `igc-expansion-panel[indicator-position]`. |
119
119
  | `class` | `string` | — | Forwarded to `<igc-expansion-panel>`. |
120
120
  | `id` | `string` | — | Spread onto `<igc-expansion-panel>`. |
121
121
  | `aria-label`, `aria-labelledby`, `aria-describedby` | `string` | — | Spread onto `<igc-expansion-panel>`. Typed for autocomplete — see the caveat below. |