@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,464 @@
1
+ # Lottie
2
+
3
+ **Category:** Components/Multimedia/Lottie
4
+
5
+ **Import:** `import { Lottie } from '@reuters-graphics/graphics-components'`
6
+
7
+ ## Examples
8
+
9
+ ### Demo
10
+
11
+ ```svelte
12
+ {#snippet template(args)}
13
+ <Lottie {...args} src={DemoLottie} />
14
+ {/snippet}
15
+ ```
16
+
17
+ ### Segment
18
+
19
+ ```svelte
20
+ {#snippet template(args)}
21
+ <Lottie {...args} src={DemoLottie} />
22
+ {/snippet}
23
+ ```
24
+
25
+ ### Marker
26
+
27
+ ```svelte
28
+ {#snippet template(args)}
29
+ <Lottie {...args} src={MarkerSample} />
30
+ {/snippet}
31
+ ```
32
+
33
+ ### Themes
34
+
35
+ ```svelte
36
+ {#snippet template(args)}
37
+ <Lottie
38
+ {...args}
39
+ src={ThemesSample}
40
+ bind:progress
41
+ themeId={progress < 0.33 ? 'Water'
42
+ : progress < 0.66 ? 'air'
43
+ : 'earth'}
44
+ />
45
+ {/snippet}
46
+ ```
47
+
48
+ ### Using with ScrollerBase
49
+
50
+ ```svelte
51
+ <WithScrollerBase />
52
+ ```
53
+
54
+ ### With foregrounds
55
+
56
+ ```svelte
57
+ <Lottie src={ForegroundSample} autoplay showDebugInfo>
58
+ <LottieForeground
59
+ startFrame={0}
60
+ endFrame={50}
61
+ position="center center"
62
+ backgroundColour="rgba(0, 0, 0)"
63
+ >
64
+ <div class="headline-container">
65
+ <Theme base="dark">
66
+ <Headline
67
+ hed="Headline"
68
+ dek="This is an example of using a Svelte component as the foreground."
69
+ authors={['Jane Doe', 'John Doe']}
70
+ />
71
+ </Theme>
72
+ </div>
73
+ </LottieForeground>
74
+
75
+ <LottieForeground
76
+ startFrame={50}
77
+ endFrame={100}
78
+ text="Foreground caption between frames 50ms and 100ms."
79
+ position="bottom center"
80
+ backgroundColour="rgba(0, 0, 0)"
81
+ width="wide"
82
+ />
83
+ </Lottie>
84
+ ```
85
+
86
+ ## Documentation
87
+
88
+ # Lottie
89
+
90
+ The `Lottie` component uses the [dotLottie-web](https://developers.lottiefiles.com/docs/dotlottie-player/dotlottie-web/) library to render Lottie animations.
91
+
92
+ ## How to prepare Lottie files
93
+
94
+ [LottieFiles](https://lottiefiles.com/) is the official platform for creating and editing Lottie animations. The free version of LottieFiles has limited features, so [Bodymovin](https://exchange.adobe.com/apps/cc/12557/bodymovin) remains a popular, free way to export Lottie animations as JSON files.
95
+
96
+ [dotLottie](https://dotlottie.io/) is another common format for Lottie files. This format bundles the Lottie JSON file and any associated assets, such as images and fonts, into a single compressed file with the extension `.lottie`.
97
+
98
+ This `Lottie` component is flexible and supports both `dotLottie` and JSON Lottie files. For best performance it is recommended that you convert your Lottie JSON file into a `.zip` file by following these steps:
99
+
100
+ 1. Export your Lottie animation as a JSON file using [Bodymovin](https://exchange.adobe.com/apps/cc/12557/bodymovin) or another Lottie exporter.
101
+ 2. Use the [LottieFiles converter](https://lottiefiles.com/tools/lottie-to-dotlottie) to convert the JSON file into a `.lottie` file.
102
+ 3. Change the file extension to `.zip` from `.lottie`. This ensures full compatibility with the Reuters graphics publisher while maintaining the benefits of dotLottie format's compression and optimisation.
103
+
104
+ ## When not to use Lottie
105
+
106
+ Lottie animations are great for lightweight, scalable animations. However, they may not be suitable for all use cases. Consider the following before using Lottie:
107
+
108
+ - **Huge raster images**: Lottie is best suited for simple to moderately complex animations. Animations with large raster images may not render well or could lead to performance issues. In such cases, consider using a [Video](?path=/docs/components-multimedia-video--docs) component or a [ScrollerVideo](?path=/docs/components-graphics-scrollervideo--docs) component instead.
109
+
110
+ - **Complex effects**: Some advanced effects and features available in After Effects may not be fully supported in Lottie, which could lead to discrepancies between the original design and the rendered animation. Check the [Lottie documentation](https://lottiefiles.com/supported-features) for a list of supported features.
111
+
112
+ - **Text rendering**: Lottie renders text as vector shapes. If you need DOM text for accessibility or CSS manipulation, consider using HTML/CSS animations instead.
113
+
114
+ - **SVG DOM manipulation**: Lottie renders animations on a canvas. If you need to manipulate individual elements of the animation using JavaScript or CSS, consider using SVG animations instead.
115
+
116
+ ## Basic demo
117
+
118
+ To use the `Lottie` component, import it and provide the Lottie animation source. The height of the container defaults to `100lvh`, but you can adjust this to any valid CSS height value such as `1200px` or `200lvh` with the `height` prop.
119
+
120
+ **Use `lvh` or `svh` units instead of `vh`** as [these units](https://www.w3.org/TR/css-values-4/#large-viewport-size) are more reliable on mobile and other devices where elements such as the address bar appear and disappear and affect the height.
121
+
122
+ The component also provides a `width` prop to set the width of the Lottie container. While the `width` prop defaults to `fluid`, it allows any `ContainerWidth` value such as `narrower`, `narrow`, `normal`, `wide`, `wider`, `widest`, `fluid`, or a custom CSS width value like `600px` or `80vw`.
123
+
124
+ If importing the Lottie file directly into a Svelte component, make sure to append **?url** to the import statement (see example below). This ensures that the file is treated as a URL.
125
+
126
+ > 💡TIP: Set `showDebugInfo` prop to `true` to display information about the component state.
127
+
128
+ [Demo](?path=/story/components-graphics-scrollerlottie--demo)
129
+
130
+ ```svelte
131
+ <script lang="ts">
132
+ import { Lottie } from '@reuters-graphics/graphics-components';
133
+
134
+ // Import Lottie file
135
+ import MyLottie from './lottie/my-lottie.zip?url'; // Append **?url** to the file path
136
+ </script>
137
+
138
+ <Lottie src={MyLottie} autoplay={true} showDebugInfo={true} />
139
+ ```
140
+
141
+ ## Using with ArchieML
142
+
143
+ If you are using `Lottie` with ArchieML, store your Lottie zip file in the `src/statics/lottie/` folder.
144
+
145
+ With the graphics kit, you'll likely get your text and prop values from an ArchieML doc...
146
+
147
+ ```yaml
148
+ # ArchieML doc
149
+ [blocks]
150
+ type: lottie
151
+
152
+ # Lottie file stored in `src/statics/lottie/` folder
153
+ src: lottie/LottieFile.zip
154
+ autoplay: true
155
+ loop: true
156
+ showDebugInfo: true
157
+ []
158
+ ```
159
+
160
+ ... which you'll parse out of a ArchieML block object before passing to the `Lottie` component.
161
+
162
+ ```svelte
163
+ <script lang="ts">
164
+ import { Lottie } from '@reuters-graphics/graphics-components';
165
+
166
+ // Graphics kit only
167
+ import { asset } from '$app/paths'; // 👈 If using in the graphics kit...
168
+ import { truthy } from '$utils/propValidators'; // 👈 If using in the graphics kit...
169
+ </script>
170
+
171
+ {#each content.blocks as block}
172
+ <!-- Inside the content.blocks for loop... -->
173
+ {#if block.type == 'lottie'}
174
+ <Lottie
175
+ src={asset(`/${block.src}`)}
176
+ autoplay={truthy(block.autoplay)}
177
+ loop={truthy(block.loop)}
178
+ showDebugInfo={truthy(block.showDebugInfo)}
179
+ />
180
+ {/if}
181
+ {/each}
182
+ ```
183
+
184
+ ## Playing a segment
185
+
186
+ The `Lottie` component can play a specific segment of the Lottie animation using the `segment` prop. The `segment` prop expects an array of two numbers representing the start and end frames of the segment.
187
+
188
+ [Demo](?path=/story/components-graphics-scrollerlottie--segment)
189
+
190
+ With the graphics kit, you'll likely get your text and prop values from an ArchieML doc...
191
+
192
+ ```yaml
193
+ # ArchieML doc
194
+ [blocks]
195
+ type: lottie
196
+ showDebugInfo: true
197
+ loop: true
198
+
199
+ # Optionally, set playback speed
200
+ speed: 0.5
201
+
202
+ # Lottie file stored in `src/statics/lottie/` folder
203
+ src: lottie/LottieFile.zip
204
+ [.segment]
205
+ start: 0
206
+ end: 20
207
+ []
208
+ []
209
+ ```
210
+
211
+ ... which you'll parse out of a ArchieML block object before passing to the `Lottie` component.
212
+
213
+ ```svelte
214
+ <script lang="ts">
215
+ import { Lottie } from '@reuters-graphics/graphics-components';
216
+
217
+ // Graphics kit only
218
+ import { asset } from '$app/paths'; // 👈 If using in the graphics kit...
219
+ import { truthy } from '$utils/propValidators'; // 👈 If using in the graphics kit...
220
+ </script>
221
+
222
+ {#each content.blocks as block}
223
+ <!-- Inside the content.blocks for loop... -->
224
+ {#if block.type == 'lottie'}
225
+ <Lottie
226
+ src={asset(`/${block.src}`)}
227
+ segment={[parseInt(block.segment.start), parseInt(block.segment.end)]}
228
+ showDebugInfo={truthy(block.showDebugInfo)}
229
+ loop={truthy(block.loop)}
230
+ speed={parseInt(block.speed)}
231
+ />
232
+ {/if}
233
+ {/each}
234
+ ```
235
+
236
+ ## Markers
237
+
238
+ The `Lottie` component can also play a specific portion of the Lottie animation using markers set in [AfterEffects](https://helpx.adobe.com/in/after-effects/using/layer-markers-composition-markers.html).
239
+
240
+ The list of available markers, which can be passed into the `marker` prop, can be found in the debug info box that appears when `showDebugInfo` is set to `true`.
241
+
242
+ When setting markers in AfterEffects, ensure that the **Comment** section of the Composition Marker contains only the name of your marker:
243
+
244
+ [Demo](?path=/story/components-graphics-scrollerlottie--marker)
245
+
246
+ ```svelte
247
+ <script lang="ts">
248
+ import { Lottie } from '@reuters-graphics/graphics-components';
249
+
250
+ // Import Lottie file
251
+ import MyLottie from './lottie/my-lottie.zip?url'; // Append **?url** to the file path
252
+ </script>
253
+
254
+ <Lottie src={MyLottie} marker="myMarker" />
255
+ ```
256
+
257
+ ## Switching themes
258
+
259
+ [Lottie Creator](https://lottiefiles.com/theming) allows you to define multiple colour themes for your animation. You can switch between these themes using the `theme` prop.
260
+
261
+ Available themes can be found in the debug info when the `showDebugInfo` prop is set to `true`.
262
+
263
+ You can set multiple themes and switch between them dynamically -- for example, based on the `progress` of the animation.
264
+
265
+ [Demo](?path=/story/components-graphics-scrollerlottie--themes)
266
+
267
+ ```svelte
268
+ <script lang="ts">
269
+ import { Lottie } from '@reuters-graphics/graphics-components';
270
+ import MyLottie from './lottie/my-lottie.zip?url';
271
+
272
+ // Set a bindable `progress` variable to pass into `<Lottie />`
273
+ let progress = $state(0);
274
+ </script>
275
+
276
+ <Lottie
277
+ src={MyLottie}
278
+ bind:progress
279
+ themeId={progress < 0.33 ? 'Water'
280
+ : progress < 0.66 ? 'air'
281
+ : 'earth'}
282
+ autoplay
283
+ showDebugInfo
284
+ />
285
+ ```
286
+
287
+ ## Using with `ScrollerBase`
288
+
289
+ The `Lottie` component can be used with the `ScrollerBase` component to create a more complex scrolling experience. `ScrollerBase` provides a scrollable container sets the `Lottie` component as a background.
290
+
291
+ ```svelte
292
+ <script lang="ts">
293
+ import { Lottie, ScrollerBase } from '@reuters-graphics/graphics-components';
294
+ import MyLottie from './lottie/my-lottie.zip?url';
295
+
296
+ // Pass `progress` as `videoPercentage` to Lottie
297
+ let progress = $state(0);
298
+ </script>
299
+
300
+ <ScrollerBase bind:progress query="div.step-foreground-container">
301
+ {#snippet backgroundSnippet()}
302
+ <!-- Pass bindable prop `progress` as `progress` -->
303
+ <Lottie src={MyLottie} {progress} height="100lvh" showDebugInfo />
304
+ {/snippet}
305
+ {#snippet foregroundSnippet()}
306
+ <div class="step-foreground-container">
307
+ <h3 class="text-center">Step 1</h3>
308
+ </div>
309
+ <div class="step-foreground-container">
310
+ <h3 class="text-center">Step 2</h3>
311
+ </div>
312
+ <div class="step-foreground-container">
313
+ <h3 class="text-center">Step 3</h3>
314
+ </div>
315
+ {/snippet}
316
+ </ScrollerBase>
317
+
318
+ <style lang="scss">
319
+ .step-foreground-container {
320
+ height: 100lvh;
321
+ width: 50%;
322
+ margin: 0 auto;
323
+
324
+ h3 {
325
+ background-color: antiquewhite;
326
+ text-align: center;
327
+ }
328
+ }
329
+ </style>
330
+ ```
331
+
332
+ ## With foregrounds
333
+
334
+ The `Lottie` component can also be used with the `LottieForeground` component to display foreground elements at specific times in the animation.
335
+
336
+ [Demo](?path=/story/components-graphics-scrollerlottie--with-foregrounds).
337
+
338
+ ```svelte
339
+ <script lang="ts">
340
+ import { Lottie, ScrollerBase } from '@reuters-graphics/graphics-components';
341
+ import MyLottie from './lottie/my-lottie.zip?url';
342
+ </script>
343
+
344
+ <Lottie src={MyLottie} autoplay>
345
+ <!-- Foreground 1: Headline component as foreground -->
346
+ <LottieForeground
347
+ startFrame={0}
348
+ endFrame={50}
349
+ position="center center"
350
+ backgroundColour="rgba(0, 0, 0)"
351
+ >
352
+ <div class="headline-container">
353
+ <Theme base="dark">
354
+ <Headline
355
+ hed="Headline"
356
+ dek="This is an example of using a Svelte component as the foreground."
357
+ authors={['Jane Doe', 'John Doe']}
358
+ />
359
+ </Theme>
360
+ </div>
361
+ </LottieForeground>
362
+
363
+ <!-- Foreground 2: Text only -->
364
+ <LottieForeground
365
+ startFrame={50}
366
+ endFrame={100}
367
+ text="Foreground caption between frames 50 and 100."
368
+ position="bottom center"
369
+ backgroundColour="rgba(0, 0, 0)"
370
+ width="wide"
371
+ />
372
+ </Lottie>
373
+ ```
374
+
375
+ ### Using with ArchieML
376
+
377
+ With the graphics kit, you'll likely get your text and prop values from an ArchieML doc...
378
+
379
+ ```yaml
380
+ # ArchieML doc
381
+ [blocks]
382
+ type: lottie
383
+
384
+ # Lottie file stored in `src/statics/lottie/` folder
385
+ src: lottie/LottieFile.zip
386
+
387
+ # Array of foregrounds
388
+ [.foregrounds]
389
+
390
+ # Foreground 1: Headline component
391
+ startFrame: 0 # When in the animation to start showing the foreground
392
+ endFrame: 50 # When to stop showing the foreground
393
+
394
+ # Set foreground type
395
+ type: component
396
+
397
+ # Set props to pass into `LottieForeground`
398
+ {.foregroundProps}
399
+ componentName: Headline
400
+ hed: Headline
401
+ dek: Some deck text
402
+ [.authors]
403
+ * Jane Doe
404
+ * John Smith
405
+ []
406
+ {}
407
+
408
+ # Foreground 2: Text only
409
+ startFrame: 50
410
+ endFrame: 100
411
+
412
+ # Set foreground type
413
+ type: text
414
+
415
+ # If the foreground type is `text`, set text prop here
416
+ {.foregroundProps}
417
+ text: Some text for the foreground
418
+ {}
419
+
420
+ []
421
+ ```
422
+
423
+ ... which you'll parse out of a ArchieML block object before passing to the `Lottie` component.
424
+
425
+ ```svelte
426
+ <script lang="ts">
427
+ import {
428
+ Lottie,
429
+ LottieForeground,
430
+ } from '@reuters-graphics/graphics-components';
431
+ import { asset } from '$app/paths';
432
+
433
+ // Make an object of components to use as foregrounds
434
+ const Components = $state({
435
+ Headline,
436
+ });
437
+ </script>
438
+
439
+ {#each content.blocks as block}
440
+ <!-- Inside the content.blocks for loop... -->
441
+ {#if block.type == 'lottie'}
442
+ <Lottie src={asset(`/${block.src}`)}>
443
+ {#each block.foregrounds as foreground}
444
+ {#if foreground.type == 'text'}
445
+ <LottieForeground
446
+ startFrame={parseInt(foreground.startFrame)}
447
+ endFrame={parseInt(foreground.endFrame)}
448
+ text={foreground.foregroundProps.text}
449
+ />
450
+ {:else if foreground.type == 'component'}
451
+ {@const Component =
452
+ Components[foreground.foregroundProps.componentName]}
453
+ <LottieForeground
454
+ startFrame={parseInt(foreground.startFrame)}
455
+ endFrame={parseInt(foreground.endFrame)}
456
+ >
457
+ <Component {...foreground.foregroundProps} />
458
+ </LottieForeground>
459
+ {/if}
460
+ {/each}
461
+ </Lottie>
462
+ {/if}
463
+ {/each}
464
+ ```
@@ -0,0 +1,78 @@
1
+ # PaddingReset
2
+
3
+ **Category:** Components/Page layout/PaddingReset
4
+
5
+ **Import:** `import { PaddingReset } from '@reuters-graphics/graphics-components'`
6
+
7
+ ## Props
8
+
9
+ | Prop | Type | Default | Required | Description |
10
+ |------|------|---------|:--------:|-------------|
11
+ | `containerIsFluid` | `boolean` | `true` | | Set to `true` if the parent container is fluid. |
12
+ | `children` | `Snippet` | — | ✓ | Content to be padded. |
13
+
14
+ ## Examples
15
+
16
+ ### Demo
17
+
18
+ ```svelte
19
+ <!-- Fluid block -->
20
+ <Block {width}>
21
+ <img src={sharkSrc} alt="shark" class="fmb-1" />
22
+ <PaddingReset containerIsFluid={width === 'fluid' ? true : false}>
23
+ <div class="body-note">
24
+ A caption for the image that is padded when its containing <code
25
+ >Block</code
26
+ > is fluid.
27
+ </div>
28
+ </PaddingReset>
29
+ </Block>
30
+ ```
31
+
32
+ ## Documentation
33
+
34
+ # PaddingReset
35
+
36
+ Sometimes you want a visual element to be fluid, i.e., edge-to-edge, but keep padding on adjacent text such as notes or captions. The `PaddingReset` component resets our normal well padding inside a `fluid` container.
37
+
38
+ ```svelte
39
+ <script>
40
+ import { Block, PaddingReset } from '@reuters-graphics/graphics-components';
41
+ </script>
42
+
43
+ <Block width="fluid">
44
+ <!-- Edge-to-edge image -->
45
+ <img src="https:..." alt="Alt text" class="fmb-1" />
46
+
47
+ <!-- Wrap text in `PaddingReset`to add padding back in -->
48
+ <PaddingReset>
49
+ <div class="body-note">
50
+ A caption for the image that is padded when Block is fluid.
51
+ </div>
52
+ </PaddingReset>
53
+ </Block>
54
+ ```
55
+
56
+ ## Conditional padding
57
+
58
+ You can add the padding conditionally by setting the `containerIsFluid` prop to `true` when the `Block` width is `fluid`, which is what many other components in this library do.
59
+
60
+ ```svelte
61
+ <script>
62
+ import { Block, PaddingReset } from '@reuters-graphics/graphics-components';
63
+
64
+ let { src = 'https://...', width = 'fluid' } = $props();
65
+ </script>
66
+
67
+ <Block {width}>
68
+ <!-- Edge-to-edge image -->
69
+ <img src="https:..." alt="Alt text" class="fmb-1" />
70
+
71
+ <!-- Set conditional padding with the `containerIsFluid` prop -->
72
+ <PaddingReset containerIsFluid={width === 'fluid'}>
73
+ <div class="body-note">
74
+ A caption for the image that is padded when Block is fluid.
75
+ </div>
76
+ </PaddingReset>
77
+ </Block>
78
+ ```