@reuters-graphics/graphics-components 3.9.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 +23 -3
@@ -0,0 +1,523 @@
1
+ # HorizontalScroller
2
+
3
+ **Category:** Components/Graphics/HorizontalScroller
4
+
5
+ **Import:** `import { HorizontalScroller } from '@reuters-graphics/graphics-components'`
6
+
7
+ ## Props
8
+
9
+ | Prop | Type | Default | Required | Description |
10
+ |------|------|---------|:--------:|-------------|
11
+ | `id` | `string` | `''` | | Optional id for the scroller container |
12
+ | `class` | `string` | `''` | | Optional additional classes for the scroller container |
13
+ | `height` | `string` | `'200lvh'` | | Height of the scroller container in CSS `vh` units. Set it to `100lvh` when using inside ScrollerBase. |
14
+ | `progress` | `number` | `$bindable(0)` | | Bindable progress value. Ideal range: `[0-1]`. Bind ScrollerBase's progress to this prop. |
15
+ | `direction` | `'left' \| 'right'` | `'right'` | | Direction of movement |
16
+ | `children` | `Snippet` | — | | Content to scroll |
17
+ | `stops` | `number[]` | `[]` | | Array of numbers desired as stops for the scroller |
18
+ | `handleScroll` | `boolean` | `true` | | Should the component handle scroll events? Set it to `false` when using inside ScrollerBase. |
19
+ | `scrubbed` | `boolean` | `true` | | Whether the stops should be scrubbed |
20
+ | `easing` | `(t: number) => number` | `(t) => t` | | Easing function for the progress/stops |
21
+ | `duration` | `number` | `400` | | Duration of the easing animation in milliseconds. Effective only when scrubbed is false. |
22
+ | `showDebugInfo` | `boolean` | `false` | | Whether to show debug info |
23
+ | `mappedStart` | `number` | `0` | | Modified starting scale. Default is 0 |
24
+ | `mappedEnd` | `number` | `1` | | Modified ending scale. Default is 1 |
25
+
26
+ ## Examples
27
+
28
+ ### Demo
29
+
30
+ ```svelte
31
+ <DemoComponent>
32
+ <DemoSnippetBlock />
33
+ </DemoComponent>
34
+ ```
35
+
36
+ ### With stops and easing
37
+
38
+ ```svelte
39
+ <DemoComponent
40
+ stops={[0.2, 0.5, 0.9]}
41
+ duration={400}
42
+ toggleScrub={true}
43
+ easing={quartInOut}
44
+ >
45
+ <DemoSnippetBlock />
46
+ </DemoComponent>
47
+ ```
48
+
49
+ ### Extended boundaries
50
+
51
+ ```svelte
52
+ <DemoComponent
53
+ mappedStart={-0.5}
54
+ mappedEnd={1.5}
55
+ easing={quartInOut}
56
+ stops={[0, 1]}
57
+ >
58
+ <DemoSnippetBlock />
59
+ </DemoComponent>
60
+ ```
61
+
62
+ ### Custom children
63
+
64
+ ```svelte
65
+ <DemoComponent>
66
+ <CustomChildrenBlock />
67
+ </DemoComponent>
68
+ ```
69
+
70
+ ### Scrollable ai2svelte
71
+
72
+ ```svelte
73
+ <ScrollableGraphic />
74
+ ```
75
+
76
+ ### Scrollable ai2svelte (advanced)
77
+
78
+ ```svelte
79
+ <AdvancedScrollableGraphic />
80
+ ```
81
+
82
+ ### With ScrollerBase
83
+
84
+ ```svelte
85
+ <WithScrollerBaseComponent />
86
+ ```
87
+
88
+ ## Documentation
89
+
90
+ # HorizontalScroller
91
+
92
+ The `HorizontalScroller` component creates a horizontal scrolling section that scrolls through any child content wider than `100vw`.
93
+
94
+ To use `HorizontalScroller`, wrap it around the content that you want to horizontally scroll through. The scroll length is controlled by the height of the `HorizontalScroller` container, which is set by the prop `height`. `height` defaults to `200lvh`, but you can adjust this to any valid CSS height value such as `1200px` or `400lvh`.
95
+
96
+ The child content inside the `HorizontalScroller` must be wider than `100vw` so that there is overflow to horizontal scroll through. By default, only the top `100lvh` of the child content is visible. You can use CSS `transform: translate()` on the child content to adjust its vertical positioning within the visible area.
97
+
98
+ > 💡TIP: Use `lvh` or `svh` units instead of `vh` unit for the height, as [these units](https://www.w3.org/TR/css-values-4/#large-viewport-size) are more reliable on mobile or other devices where elements such as the address bar toggle between being shown and hidden.
99
+
100
+ > 💡TIP: Set the `showDebugInfo` prop to `true` to visualise the scroll progress and other useful information.
101
+
102
+ See the full list of available props under the `Controls` tab in the [demo](?path=/story/components-graphics-horizontalscroller--demo).
103
+
104
+ ```svelte
105
+ <script lang="ts">
106
+ import {
107
+ HorizontalScroller,
108
+ Block,
109
+ } from '@reuters-graphics/graphics-components';
110
+ </script>
111
+
112
+ <!-- Wrap `HorizontalScroller` in a fluid container for a full bleed experience -->
113
+ <Block width="fluid">
114
+ <!-- Optionally set `height` prop to adjust scroll length. Defaults to `200lvh` -->
115
+ <HorizontalScroller>
116
+ <!-- Child content wider than 100vw. Only the top 100lvh is visible. -->
117
+ <div style="width: 400vw; height: 100lvh;">
118
+ <img
119
+ src="my-wide-image.jpg"
120
+ alt="alt text"
121
+ style="width: 100%; height: 100%; object-fit: cover; padding: 0; margin: 0;"
122
+ />
123
+ </div>
124
+ </HorizontalScroller>
125
+ </Block>
126
+ ```
127
+
128
+ ## Controlling scroll behaviour with stops and easing
129
+
130
+ The `HorizontalScroller` allows you to control the horizontal scroll behaviour and pacing with various props.
131
+
132
+ **`stops`:**
133
+
134
+ `stops` is an optional prop that accepts an array of numbers between `0` and `1`. At these points, which corresponds to the scroll `progress` values, the scrolling stops or slows down. This is useful for adding custom pauses based on progress.
135
+
136
+ For example, as shown in the demo below, if you define `stops` as `[0.2, 0.5, 0.9]`, the scrolling will pause or slow down at these `progress` values as the user scrolls through the `HorizontalScroller` section.
137
+
138
+ **`scrubbed`:**
139
+
140
+ The `scrubbed` prop controls whether the scrolling is tied exactly to the scroll position (`scrubbed: true`) or is smoothed out (`scrubbed: false`). This prop defaults to `true`.
141
+
142
+ If `scrubbed` is set to `false` and `stops` are defined, the scrolling transitions smoothly between the stop values.
143
+
144
+ **`easing`** and **`duration`**:
145
+
146
+ `easing` accepts any easing function from `svelte/easing` or a custom easing function, while `duration` sets the time, in milliseconds, for each transition between stops.
147
+
148
+ So, if the stops are at irregular intervals — for example, `[0.2, 0.9]` — the scroll to the first stop will be much quicker than the scroll to the second stop since the distance to travel is different but the duration of the transition is the same.
149
+
150
+ By default, `duration` is set to `400` milliseconds.
151
+
152
+ [Demo](?path=/story/components-graphics-horizontalscroller--with-stops)
153
+
154
+ ```svelte
155
+ <script lang="ts">
156
+ import {
157
+ HorizontalScroller,
158
+ Block,
159
+ } from '@reuters-graphics/graphics-components';
160
+ import { quartInOut } from 'svelte/easing';
161
+ </script>
162
+
163
+ <!-- Wrap `HorizontalScroller` in a fluid container for a full bleed experience -->
164
+ <Block width="fluid">
165
+ <HorizontalScroller
166
+ stops={[0.2, 0.5, 0.9]}
167
+ duration={400}
168
+ scrubbed={false}
169
+ easing={quartInOut}
170
+ showDebugInfo={true}
171
+ >
172
+ <!-- Child content wider than 100vw. Only the top 100lvh is visible. -->
173
+ <div style="width: 200vw; height: 100lvh;">
174
+ <img
175
+ src="my-wide-image.jpg"
176
+ alt="alt text"
177
+ style="width: 100%; height: 100%; object-fit: cover; padding: 0; margin: 0;"
178
+ />
179
+ </div>
180
+ </HorizontalScroller>
181
+ </Block>
182
+ ```
183
+
184
+ ## Extended boundaries
185
+
186
+ `HorizontalScroller` has `mappedStart` and `mappedEnd` props, which extend the horizontal scroll boundaries beyond the default 0 to 1 range. This is useful when you want to create an overscroll effect or have more control over the horizontal scroll range. By default, these values are set to 0 and 1 respectively.
187
+
188
+ If using custom `mappedStart` and `mappedEnd` values, you must also set `stops` values that are within the mapped range.
189
+
190
+ > 💡TIP: In the debugging info box, `Progress` indicates the raw scroll progress value between `0` and `1`. `Mapped Progress` indicates the vertical progress mapped to `mappedStart` and `mappedEnd`. If they are not set, `Mapped Progress` is bound between 0 and 1 and matches `Progress`. `Eased Progress` indicates the scroll progress with any stops and easing applied. `Eased Progress` is what reflects the actual transition of the horizontal scroll position.
191
+
192
+ [Demo](?path=/story/components-graphics-horizontalscroller--extended-boundaries)
193
+
194
+ ```svelte
195
+ <script lang="ts">
196
+ import {
197
+ HorizontalScroller,
198
+ Block,
199
+ } from '@reuters-graphics/graphics-components';
200
+ import { quartInOut } from 'svelte/easing';
201
+ </script>
202
+
203
+ <!-- Wrap `HorizontalScroller` in a fluid container for a full bleed experience -->
204
+ <Block width="fluid">
205
+ <HorizontalScroller
206
+ mappedStart={-0.5}
207
+ mappedEnd={1.5}
208
+ stops={[0, 1]}
209
+ showDebugInfo={true}
210
+ easing={quartInOut}
211
+ >
212
+ <!-- Child content wider than 100vw. Only the top 100lvh is visible. -->
213
+ <div style="width: 200vw; height: 100lvh;">
214
+ <img
215
+ src="my-wide-image.jpg"
216
+ alt="alt text"
217
+ style="width: 100%; height: 100%; object-fit: cover; padding: 0; margin: 0;"
218
+ />
219
+ </div>
220
+ </HorizontalScroller>
221
+ </Block>
222
+ ```
223
+
224
+ ## With ai2svelte components
225
+
226
+ With [ai2svelte](https://reuters-graphics.github.io/ai2svelte/) v1.0.3 onwards, you can export your ai2svelte graphic with a wider-than-viewport layout and use it directly inside `HorizontalScroller` to create horizontally scrolling graphics.
227
+
228
+ To do that, follow these steps:
229
+
230
+ 1. In Illustrator, rename your artboard with the breakpoint at which you want that artboard to be visible on the page. For example, to make the XL artboard visible on viewports wider than 1200px, rename it to `xl:1200`. You can have multiple artboards with different breakpoints.
231
+ 2. Add these properties to the ai2svelte settings and run the script to export the component.
232
+
233
+ ```yaml
234
+ include_resizer_css: false
235
+ respect_height: true
236
+ allow_overflow: true
237
+ ```
238
+
239
+ [Demo](?path=/story/components-graphics-horizontalscroller--scrollable-ai-2-svelte)
240
+
241
+ ```svelte
242
+ <script lang="ts">
243
+ import {
244
+ HorizontalScroller,
245
+ Block,
246
+ } from '@reuters-graphics/graphics-components';
247
+ import AiGraphic from './ai2svelte/ai-graphic.svelte';
248
+
249
+ // If using with the graphics kit
250
+ import { assets } from '$app/paths';
251
+
252
+ // Optional easing function
253
+ import { sineInOut } from 'svelte/easing';
254
+ </script>
255
+
256
+ <!-- Wrap `HorizontalScroller` in a fluid container for a full bleed experience -->
257
+ <Block width="fluid">
258
+ <HorizontalScroller height="800lvh" easing={sineInOut} showDebugInfo>
259
+ <AiGraphic assetsPath={assets} />
260
+ </HorizontalScroller>
261
+ </Block>
262
+ ```
263
+
264
+ ## With ai2svelte components: advanced
265
+
266
+ You can use the bound prop `progress` to create advanced interactivity with an ai2svelte graphic.
267
+
268
+ The demo below has 2 advanced interactions: fade in/out of caption boxes based on scroll position and parallax movement of a `png` layer.
269
+
270
+ ### Captions fading in/out
271
+
272
+ Caption boxes are exported as `htext` [tagged layers](https://reuters-graphics.github.io/ai2svelte/users/tagged-layers/) in ai2svelte. In this example, we use the `handleScroll()` function to check the position of each caption box relative to the viewport width and set its opacity to `1` (visible) or `0` (hidden) based on whether the caption box is within the `threshold` of the viewport. In Adobe Illustrator, set `override_text: true` in the ai2svelte export settings to allow custom HTML content in tagged text layers.
273
+
274
+ ### Parallax effect with png layer
275
+
276
+ This demo has a tagged `png` [layer](https://reuters-graphics.github.io/ai2svelte/users/tagged-layers/), which contains the foreground overlay image. The `handleScroll()` function uses the bound `progress` value to calculate a horizontal translation for the `png` layer, creating a parallax effect as the user scrolls through the `HorizontalScroller`.
277
+
278
+ [Demo](?path=/story/components-graphics-horizontalscroller--scrollable-ai-2-svelte-advanced)
279
+
280
+ ```svelte
281
+ <script lang="ts">
282
+ import {
283
+ HorizontalScroller,
284
+ Block,
285
+ } from '@reuters-graphics/graphics-components';
286
+ import AiGraphic from './ai2svelte/ai-graphic.svelte';
287
+ import { sineInOut } from 'svelte/easing';
288
+
289
+ // If using with the graphics kit
290
+ import { assets } from '$app/paths';
291
+
292
+ // bind progress for advanced interactivity
293
+ let progress: number = $state(0);
294
+ let pngLayer: HTMLElement | null;
295
+ let captions: HTMLElement[] | null;
296
+ let threshold = 0.8;
297
+ let screenWidth: number = $state(0);
298
+
299
+ function handleScroll() {
300
+ // Create a parallax movement for the foreground png layer
301
+ if (pngLayer) {
302
+ pngLayer.style.transform = `scale(1.5) translateX(${map(progress, 0, 1, -15, 85)}%)`;
303
+ }
304
+
305
+ // For each caption, checks if position of the caption is below the threshold.
306
+ // If it is, show it. If not, hide it
307
+ if (captions?.length) {
308
+ captions.forEach((caption) => {
309
+ let captionWidth = caption.getBoundingClientRect().width;
310
+ let captionMidpoint =
311
+ caption.getBoundingClientRect().left + captionWidth / 2;
312
+
313
+ if (
314
+ captionMidpoint < screenWidth * threshold &&
315
+ caption.style.opacity !== '1'
316
+ ) {
317
+ caption.style.opacity = '1';
318
+ } else if (
319
+ captionMidpoint > screenWidth * threshold &&
320
+ caption.style.opacity !== '0'
321
+ ) {
322
+ caption.style.opacity = '0';
323
+ }
324
+ });
325
+ }
326
+ }
327
+
328
+ // Refetch new captions and png image every time the artboard changes
329
+ function onArtboardChange(artboard: HTMLElement) {
330
+ pngLayer = artboard.querySelector('.g-png-layer-overlay');
331
+ captions = Array.from(artboard.querySelectorAll('.g-captions'));
332
+
333
+ if (pngLayer) {
334
+ window.removeEventListener('scroll', handleScroll);
335
+ window.addEventListener('scroll', handleScroll, {
336
+ passive: true,
337
+ });
338
+
339
+ // to translate overlay layer on initial load
340
+ handleScroll();
341
+ }
342
+ }
343
+ </script>
344
+
345
+ <!-- Wrap `HorizontalScroller` in a fluid container for a full bleed experience -->
346
+ <Block width="fluid">
347
+ <HorizontalScroller
348
+ height="800lvh"
349
+ bind:progress
350
+ easing={sineInOut}
351
+ showDebugInfo={true}
352
+ >
353
+ <AiGraphic
354
+ assetsPath={assets}
355
+ {onArtboardChange}
356
+ taggedText={{
357
+ htext: {
358
+ captions: {
359
+ caption1:
360
+ '<div class="scroller-caption"><strong>Caption 1!</strong><br/>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>',
361
+ caption2:
362
+ '<div class="scroller-caption"><strong>Caption 2!</strong><br/>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>',
363
+ caption3:
364
+ '<div class="scroller-caption"><strong>Caption 3!</strong><br/>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>',
365
+ caption4:
366
+ '<div class="scroller-caption"><strong>Caption 4!</strong><br/>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>',
367
+ },
368
+ },
369
+ }}
370
+ />
371
+ </HorizontalScroller>
372
+ </Block>
373
+
374
+ <style lang="scss">
375
+ :global(.scroller-caption) {
376
+ padding: 1rem;
377
+ margin: 0;
378
+ background-color: rgba(0, 0, 0, 0.8);
379
+ border-radius: 8px;
380
+ color: white;
381
+ filter: drop-shadow(0px 2px 16px rgba(0, 0, 0, 0.2));
382
+ }
383
+ </style>
384
+ ```
385
+
386
+ ## With custom child components
387
+
388
+ You can create a custom horizontal layout with any component and pass it as a child to the `HorizontalScroller`. Here's an example with `DatawrapperChart`, `Headline` and ai2svelte components laid out in a horizontal scroll.
389
+
390
+ [Demo](?path=/story/components-graphics-horizontalscroller--custom-children)
391
+
392
+ ```svelte
393
+ <script lang="ts">
394
+ import {
395
+ Block,
396
+ DatawrapperChart,
397
+ Headline,
398
+ HorizontalScroller,
399
+ } from '@reuters-graphics/graphics-components';
400
+ import AiChart from './ai2svelte/ai-chart.svelte';
401
+ </script>
402
+
403
+ <!-- Wrap `HorizontalScroller` in a fluid container for a full bleed experience -->
404
+ <Block width="fluid">
405
+ <HorizontalScroller>
406
+ <div id="horizontal-stack">
407
+ <div style="width: 100vw;">
408
+ <DatawrapperChart
409
+ title="Global abortion access"
410
+ ariaLabel="map"
411
+ id="abortion-rights-map"
412
+ src="https://graphics.reuters.com/USA-ABORTION/lgpdwggnwvo/media-embed.html"
413
+ frameTitle=""
414
+ scrolling="no"
415
+ textWidth="normal"
416
+ width="wider"
417
+ />
418
+ </div>
419
+ <div style="width: 100vw;">
420
+ <Headline
421
+ hed="Reuters Graphics Interactive"
422
+ dek="The beginning of a beautiful page"
423
+ section="World News"
424
+ />
425
+ </div>
426
+ <div style="width: 100vw;">
427
+ <Block width="normal">
428
+ <AiChart />
429
+ </Block>
430
+ </div>
431
+ </div>
432
+ </HorizontalScroller>
433
+ </Block>
434
+
435
+ <style lang="scss">
436
+ #horizontal-stack {
437
+ display: flex;
438
+ flex-direction: row;
439
+ align-items: center;
440
+ justify-content: space-around;
441
+ gap: 10vw;
442
+ height: 100%;
443
+ }
444
+ </style>
445
+ ```
446
+
447
+ ## With ScrollerBase
448
+
449
+ You can also integrate HorizontalScroller with `ScrollerBase` for a horizontal scroll with vertical captions.
450
+
451
+ When using `HorizontalScroller` with `ScrollerBase` or other scrollers, you must:
452
+
453
+ - Create a `progress` state variable and bind it to both `ScrollerBase` and `HorizontalScroller`
454
+ - Set `HorizontalScroller`'s `height` to `100lvh`
455
+ - Set `handleScroll` to `false`
456
+
457
+ > **⚠️ Warning:** It is not recommended to use HorizontalScroller with vertical ScrollerBase. This example is only to serve the purpose of demonstrating how to control the HorizontalScroller with an external progress value (ScrollerBase's progress in this case).
458
+
459
+ [Demo](?path=/story/components-graphics-horizontalscroller--with-scroller-base)
460
+
461
+ ```svelte
462
+ <script lang="ts">
463
+ import {
464
+ HorizontalScroller,
465
+ ScrollerBase,
466
+ Block,
467
+ } from '@reuters-graphics/graphics-components';
468
+ import AiGraphic from './ai2svelte/ai-graphic.svelte';
469
+ import { circInOut } from 'svelte/easing';
470
+
471
+ // Optional: Bind your own variables to use them in your code.
472
+ let progress = $state(0);
473
+ </script>
474
+
475
+ <ScrollerBase bind:progress query="div.step-foreground-container">
476
+ {#snippet backgroundSnippet()}
477
+ <!-- Wrap `HorizontalScroller` in a fluid container for a full bleed experience -->
478
+ <Block width="fluid">
479
+ <HorizontalScroller
480
+ bind:progress
481
+ height="100lvh"
482
+ handleScroll={false}
483
+ showDebugInfo={true}
484
+ >
485
+ <AiGraphic />
486
+ </HorizontalScroller>
487
+ </Block>
488
+ {/snippet}
489
+ {#snippet foregroundSnippet()}
490
+ <!-- Add custom foreground HTML or component -->
491
+ <div class="step-foreground-container"><p>Step 1</p></div>
492
+ <div class="step-foreground-container"><p>Step 2</p></div>
493
+ <div class="step-foreground-container"><p>Step 3</p></div>
494
+ <div class="step-foreground-container"><p>Step 4</p></div>
495
+ <div class="step-foreground-container"><p>Step 5</p></div>
496
+ {/snippet}
497
+ </ScrollerBase>
498
+
499
+ <style lang="scss">
500
+ .step-foreground-container {
501
+ height: 100vh;
502
+ width: 50%;
503
+ background-color: rgba(0, 0, 0, 0);
504
+ padding: 1em;
505
+ margin: 0 auto 10px 0;
506
+ position: relative;
507
+ left: 50%;
508
+ transform: translate(-50%, 0);
509
+
510
+ p {
511
+ position: absolute;
512
+ top: 50%;
513
+ left: 50%;
514
+ transform: translate(-50%, -50%);
515
+ width: 100%;
516
+ padding: 1rem;
517
+ background-color: rgba(0, 0, 0, 0.8);
518
+ border-radius: 4px;
519
+ color: white;
520
+ }
521
+ }
522
+ </style>
523
+ ```