@swr-data-lab/components 1.13.1 → 1.13.3
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.mdx +0 -17
- package/dist/ChartFooter/ChartFooter.stories.svelte +0 -32
- package/dist/ChartFooter/ChartFooter.stories.svelte.d.ts +0 -27
- package/dist/ChartHeader/ChartHeader.mdx +0 -16
- package/dist/ChartHeader/ChartHeader.stories.svelte +0 -31
- package/dist/ChartHeader/ChartHeader.stories.svelte.d.ts +0 -27
- package/dist/ChartList/ChartList.mdx +0 -13
- 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/DesignTokens/DesignTokens.mdx +0 -110
- package/dist/FormLabel/FormLabel.mdx +0 -13
- 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/Intro.mdx +0 -7
- 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.mdx +0 -25
- 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.mdx +0 -13
- 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.mdx +0 -12
- 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.mdx +0 -86
- package/dist/maplibre/MapStyle/SWRDataLabLight.stories.svelte +0 -39
- package/dist/maplibre/MapStyle/SWRDataLabLight.stories.svelte.d.ts +0 -18
- package/dist/maplibre/Maplibre.mdx +0 -91
- 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.mdx +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.mdx +0 -11
- package/dist/maplibre/WithLinkLocation/WithLinkLocation.stories.svelte +0 -27
- package/dist/maplibre/WithLinkLocation/WithLinkLocation.stories.svelte.d.ts +0 -19
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Story, Meta, Primary, Controls, Stories } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
|
-
import * as FormLabelStories from './FormLabel.stories.svelte';
|
|
4
|
-
|
|
5
|
-
<Meta of={FormLabelStories}/>
|
|
6
|
-
|
|
7
|
-
# Form Label
|
|
8
|
-
|
|
9
|
-
Standard form label. The `htmlFor` prop is required to semantically link the label to the form element it describes.
|
|
10
|
-
|
|
11
|
-
<Controls />
|
|
12
|
-
|
|
13
|
-
<Stories/>
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { userEvent, within, expect } from 'storybook/test';
|
|
4
|
-
|
|
5
|
-
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
6
|
-
|
|
7
|
-
import FormLabel from './FormLabel.svelte';
|
|
8
|
-
import Select from '../Select/Select.svelte';
|
|
9
|
-
|
|
10
|
-
const { Story } = defineMeta({
|
|
11
|
-
title: 'Form/Label',
|
|
12
|
-
component: FormLabel
|
|
13
|
-
});
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<Story name="Default" asChild>
|
|
17
|
-
<DesignTokens>
|
|
18
|
-
<FormLabel htmlFor="">Deine Gemeinde</FormLabel>
|
|
19
|
-
</DesignTokens>
|
|
20
|
-
</Story>
|
|
21
|
-
|
|
22
|
-
<Story
|
|
23
|
-
name="With Select"
|
|
24
|
-
asChild
|
|
25
|
-
play={async ({ canvasElement, step }) => {
|
|
26
|
-
const canvas = within(canvasElement);
|
|
27
|
-
const label = canvas.getByTestId('label-container');
|
|
28
|
-
const input = canvas.getByPlaceholderText('...');
|
|
29
|
-
await step('Label renders children', async () => {
|
|
30
|
-
await userEvent.click(label);
|
|
31
|
-
expect(label).toHaveTextContent('Deine Gemeinde');
|
|
32
|
-
});
|
|
33
|
-
await step('Clicking the label focuses the input', async () => {
|
|
34
|
-
await userEvent.click(label);
|
|
35
|
-
expect(input).toHaveFocus();
|
|
36
|
-
});
|
|
37
|
-
}}
|
|
38
|
-
>
|
|
39
|
-
<DesignTokens>
|
|
40
|
-
<FormLabel htmlFor="select-gemeinde">Deine Gemeinde</FormLabel>
|
|
41
|
-
<Select
|
|
42
|
-
inputId="select-gemeinde"
|
|
43
|
-
placeholder="..."
|
|
44
|
-
value={undefined}
|
|
45
|
-
items={[
|
|
46
|
-
{ value: 'konstanz', label: 'Konstanz' },
|
|
47
|
-
{ value: 'stuttgart', label: 'Stuttgart' },
|
|
48
|
-
{ value: 'heidelberg', label: 'Heidelberg' }
|
|
49
|
-
]}
|
|
50
|
-
></Select>
|
|
51
|
-
</DesignTokens>
|
|
52
|
-
</Story>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export default FormLabel;
|
|
2
|
-
type FormLabel = SvelteComponent<{
|
|
3
|
-
[x: string]: never;
|
|
4
|
-
}, {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
8
|
-
};
|
|
9
|
-
declare const FormLabel: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
-
[x: string]: never;
|
|
11
|
-
}, {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
14
|
-
import FormLabel from './FormLabel.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,17 +0,0 @@
|
|
|
1
|
-
<script context="module">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
4
|
-
|
|
5
|
-
import Headline from './Headline.svelte';
|
|
6
|
-
|
|
7
|
-
const { Story } = defineMeta({
|
|
8
|
-
title: 'Typography/Headline',
|
|
9
|
-
component: Headline
|
|
10
|
-
});
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<Story name="Default" asChild>
|
|
14
|
-
<DesignTokens>
|
|
15
|
-
<Headline>Baden-Württemberg heizt überdurchschnittlich viel mit Wärmepumpe</Headline>
|
|
16
|
-
</DesignTokens>
|
|
17
|
-
</Story>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export default Headline;
|
|
2
|
-
type Headline = SvelteComponent<{
|
|
3
|
-
[x: string]: never;
|
|
4
|
-
}, {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
8
|
-
};
|
|
9
|
-
declare const Headline: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
-
[x: string]: never;
|
|
11
|
-
}, {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
14
|
-
import Headline from './Headline.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,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;
|
package/dist/Intro.mdx
DELETED
|
@@ -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
|
-
}
|
package/dist/Select/Select.mdx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Story, Meta, Primary, Controls, Stories} from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
|
-
import * as SelectStories from './Select.stories.svelte';
|
|
4
|
-
|
|
5
|
-
<Meta of={SelectStories}/>
|
|
6
|
-
|
|
7
|
-
# Select
|
|
8
|
-
|
|
9
|
-
This component is a select input with a search feature and various options such as grouped items, multi-select etc. based on [svelte-select](https://github.com/rob-balfre/svelte-select).
|
|
10
|
-
|
|
11
|
-
Select items passed to the `items` prop must be of type `SelectItem`:
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
interface SelectItem {
|
|
15
|
-
value: string;
|
|
16
|
-
label: string;
|
|
17
|
-
group?: string;
|
|
18
|
-
details?: any;
|
|
19
|
-
}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
<Controls/>
|
|
23
|
-
|
|
24
|
-
<Stories/>
|
|
25
|
-
|
|
@@ -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,13 +0,0 @@
|
|
|
1
|
-
import { Story, Meta, Primary, Controls, Stories} from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
|
-
import * as SwictherStories from './Switcher.stories.svelte';
|
|
4
|
-
|
|
5
|
-
<Meta of={SwictherStories}/>
|
|
6
|
-
|
|
7
|
-
# Switcher
|
|
8
|
-
|
|
9
|
-
Radio-like form component to choose exactly one of a given set of options.
|
|
10
|
-
|
|
11
|
-
<Controls/>
|
|
12
|
-
|
|
13
|
-
<Stories/>
|