@swr-data-lab/components 1.13.1 → 1.13.2
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/package.json +2 -4
- package/dist/Autocomplete/Autocomplete.stories.svelte +0 -61
- package/dist/Autocomplete/Autocomplete.stories.svelte.d.ts +0 -27
- package/dist/Button/Button.stories.svelte +0 -19
- package/dist/Button/Button.stories.svelte.d.ts +0 -19
- package/dist/Caption/Caption.stories.svelte +0 -24
- package/dist/Caption/Caption.stories.svelte.d.ts +0 -27
- package/dist/Card/Card.stories.svelte +0 -17
- package/dist/Card/Card.stories.svelte.d.ts +0 -19
- package/dist/ChartFooter/ChartFooter.stories.svelte +0 -32
- package/dist/ChartFooter/ChartFooter.stories.svelte.d.ts +0 -27
- package/dist/ChartHeader/ChartHeader.stories.svelte +0 -31
- package/dist/ChartHeader/ChartHeader.stories.svelte.d.ts +0 -27
- package/dist/ChartList/ChartList.stories.svelte +0 -48
- package/dist/ChartList/ChartList.stories.svelte.d.ts +0 -27
- package/dist/Copy/Copy.stories.svelte +0 -32
- package/dist/Copy/Copy.stories.svelte.d.ts +0 -27
- package/dist/FormLabel/FormLabel.stories.svelte +0 -52
- package/dist/FormLabel/FormLabel.stories.svelte.d.ts +0 -27
- package/dist/Headline/Headline.stories.svelte +0 -17
- package/dist/Headline/Headline.stories.svelte.d.ts +0 -27
- package/dist/HighlightCard/HighlightCard.stories.svelte +0 -55
- package/dist/HighlightCard/HighlightCard.stories.svelte.d.ts +0 -19
- package/dist/Logotype/Logotype.stories.svelte +0 -14
- package/dist/Logotype/Logotype.stories.svelte.d.ts +0 -19
- package/dist/Middot/Middot.stories.svelte +0 -14
- package/dist/Middot/Middot.stories.svelte.d.ts +0 -19
- package/dist/Note/Note.stories.svelte +0 -23
- package/dist/Note/Note.stories.svelte.d.ts +0 -27
- package/dist/Select/Select.stories.svelte +0 -202
- package/dist/Select/Select.stories.svelte.d.ts +0 -19
- package/dist/Select/SelectStoriesTemplate.svelte +0 -31
- package/dist/Select/SelectStoriesTemplate.svelte.d.ts +0 -15
- package/dist/Switcher/Switcher.stories.svelte +0 -44
- package/dist/Switcher/Switcher.stories.svelte.d.ts +0 -27
- package/dist/maplibre/AttributionControl/AttributionControl.stories.svelte +0 -27
- package/dist/maplibre/AttributionControl/AttributionControl.stories.svelte.d.ts +0 -19
- package/dist/maplibre/GeocoderControl/GeocoderControl.stories.svelte +0 -74
- package/dist/maplibre/GeocoderControl/GeocoderControl.stories.svelte.d.ts +0 -19
- package/dist/maplibre/Map/Map.stories.svelte +0 -113
- package/dist/maplibre/Map/Map.stories.svelte.d.ts +0 -19
- package/dist/maplibre/MapControl/MapControl.stories.svelte +0 -46
- package/dist/maplibre/MapControl/MapControl.stories.svelte.d.ts +0 -19
- package/dist/maplibre/MapStyle/SWRDataLabLight.stories.svelte +0 -39
- package/dist/maplibre/MapStyle/SWRDataLabLight.stories.svelte.d.ts +0 -18
- package/dist/maplibre/NavigationControl/NavigationControl.stories.svelte +0 -37
- package/dist/maplibre/NavigationControl/NavigationControl.stories.svelte.d.ts +0 -19
- package/dist/maplibre/ScaleControl/ScaleControl.stories.svelte +0 -68
- package/dist/maplibre/ScaleControl/ScaleControl.stories.svelte.d.ts +0 -19
- package/dist/maplibre/Source/MapSource.stories.svelte +0 -7
- package/dist/maplibre/Source/MapSource.stories.svelte.d.ts +0 -19
- package/dist/maplibre/Tooltip/Tooltip.stories.svelte +0 -186
- package/dist/maplibre/Tooltip/Tooltip.stories.svelte.d.ts +0 -19
- package/dist/maplibre/VectorLayer/VectorLayer.stories.svelte +0 -62
- package/dist/maplibre/VectorLayer/VectorLayer.stories.svelte.d.ts +0 -19
- package/dist/maplibre/VectorTileSource/VectorTileSource.stories.svelte +0 -44
- package/dist/maplibre/VectorTileSource/VectorTileSource.stories.svelte.d.ts +0 -19
- package/dist/maplibre/WithLinkLocation/WithLinkLocation.stories.svelte +0 -27
- package/dist/maplibre/WithLinkLocation/WithLinkLocation.stories.svelte.d.ts +0 -19
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<script context="module" lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
-
import HighlightCard from './HighlightCard.svelte';
|
|
3
|
-
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
4
|
-
const { Story } = defineMeta({
|
|
5
|
-
title: 'Display/Card/HighlightCard',
|
|
6
|
-
component: HighlightCard
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<Story name="Basic HighlightCard" asChild>
|
|
11
|
-
<DesignTokens>
|
|
12
|
-
<HighlightCard
|
|
13
|
-
topline="Die letzte Großspende liegt bei"
|
|
14
|
-
value="375.000"
|
|
15
|
-
unit="Euro"
|
|
16
|
-
subline="Der Betrag ging am 7. Januar von Dr. Kim Musterperson ein."
|
|
17
|
-
/>
|
|
18
|
-
</DesignTokens>
|
|
19
|
-
</Story>
|
|
20
|
-
|
|
21
|
-
<Story name="Multiple HighlightCards" asChild>
|
|
22
|
-
<DesignTokens>
|
|
23
|
-
<div class="highlight-cards">
|
|
24
|
-
<HighlightCard
|
|
25
|
-
topline="Im aktuellen Jahr wurden bisher"
|
|
26
|
-
value="375.000"
|
|
27
|
-
unit="€"
|
|
28
|
-
subline="an Parteien gespendet."
|
|
29
|
-
/>
|
|
30
|
-
<HighlightCard
|
|
31
|
-
topline="Die letzte Großspende liegt bei"
|
|
32
|
-
value="37.500"
|
|
33
|
-
unit="€"
|
|
34
|
-
subline="Der Betrag ging am 7. Januar von Dr. Kim Musterperson ein."
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
37
|
-
</DesignTokens>
|
|
38
|
-
</Story>
|
|
39
|
-
|
|
40
|
-
<style>
|
|
41
|
-
.highlight-cards {
|
|
42
|
-
@media (min-width: 900px) {
|
|
43
|
-
margin: 0 -1rem;
|
|
44
|
-
display: flex;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:global(.highlight-cards > *) {
|
|
49
|
-
margin: 1rem 0;
|
|
50
|
-
@media (min-width: 900px) {
|
|
51
|
-
margin: 2rem 1rem;
|
|
52
|
-
flex: 1;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
</style>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import HighlightCard from './HighlightCard.svelte';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const HighlightCard: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
}, {}, {}, string>;
|
|
18
|
-
type HighlightCard = InstanceType<typeof HighlightCard>;
|
|
19
|
-
export default HighlightCard;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script context="module" lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
-
import Logotype from './Logotype.svelte';
|
|
3
|
-
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
4
|
-
const { Story } = defineMeta({
|
|
5
|
-
title: 'Chart/Logotype',
|
|
6
|
-
component: Logotype
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<Story name="Basic" asChild>
|
|
11
|
-
<DesignTokens>
|
|
12
|
-
<Logotype></Logotype>
|
|
13
|
-
</DesignTokens>
|
|
14
|
-
</Story>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Logotype from './Logotype.svelte';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const Logotype: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
}, {}, {}, string>;
|
|
18
|
-
type Logotype = InstanceType<typeof Logotype>;
|
|
19
|
-
export default Logotype;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script context="module" lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
-
import Middot from './Middot.svelte';
|
|
3
|
-
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
4
|
-
const { Story } = defineMeta({
|
|
5
|
-
title: 'Chart/Middot',
|
|
6
|
-
component: Middot
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<Story name="Basic" asChild>
|
|
11
|
-
<DesignTokens>
|
|
12
|
-
<Middot></Middot>
|
|
13
|
-
</DesignTokens>
|
|
14
|
-
</Story>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Middot from './Middot.svelte';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const Middot: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
}, {}, {}, string>;
|
|
18
|
-
type Middot = InstanceType<typeof Middot>;
|
|
19
|
-
export default Middot;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<script context="module">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
4
|
-
import Middot from '../Middot/Middot.svelte';
|
|
5
|
-
|
|
6
|
-
import Note from './Note.svelte';
|
|
7
|
-
|
|
8
|
-
const { Story } = defineMeta({
|
|
9
|
-
title: 'Typography/Note',
|
|
10
|
-
component: Note
|
|
11
|
-
});
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<Story name="Default" asChild>
|
|
15
|
-
<DesignTokens>
|
|
16
|
-
<Note>
|
|
17
|
-
Daten: <a href="#1">Zensus 2022</a>
|
|
18
|
-
(Durchschnittsmieten und Einwohnerzahlen),
|
|
19
|
-
<a href="#1">OpenStreetMap</a> (Kartenmaterial) <Middot /> In unserer Darstellung wurde das Zensusgitter
|
|
20
|
-
auf bewohnte Gebiete begrenzt.
|
|
21
|
-
</Note>
|
|
22
|
-
</DesignTokens>
|
|
23
|
-
</Story>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export default Note;
|
|
2
|
-
type Note = SvelteComponent<{
|
|
3
|
-
[x: string]: never;
|
|
4
|
-
}, {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
8
|
-
};
|
|
9
|
-
declare const Note: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
-
[x: string]: never;
|
|
11
|
-
}, {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
14
|
-
import Note from './Note.svelte';
|
|
15
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
|
-
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
|
-
$$bindings?: Bindings;
|
|
18
|
-
} & Exports;
|
|
19
|
-
(internal: unknown, props: {
|
|
20
|
-
$$events?: Events;
|
|
21
|
-
$$slots?: Slots;
|
|
22
|
-
}): Exports & {
|
|
23
|
-
$set?: any;
|
|
24
|
-
$on?: any;
|
|
25
|
-
};
|
|
26
|
-
z_$$bindings?: Bindings;
|
|
27
|
-
}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
<script context="module" lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
-
import Select from './Select.svelte';
|
|
3
|
-
import FormLabel from '../FormLabel/FormLabel.svelte';
|
|
4
|
-
import StoryTemplate from './SelectStoriesTemplate.svelte';
|
|
5
|
-
import jobsData from './mock_data/jobs.json';
|
|
6
|
-
const { Story } = defineMeta({
|
|
7
|
-
title: 'Form/Select',
|
|
8
|
-
component: Select
|
|
9
|
-
});
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<script lang="ts">import { userEvent, within, expect } from 'storybook/test';
|
|
13
|
-
import {} from './Select.types';
|
|
14
|
-
let selectedItem = undefined;
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<Story
|
|
18
|
-
name="Simple"
|
|
19
|
-
asChild
|
|
20
|
-
play={async ({ canvasElement, step }) => {
|
|
21
|
-
const canvas = within(canvasElement);
|
|
22
|
-
const select = canvas.getByLabelText('Select');
|
|
23
|
-
|
|
24
|
-
await step('Clicking an option selects that item', async () => {
|
|
25
|
-
await userEvent.click(select);
|
|
26
|
-
await userEvent.click(canvas.getByText('Cake'));
|
|
27
|
-
expect(selectedItem).toEqual({ value: 'cake', label: 'Cake' });
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
await step('Entering a complete label selects that item', async () => {
|
|
31
|
-
await userEvent.type(select, 'Chocolate{enter}');
|
|
32
|
-
expect(selectedItem).toEqual({ value: 'chocolate', label: 'Chocolate' });
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
await step('Entering a unique part of a label selects the matching item', async () => {
|
|
36
|
-
await userEvent.type(select, 'Ice{enter}');
|
|
37
|
-
expect(selectedItem).toEqual({ value: 'ice-cream', label: 'Ice Cream' });
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
await step('Tapping the clear button clears the input', async () => {
|
|
41
|
-
const clearButton = document.querySelector('.clear-select');
|
|
42
|
-
await userEvent.click(clearButton);
|
|
43
|
-
expect(selectedItem).toEqual(undefined);
|
|
44
|
-
});
|
|
45
|
-
}}
|
|
46
|
-
>
|
|
47
|
-
<StoryTemplate
|
|
48
|
-
bind:selectedItem
|
|
49
|
-
args={{
|
|
50
|
-
inputId: 'select',
|
|
51
|
-
clearable: true,
|
|
52
|
-
items: [
|
|
53
|
-
{ value: 'chocolate', label: 'Chocolate' },
|
|
54
|
-
{ value: 'cake', label: 'Cake' },
|
|
55
|
-
{ value: 'ice-cream', label: 'Ice Cream' }
|
|
56
|
-
]
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
</Story>
|
|
60
|
-
|
|
61
|
-
<Story name="Grouped" asChild>
|
|
62
|
-
<StoryTemplate
|
|
63
|
-
bind:selectedItem
|
|
64
|
-
args={{
|
|
65
|
-
items: [
|
|
66
|
-
{ value: 'chocolate', label: 'Chocolate', group: 'Sweet' },
|
|
67
|
-
{ value: 'pizza', label: 'Pizza', group: 'Savory' },
|
|
68
|
-
{ value: 'cake', label: 'Cake', group: 'Sweet' },
|
|
69
|
-
{ value: 'chips', label: 'Chips', group: 'Savory' },
|
|
70
|
-
{ value: 'ice-cream', label: 'Ice Cream', group: 'Sweet' }
|
|
71
|
-
]
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
</Story>
|
|
75
|
-
|
|
76
|
-
<Story
|
|
77
|
-
name="Grouped (group header selectable)"
|
|
78
|
-
asChild
|
|
79
|
-
play={async ({ canvasElement, step }) => {
|
|
80
|
-
const canvas = within(canvasElement);
|
|
81
|
-
const select = canvas.getByLabelText('Select');
|
|
82
|
-
|
|
83
|
-
await step('Clicking an option header selects that header item', async () => {
|
|
84
|
-
await userEvent.click(select);
|
|
85
|
-
await userEvent.click(canvas.getByText('Savory'));
|
|
86
|
-
expect(selectedItem).toEqual({
|
|
87
|
-
groupHeader: true,
|
|
88
|
-
id: 'Savory',
|
|
89
|
-
label: 'Savory',
|
|
90
|
-
selectable: true,
|
|
91
|
-
value: 'Savory'
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
await step('Entering a label text selects its group header', async () => {
|
|
96
|
-
await userEvent.type(select, 'Chocolate{enter}');
|
|
97
|
-
expect(selectedItem).toEqual({
|
|
98
|
-
groupHeader: true,
|
|
99
|
-
id: 'Sweet',
|
|
100
|
-
label: 'Sweet',
|
|
101
|
-
selectable: true,
|
|
102
|
-
value: 'Sweet'
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<StoryTemplate
|
|
108
|
-
bind:selectedItem
|
|
109
|
-
args={{
|
|
110
|
-
inputId: 'job-select',
|
|
111
|
-
placeholder: 'Ihr Beruf',
|
|
112
|
-
groupHeaderSelectable: true,
|
|
113
|
-
items: [
|
|
114
|
-
{ value: 'chocolate', label: 'Chocolate', group: 'Sweet' },
|
|
115
|
-
{ value: 'pizza', label: 'Pizza', group: 'Savory' },
|
|
116
|
-
{ value: 'cake', label: 'Cake', group: 'Sweet' },
|
|
117
|
-
{ value: 'chips', label: 'Chips', group: 'Savory' },
|
|
118
|
-
{ value: 'ice-cream', label: 'Ice Cream', group: 'Sweet' }
|
|
119
|
-
]
|
|
120
|
-
}}
|
|
121
|
-
/>
|
|
122
|
-
</Story>
|
|
123
|
-
|
|
124
|
-
<Story
|
|
125
|
-
name="Custom items"
|
|
126
|
-
asChild
|
|
127
|
-
play={async ({ canvasElement, step }) => {
|
|
128
|
-
const canvas = within(canvasElement);
|
|
129
|
-
const select = canvas.getByLabelText('Berufe');
|
|
130
|
-
|
|
131
|
-
await step('Render custom list item with the supplied data', async () => {
|
|
132
|
-
await userEvent.type(select, 'Journalismus');
|
|
133
|
-
expect(canvas.getByTestId('custom-item-title').innerText).toEqual('Journalismus');
|
|
134
|
-
expect(canvas.getByTestId('custom-item-addon').innerText).toContain('Redakteur/in');
|
|
135
|
-
await userEvent.type(select, '{enter}');
|
|
136
|
-
expect(selectedItem?.details.title).toEqual('Journalismus');
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
await step('Entering an item\'s "title" selects that item', async () => {
|
|
140
|
-
await userEvent.type(select, 'Tierpflege{enter}');
|
|
141
|
-
expect(selectedItem?.details.title).toEqual('Tierpflege');
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
await step('Entering an item\'s "addon" selects that item', async () => {
|
|
145
|
-
await userEvent.type(select, 'Zirkuskünstler{enter}');
|
|
146
|
-
expect(selectedItem?.details.title).toEqual('Schauspiel und Tanz');
|
|
147
|
-
});
|
|
148
|
-
}}
|
|
149
|
-
>
|
|
150
|
-
<StoryTemplate>
|
|
151
|
-
{#snippet demoComponent()}
|
|
152
|
-
<FormLabel htmlFor="job-select">Berufe</FormLabel>
|
|
153
|
-
<Select
|
|
154
|
-
bind:value={selectedItem}
|
|
155
|
-
inputId="job-select"
|
|
156
|
-
placeholder="z.B. Taxifahrer/in"
|
|
157
|
-
items={jobsData
|
|
158
|
-
.sort((a, b) => a.label.localeCompare(b.label))
|
|
159
|
-
.map((item) => ({
|
|
160
|
-
value: item.value,
|
|
161
|
-
label: `${item.label}: ${item.add_on}`, // used for filtering
|
|
162
|
-
details: {
|
|
163
|
-
title: item.label, // used for display
|
|
164
|
-
addon: item.add_on // used for display
|
|
165
|
-
}
|
|
166
|
-
}))}
|
|
167
|
-
groupHeaderSelectable={false}
|
|
168
|
-
>
|
|
169
|
-
<div slot="item" let:item class="custom-item">
|
|
170
|
-
<h4 class="custom-item-title" data-testid="custom-item-title">
|
|
171
|
-
{item.details.title}
|
|
172
|
-
</h4>
|
|
173
|
-
<p class="custom-item-addon" data-testid="custom-item-addon">{item.details.addon}</p>
|
|
174
|
-
</div>
|
|
175
|
-
<div slot="selection" let:selection class="selection">
|
|
176
|
-
{selection.details.title}
|
|
177
|
-
</div>
|
|
178
|
-
</Select>
|
|
179
|
-
{/snippet}
|
|
180
|
-
</StoryTemplate>
|
|
181
|
-
</Story>
|
|
182
|
-
|
|
183
|
-
<style>
|
|
184
|
-
.custom-item {
|
|
185
|
-
font-size: 0.9rem;
|
|
186
|
-
margin-top: 0.2rem;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.custom-item-title {
|
|
190
|
-
margin: 0 0 0 -0.8rem;
|
|
191
|
-
padding: 0;
|
|
192
|
-
line-height: 1.4;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.custom-item-addon {
|
|
196
|
-
margin: 0 0 0 -0.8rem;
|
|
197
|
-
padding: 0;
|
|
198
|
-
line-height: 1;
|
|
199
|
-
opacity: 0.6;
|
|
200
|
-
font-size: 0.8rem;
|
|
201
|
-
}
|
|
202
|
-
</style>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Select from './Select.svelte';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const Select: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
}, {}, {}, string>;
|
|
18
|
-
type Select = InstanceType<typeof Select>;
|
|
19
|
-
export default Select;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Select from './Select.svelte';
|
|
3
|
-
import FormLabel from '../FormLabel/FormLabel.svelte';
|
|
4
|
-
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
5
|
-
|
|
6
|
-
let { args = null, selectedItem = $bindable(), demoComponent = null } = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<DesignTokens>
|
|
10
|
-
{#if demoComponent}
|
|
11
|
-
{@render demoComponent()}
|
|
12
|
-
{:else}
|
|
13
|
-
<FormLabel htmlFor={args.inputId}>Select</FormLabel>
|
|
14
|
-
<Select {...args} bind:value={selectedItem} />
|
|
15
|
-
{/if}
|
|
16
|
-
</DesignTokens>
|
|
17
|
-
|
|
18
|
-
{#if selectedItem}
|
|
19
|
-
<pre class="output">
|
|
20
|
-
value = {JSON.stringify(selectedItem, null, ' ')}</pre>
|
|
21
|
-
{/if}
|
|
22
|
-
|
|
23
|
-
<style>
|
|
24
|
-
.output {
|
|
25
|
-
display: block;
|
|
26
|
-
margin-top: 1rem;
|
|
27
|
-
padding: 1rem;
|
|
28
|
-
background: #fcfaff;
|
|
29
|
-
color: rgb(18, 69, 139);
|
|
30
|
-
}
|
|
31
|
-
</style>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export default SelectStoriesTemplate;
|
|
2
|
-
type SelectStoriesTemplate = {
|
|
3
|
-
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
-
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
-
};
|
|
6
|
-
declare const SelectStoriesTemplate: import("svelte").Component<{
|
|
7
|
-
args?: any;
|
|
8
|
-
selectedItem?: any;
|
|
9
|
-
demoComponent?: any;
|
|
10
|
-
}, {}, "selectedItem">;
|
|
11
|
-
type $$ComponentProps = {
|
|
12
|
-
args?: any;
|
|
13
|
-
selectedItem?: any;
|
|
14
|
-
demoComponent?: any;
|
|
15
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<script context="module">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Switcher from './Switcher.svelte';
|
|
4
|
-
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
5
|
-
import { userEvent, within, expect } from 'storybook/test';
|
|
6
|
-
|
|
7
|
-
const { Story } = defineMeta({
|
|
8
|
-
title: 'Form/Switcher',
|
|
9
|
-
component: Switcher
|
|
10
|
-
});
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<Story name="Two Options" asChild>
|
|
14
|
-
<DesignTokens>
|
|
15
|
-
<Switcher options={['Option A', 'Option B']} value="Option A" size="default" label="Label" />
|
|
16
|
-
</DesignTokens>
|
|
17
|
-
</Story>
|
|
18
|
-
|
|
19
|
-
<Story
|
|
20
|
-
name="Four Options"
|
|
21
|
-
asChild
|
|
22
|
-
play={async ({ canvasElement, step }) => {
|
|
23
|
-
const canvas = within(canvasElement);
|
|
24
|
-
await step('Clicking selects the expected option', async () => {
|
|
25
|
-
const optionA = canvas.getByLabelText('Apples');
|
|
26
|
-
const optionB = canvas.getByLabelText('Bananas');
|
|
27
|
-
await userEvent.click(optionA);
|
|
28
|
-
expect(optionA).toBeChecked();
|
|
29
|
-
expect(optionB).not.toBeChecked();
|
|
30
|
-
await userEvent.click(optionB);
|
|
31
|
-
expect(optionB).toBeChecked();
|
|
32
|
-
expect(optionA).not.toBeChecked();
|
|
33
|
-
});
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
36
|
-
<DesignTokens>
|
|
37
|
-
<Switcher
|
|
38
|
-
options={['Apples', 'Oranges', 'Bananas', 'Peaches']}
|
|
39
|
-
value="Oranges"
|
|
40
|
-
label="Label"
|
|
41
|
-
size="small"
|
|
42
|
-
/>
|
|
43
|
-
</DesignTokens>
|
|
44
|
-
</Story>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export default Switcher;
|
|
2
|
-
type Switcher = SvelteComponent<{
|
|
3
|
-
[x: string]: never;
|
|
4
|
-
}, {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
8
|
-
};
|
|
9
|
-
declare const Switcher: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
-
[x: string]: never;
|
|
11
|
-
}, {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
14
|
-
import Switcher from './Switcher.svelte';
|
|
15
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
|
-
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
|
-
$$bindings?: Bindings;
|
|
18
|
-
} & Exports;
|
|
19
|
-
(internal: unknown, props: {
|
|
20
|
-
$$events?: Events;
|
|
21
|
-
$$slots?: Slots;
|
|
22
|
-
}): Exports & {
|
|
23
|
-
$set?: any;
|
|
24
|
-
$on?: any;
|
|
25
|
-
};
|
|
26
|
-
z_$$bindings?: Bindings;
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script context="module" lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
-
import AttributionControl from './AttributionControl.svelte';
|
|
3
|
-
import DesignTokens from '../../DesignTokens/DesignTokens.svelte';
|
|
4
|
-
import Map from '../Map/Map.svelte';
|
|
5
|
-
import { SWRDataLabLight } from '../MapStyle';
|
|
6
|
-
const { Story } = defineMeta({
|
|
7
|
-
title: 'Maplibre/Control/AttributionControl',
|
|
8
|
-
component: AttributionControl
|
|
9
|
-
});
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<Story asChild name="Default">
|
|
13
|
-
<DesignTokens>
|
|
14
|
-
<div class="container">
|
|
15
|
-
<Map style={SWRDataLabLight} initialLocation={{ lat: 51, lng: 10, zoom: 20 }}>
|
|
16
|
-
<AttributionControl customAttribution="SWR Data Lab" position="bottom-left" />
|
|
17
|
-
</Map>
|
|
18
|
-
</div>
|
|
19
|
-
</DesignTokens>
|
|
20
|
-
</Story>
|
|
21
|
-
|
|
22
|
-
<style>
|
|
23
|
-
.container {
|
|
24
|
-
width: 500px;
|
|
25
|
-
height: 300px;
|
|
26
|
-
}
|
|
27
|
-
</style>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import AttributionControl from './AttributionControl.svelte';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const AttributionControl: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
}, {}, {}, string>;
|
|
18
|
-
type AttributionControl = InstanceType<typeof AttributionControl>;
|
|
19
|
-
export default AttributionControl;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
<script context="module" lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
-
import { within, expect } from 'storybook/test';
|
|
3
|
-
import GeocoderControl from './GeocoderControl.svelte';
|
|
4
|
-
import DesignTokens from '../../DesignTokens/DesignTokens.svelte';
|
|
5
|
-
import Map from '../Map/Map.svelte';
|
|
6
|
-
import { SWRDataLabLight } from '../MapStyle';
|
|
7
|
-
const { Story } = defineMeta({
|
|
8
|
-
title: 'Maplibre/Control/GeocoderControl',
|
|
9
|
-
component: GeocoderControl
|
|
10
|
-
});
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<Story
|
|
14
|
-
asChild
|
|
15
|
-
name="Default"
|
|
16
|
-
play={async ({ canvasElement, step }) => {
|
|
17
|
-
const canvas = within(canvasElement);
|
|
18
|
-
const containerEl = canvas.getByTestId('map-container');
|
|
19
|
-
|
|
20
|
-
await step('Geocoder control renders', async () => {
|
|
21
|
-
const el = containerEl.querySelector('.maplibregl-ctrl-geocoder');
|
|
22
|
-
expect(el).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
await step('Localised placeholder text renders', async () => {
|
|
25
|
-
const el = containerEl.querySelector('.maplibregl-ctrl-geocoder input');
|
|
26
|
-
expect(el).toHaveAttribute('placeholder', 'Suche');
|
|
27
|
-
});
|
|
28
|
-
}}
|
|
29
|
-
>
|
|
30
|
-
<DesignTokens>
|
|
31
|
-
<div class="container">
|
|
32
|
-
<Map style={SWRDataLabLight} initialLocation={{ lat: 51, lng: 10, zoom: 20 }}>
|
|
33
|
-
<GeocoderControl languages="de" service="maptiler" key="V32kPHZjMa0Mkn6YvSzA" />
|
|
34
|
-
</Map>
|
|
35
|
-
</div>
|
|
36
|
-
</DesignTokens>
|
|
37
|
-
</Story>
|
|
38
|
-
<Story
|
|
39
|
-
asChild
|
|
40
|
-
name="Custom placeholder text"
|
|
41
|
-
play={async ({ canvasElement, step }) => {
|
|
42
|
-
const canvas = within(canvasElement);
|
|
43
|
-
const containerEl = canvas.getByTestId('map-container');
|
|
44
|
-
|
|
45
|
-
await step('Geocoder control renders', async () => {
|
|
46
|
-
const el = containerEl.querySelector('.maplibregl-ctrl-geocoder');
|
|
47
|
-
expect(el).toBeTruthy();
|
|
48
|
-
});
|
|
49
|
-
await step('Custom placeholder text renders', async () => {
|
|
50
|
-
const el = containerEl.querySelector('.maplibregl-ctrl-geocoder input');
|
|
51
|
-
expect(el).toHaveAttribute('placeholder', 'My placeholder text');
|
|
52
|
-
});
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
<DesignTokens>
|
|
56
|
-
<div class="container">
|
|
57
|
-
<Map style={SWRDataLabLight} initialLocation={{ lat: 51, lng: 10, zoom: 20 }}>
|
|
58
|
-
<GeocoderControl
|
|
59
|
-
placeholder="My placeholder text"
|
|
60
|
-
languages="de"
|
|
61
|
-
service="maptiler"
|
|
62
|
-
key="V32kPHZjMa0Mkn6YvSzA"
|
|
63
|
-
/>
|
|
64
|
-
</Map>
|
|
65
|
-
</div>
|
|
66
|
-
</DesignTokens>
|
|
67
|
-
</Story>
|
|
68
|
-
|
|
69
|
-
<style>
|
|
70
|
-
.container {
|
|
71
|
-
width: 500px;
|
|
72
|
-
height: 300px;
|
|
73
|
-
}
|
|
74
|
-
</style>
|