@swr-data-lab/components 1.9.1 → 1.11.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.
- package/.storybook/main.ts +7 -13
- package/.storybook/preview.ts +2 -2
- package/package.json +68 -69
- package/src/Autocomplete/Autocomplete.stories.svelte +2 -3
- package/src/Autocomplete/Autocomplete.svelte +4 -5
- package/src/Button/Button.stories.svelte +20 -0
- package/src/Button/Button.svelte +14 -11
- package/src/Caption/Caption.stories.svelte +23 -0
- package/src/Caption/Caption.svelte +29 -0
- package/src/Caption/index.ts +2 -0
- package/src/Card/Card.stories.svelte +1 -2
- package/src/Card/Card.svelte +5 -3
- package/src/ChartFooter/ChartFooter.mdx +1 -1
- package/src/ChartFooter/ChartFooter.stories.svelte +1 -2
- package/src/ChartFooter/ChartFooter.svelte +7 -20
- package/src/ChartHeader/ChartHeader.mdx +2 -1
- package/src/ChartHeader/ChartHeader.stories.svelte +2 -3
- package/src/ChartHeader/ChartHeader.svelte +9 -16
- package/src/Copy/Copy.stories.svelte +31 -0
- package/src/Copy/Copy.svelte +29 -0
- package/src/Copy/index.ts +2 -0
- package/src/DesignTokens/DesignTokens.mdx +50 -14
- package/src/DesignTokens/DesignTokens.svelte +48 -22
- package/src/DesignTokens/{Tokens.js → Tokens.ts} +41 -26
- package/src/FormLabel/FormLabel.mdx +13 -0
- package/src/FormLabel/FormLabel.stories.svelte +50 -0
- package/src/FormLabel/FormLabel.svelte +36 -0
- package/src/FormLabel/index.ts +2 -0
- package/src/Headline/Headline.stories.svelte +16 -0
- package/src/Headline/Headline.svelte +23 -0
- package/src/Headline/index.ts +2 -0
- package/src/HighlightCard/HighlightCard.stories.svelte +1 -2
- package/src/HighlightCard/HighlightCard.svelte +1 -2
- package/src/Input/Input.svelte +3 -4
- package/src/Intro.mdx +1 -1
- package/src/Logotype/Logotype.stories.svelte +1 -2
- package/src/Middot/Middot.stories.svelte +1 -2
- package/src/Note/Note.stories.svelte +22 -0
- package/src/Note/Note.svelte +38 -0
- package/src/Note/index.ts +2 -0
- package/src/Select/Select.mdx +1 -1
- package/src/Select/Select.stories.svelte +4 -4
- package/src/Select/SelectStoriesTemplate.svelte +2 -6
- package/src/Switcher/Switcher.mdx +1 -1
- package/src/Switcher/Switcher.stories.svelte +2 -3
- package/src/Switcher/Switcher.svelte +8 -12
- package/src/styles/base.scss +8 -33
- package/vitest.workspace.ts +1 -1
package/.storybook/main.ts
CHANGED
|
@@ -11,20 +11,14 @@ const config: StorybookConfig = {
|
|
|
11
11
|
'../src/**/*.mdx'
|
|
12
12
|
],
|
|
13
13
|
|
|
14
|
-
addons: [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
getAbsolutePath('@storybook/addon-links'),
|
|
22
|
-
getAbsolutePath('@storybook/addon-essentials'),
|
|
23
|
-
getAbsolutePath('@chromatic-com/storybook'),
|
|
24
|
-
getAbsolutePath('@storybook/experimental-addon-test')
|
|
25
|
-
],
|
|
14
|
+
addons: [{
|
|
15
|
+
name: getAbsolutePath("@storybook/addon-svelte-csf"),
|
|
16
|
+
options: {
|
|
17
|
+
legacyTemplate: true
|
|
18
|
+
}
|
|
19
|
+
}, getAbsolutePath('@storybook/addon-links'), getAbsolutePath('@chromatic-com/storybook'), getAbsolutePath('@storybook/addon-vitest'), getAbsolutePath("@storybook/addon-docs")],
|
|
26
20
|
framework: {
|
|
27
|
-
name:
|
|
21
|
+
name: getAbsolutePath("@storybook/sveltekit"),
|
|
28
22
|
options: {}
|
|
29
23
|
},
|
|
30
24
|
|
package/.storybook/preview.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Preview } from "@storybook/
|
|
1
|
+
import type { Preview } from "@storybook/sveltekit";
|
|
2
2
|
|
|
3
3
|
const preview: Preview = {
|
|
4
4
|
parameters: {
|
|
5
5
|
options: {
|
|
6
|
-
storySort: { order: ['About', 'Design Tokens', "Display", "Chart", ["ChartHeader"], "Form", "Deprecated"] },
|
|
6
|
+
storySort: { order: ['About', 'Design Tokens', "Typography", ["Headline", "Copy", "Caption"], "Display", "Chart", ["ChartHeader"], "Form", "Deprecated"] },
|
|
7
7
|
},
|
|
8
8
|
controls: {
|
|
9
9
|
matchers: {
|
package/package.json
CHANGED
|
@@ -1,71 +1,70 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"version": "1.9.1"
|
|
2
|
+
"name": "@swr-data-lab/components",
|
|
3
|
+
"description": "SWR Data Lab component library",
|
|
4
|
+
"author": "SWR Data Lab",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "restricted"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "vite dev",
|
|
10
|
+
"build": "vite build",
|
|
11
|
+
"preview": "vite preview",
|
|
12
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
13
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
14
|
+
"storybook": "storybook dev -p 6006",
|
|
15
|
+
"start": "storybook dev -p 6006",
|
|
16
|
+
"build-storybook": "storybook build --disable-telemetry",
|
|
17
|
+
"test-storybook": "vitest run --project=storybook",
|
|
18
|
+
"test-storybook:ci": "concurrently -k -s first -n \"Storybook,Test\" -c \"magenta,blue\" \"npm run build-storybook --quiet && npx http-server storybook-static --port 6006 --silent\" \"wait-on tcp:6006 && npm run test-storybook\"",
|
|
19
|
+
"semantic-release": "semantic-release"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"svelte-select": "^5.8.3"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@chromatic-com/storybook": "^4.0.0-next.6",
|
|
26
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
27
|
+
"@semantic-release/git": "^10.0.1",
|
|
28
|
+
"@semantic-release/npm": "^12.0.1",
|
|
29
|
+
"@storybook/addon-docs": "^9.0.0-beta.11",
|
|
30
|
+
"@storybook/addon-links": "^9.0.0-beta.11",
|
|
31
|
+
"@storybook/addon-svelte-csf": "^5.0.0-next.30",
|
|
32
|
+
"@storybook/addon-vitest": "^9.0.0-beta.11",
|
|
33
|
+
"@storybook/sveltekit": "^9.0.0-beta.11",
|
|
34
|
+
"@storybook/test-runner": "^0.23.0-next.1",
|
|
35
|
+
"@sveltejs/adapter-auto": "^3.0.0",
|
|
36
|
+
"@sveltejs/kit": "^2.0.0",
|
|
37
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
38
|
+
"@vitest/browser": "^3.1.1",
|
|
39
|
+
"@vitest/coverage-v8": "^3.1.1",
|
|
40
|
+
"concurrently": "^9.0.1",
|
|
41
|
+
"http-server": "^14.1.1",
|
|
42
|
+
"playwright": "^1.51.1",
|
|
43
|
+
"sass-embedded": "^1.78.0",
|
|
44
|
+
"semantic-release": "^24.1.2",
|
|
45
|
+
"storybook": "^9.0.0-beta.11",
|
|
46
|
+
"svelte": "^5.23.0",
|
|
47
|
+
"svelte-check": "^4.0.0",
|
|
48
|
+
"typescript": "^5.0.0",
|
|
49
|
+
"vite": "^6.0.0",
|
|
50
|
+
"vitest": "^3.1.1",
|
|
51
|
+
"wait-on": "^8.0.1"
|
|
52
|
+
},
|
|
53
|
+
"type": "module",
|
|
54
|
+
"release": {
|
|
55
|
+
"plugins": [
|
|
56
|
+
"@semantic-release/commit-analyzer",
|
|
57
|
+
"@semantic-release/release-notes-generator",
|
|
58
|
+
"@semantic-release/npm"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"exports": {
|
|
62
|
+
".": {
|
|
63
|
+
"svelte": "./src/index.js"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"version": "1.11.0",
|
|
67
|
+
"overrides": {
|
|
68
|
+
"storybook": "$storybook"
|
|
69
|
+
}
|
|
71
70
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
<script module>
|
|
2
2
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { userEvent, within, expect } from '
|
|
3
|
+
import { userEvent, within, expect } from 'storybook/test';
|
|
4
4
|
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
5
5
|
|
|
6
6
|
import Autocomplete from './Autocomplete.svelte';
|
|
7
7
|
|
|
8
8
|
const { Story } = defineMeta({
|
|
9
|
-
title: 'Deprecated/Autocomplete'
|
|
10
|
-
component: Autocomplete
|
|
9
|
+
title: 'Deprecated/Autocomplete'
|
|
11
10
|
});
|
|
12
11
|
|
|
13
12
|
const testData = ['Apples', 'Oranges', 'Pears', 'Peaches', 'Bananas'].map((el) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { createEventDispatcher } from 'svelte';
|
|
3
3
|
import Circle from '../assets/times-circle-solid.svg.svelte';
|
|
4
|
+
import Caption from '../Caption/Caption.svelte';
|
|
4
5
|
|
|
5
6
|
export let data = [];
|
|
6
7
|
export let query: string = '';
|
|
@@ -137,7 +138,9 @@ Data should be provided as array of objects. Each object contains the informatio
|
|
|
137
138
|
handleItemClick(i);
|
|
138
139
|
}}
|
|
139
140
|
>
|
|
140
|
-
|
|
141
|
+
<Caption>
|
|
142
|
+
{item.label}
|
|
143
|
+
</Caption>
|
|
141
144
|
</button>
|
|
142
145
|
</li>
|
|
143
146
|
{/each}
|
|
@@ -158,9 +161,6 @@ Data should be provided as array of objects. Each object contains the informatio
|
|
|
158
161
|
color: white;
|
|
159
162
|
display: flex;
|
|
160
163
|
flex-flow: column;
|
|
161
|
-
label {
|
|
162
|
-
@extend %form-label;
|
|
163
|
-
}
|
|
164
164
|
|
|
165
165
|
input {
|
|
166
166
|
@extend %form-input;
|
|
@@ -188,7 +188,6 @@ Data should be provided as array of objects. Each object contains the informatio
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
.item {
|
|
191
|
-
@extend %caption;
|
|
192
191
|
padding: 0.5em;
|
|
193
192
|
width: 100%;
|
|
194
193
|
background: transparent;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Button from './Button.svelte';
|
|
4
|
+
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: 'Form/Button'
|
|
8
|
+
});
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<Story name="Basic">
|
|
12
|
+
<DesignTokens>
|
|
13
|
+
<Button label="This is a button label"></Button>
|
|
14
|
+
</DesignTokens>
|
|
15
|
+
</Story>
|
|
16
|
+
<Story name="Disabled">
|
|
17
|
+
<DesignTokens>
|
|
18
|
+
<Button disabled label="This button is disabled"></Button>
|
|
19
|
+
</DesignTokens>
|
|
20
|
+
</Story>
|
package/src/Button/Button.svelte
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import Copy from '../Copy/Copy.svelte';
|
|
3
|
+
|
|
2
4
|
interface ButtonProps {
|
|
3
|
-
as: 'button' | 'a';
|
|
4
5
|
label: string;
|
|
6
|
+
as?: 'button' | 'a';
|
|
5
7
|
href?: string;
|
|
6
8
|
disabled?: boolean;
|
|
7
9
|
onclick?: (e: MouseEvent) => any | void;
|
|
@@ -11,31 +13,32 @@
|
|
|
11
13
|
</script>
|
|
12
14
|
|
|
13
15
|
{#if as === 'a'}
|
|
14
|
-
<a class="button" class:disabled {href}>
|
|
16
|
+
<a class="button" class:disabled {href}>
|
|
17
|
+
<Copy weight="bold">
|
|
18
|
+
{label}
|
|
19
|
+
</Copy>
|
|
20
|
+
</a>
|
|
15
21
|
{:else}
|
|
16
|
-
<button class="button" {onclick} {disabled}>
|
|
22
|
+
<button class="button" {onclick} {disabled}>
|
|
23
|
+
<Copy weight="bold">
|
|
24
|
+
{label}
|
|
25
|
+
</Copy>
|
|
26
|
+
</button>
|
|
17
27
|
{/if}
|
|
18
28
|
|
|
19
29
|
<style lang="scss">
|
|
20
|
-
@use '../styles/base.scss';
|
|
21
30
|
.button {
|
|
22
|
-
@extend %copy-bold;
|
|
23
31
|
background: var(--violet-dark-3);
|
|
24
32
|
display: inline-flex;
|
|
25
33
|
align-items: center;
|
|
26
34
|
justify-self: flex-start;
|
|
27
|
-
padding: 0.
|
|
28
|
-
padding-bottom: 0.35em;
|
|
35
|
+
padding: 0.45em 1.25em;
|
|
29
36
|
color: white;
|
|
30
37
|
border: 1px solid rgba(white, 0.1);
|
|
31
38
|
box-shadow: 0px 0px 10px rgba(black, 0.05);
|
|
32
39
|
border-radius: var(--br-small);
|
|
33
40
|
text-shadow: 0px 0px 5px rgba(black, 0.05);
|
|
34
|
-
font-size: 1.2rem;
|
|
35
41
|
text-decoration: none;
|
|
36
|
-
@media (min-width: base.$break-tablet) {
|
|
37
|
-
font-size: 1.4rem;
|
|
38
|
-
}
|
|
39
42
|
&:hover,
|
|
40
43
|
&:focus-visible {
|
|
41
44
|
text-decoration: underline;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
4
|
+
|
|
5
|
+
import Caption from './Caption.svelte';
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: 'Typography/Caption'
|
|
9
|
+
});
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Story name="Default">
|
|
13
|
+
<DesignTokens>
|
|
14
|
+
<Caption>Björn Schittenhelm, Apotheker aus Holzgerlingen (Kreis Böblingen)</Caption>
|
|
15
|
+
</DesignTokens>
|
|
16
|
+
</Story>
|
|
17
|
+
<Story name="Bold">
|
|
18
|
+
<DesignTokens>
|
|
19
|
+
<Caption weight="bold">
|
|
20
|
+
Björn Schittenhelm, Apotheker aus Holzgerlingen (Kreis Böblingen)
|
|
21
|
+
</Caption>
|
|
22
|
+
</DesignTokens>
|
|
23
|
+
</Story>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface CaptionProps {
|
|
5
|
+
weight?: 'regular' | 'bold';
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
}
|
|
8
|
+
let { weight = 'regular', children }: CaptionProps = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div class={['container', weight]}>
|
|
12
|
+
{#if children}
|
|
13
|
+
{@render children()}
|
|
14
|
+
{/if}
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<style lang="scss">
|
|
18
|
+
.container {
|
|
19
|
+
font-family: var(--swr-sans);
|
|
20
|
+
font-size: var(--fs-small-2);
|
|
21
|
+
line-height: 1;
|
|
22
|
+
letter-spacing: 0.0045em;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.bold {
|
|
26
|
+
font-weight: 585;
|
|
27
|
+
letter-spacing: 0;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
package/src/Card/Card.svelte
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import Copy from '../Copy/Copy.svelte';
|
|
3
4
|
|
|
4
5
|
interface CardProps {
|
|
5
6
|
children?: Snippet;
|
|
@@ -10,7 +11,9 @@
|
|
|
10
11
|
|
|
11
12
|
<div class="card">
|
|
12
13
|
{#if children}
|
|
13
|
-
|
|
14
|
+
<Copy>
|
|
15
|
+
{@render children()}
|
|
16
|
+
</Copy>
|
|
14
17
|
{/if}
|
|
15
18
|
</div>
|
|
16
19
|
|
|
@@ -18,14 +21,13 @@
|
|
|
18
21
|
@use '../styles/base.scss';
|
|
19
22
|
|
|
20
23
|
.card {
|
|
21
|
-
@extend %copy;
|
|
22
24
|
color: white;
|
|
23
25
|
width: auto;
|
|
24
26
|
max-width: var(--app-max-width);
|
|
25
27
|
background: var(--violet-dark-5);
|
|
26
28
|
border-radius: var(--br-large);
|
|
27
29
|
padding: 1.5rem;
|
|
28
|
-
@media (min-width: base.$
|
|
30
|
+
@media (min-width: base.$bp-m) {
|
|
29
31
|
padding: 2.5rem;
|
|
30
32
|
}
|
|
31
33
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import Logotype from '../Logotype/Logotype.svelte';
|
|
4
|
+
import Note from '../Note/Note.svelte';
|
|
4
5
|
|
|
5
6
|
interface ChartFooterProps {
|
|
6
7
|
layout: 'one-up' | 'two-up';
|
|
@@ -12,9 +13,9 @@
|
|
|
12
13
|
|
|
13
14
|
<footer class={`container ${layout}`}>
|
|
14
15
|
{#if children}
|
|
15
|
-
<
|
|
16
|
+
<Note>
|
|
16
17
|
{@render children()}
|
|
17
|
-
</
|
|
18
|
+
</Note>
|
|
18
19
|
{/if}
|
|
19
20
|
<Logotype />
|
|
20
21
|
</footer>
|
|
@@ -24,9 +25,9 @@
|
|
|
24
25
|
|
|
25
26
|
.container {
|
|
26
27
|
gap: 0.5rem;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
:global(div) {
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
30
31
|
}
|
|
31
32
|
.one-up {
|
|
32
33
|
display: flex;
|
|
@@ -36,24 +37,10 @@
|
|
|
36
37
|
.two-up {
|
|
37
38
|
display: grid;
|
|
38
39
|
grid-template-columns: 1fr;
|
|
39
|
-
@media (min-width: base.$
|
|
40
|
+
@media (min-width: base.$bp-s) {
|
|
40
41
|
grid-template-columns: 2.5fr 1fr;
|
|
41
42
|
align-items: last baseline;
|
|
42
43
|
justify-items: flex-end;
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
|
-
.notes {
|
|
46
|
-
width: 100%;
|
|
47
|
-
}
|
|
48
|
-
footer :global(*) {
|
|
49
|
-
margin-bottom: 0;
|
|
50
|
-
color: var(--gray-base);
|
|
51
|
-
}
|
|
52
|
-
footer :global(a),
|
|
53
|
-
footer :global(summary) {
|
|
54
|
-
&:hover,
|
|
55
|
-
&:focus-visible {
|
|
56
|
-
color: var(--gray-dark-3);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
46
|
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Story,
|
|
1
|
+
import { Story, Meta, Primary, Controls, Stories } from '@storybook/addon-docs/blocks';
|
|
2
2
|
|
|
3
3
|
import * as ChartHeaderStories from './ChartHeader.stories.svelte';
|
|
4
4
|
|
|
@@ -8,6 +8,7 @@ import * as ChartHeaderStories from './ChartHeader.stories.svelte';
|
|
|
8
8
|
|
|
9
9
|
Standard chart header.
|
|
10
10
|
|
|
11
|
+
- The slugified `title` is set as the header element's `id` attribute (useful for linking to interactives from in-article table of contents)
|
|
11
12
|
- Any nested HTML will render under the description (useful for i.e colour keys and interactives controls).
|
|
12
13
|
|
|
13
14
|
<Controls />
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<script context="module">
|
|
2
2
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
3
|
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
4
|
-
import { expect } from '
|
|
4
|
+
import { expect } from 'storybook/test';
|
|
5
5
|
import ChartHeader from './ChartHeader.svelte';
|
|
6
6
|
|
|
7
7
|
const { Story } = defineMeta({
|
|
8
|
-
title: 'Chart/ChartHeader'
|
|
9
|
-
component: ChartHeader
|
|
8
|
+
title: 'Chart/ChartHeader'
|
|
10
9
|
});
|
|
11
10
|
</script>
|
|
12
11
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import Headline from '../Headline/Headline.svelte';
|
|
4
|
+
import Copy from '../Copy/Copy.svelte';
|
|
5
|
+
import slugify from '../utils/slugify';
|
|
6
|
+
|
|
5
7
|
interface ChartHeaderProps {
|
|
6
8
|
title: string;
|
|
7
9
|
subtitle?: string;
|
|
@@ -11,9 +13,9 @@
|
|
|
11
13
|
</script>
|
|
12
14
|
|
|
13
15
|
<header class="container" id={slugify(title)}>
|
|
14
|
-
<
|
|
16
|
+
<Headline>{title}</Headline>
|
|
15
17
|
{#if subtitle}
|
|
16
|
-
<p class="subtitle">{subtitle}</p>
|
|
18
|
+
<Copy><p class="subtitle">{subtitle}</p></Copy>
|
|
17
19
|
{/if}
|
|
18
20
|
{#if children}
|
|
19
21
|
<div class="content">
|
|
@@ -27,19 +29,10 @@
|
|
|
27
29
|
color: var(--violet-blue);
|
|
28
30
|
font-family: var(--swr-sans);
|
|
29
31
|
}
|
|
30
|
-
.title {
|
|
31
|
-
font-size: var(--fs-large-3);
|
|
32
|
-
line-height: 1.05;
|
|
33
|
-
text-wrap: balance;
|
|
34
|
-
font-weight: 700;
|
|
35
|
-
margin-bottom: 0.2em;
|
|
36
|
-
}
|
|
37
32
|
.subtitle {
|
|
38
33
|
text-wrap: balance;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
margin-bottom: 0;
|
|
43
|
-
}
|
|
34
|
+
}
|
|
35
|
+
.content {
|
|
36
|
+
margin-top: 0.25em;
|
|
44
37
|
}
|
|
45
38
|
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
4
|
+
|
|
5
|
+
import Copy from './Copy.svelte';
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: 'Typography/Copy'
|
|
9
|
+
});
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Story name="Default">
|
|
13
|
+
<DesignTokens>
|
|
14
|
+
<Copy>
|
|
15
|
+
Björn Schittenhelm, Apotheker aus Holzgerlingen (Kreis Böblingen), bedient derzeit
|
|
16
|
+
größtenteils Allergiegeplagte: "Wir gehen nahtlos von der Erkältungssaison in die Pollensaison
|
|
17
|
+
hinein. Wir merken definitiv eine Veränderung über die letzten Jahre: Die Pollensaison wird
|
|
18
|
+
länger, die Grippesaison wird länger und dadurch überlappt sich das Ganze."
|
|
19
|
+
</Copy>
|
|
20
|
+
</DesignTokens>
|
|
21
|
+
</Story>
|
|
22
|
+
<Story name="Bold">
|
|
23
|
+
<DesignTokens>
|
|
24
|
+
<Copy weight="bold">
|
|
25
|
+
Björn Schittenhelm, Apotheker aus Holzgerlingen (Kreis Böblingen), bedient derzeit
|
|
26
|
+
größtenteils Allergiegeplagte: "Wir gehen nahtlos von der Erkältungssaison in die Pollensaison
|
|
27
|
+
hinein. Wir merken definitiv eine Veränderung über die letzten Jahre: Die Pollensaison wird
|
|
28
|
+
länger, die Grippesaison wird länger und dadurch überlappt sich das Ganze."
|
|
29
|
+
</Copy>
|
|
30
|
+
</DesignTokens>
|
|
31
|
+
</Story>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface CopyProps {
|
|
5
|
+
weight?: 'regular' | 'bold';
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
}
|
|
8
|
+
let { weight = 'regular', children }: CopyProps = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div class={['container', weight]}>
|
|
12
|
+
{#if children}
|
|
13
|
+
{@render children()}
|
|
14
|
+
{/if}
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<style lang="scss">
|
|
18
|
+
.container {
|
|
19
|
+
font-family: var(--swr-sans);
|
|
20
|
+
font-size: var(--fs-base);
|
|
21
|
+
letter-spacing: 0.005em;
|
|
22
|
+
line-height: 1.475;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.bold {
|
|
26
|
+
font-weight: 585;
|
|
27
|
+
letter-spacing: 0;
|
|
28
|
+
}
|
|
29
|
+
</style>
|