@reuters-graphics/graphics-components 3.10.0 → 3.10.1

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 (67) hide show
  1. package/dist/llm-docs/components/AdSlot.md +11 -0
  2. package/dist/llm-docs/components/Analytics.md +89 -0
  3. package/dist/llm-docs/components/Article.md +183 -0
  4. package/dist/llm-docs/components/BeforeAfter.md +170 -0
  5. package/dist/llm-docs/components/BioBox.md +74 -0
  6. package/dist/llm-docs/components/Block.md +211 -0
  7. package/dist/llm-docs/components/BlogPost.md +68 -0
  8. package/dist/llm-docs/components/BlogTOC.md +91 -0
  9. package/dist/llm-docs/components/BodyText.md +143 -0
  10. package/dist/llm-docs/components/Byline.md +242 -0
  11. package/dist/llm-docs/components/ClockWall.md +48 -0
  12. package/dist/llm-docs/components/DatawrapperChart.md +87 -0
  13. package/dist/llm-docs/components/DocumentCloud.md +47 -0
  14. package/dist/llm-docs/components/EmbedPreviewerLink.md +35 -0
  15. package/dist/llm-docs/components/EndNotes.md +79 -0
  16. package/dist/llm-docs/components/FeaturePhoto.md +102 -0
  17. package/dist/llm-docs/components/Framer.md +44 -0
  18. package/dist/llm-docs/components/Geocoder.md +49 -0
  19. package/dist/llm-docs/components/GraphicBlock.md +319 -0
  20. package/dist/llm-docs/components/Headline.md +248 -0
  21. package/dist/llm-docs/components/Headpile.md +55 -0
  22. package/dist/llm-docs/components/HeroHeadline.md +515 -0
  23. package/dist/llm-docs/components/HorizontalScroller.md +523 -0
  24. package/dist/llm-docs/components/InfoBox.md +196 -0
  25. package/dist/llm-docs/components/KinesisLogo.md +34 -0
  26. package/dist/llm-docs/components/LanguageButton.md +171 -0
  27. package/dist/llm-docs/components/Legend.md +251 -0
  28. package/dist/llm-docs/components/Lottie.md +464 -0
  29. package/dist/llm-docs/components/PaddingReset.md +78 -0
  30. package/dist/llm-docs/components/PhotoPack.md +237 -0
  31. package/dist/llm-docs/components/PymChild.md +49 -0
  32. package/dist/llm-docs/components/ReferralBlock.md +119 -0
  33. package/dist/llm-docs/components/ReutersGraphicsLogo.md +37 -0
  34. package/dist/llm-docs/components/ReutersLogo.md +35 -0
  35. package/dist/llm-docs/components/SEO.md +113 -0
  36. package/dist/llm-docs/components/Scroller.md +350 -0
  37. package/dist/llm-docs/components/ScrollerBase.md +104 -0
  38. package/dist/llm-docs/components/ScrollerVideo.md +576 -0
  39. package/dist/llm-docs/components/SearchInput.md +44 -0
  40. package/dist/llm-docs/components/ShareBar.md +78 -0
  41. package/dist/llm-docs/components/SimpleTimeline.md +141 -0
  42. package/dist/llm-docs/components/SiteFooter.md +77 -0
  43. package/dist/llm-docs/components/SiteHeader.md +55 -0
  44. package/dist/llm-docs/components/SiteHeadline.md +111 -0
  45. package/dist/llm-docs/components/Spinner.md +43 -0
  46. package/dist/llm-docs/components/Table.md +298 -0
  47. package/dist/llm-docs/components/Theme.md +266 -0
  48. package/dist/llm-docs/components/TileMap.md +477 -0
  49. package/dist/llm-docs/components/ToolsHeader.md +46 -0
  50. package/dist/llm-docs/components/Video.md +254 -0
  51. package/dist/llm-docs/components/Visible.md +54 -0
  52. package/dist/llm-docs/components/cssVariables.md +40 -0
  53. package/dist/llm-docs/components/index.md +59 -0
  54. package/dist/llm-docs/components/resizeObserver.md +21 -0
  55. package/dist/llm-docs/guides/archieml.md +406 -0
  56. package/dist/llm-docs/guides/colours.md +443 -0
  57. package/dist/llm-docs/guides/customising-with-scss.md +61 -0
  58. package/dist/llm-docs/guides/graphics-kit.md +25 -0
  59. package/dist/llm-docs/guides/index.md +16 -0
  60. package/dist/llm-docs/guides/intro.md +21 -0
  61. package/dist/llm-docs/guides/layout.md +13 -0
  62. package/dist/llm-docs/guides/llm-docs.md +71 -0
  63. package/dist/llm-docs/guides/styles.md +16 -0
  64. package/dist/llm-docs/guides/theming.md +100 -0
  65. package/dist/llm-docs/guides/tokens.md +150 -0
  66. package/dist/llm-docs/index.md +36 -0
  67. package/package.json +1 -1
@@ -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 { assets } 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={assets || '/'} />
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={assets || '/'} />
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={assets || '/'} />
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
+ ```
@@ -0,0 +1,248 @@
1
+ # Headline
2
+
3
+ **Category:** Components/Text elements/Headline
4
+
5
+ **Import:** `import { Headline } from '@reuters-graphics/graphics-components'`
6
+
7
+ ## Props
8
+
9
+ | Prop | Type | Default | Required | Description |
10
+ |------|------|---------|:--------:|-------------|
11
+ | `hed` | `string \| Snippet` | `'Reuters Graphics Interactive'` | | Headline, parsed as an _inline_ markdown string in an `h1` element OR as a custom snippet. |
12
+ | `class` | `string` | `''` | | Add extra classes to the block tag to target it with custom CSS. |
13
+ | `hedSize` | `HeadlineSize` | `'normal'` | | Headline size: small, normal, big, bigger, biggest Options: `small`, `normal`, `big`, `bigger`, `biggest` |
14
+ | `dek` | `string \| Snippet` | — | | Dek, parsed as a markdown string OR as a custom snippet. |
15
+ | `section` | `string` | — | | Section title |
16
+ | `authors` | `string[]` | `[]` | | Array of author names, which will be slugified to create links to Reuters author pages |
17
+ | `publishTime` | `string` | `''` | | Publish time as a datetime string. |
18
+ | `updateTime` | `string` | `''` | | Update time as a datetime string. |
19
+ | `width` | `'normal' \| 'wide' \| 'wider' \| 'widest'` | `'normal'` | | Width of the headline: normal, wide, wider, widest Options: `normal`, `wide`, `wider`, `widest` |
20
+ | `getAuthorPage` | `(author: string) => string` | — | | Custom function that returns an author page URL. |
21
+ | `crown` | `Snippet` | — | | Custom crown snippet |
22
+ | `byline` | `Snippet` | — | | Optional snippet for a custom byline. |
23
+ | `published` | `Snippet` | — | | Optional snippet for a custom published dateline. |
24
+ | `updated` | `Snippet` | — | | Optional snippet for a custom updated dateline. |
25
+
26
+ ## Examples
27
+
28
+ ### Demo
29
+
30
+ ```svelte
31
+ <Headline
32
+ hed="Reuters Graphics interactive"
33
+ dek="The beginning of a beautiful page"
34
+ section="World News"
35
+ />
36
+ ```
37
+
38
+ ### With byline and dateline
39
+
40
+ ```svelte
41
+ <Headline
42
+ hed={'Reuters Graphics Interactive'}
43
+ dek={'The beginning of a beautiful page'}
44
+ section={'Global news'}
45
+ authors={['Jane Doe']}
46
+ publishTime={new Date('2020-01-01').toISOString()}
47
+ getAuthorPage={(author: string) => {
48
+ return `mailto:${author.replace(' ', '')}@example.com`;
49
+ }}
50
+ />
51
+ ```
52
+
53
+ ### Custom hed and dek
54
+
55
+ ```svelte
56
+ <Headline width="wide">
57
+ {#snippet hed()}
58
+ <h1 class="custom-hed">
59
+ <span class="small block text-base">The secret to</span>
60
+ “The Nutcracker's”
61
+ <span class="small block text-base fpt-1">success</span>
62
+ </h1>
63
+ {/snippet}
64
+ {#snippet dek()}
65
+ <p class="custom-dek !fmt-3">
66
+ How “The Nutcracker” ballet became an<span
67
+ class="font-medium mx-1 px-1.5 py-1">American holday staple</span
68
+ >and a financial pillar of ballet companies across the country
69
+ </p>
70
+ {/snippet}
71
+ </Headline>
72
+ ```
73
+
74
+ ### Crown image
75
+
76
+ ```svelte
77
+ <Headline
78
+ class="!fmt-3"
79
+ hed="Europa"
80
+ publishTime={new Date('2020-01-01').toISOString()}
81
+ >
82
+ <!-- Add a crown -->
83
+ {#snippet crown()}
84
+ <img
85
+ src={crownImgSrc}
86
+ width="100"
87
+ class="mx-auto mb-0"
88
+ alt="Illustration of Europe"
89
+ />
90
+ {/snippet}
91
+ </Headline>
92
+ ```
93
+
94
+ ### Crown graphic
95
+
96
+ ```svelte
97
+ <Headline
98
+ width="wider"
99
+ class="!fmt-1"
100
+ hed={'Unfriendly skies'}
101
+ dek={'How Russia’s invasion of Ukraine is redrawing air routes'}
102
+ section={'Ukraine Crisis'}
103
+ authors={['Simon Scarr', 'Vijdan Mohammad Kawoosa']}
104
+ publishTime={new Date('2022-03-04').toISOString()}
105
+ >
106
+ <!-- Add a crown graphic -->
107
+ {#snippet crown()}
108
+ <Map />
109
+ {/snippet}
110
+ </Headline>
111
+ ```
112
+
113
+ ## Documentation
114
+
115
+ # Headline
116
+
117
+ The `Headline` component creates headlines in the legacy Reuters Graphics style, with the text centred on the page.
118
+
119
+ ```svelte
120
+ <script>
121
+ import { Headline } from '@reuters-graphics/graphics-components';
122
+ </script>
123
+
124
+ <Headline
125
+ hed="Reuters Graphics Interactive"
126
+ dek="The beginning of a beautiful page"
127
+ section="World News"
128
+ />
129
+ ```
130
+
131
+ ## With bylines and dateline
132
+
133
+ Optionally, you can add authors and a publish time to the headline, which the `Headline` component internally renders with the [Byline](./?path=/docs/components-text-elements-byline--docs) component.
134
+
135
+ > **Note**: Since `Headline` uses `Byline`, you can customise the author page hyperlink and bylines with the `getAuthorPage`, `byline`, `published` and `updated` props.
136
+
137
+ ```svelte
138
+ <script>
139
+ import { Headline } from '@reuters-graphics/graphics-components';
140
+ </script>
141
+
142
+ <Headline
143
+ hed={'Reuters Graphics Interactive'}
144
+ dek={'The beginning of a beautiful page'}
145
+ section={'Global news'}
146
+ authors={['Jane Doe']}
147
+ publishTime={new Date('2020-01-01').toISOString()}
148
+ getAuthorPage={(author) => `mailto:${author.replace(' ', '')}@example.com`}
149
+ />
150
+ ```
151
+
152
+ ## Custom hed and dek
153
+
154
+ Use the `hed` and/or `dek` [snippets](https://svelte.dev/docs/svelte/snippet) to override those elements with custom elements.
155
+
156
+ ```svelte
157
+ <script>
158
+ import { Headline } from '@reuters-graphics/graphics-components';
159
+ </script>
160
+
161
+ <Headline width="wide">
162
+ <!-- Custom hed snippet -->
163
+ {#snippet hed()}
164
+ <h1 class="custom-hed">
165
+ <span class="small block text-base">The secret to</span>
166
+ “The Nutcracker's”
167
+ <span class="small block text-base fpt-1">success</span>
168
+ </h1>
169
+ {/snippet}
170
+
171
+ <!-- Custom dek snippet -->
172
+ {#snippet dek()}
173
+ <p class="custom-dek !fmt-3">
174
+ How “The Nutcracker” ballet became an<span
175
+ class="font-medium mx-1 px-1.5 py-1">American holday staple</span
176
+ >and a financial pillar of ballet companies across the country
177
+ </p>
178
+ {/snippet}
179
+ </Headline>
180
+
181
+ <!-- Custom styles -->
182
+ <style lang="scss">
183
+ .custom-hed {
184
+ line-height: 0.9;
185
+ }
186
+ .custom-dek {
187
+ span {
188
+ background-color: #fde68a;
189
+ }
190
+ }
191
+ </style>
192
+ ```
193
+
194
+ ## With crown image
195
+
196
+ To add a crown image, use the `crown` [snippet](https://svelte.dev/docs/svelte/snippet).
197
+
198
+ ```svelte
199
+ <script>
200
+ import { Headline } from '@reuters-graphics/graphics-components';
201
+ import { assets } from '$app/paths';
202
+ </script>
203
+
204
+ <Headline
205
+ class="!fmt-3"
206
+ hed="Europa"
207
+ publishTime={new Date('2020-01-01').toISOString()}
208
+ >
209
+ <!-- Add a crown -->
210
+ {#snippet crown()}
211
+ <img
212
+ src={crownImgSrc}
213
+ width="100"
214
+ class="mx-auto mb-0"
215
+ alt="Illustration of Europe"
216
+ />
217
+ {/snippet}
218
+ </Headline>
219
+ ```
220
+
221
+ ## With crown graphic
222
+
223
+ Add a full graphic or any other component in the crown.
224
+
225
+ ```svelte
226
+ <script>
227
+ import { Headline } from '@reuters-graphics/graphics-components';
228
+ import { assets } from '$app/paths'; // If in Graphis Kit
229
+
230
+ import Map from './ai2svelte/graphic.svelte'; // Import the crown graphic component
231
+ </script>
232
+
233
+ <Headline
234
+ width="wider"
235
+ class="!fmt-1"
236
+ hed={'Unfriendly skies'}
237
+ dek={'How Russia’s invasion of Ukraine is redrawing air routes'}
238
+ section={'Ukraine Crisis'}
239
+ authors={['Simon Scarr', 'Vijdan Mohammad Kawoosa']}
240
+ publishTime={new Date('2022-03-04').toISOString()}
241
+ >
242
+ <!-- Add a crown graphic -->
243
+ {#snippet crown()}
244
+ <!-- Pass `assetsPath` if in graphics kit -->
245
+ <Map assetsPath={assets || '/'} />
246
+ {/snippet}
247
+ </Headline>
248
+ ```
@@ -0,0 +1,55 @@
1
+ # Headpile
2
+
3
+ **Category:** Components/Text elements/Headpile
4
+
5
+ **Import:** `import { Headpile } from '@reuters-graphics/graphics-components'`
6
+
7
+ ## Props
8
+
9
+ | Prop | Type | Default | Required | Description |
10
+ |------|------|---------|:--------:|-------------|
11
+ | `class` | `string` | — | ✓ | Add classes to target with custom CSS. |
12
+ | `id` | `string` | — | ✓ | Add an id to target with custom CSS. |
13
+ | `width` | `Extract<ContainerWidth, 'normal' \| 'wide'>` | `'normal'` | | Width of the container. |
14
+ | `colour` | `string` | `'#cccccc'` | | Default background colour to be used as a mount behind the headshot. |
15
+ | `figures` | `{ /** * Headshot image src. Be sure to prefix the image * * ```typescript * import { assets } from '$app/paths'; * * const imgSrc = `${assets}/images/my-image.jpg`; * ``` */ img: string; /** * Figure name. */ name: string; /** * Figure role or title. */ role?: string; /** * Text describing the person. */ text: string; /** * Background colour to be used as a mount behind the headshot. */ colour?: string; }[]` | — | ✓ | Individual figures -- i.e., people -- for the headpile. |
16
+
17
+ ## Examples
18
+
19
+ ### Demo
20
+
21
+ ```svelte
22
+ <Headpile figures={/* defaultArgs */} />
23
+ ```
24
+
25
+ ## Documentation
26
+
27
+ # Headpile
28
+
29
+ The `Headpile` component is a headshot-bulleted list of people, identifying them with their names, roles and a short description of their significance to a story.
30
+
31
+ It's designed to be used with headshots that have had their background removed, which can be done in the [Preview app](https://support.apple.com/en-gb/guide/preview/prvw15636/mac?#apd320b3b1b750a4) on macOS.
32
+
33
+ ```svelte
34
+ <script>
35
+ import { Headpile } from '@reuters-graphics/graphics-components';
36
+ import { assets } from '$app/paths'; // 👈 If using in the graphics kit...
37
+ </script>
38
+
39
+ <Headpile
40
+ figures={[
41
+ {
42
+ img: `${assets}/images/person-A.jpg`,
43
+ name: 'General Abdel Fattah al-Burhan',
44
+ role: "Sudan's Sovereign Council Chief and military commander",
45
+ text: 'Burhan was little known in public life until taking part in the coup ...',
46
+ },
47
+ {
48
+ img: `${assets}/images/person-B.jpg`,
49
+ name: 'General Mohamed Hamdan Dagalo',
50
+ role: 'Leader of the Sudanese paramilitary Rapid Support Forces (RSF)',
51
+ text: 'Popularly known as Hemedti, Dagalo rose from lowly beginnings ...',
52
+ },
53
+ ]}
54
+ />
55
+ ```