@swr-data-lab/components 1.8.0 → 1.9.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/package.json CHANGED
@@ -67,5 +67,5 @@
67
67
  "svelte": "./src/index.js"
68
68
  }
69
69
  },
70
- "version": "1.8.0"
70
+ "version": "1.9.1"
71
71
  }
@@ -1,7 +1,7 @@
1
1
  <script context="module">
2
2
  import { defineMeta } from '@storybook/addon-svelte-csf';
3
3
  import DesignTokens from '../DesignTokens/DesignTokens.svelte';
4
-
4
+ import { expect } from '@storybook/test';
5
5
  import ChartHeader from './ChartHeader.svelte';
6
6
 
7
7
  const { Story } = defineMeta({
@@ -10,7 +10,15 @@
10
10
  });
11
11
  </script>
12
12
 
13
- <Story name="Default">
13
+ <Story
14
+ name="Default"
15
+ play={async ({ step }) => {
16
+ await step('Container has ID attribute derived from title prop', async () => {
17
+ const containerEl = document.querySelector('#mehr-uber-60-jahrige-in-allen-berufen');
18
+ expect(containerEl).toBeTruthy();
19
+ });
20
+ }}
21
+ >
14
22
  <DesignTokens>
15
23
  <ChartHeader
16
24
  title="Mehr über-60-Jährige in allen Berufen"
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
-
3
+ import slugify from "../utils/slugify.ts"
4
+
4
5
  interface ChartHeaderProps {
5
6
  title: string;
6
7
  subtitle?: string;
@@ -9,7 +10,7 @@
9
10
  let { title, subtitle, children }: ChartHeaderProps = $props();
10
11
  </script>
11
12
 
12
- <header class="container">
13
+ <header class="container" id={slugify(title)}>
13
14
  <h2 class="title">{title}</h2>
14
15
  {#if subtitle}
15
16
  <p class="subtitle">{subtitle}</p>
package/src/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  export { default as Card } from './Card/Card.svelte';
2
- export { default as Container } from './Container/Container.svelte';
3
2
  export { default as Autocomplete } from './Autocomplete/Autocomplete.svelte';
4
3
  export { default as Switcher } from './Switcher/Switcher.svelte';
5
4
  export { default as Input } from './Input/Input.svelte';
@@ -0,0 +1,12 @@
1
+ // Source: https://svelte.dev/playground/b130be5e485441a1842ae97e4ce4f244?version=5.20.0
2
+
3
+ export default function slugify(str: string): string {
4
+ return str
5
+ .replace(/\s+/g, '-')
6
+ .replace(/-+/g, '-')
7
+ .trim()
8
+ .normalize('NFKD')
9
+ .replace(/[\u0300-\u036f]/g, '')
10
+ .toLowerCase()
11
+ .replace(/[^a-z0-9 -]/g, '')
12
+ }