@reuters-graphics/graphics-components 3.10.0 → 4.0.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 (85) hide show
  1. package/dist/components/Analytics/GTM.svelte.d.ts +3 -3
  2. package/dist/components/BlogPost/BlogPost.svelte +6 -5
  3. package/dist/components/BlogPost/BlogPost.svelte.d.ts +3 -2
  4. package/dist/components/BlogPost/CopyLink.svelte +7 -4
  5. package/dist/components/BlogPost/CopyLink.svelte.d.ts +5 -2
  6. package/dist/components/BlogPost/PostHeadline.svelte +7 -4
  7. package/dist/components/BlogPost/PostHeadline.svelte.d.ts +5 -2
  8. package/dist/components/BlogPost/utils.d.ts +2 -1
  9. package/dist/components/BlogPost/utils.js +8 -2
  10. package/dist/components/BlogTOC/BlogTOC.svelte +7 -4
  11. package/dist/components/BlogTOC/BlogTOC.svelte.d.ts +8 -5
  12. package/dist/components/BlogTOC/TOCList.svelte.d.ts +3 -3
  13. package/dist/components/Headpile/Headpile.svelte +2 -2
  14. package/dist/components/Headpile/Headpile.svelte.d.ts +2 -2
  15. package/dist/components/LanguageButton/LanguageButton.svelte +10 -7
  16. package/dist/components/LanguageButton/LanguageButton.svelte.d.ts +5 -2
  17. package/dist/components/SEO/SEO.svelte.d.ts +3 -3
  18. package/dist/components/Video/Video.svelte +2 -2
  19. package/dist/llm-docs/components/AdSlot.md +11 -0
  20. package/dist/llm-docs/components/Analytics.md +89 -0
  21. package/dist/llm-docs/components/Article.md +183 -0
  22. package/dist/llm-docs/components/BeforeAfter.md +170 -0
  23. package/dist/llm-docs/components/BioBox.md +74 -0
  24. package/dist/llm-docs/components/Block.md +211 -0
  25. package/dist/llm-docs/components/BlogPost.md +66 -0
  26. package/dist/llm-docs/components/BlogTOC.md +89 -0
  27. package/dist/llm-docs/components/BodyText.md +143 -0
  28. package/dist/llm-docs/components/Byline.md +242 -0
  29. package/dist/llm-docs/components/ClockWall.md +48 -0
  30. package/dist/llm-docs/components/DatawrapperChart.md +87 -0
  31. package/dist/llm-docs/components/DocumentCloud.md +47 -0
  32. package/dist/llm-docs/components/EmbedPreviewerLink.md +35 -0
  33. package/dist/llm-docs/components/EndNotes.md +79 -0
  34. package/dist/llm-docs/components/FeaturePhoto.md +102 -0
  35. package/dist/llm-docs/components/Framer.md +44 -0
  36. package/dist/llm-docs/components/Geocoder.md +49 -0
  37. package/dist/llm-docs/components/GraphicBlock.md +319 -0
  38. package/dist/llm-docs/components/Headline.md +248 -0
  39. package/dist/llm-docs/components/Headpile.md +55 -0
  40. package/dist/llm-docs/components/HeroHeadline.md +515 -0
  41. package/dist/llm-docs/components/HorizontalScroller.md +523 -0
  42. package/dist/llm-docs/components/InfoBox.md +196 -0
  43. package/dist/llm-docs/components/KinesisLogo.md +34 -0
  44. package/dist/llm-docs/components/LanguageButton.md +170 -0
  45. package/dist/llm-docs/components/Legend.md +251 -0
  46. package/dist/llm-docs/components/Lottie.md +464 -0
  47. package/dist/llm-docs/components/PaddingReset.md +78 -0
  48. package/dist/llm-docs/components/PhotoPack.md +238 -0
  49. package/dist/llm-docs/components/PymChild.md +49 -0
  50. package/dist/llm-docs/components/ReferralBlock.md +119 -0
  51. package/dist/llm-docs/components/ReutersGraphicsLogo.md +37 -0
  52. package/dist/llm-docs/components/ReutersLogo.md +35 -0
  53. package/dist/llm-docs/components/SEO.md +113 -0
  54. package/dist/llm-docs/components/Scroller.md +350 -0
  55. package/dist/llm-docs/components/ScrollerBase.md +104 -0
  56. package/dist/llm-docs/components/ScrollerVideo.md +576 -0
  57. package/dist/llm-docs/components/SearchInput.md +44 -0
  58. package/dist/llm-docs/components/ShareBar.md +78 -0
  59. package/dist/llm-docs/components/SimpleTimeline.md +141 -0
  60. package/dist/llm-docs/components/SiteFooter.md +77 -0
  61. package/dist/llm-docs/components/SiteHeader.md +55 -0
  62. package/dist/llm-docs/components/SiteHeadline.md +111 -0
  63. package/dist/llm-docs/components/Spinner.md +43 -0
  64. package/dist/llm-docs/components/Table.md +298 -0
  65. package/dist/llm-docs/components/Theme.md +266 -0
  66. package/dist/llm-docs/components/TileMap.md +477 -0
  67. package/dist/llm-docs/components/ToolsHeader.md +46 -0
  68. package/dist/llm-docs/components/Video.md +254 -0
  69. package/dist/llm-docs/components/Visible.md +54 -0
  70. package/dist/llm-docs/components/cssVariables.md +40 -0
  71. package/dist/llm-docs/components/index.md +59 -0
  72. package/dist/llm-docs/components/resizeObserver.md +21 -0
  73. package/dist/llm-docs/guides/archieml.md +406 -0
  74. package/dist/llm-docs/guides/colours.md +443 -0
  75. package/dist/llm-docs/guides/customising-with-scss.md +61 -0
  76. package/dist/llm-docs/guides/graphics-kit.md +25 -0
  77. package/dist/llm-docs/guides/index.md +16 -0
  78. package/dist/llm-docs/guides/intro.md +21 -0
  79. package/dist/llm-docs/guides/layout.md +13 -0
  80. package/dist/llm-docs/guides/llm-docs.md +71 -0
  81. package/dist/llm-docs/guides/styles.md +16 -0
  82. package/dist/llm-docs/guides/theming.md +100 -0
  83. package/dist/llm-docs/guides/tokens.md +150 -0
  84. package/dist/llm-docs/index.md +36 -0
  85. package/package.json +18 -24
@@ -0,0 +1,102 @@
1
+ # FeaturePhoto
2
+
3
+ **Category:** Components/Multimedia/FeaturePhoto
4
+
5
+ **Import:** `import { FeaturePhoto } from '@reuters-graphics/graphics-components'`
6
+
7
+ ## Props
8
+
9
+ | Prop | Type | Default | Required | Description |
10
+ |------|------|---------|:--------:|-------------|
11
+ | `src` | `string` | — | ✓ | Photo source |
12
+ | `altText` | `string` | — | ✓ | Photo altText |
13
+ | `id` | `string` | `''` | | Add an id to target with custom CSS. |
14
+ | `class` | `string` | `''` | | Add classes to target with custom CSS. |
15
+ | `caption` | `string` | — | | Photo caption |
16
+ | `height` | `number` | `100` | | Height of the photo placeholder when lazy-loading |
17
+ | `width` | `ContainerWidth` | `'normal'` | | Width of the container: normal, wide, wider, widest or fluid Options: `normal`, `wide`, `wider`, `widest`, `fluid` |
18
+ | `textWidth` | `ContainerWidth` | `'normal'` | | Set a different width for the text vs the photo. For example, "normal" to keep the title, description and notes inline with the rest of the text well. Can't ever be wider than `width`. Options: `normal`, `wide`, `wider`, `widest`, `fluid` |
19
+ | `lazy` | `boolean` | `true` | | Whether to lazy load the photo using the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) |
20
+ | `top` | `number` | `0` | | Set Intersection Observer [rootMargin](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#rootmargin) `top` when lazy loading. |
21
+ | `bottom` | `number` | `0` | | Set Intersection Observer [rootMargin](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#rootmargin) `bottom` when lazy loading. |
22
+ | `left` | `number` | `0` | | Set Intersection Observer [rootMargin](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#rootmargin) `left` when lazy loading. |
23
+ | `right` | `number` | `0` | | Set Intersection Observer [rootMargin](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#rootmargin) `right` when lazy loading. |
24
+
25
+ ## Examples
26
+
27
+ ### Demo
28
+
29
+ ```svelte
30
+ <FeaturePhoto src={/* sharkSrc */} altText="A shark!" caption="Carcharodon carcharias - REUTERS" />
31
+ ```
32
+
33
+ ### Missing altText
34
+
35
+ ```svelte
36
+ <FeaturePhoto src={/* sharkSrc */} caption="Carcharodon carcharias - REUTERS" />
37
+ ```
38
+
39
+ ## Documentation
40
+
41
+ # FeaturePhoto
42
+
43
+ The `FeaturePhoto` component adds a full-width photo.
44
+
45
+ ```svelte
46
+ <script>
47
+ import { FeaturePhoto } from '@reuters-graphics/graphics-components';
48
+ import { asset } from '$app/paths'; // 👈 If using in the graphics kit...
49
+ </script>
50
+
51
+ <FeaturePhoto
52
+ src={asset('/images/myImage.jpg')}
53
+ altText="Some alt text"
54
+ caption="A caption"
55
+ />
56
+ ```
57
+
58
+ ## Using with ArchieML docs
59
+
60
+ With the graphics kit, you'll likely get your text value from an ArchieML doc...
61
+
62
+ ```yaml
63
+ # ArchieML doc
64
+ [blocks]
65
+
66
+ type: photo
67
+ width: normal
68
+ src: images/shark.jpg
69
+ altText: The king of the sea
70
+ caption: Carcharodon carcharias - REUTERS
71
+
72
+ []
73
+ ```
74
+
75
+ ... which you'll parse out of a ArchieML block object before passing to the `FeaturePhoto` component.
76
+
77
+ ```svelte
78
+ <!-- App.svelte -->
79
+ <script>
80
+ import { FeaturePhoto } from '@reuters-graphics/graphics-components';
81
+
82
+ import content from '$locales/en/content.json';
83
+ import { asset } from '$app/paths';
84
+ </script>
85
+
86
+ {#each content.blocks as block}
87
+ {#if block.Type === 'text'}
88
+ <!-- ... -->
89
+ {:else if block.type === 'photo'}
90
+ <FeaturePhoto
91
+ width={block.width}
92
+ src={asset(`/${block.src}`)}
93
+ altText={block.altText}
94
+ caption={block.caption}
95
+ />
96
+ {/if}
97
+ {/each}
98
+ ```
99
+
100
+ ## Missing alt text
101
+
102
+ `altText` is required in this component. If your photo is missing it, a small red text box will overlay the image.
@@ -0,0 +1,44 @@
1
+ # Framer
2
+
3
+ **Category:** Components/Utilities/Framer
4
+
5
+ **Import:** `import { Framer } from '@reuters-graphics/graphics-components'`
6
+
7
+ ## Props
8
+
9
+ | Prop | Type | Default | Required | Description |
10
+ |------|------|---------|:--------:|-------------|
11
+ | `embeds` | `string[]` | `[]` | | — |
12
+ | `breakpoints` | `number[]` | `[330, 510, 660, 930, 1200]` | | — |
13
+ | `minFrameWidth` | `number` | `320` | | — |
14
+ | `maxFrameWidth` | `number` | `1200` | | — |
15
+ | `searchType` | `'dropdown' \| 'typeahead'` | `'dropdown'` | | — |
16
+
17
+ ## Examples
18
+
19
+ ### Demo
20
+
21
+ ```svelte
22
+ <Framer
23
+ embeds={[
24
+ 'https://graphics.reuters.com/USA-CONGRESS/FUNDRAISING/zjvqkawjlvx/embeds/en/embed/?zzz',
25
+ 'https://www.reuters.com/graphics/UKRAINE-CRISIS/MAP/klvymdzdrvg/embeds/en/map/',
26
+ ]}
27
+ />
28
+ ```
29
+
30
+ ## Documentation
31
+
32
+ # FeaturePhoto
33
+
34
+ An embed tool for development in the graphics kit.
35
+
36
+ ```svelte
37
+ <script>
38
+ import { Framer } from '@reuters-graphics/graphics-components';
39
+
40
+ const embeds = ['/embeds/my-chart/index.html'];
41
+ </script>
42
+
43
+ <Framer {embeds} />
44
+ ```
@@ -0,0 +1,49 @@
1
+ # Geocoder
2
+
3
+ **Category:** Components/Controls/Geocoder
4
+
5
+ **Import:** `import { Geocoder } from '@reuters-graphics/graphics-components'`
6
+
7
+ ## Props
8
+
9
+ | Prop | Type | Default | Required | Description |
10
+ |------|------|---------|:--------:|-------------|
11
+ | `accessToken` | `string` | — | ✓ | Mapbox public access token. |
12
+ | `searchPlaceholder` | `string` | `'Search for a location'` | | Placeholder text shown in the search input. |
13
+ | `onselect` | `(location: { lng: number; lat: number; name: string }) => void` | — | | Callback fired when a location is selected from the results. |
14
+ | `minLength` | `number` | `2` | | Minimum number of characters before a request is made. Raising this cuts the number of paid geocoding requests per search. Defaults to 2. |
15
+ | `debounceMs` | `number` | `300` | | Debounce window in milliseconds between the last keystroke and the request. Raising this fires fewer requests while the user is still typing (each request is billed). Defaults to 300. |
16
+
17
+ ## Examples
18
+
19
+ ### Demo
20
+
21
+ ```svelte
22
+ <div style="min-height: 330px; padding-top: 1rem;">
23
+ <Geocoder {accessToken} onselect={handleSelect} />
24
+ </div>
25
+ ```
26
+
27
+ ## Documentation
28
+
29
+ # Geocoder
30
+
31
+ The `Geocoder` component provides an autocomplete location search powered by the [Mapbox Geocoding v6 API](https://docs.mapbox.com/api/search/geocoding-v6/). It returns coordinates and a place name via the `onselect` callback.
32
+
33
+ ```svelte
34
+ <script>
35
+ import { Geocoder } from '@reuters-graphics/graphics-components';
36
+
37
+ const MAPBOX_TOKEN = 'your_mapbox_token';
38
+
39
+ function handleSelect(location) {
40
+ console.log(location.name, location.lng, location.lat);
41
+ }
42
+ </script>
43
+
44
+ <Geocoder accessToken={MAPBOX_TOKEN} onselect={handleSelect} />
45
+ ```
46
+
47
+ The `accessToken` prop is required. Look up the Reuters Mapbox token in the team's 1Password vault. All [Mapbox forward geocoding options](https://docs.mapbox.com/api/search/geocoding-v6/#forward-geocoding) are available as props, including `country`, `language`, `types`, `bbox`, `proximity`, `limit`, and `worldview`.
48
+
49
+ To reduce the number of paid geocoding requests, use `minLength` (minimum characters before searching, default `2`) and `debounceMs` (delay after the last keystroke before requesting, default `300`). Raising them fires fewer requests while the user is still typing.
@@ -0,0 +1,319 @@
1
+ # GraphicBlock
2
+
3
+ **Category:** Components/Graphics/GraphicBlock
4
+
5
+ **Import:** `import { GraphicBlock } from '@reuters-graphics/graphics-components'`
6
+
7
+ ## Props
8
+
9
+ | Prop | Type | Default | Required | Description |
10
+ |------|------|---------|:--------:|-------------|
11
+ | `children` | `Snippet` | — | ✓ | Content to place inside `GraphicBlock` |
12
+ | `id` | `string` | `''` | | Add an id to the block tag to target it with custom CSS. |
13
+ | `class` | `string` | `''` | | Add classes to the block tag to target it with custom CSS. |
14
+ | `snap` | `boolean` | `false` | | Snap block to column widths, rather than fluidly resizing them. |
15
+ | `role` | `string` | — | | ARIA [role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles) for the block |
16
+ | `notes` | `string \| Snippet` | — | | Notes to the graphic, passed in as a markdown string OR as a custom snippet. |
17
+ | `width` | `ContainerWidth` | `'normal'` | | Width of the component within the text well. Options: `normal`, `wide`, `wider`, `widest`, `fluid` |
18
+ | `textWidth` | `ContainerWidth` | `'normal'` | | Set a different width for the text within the text well, for example, "normal" to keep the title, description and notes inline with the rest of the text well. Can't ever be wider than `width`. Options: `normal`, `wide`, `wider`, `widest`, `fluid` |
19
+ | `title` | `string \| Snippet` | — | | Title of the graphic as a string or a custom snippet. |
20
+ | `description` | `string` | — | | Description of the graphic, passed in as a markdown string. |
21
+ | `ariaLabel` | `string` | `'chart'` | | ARIA [label](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) for the block |
22
+ | `ariaDescription` | `string \| Snippet` | — | | ARIA description, passed in as a markdown string OR as a custom snippet. |
23
+
24
+ ## Examples
25
+
26
+ ### Demo
27
+
28
+ ```svelte
29
+ <GraphicBlock
30
+ title="Title for my chart"
31
+ description="Some description for your chart."
32
+ notes={`Note: Data current as of Aug. 2, 2022.\n\nSource: [Google research](https://google.com)`}
33
+ >
34
+ <div id="my-chart">
35
+ <img src={PlaceholderImg} alt="placeholder" />
36
+ </div>
37
+ </GraphicBlock>
38
+ ```
39
+
40
+ ### Ai2svelte and ArchieML
41
+
42
+ ```svelte
43
+ <GraphicBlock
44
+ title="Earthquake in Haiti"
45
+ description="The 7.2-magnitude earthquake struck at 8:29 a.m. EST, Aug. 14, 2021."
46
+ notes="Note: A shakemap represents the ground shaking produced by an earthquake."
47
+ >
48
+ <AiMap />
49
+ </GraphicBlock>
50
+ ```
51
+
52
+ ### Custom text
53
+
54
+ ```svelte
55
+ <GraphicBlock>
56
+ <div class="demo-graphic">
57
+ <img src={PlaceholderImg} alt="placeholder" />
58
+ </div>
59
+
60
+ {#snippet title()}
61
+ <h5>My smaller title</h5>
62
+ {/snippet}
63
+
64
+ {#snippet notes()}
65
+ <aside>
66
+ <p><strong>Note:</strong> Data current as of Aug. 2, 2022.</p>
67
+ </aside>
68
+ {/snippet}
69
+ </GraphicBlock>
70
+ ```
71
+
72
+ ### AREA description
73
+
74
+ ```svelte
75
+ <GraphicBlock
76
+ title="Earthquake in Haiti"
77
+ description="The 7.2-magnitude earthquake struck at 8:29 a.m. EST, Aug. 14, 2021."
78
+ notes="Note: A shakemap represents the ground shaking produced by an earthquake."
79
+ ariaDescription="A map showing the shake intensity produced by the earthquake."
80
+ >
81
+ <AiMap />
82
+ </GraphicBlock>
83
+ ```
84
+
85
+ ### Custom AREA description
86
+
87
+ ```svelte
88
+ <GraphicBlock
89
+ title="Earthquake in Haiti"
90
+ description="The 7.2-magnitude earthquake struck at 8:29 a.m. EST, Aug. 14, 2021."
91
+ notes="Note: A shakemap represents the ground shaking produced by an earthquake."
92
+ >
93
+ <AiMap />
94
+ {#snippet ariaDescription()}
95
+ <p>
96
+ A shakemap shows the intensity of the 7.2-magnitude earthquake that
97
+ struck Haiti at 8:29 a.m. EST, Aug. 14, 2021.
98
+ </p>
99
+ <table>
100
+ <tbody>
101
+ <tr>
102
+ <th>City</th>
103
+ <th>Felt shake strength</th>
104
+ </tr>
105
+ <tr>
106
+ <td>Les Cayes</td>
107
+ <td>Very strong</td>
108
+ </tr>
109
+ <tr>
110
+ <td>Jeremie</td>
111
+ <td>Strong</td>
112
+ </tr>
113
+ </tbody>
114
+ </table>
115
+ {/snippet}
116
+ </GraphicBlock>
117
+ ```
118
+
119
+ ## Documentation
120
+
121
+ # GraphicBlock
122
+
123
+ The `GraphicBlock` component is a special derivative of the [Block](?path=/docs/components-page-layout-block--docs) component that wraps around your graphic. It also adds a title, description, notes and other text elements.
124
+
125
+ Many other Reuters Graphics components use `GraphicBlock` to wrap graphics with styled text.
126
+
127
+ ```svelte
128
+ <script>
129
+ import { GraphicBlock } from '@reuters-graphics/graphics-components';
130
+ </script>
131
+
132
+ <GraphicBlock
133
+ title="Title for my chart"
134
+ description="Some description for your chart."
135
+ notes={`Note: Data current as of Aug. 2, 2022.\n\nSource: [Google research](https://google.com)`}
136
+ >
137
+ <!-- Your chart goes here -->
138
+ <div id="my-chart" />
139
+ </GraphicBlock>
140
+ ```
141
+
142
+ ## Using with ai2svelte and ArchieML docs
143
+
144
+ The `GraphicBlock` component is built to handle [ai2svelte](https://github.com/reuters-graphics/ai2svelte) graphics in graphics kit.
145
+
146
+ You'll likely get your text value from an ArchieML doc...
147
+
148
+ ```yaml
149
+ # ArchieML doc
150
+ [blocks]
151
+ type: ai-graphic
152
+ width: normal
153
+ chart: AiMap # IMPORTANT: This must match the name of the ai2svelte chart you import in App.svelte
154
+ title: Earthquake in Haiti
155
+ description: The 7.2-magnitude earthquake struck at 8:29 a.m. EST, Aug. 14, 2021.
156
+ notes: \Note: A shakemap represents the ground shaking produced by an earthquake.
157
+
158
+ \Source: USGIS
159
+ :end
160
+ altText: A map that shows the shake intensity of the earthquake, which was worst in central Haiti.
161
+ :end
162
+ []
163
+ ```
164
+
165
+ ... which you'll parse out of a ArchieML block object before passing to the `GraphicBlock` component.
166
+
167
+ To pass your ai2svelte graphic into `GraphicBlock` component, import your ai2svelte graphic at the top of `App.svelte` and add it to the `aiCharts` object.
168
+
169
+ > **Important❗:** Make sure that the value for `chart` in the ArchieML doc matches the name of the ai2svelte file imported in `App.svelte`.
170
+
171
+ ```svelte
172
+ <!-- App.svelte -->
173
+ <script>
174
+ // IMPORTANT: The name of your ai2svelte chart must match `chart` in your ArchieML doc
175
+ import AiMap from './ai2svelte/my-map.svelte';
176
+ // Error handler for missing ai2svelte charts
177
+ import LogBlock from './components/dev/LogBlock.svelte';
178
+
179
+ // If using with the graphics kit
180
+ import { asset } from '$app/paths';
181
+
182
+ // A built-in helper function in Graphis Kit for validating container width
183
+ import { containerWidth } from '$utils/propValidators';
184
+
185
+ // Add your imported ai2svelte charts to this object
186
+ const aiCharts = {
187
+ AiMap,
188
+ // Other ai2svelte graphics...
189
+ };
190
+ </script>
191
+
192
+ <!-- Loop through ArchieML blocks -->
193
+ {#each content.blocks as block}
194
+ {#if block.type === 'ai-graphic'}
195
+ {#if !aiCharts[block.chart]}
196
+ <!-- Error message for when the ai2svelte chart is missing -->
197
+ <LogBlock message={`Unable to find "${block.chart}" in aiCharts`} />
198
+ {:else}
199
+ <!-- Get the ai2svelte graphic specified by `chart` in ArchieML -->
200
+ {@const AiChart = aiCharts[block.chart]}
201
+ <GraphicBlock
202
+ id={block.chart}
203
+ width={containerWidth(block.width)}
204
+ title={block.title}
205
+ description={block.description}
206
+ notes={block.notes}
207
+ ariaDescription={block.altText}
208
+ >
209
+ <!-- In graphics kit, pass the `assetsPath` prop -->
210
+ <AiChart assetsPath={asset('/').replace(/\/$/, '')} />
211
+ </GraphicBlock>
212
+ {/if}
213
+ {/if}
214
+ {/each}
215
+ ```
216
+
217
+ ## Custom text
218
+
219
+ You can override the default styles for title and notes by making your own custom elements and passing them as `title` and `notes` [snippets](https://svelte.dev/docs/svelte/snippet) instead of as strings:
220
+
221
+ ```svelte
222
+ <GraphicBlock>
223
+ <!-- Custom title snippet -->
224
+ {#snippet title()}
225
+ <h5>My smaller title</h5>
226
+ {/snippet}
227
+
228
+ <!-- Your graphic -->
229
+ <div id="my-chart"></div>
230
+
231
+ <!-- Custom notes snippet -->
232
+ {#snippet notes()}
233
+ <aside>
234
+ <p><strong>Note:</strong> Data current as of Aug. 2, 2022.</p>
235
+ </aside>
236
+ {/snippet}
237
+ </GraphicBlock>
238
+ ```
239
+
240
+ ## ARIA descriptions
241
+
242
+ If the text in your chart isn't easily read by screen readers — for example, a map with annotations that wouldn't make sense without the visual — add an `ariaDescription` that describes the chart.
243
+
244
+ The `ariaDescription` string will be processed as markdown, so you can add multiple paragraphs, links, headers, etc. in markdown.
245
+
246
+ > **Note:** When you set an `ariaDescription`, your graphic will be automatically wrapped in a div with [aria-hidden="true"](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-hidden), which tells screen readers to read the hidden ARIA description and skip the text in the graphic.
247
+
248
+ ```svelte
249
+ <GraphicBlock
250
+ title="Earthquake in Haiti"
251
+ description="The 7.2-magnitude earthquake struck at 8:29 a.m. EST, Aug. 14, 2021."
252
+ notes="Note: A shakemap represents the ground shaking produced by an earthquake."
253
+ ariaDescription="A map showing the shake intensity produced by the earthquake."
254
+ >
255
+ <!-- In graphics kit, pass the `assetsPath` prop -->
256
+ <AiChart assetsPath={asset('/').replace(/\/$/, '')} />
257
+ </GraphicBlock>
258
+ ```
259
+
260
+ ## Custom ARIA descriptions
261
+
262
+ Sometimes, instead of a simple sentence, we want to provide a data table or something more complex as an ARIA description. To do this, pass the custom elements as an `ariaDescription` [snippet](https://svelte.dev/docs/svelte/snippet) instead of as a string, as in the [example above](?path=/docs/components-graphics-graphicblock--docs#aria-descriptions).
263
+
264
+ [Read this](https://accessibility.psu.edu/images/charts/) for more information on using screen reader data tables for charts.
265
+
266
+ > **Note:** The `customAria` snippet will override the `ariaDescription` and will also hide the text in your graphic from screen readers.
267
+
268
+ ```svelte
269
+ <GraphicBlock
270
+ title="Earthquake in Haiti"
271
+ description="The 7.2-magnitude earthquake struck at 8:29 a.m. EST, Aug. 14, 2021."
272
+ notes="Note: A shakemap represents the ground shaking produced by an earthquake."
273
+ >
274
+ <!-- In graphics kit, pass the `assetsPath` prop -->
275
+ <AiChart assetsPath={asset('/').replace(/\/$/, '')} />
276
+
277
+ <!-- Custom ARIA description snippet -->
278
+ {#snippet ariaDescription()}
279
+ <p>
280
+ A shakemap shows the intensity of the 7.2-magnitude earthquake that struck
281
+ Haiti at 8:29 a.m. EST, Aug. 14, 2021.
282
+ </p>
283
+ <table>
284
+ <tbody>
285
+ <tr>
286
+ <th>City</th>
287
+ <th>Felt shake strength</th>
288
+ </tr>
289
+ <tr>
290
+ <td>Les Cayes</td>
291
+ <td>Very strong</td>
292
+ </tr>
293
+ <tr>
294
+ <td>Jeremie</td>
295
+ <td>Strong</td>
296
+ </tr>
297
+ </tbody>
298
+ </table>
299
+ {/snippet}
300
+ </GraphicBlock>
301
+
302
+ <!-- Optionally, style the visually hidden table nicely for sighted readers who use screen readers -->
303
+ <style lang="scss">
304
+ table {
305
+ width: 100%;
306
+ border-collapse: collapse;
307
+
308
+ th,
309
+ td {
310
+ border: 1px solid #ddd;
311
+ padding: 8px;
312
+ }
313
+
314
+ th {
315
+ background-color: #f2f2f2;
316
+ }
317
+ }
318
+ </style>
319
+ ```