@hyvor/design 1.1.6 → 1.1.8

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.
@@ -8,7 +8,6 @@
8
8
  import IconCaretDown from '@hyvor/icons/IconCaretDown';
9
9
  import IconButton from '../IconButton/IconButton.svelte';
10
10
  import { get } from 'svelte/store';
11
- import { goto } from '$app/navigation';
12
11
 
13
12
  interface Props {
14
13
  position?: ComponentProps<typeof Dropdown>['position'];
@@ -17,6 +16,7 @@
17
16
  icon?: boolean;
18
17
  size?: 'medium' | 'small';
19
18
  staticPage?: boolean;
19
+ goto?: Function; // sveltekit goto function, required for static pages
20
20
  }
21
21
 
22
22
  let {
@@ -25,7 +25,8 @@
25
25
  caret = IconCaretDown,
26
26
  icon = false,
27
27
  size = 'medium',
28
- staticPage = false
28
+ staticPage = false,
29
+ goto,
29
30
  }: Props = $props();
30
31
 
31
32
  const i18n = getContext<InternationalizationService>('i18n');
@@ -33,7 +34,7 @@
33
34
 
34
35
  let show = $state(false);
35
36
 
36
- function handleClick(language: Language) {
37
+ async function handleClick(language: Language) {
37
38
  show = false;
38
39
 
39
40
  if (staticPage) {
@@ -44,7 +45,12 @@
44
45
  }
45
46
  const url = new URL(window.location.href);
46
47
  url.pathname = url.pathname.replace(`/${currentLocale}`, `/${language.code}`);
47
- goto(url.toString());
48
+
49
+ if (goto) {
50
+ goto(url.toString());
51
+ } else {
52
+ window.location.href = url.toString();
53
+ }
48
54
  }
49
55
 
50
56
  i18n.setLocale(language.code);
@@ -7,6 +7,7 @@ interface Props {
7
7
  icon?: boolean;
8
8
  size?: 'medium' | 'small';
9
9
  staticPage?: boolean;
10
+ goto?: Function;
10
11
  }
11
12
  declare const LanguageToggle: Component<Props, {}, "">;
12
13
  type LanguageToggle = ReturnType<typeof LanguageToggle>;
package/package.json CHANGED
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "version": "1.1.6"
62
+ "version": "1.1.8"
63
63
  }