@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.
- package/dist/llm-docs/components/AdSlot.md +11 -0
- package/dist/llm-docs/components/Analytics.md +89 -0
- package/dist/llm-docs/components/Article.md +183 -0
- package/dist/llm-docs/components/BeforeAfter.md +170 -0
- package/dist/llm-docs/components/BioBox.md +74 -0
- package/dist/llm-docs/components/Block.md +211 -0
- package/dist/llm-docs/components/BlogPost.md +68 -0
- package/dist/llm-docs/components/BlogTOC.md +91 -0
- package/dist/llm-docs/components/BodyText.md +143 -0
- package/dist/llm-docs/components/Byline.md +242 -0
- package/dist/llm-docs/components/ClockWall.md +48 -0
- package/dist/llm-docs/components/DatawrapperChart.md +87 -0
- package/dist/llm-docs/components/DocumentCloud.md +47 -0
- package/dist/llm-docs/components/EmbedPreviewerLink.md +35 -0
- package/dist/llm-docs/components/EndNotes.md +79 -0
- package/dist/llm-docs/components/FeaturePhoto.md +102 -0
- package/dist/llm-docs/components/Framer.md +44 -0
- package/dist/llm-docs/components/Geocoder.md +49 -0
- package/dist/llm-docs/components/GraphicBlock.md +319 -0
- package/dist/llm-docs/components/Headline.md +248 -0
- package/dist/llm-docs/components/Headpile.md +55 -0
- package/dist/llm-docs/components/HeroHeadline.md +515 -0
- package/dist/llm-docs/components/HorizontalScroller.md +523 -0
- package/dist/llm-docs/components/InfoBox.md +196 -0
- package/dist/llm-docs/components/KinesisLogo.md +34 -0
- package/dist/llm-docs/components/LanguageButton.md +171 -0
- package/dist/llm-docs/components/Legend.md +251 -0
- package/dist/llm-docs/components/Lottie.md +464 -0
- package/dist/llm-docs/components/PaddingReset.md +78 -0
- package/dist/llm-docs/components/PhotoPack.md +237 -0
- package/dist/llm-docs/components/PymChild.md +49 -0
- package/dist/llm-docs/components/ReferralBlock.md +119 -0
- package/dist/llm-docs/components/ReutersGraphicsLogo.md +37 -0
- package/dist/llm-docs/components/ReutersLogo.md +35 -0
- package/dist/llm-docs/components/SEO.md +113 -0
- package/dist/llm-docs/components/Scroller.md +350 -0
- package/dist/llm-docs/components/ScrollerBase.md +104 -0
- package/dist/llm-docs/components/ScrollerVideo.md +576 -0
- package/dist/llm-docs/components/SearchInput.md +44 -0
- package/dist/llm-docs/components/ShareBar.md +78 -0
- package/dist/llm-docs/components/SimpleTimeline.md +141 -0
- package/dist/llm-docs/components/SiteFooter.md +77 -0
- package/dist/llm-docs/components/SiteHeader.md +55 -0
- package/dist/llm-docs/components/SiteHeadline.md +111 -0
- package/dist/llm-docs/components/Spinner.md +43 -0
- package/dist/llm-docs/components/Table.md +298 -0
- package/dist/llm-docs/components/Theme.md +266 -0
- package/dist/llm-docs/components/TileMap.md +477 -0
- package/dist/llm-docs/components/ToolsHeader.md +46 -0
- package/dist/llm-docs/components/Video.md +254 -0
- package/dist/llm-docs/components/Visible.md +54 -0
- package/dist/llm-docs/components/cssVariables.md +40 -0
- package/dist/llm-docs/components/index.md +59 -0
- package/dist/llm-docs/components/resizeObserver.md +21 -0
- package/dist/llm-docs/guides/archieml.md +406 -0
- package/dist/llm-docs/guides/colours.md +443 -0
- package/dist/llm-docs/guides/customising-with-scss.md +61 -0
- package/dist/llm-docs/guides/graphics-kit.md +25 -0
- package/dist/llm-docs/guides/index.md +16 -0
- package/dist/llm-docs/guides/intro.md +21 -0
- package/dist/llm-docs/guides/layout.md +13 -0
- package/dist/llm-docs/guides/llm-docs.md +71 -0
- package/dist/llm-docs/guides/styles.md +16 -0
- package/dist/llm-docs/guides/theming.md +100 -0
- package/dist/llm-docs/guides/tokens.md +150 -0
- package/dist/llm-docs/index.md +36 -0
- package/package.json +1 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# CSS variables
|
|
2
|
+
|
|
3
|
+
The [`Theme`](?path=/docs/components-theme--default) component uses **[CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)** to control major parts of your page's theme.
|
|
4
|
+
|
|
5
|
+
All other components in this library use those variables for styling basic colours and typography, helping keep our pages uniform and making it easier to customise the theme. CSS variables also allow our clients to easily change elements of our theme to match their brand.
|
|
6
|
+
|
|
7
|
+
This doc explains which variables are set and how you can use them in custom components you create.
|
|
8
|
+
|
|
9
|
+
> **Note:** CSS variables do not currently affect [ai2svelte](https://github.com/reuters-graphics/ai2svelte/) graphics, so you should continue to make sure your colours match the theme of your page directly in Adobe Illustrator for those graphics.
|
|
10
|
+
|
|
11
|
+
## Using CSS variables directly
|
|
12
|
+
|
|
13
|
+
If you're new to how CSS variables work, [here's a video](https://www.youtube.com/watch?v=PHO6TBq_auI) that does a decent job explaining what they are, how they work and why they're useful.
|
|
14
|
+
|
|
15
|
+
You can use any of the CSS variables the `Theme` component sets in your own code with the [`var()`](https://www.w3schools.com/css/css3_variables.asp) function.
|
|
16
|
+
|
|
17
|
+
```svelte
|
|
18
|
+
<p>My custom text</p>
|
|
19
|
+
|
|
20
|
+
<style lang="scss">
|
|
21
|
+
p {
|
|
22
|
+
color: var(--theme-colour-text-primary);
|
|
23
|
+
font-family: var(--theme-font-family-sans-serif);
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Customising variables
|
|
29
|
+
|
|
30
|
+
You can redefine any of the above CSS variables in the `<Theme>` component. Read more in [the docs](/docs/theming-theme--custom-theme) and **use the [Theme builder](/docs/theming-theme-builder--docs)**.
|
|
31
|
+
|
|
32
|
+
```svelte
|
|
33
|
+
<Theme
|
|
34
|
+
base="light"
|
|
35
|
+
theme={{
|
|
36
|
+
colour: {
|
|
37
|
+
// This replaces the default text-secondary colour '#666666' for light theme
|
|
38
|
+
'text-secondary': '#213310',
|
|
39
|
+
},
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<!-- page stuff -->
|
|
43
|
+
</Theme>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Adding extra variables
|
|
47
|
+
|
|
48
|
+
You can even add custom variables through the `Theme` component.
|
|
49
|
+
|
|
50
|
+
For example, let's say you want to define a border radius for some card elements on your page. You can add a custom property to the `theme` prop like this:
|
|
51
|
+
|
|
52
|
+
```svelte
|
|
53
|
+
<Theme
|
|
54
|
+
base="light"
|
|
55
|
+
theme={{
|
|
56
|
+
style: {
|
|
57
|
+
'border-radius': '22px',
|
|
58
|
+
},
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<!-- page stuff -->
|
|
62
|
+
</Theme>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
... and then access the CSS variable in your code like this:
|
|
66
|
+
|
|
67
|
+
```svelte
|
|
68
|
+
<div class="card"></div>
|
|
69
|
+
|
|
70
|
+
<style lang="scss">
|
|
71
|
+
.card {
|
|
72
|
+
border-radius: var(--theme-style-border-radius);
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Using the `Theme` component for your own CSS variables helps unify important style values across a project. It also lets clients more easily customise those values for whatever matches their brand.
|
|
78
|
+
|
|
79
|
+
You can also change a variable's value based on some condition. For example, to set a smaller border radius on mobile screens, you might:
|
|
80
|
+
|
|
81
|
+
```svelte
|
|
82
|
+
<script>
|
|
83
|
+
// other code
|
|
84
|
+
|
|
85
|
+
let windowWidth;
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<svelte:window bind:innerWidth={windowWidth} />
|
|
89
|
+
|
|
90
|
+
<Theme
|
|
91
|
+
base="light"
|
|
92
|
+
theme={{
|
|
93
|
+
style: {
|
|
94
|
+
'border-radius': windowWidth > 475 ? '22px' : '11px',
|
|
95
|
+
},
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
<!-- page stuff -->
|
|
99
|
+
</Theme>
|
|
100
|
+
```
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Style Tokens
|
|
2
|
+
|
|
3
|
+
Import the main SCSS to access all token classes:
|
|
4
|
+
|
|
5
|
+
```scss
|
|
6
|
+
@use '@reuters-graphics/graphics-components/scss/main';
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Spacing
|
|
10
|
+
|
|
11
|
+
Static spacing uses the Tailwind scale: 1 unit = 0.25rem. So `.m-4` = 1rem, `.m-8` = 2rem, `.my-6` = 1.5rem block margin.
|
|
12
|
+
|
|
13
|
+
### Static margin
|
|
14
|
+
|
|
15
|
+
| Prefix | Property |
|
|
16
|
+
|--------|---------|
|
|
17
|
+
| `m-{n}` | margin (all sides) |
|
|
18
|
+
| `mt-{n}` | margin-block-start (top) |
|
|
19
|
+
| `mb-{n}` | margin-block-end (bottom) |
|
|
20
|
+
| `ml-{n}` | margin-inline-start (left) |
|
|
21
|
+
| `mr-{n}` | margin-inline-end (right) |
|
|
22
|
+
| `mx-{n}` | margin-inline (left + right) |
|
|
23
|
+
| `my-{n}` | margin-block (top + bottom) |
|
|
24
|
+
|
|
25
|
+
Available levels and their values:
|
|
26
|
+
|
|
27
|
+
| Level | Value |
|
|
28
|
+
|-------|-------|
|
|
29
|
+
| `0` | `0` |
|
|
30
|
+
| `0\.5` | `0.125rem` |
|
|
31
|
+
| `1` | `0.25rem` |
|
|
32
|
+
| `1\.5` | `0.375rem` |
|
|
33
|
+
| `2` | `0.5rem` |
|
|
34
|
+
| `2\.5` | `0.625rem` |
|
|
35
|
+
| `3` | `0.75rem` |
|
|
36
|
+
| `3\.5` | `0.875rem` |
|
|
37
|
+
| `4` | `1rem` |
|
|
38
|
+
| `5` | `1.25rem` |
|
|
39
|
+
| `6` | `1.5rem` |
|
|
40
|
+
| `7` | `1.75rem` |
|
|
41
|
+
| `8` | `2rem` |
|
|
42
|
+
| `9` | `2.25rem` |
|
|
43
|
+
| `10` | `2.5rem` |
|
|
44
|
+
| `11` | `2.75rem` |
|
|
45
|
+
| `12` | `3rem` |
|
|
46
|
+
| `14` | `3.5rem` |
|
|
47
|
+
| `16` | `4rem` |
|
|
48
|
+
| `20` | `5rem` |
|
|
49
|
+
| `24` | `6rem` |
|
|
50
|
+
| `28` | `7rem` |
|
|
51
|
+
| `32` | `8rem` |
|
|
52
|
+
| `36` | `9rem` |
|
|
53
|
+
| `40` | `10rem` |
|
|
54
|
+
| `44` | `11rem` |
|
|
55
|
+
| `48` | `12rem` |
|
|
56
|
+
| `52` | `13rem` |
|
|
57
|
+
| `56` | `14rem` |
|
|
58
|
+
| `60` | `15rem` |
|
|
59
|
+
| `64` | `16rem` |
|
|
60
|
+
| `72` | `18rem` |
|
|
61
|
+
| `80` | `20rem` |
|
|
62
|
+
| `96` | `24rem` |
|
|
63
|
+
|
|
64
|
+
### Static padding
|
|
65
|
+
|
|
66
|
+
Same scale as margin. Prefixes:
|
|
67
|
+
|
|
68
|
+
| Prefix | Property |
|
|
69
|
+
|--------|---------|
|
|
70
|
+
| `p-{n}` | padding (all sides) |
|
|
71
|
+
| `pt-{n}` | padding-block-start (top) |
|
|
72
|
+
| `pb-{n}` | padding-block-end (bottom) |
|
|
73
|
+
| `pl-{n}` | padding-inline-start (left) |
|
|
74
|
+
| `pr-{n}` | padding-inline-end (right) |
|
|
75
|
+
| `px-{n}` | padding-inline (left + right) |
|
|
76
|
+
| `py-{n}` | padding-block (top + bottom) |
|
|
77
|
+
|
|
78
|
+
### Fluid margin
|
|
79
|
+
|
|
80
|
+
Fluid values scale with viewport width. Use SCSS `@extend` to apply: `@extend %fmy-4;`. Direct utility classes are also available for levels 0–9.
|
|
81
|
+
|
|
82
|
+
| Class | Properties |
|
|
83
|
+
|-------|------------|
|
|
84
|
+
| `.fm-1` | `margin: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);` |
|
|
85
|
+
| `.fm-2` | `margin: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);` |
|
|
86
|
+
| `.fm-3` | `margin: clamp(0.88rem, 0.83rem + 0.21vw, 1rem);` |
|
|
87
|
+
| `.fm-4` | `margin: clamp(1.13rem, 1.06rem + 0.31vw, 1.31rem);` |
|
|
88
|
+
| `.fm-5` | `margin: clamp(1.69rem, 1.58rem + 0.52vw, 2rem);` |
|
|
89
|
+
| `.fm-6` | `margin: clamp(2.25rem, 2.13rem + 0.63vw, 2.63rem);` |
|
|
90
|
+
| `.fm-7` | `margin: clamp(3.38rem, 3.19rem + 0.94vw, 3.94rem);` |
|
|
91
|
+
| `.fm-8` | `margin: clamp(4.5rem, 4.25rem + 1.25vw, 5.25rem);` |
|
|
92
|
+
| `.fm-9` | `margin: clamp(6.75rem, 6.38rem + 1.88vw, 7.88rem);` |
|
|
93
|
+
|
|
94
|
+
### Fluid padding
|
|
95
|
+
|
|
96
|
+
Same scale as fluid margin. Prefix `fp` instead of `fm`.
|
|
97
|
+
|
|
98
|
+
| Class | Properties |
|
|
99
|
+
|-------|------------|
|
|
100
|
+
| `.fp-1` | `padding: clamp(0.31rem, 0.31rem + 0vw, 0.31rem);` |
|
|
101
|
+
| `.fp-2` | `padding: clamp(0.56rem, 0.52rem + 0.21vw, 0.69rem);` |
|
|
102
|
+
| `.fp-3` | `padding: clamp(0.88rem, 0.83rem + 0.21vw, 1rem);` |
|
|
103
|
+
| `.fp-4` | `padding: clamp(1.13rem, 1.06rem + 0.31vw, 1.31rem);` |
|
|
104
|
+
| `.fp-5` | `padding: clamp(1.69rem, 1.58rem + 0.52vw, 2rem);` |
|
|
105
|
+
| `.fp-6` | `padding: clamp(2.25rem, 2.13rem + 0.63vw, 2.63rem);` |
|
|
106
|
+
| `.fp-7` | `padding: clamp(3.38rem, 3.19rem + 0.94vw, 3.94rem);` |
|
|
107
|
+
| `.fp-8` | `padding: clamp(4.5rem, 4.25rem + 1.25vw, 5.25rem);` |
|
|
108
|
+
| `.fp-9` | `padding: clamp(6.75rem, 6.38rem + 1.88vw, 7.88rem);` |
|
|
109
|
+
|
|
110
|
+
## Typography
|
|
111
|
+
|
|
112
|
+
### Font size
|
|
113
|
+
|
|
114
|
+
| Class | Properties |
|
|
115
|
+
|-------|------------|
|
|
116
|
+
| `.text-xxs` | `font-size: var(--theme-font-size-xxs);` |
|
|
117
|
+
| `.text-xs` | `font-size: var(--theme-font-size-xs);` |
|
|
118
|
+
| `.text-sm` | `font-size: var(--theme-font-size-sm);` |
|
|
119
|
+
| `.text-base` | `font-size: var(--theme-font-size-base);` |
|
|
120
|
+
| `.text-lg` | `font-size: var(--theme-font-size-lg);` |
|
|
121
|
+
| `.text-xl` | `font-size: var(--theme-font-size-xl);` |
|
|
122
|
+
| `.text-2xl` | `font-size: var(--theme-font-size-2xl);` |
|
|
123
|
+
| `.text-3xl` | `font-size: var(--theme-font-size-3xl);` |
|
|
124
|
+
| `.text-4xl` | `font-size: var(--theme-font-size-4xl);` |
|
|
125
|
+
| `.text-5xl` | `font-size: var(--theme-font-size-5xl);` |
|
|
126
|
+
| `.text-6xl` | `font-size: var(--theme-font-size-6xl);` |
|
|
127
|
+
|
|
128
|
+
### Font weight
|
|
129
|
+
|
|
130
|
+
| Class | Properties |
|
|
131
|
+
|-------|------------|
|
|
132
|
+
| `.font-thin` | `font-weight: 100;` |
|
|
133
|
+
| `.font-extralight` | `font-weight: 200;` |
|
|
134
|
+
| `.font-light` | `font-weight: 300;` |
|
|
135
|
+
| `.font-regular` | `font-weight: 400;` |
|
|
136
|
+
| `.font-medium` | `font-weight: 500;` |
|
|
137
|
+
| `.font-semibold` | `font-weight: 600;` |
|
|
138
|
+
| `.font-bold` | `font-weight: 700;` |
|
|
139
|
+
| `.font-extrabold` | `font-weight: 800;` |
|
|
140
|
+
| `.font-black` | `font-weight: 900;` |
|
|
141
|
+
|
|
142
|
+
### Line height
|
|
143
|
+
|
|
144
|
+
| Class | Properties |
|
|
145
|
+
|-------|------------|
|
|
146
|
+
| `.leading-tighter` | `line-height: 1.15;` |
|
|
147
|
+
| `.leading-tight` | `line-height: 1.3;` |
|
|
148
|
+
| `.leading-normal` | `line-height: 1.5;` |
|
|
149
|
+
| `.leading-loose` | `line-height: 1.7;` |
|
|
150
|
+
| `.leading-looser` | `line-height: 1.9;` |
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @reuters-graphics/graphics-components
|
|
2
|
+
|
|
3
|
+
A Svelte 5 component library built by the Graphics team at Reuters for producing data journalism and interactive graphics. Components cover page layout, text elements, multimedia, maps, data visualisation, and site infrastructure — all designed to match the visual and structural conventions of enterprise stories published on reuters.com.
|
|
4
|
+
|
|
5
|
+
The library ships with a full SCSS design system: spacing tokens, typography utilities, a colour palette, and CSS custom properties for theming via the `Theme` component.
|
|
6
|
+
|
|
7
|
+
**Install:** `pnpm add @reuters-graphics/graphics-components`
|
|
8
|
+
|
|
9
|
+
**Import components:**
|
|
10
|
+
|
|
11
|
+
```svelte
|
|
12
|
+
<script>
|
|
13
|
+
import {
|
|
14
|
+
BodyText,
|
|
15
|
+
Legend,
|
|
16
|
+
ShareBar,
|
|
17
|
+
} from '@reuters-graphics/graphics-components';
|
|
18
|
+
</script>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Import SCSS:**
|
|
22
|
+
|
|
23
|
+
```scss
|
|
24
|
+
@use '@reuters-graphics/graphics-components/scss/main';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## This reference
|
|
30
|
+
|
|
31
|
+
- **[Components](./components/index.md)** — Per-component docs with props tables, TypeScript type definitions, and usage examples extracted from Storybook stories.
|
|
32
|
+
- **[Guides](./guides/index.md)** — Integration guides, design system reference, theming, SCSS tokens, and colour palettes.
|
|
33
|
+
|
|
34
|
+
To find a specific component, start with `./components/index.md` for the full list, then open the individual component file. To understand the design system (spacing, colours, typography), start with `./guides/index.md`.
|
|
35
|
+
|
|
36
|
+
These docs are automatically generated from components' code structure, SCSS files and also from human-friendly documentation written using Storybook's MDX and Component Story Format syntax.
|