@iroco/ui 1.1.1 → 1.1.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.
@@ -13,6 +13,7 @@
13
13
  }
14
14
  },
15
15
  args: {
16
+ type:"topbar",
16
17
  navigationItems: [
17
18
  new NavigationItem('About', `/about`),
18
19
  new NavigationItem('Foo', `/foo`),
@@ -37,7 +38,7 @@
37
38
  <Story name="Sidebar" args={{ type: 'sidebar' }} />
38
39
  <Story name="Topbar" args={{ type: 'topbar' }} />
39
40
  <Story name="Active" args={{
40
- navigating:{to:{url:{pathname:"/bar"}}},
41
+ currentRoute:"/bar",
41
42
  navigationItems: [
42
43
  new NavigationItem('About', `/about`),
43
44
  new NavigationItem('Foo', `/foo`),
@@ -8,17 +8,11 @@
8
8
  navigationItems: Array<NavigationItem>;
9
9
  type: 'sidebar' | 'topbar';
10
10
  version?: string | null;
11
- navigating?: {
12
- to: {
13
- params: Record<string, string> | null
14
- route: { id: string | null }
15
- url: URL
16
- } | null
17
- } | null;
11
+ currentRoute?: string| null;
18
12
  onclick?: MouseEventHandler<HTMLButtonElement>;
19
13
  }
20
14
 
21
- let { navigationItems, type, version = null, navigating = null, onclick }: Props = $props();
15
+ let { navigationItems, type, version = null,currentRoute=$bindable(null), onclick }: Props = $props();
22
16
 
23
17
  const dispatch = createEventDispatcher();
24
18
 
@@ -32,12 +26,16 @@
32
26
 
33
27
  function isActive(current: string, item: NavigationItem): boolean {
34
28
  if (typeof item.hrefOrCallback === 'string') {
35
- return item.hrefOrCallback === current;
29
+ console.log("is string url",current);
30
+ const b = item.hrefOrCallback === current;
31
+ console.log("is active : ",b);
32
+ return b;
36
33
  }
37
34
  return false;
38
35
  }
39
36
 
40
- let active = $derived(navigating?.to?.url.pathname ?? '');
37
+ let active = $derived(currentRoute ?? '');
38
+
41
39
  </script>
42
40
 
43
41
  <nav data-testid={type} class="nav__{type}">
@@ -4,15 +4,7 @@ interface Props {
4
4
  navigationItems: Array<NavigationItem>;
5
5
  type: 'sidebar' | 'topbar';
6
6
  version?: string | null;
7
- navigating?: {
8
- to: {
9
- params: Record<string, string> | null;
10
- route: {
11
- id: string | null;
12
- };
13
- url: URL;
14
- } | null;
15
- } | null;
7
+ currentRoute?: string | null;
16
8
  onclick?: MouseEventHandler<HTMLButtonElement>;
17
9
  }
18
10
  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> {
@@ -32,6 +24,6 @@ declare const NavBar: $$__sveltets_2_IsomorphicComponent<Props, {
32
24
  click_link: CustomEvent<any>;
33
25
  } & {
34
26
  [evt: string]: CustomEvent<any>;
35
- }, {}, {}, "">;
27
+ }, {}, {}, "currentRoute">;
36
28
  type NavBar = InstanceType<typeof NavBar>;
37
29
  export default NavBar;
@@ -41,7 +41,7 @@
41
41
  <Story name="Title" args={{ title: 'Alternative title' }} />
42
42
  <Story name="Color" args={{ color: '#ABCDEF' }} />
43
43
  <Story name="Active" args={{
44
- navigating:{to:{url:{pathname:"/bar"}}},
44
+ currentRoute:"/bar",
45
45
  navigationItems: [
46
46
  new NavigationItem('About', `/about`),
47
47
  new NavigationItem('Foo', `/foo`),
@@ -11,7 +11,7 @@
11
11
  title?: string | null;
12
12
  version?: string | null;
13
13
  color?: Color | string;
14
- navigating?: { to: { url: { pathname: string } } } | null;
14
+ currentRoute?:string | null;
15
15
  }
16
16
 
17
17
  let showMenu = $state(false);
@@ -24,7 +24,7 @@
24
24
  title = null,
25
25
  version = null,
26
26
  color = Color.green,
27
- navigating
27
+ currentRoute = null,
28
28
  }: Props = $props();
29
29
  </script>
30
30
 
@@ -48,7 +48,7 @@
48
48
  on:click={() => (showMenu = false)}
49
49
  {type}
50
50
  {navigationItems}
51
- {navigating}
51
+ {currentRoute}
52
52
  {version}
53
53
  />
54
54
  {/if}
@@ -8,13 +8,7 @@ interface Props {
8
8
  title?: string | null;
9
9
  version?: string | null;
10
10
  color?: Color | string;
11
- navigating?: {
12
- to: {
13
- url: {
14
- pathname: string;
15
- };
16
- };
17
- } | null;
11
+ currentRoute?: string | null;
18
12
  }
19
13
  declare const Navigation: import("svelte").Component<Props, {}, "">;
20
14
  type Navigation = ReturnType<typeof Navigation>;
@@ -1,5 +1,3 @@
1
- //@use 'colors';
2
-
3
1
  .iroco-ui-form {
4
2
  input,
5
3
  textarea {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iroco/ui",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Iroco design system based on Svelte",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -50,7 +50,7 @@
50
50
  "prettier": "^3.4.2",
51
51
  "prettier-plugin-svelte": "^3.3.2",
52
52
  "release-it": "^18.1.1",
53
- "sass": "^1.83.1",
53
+ "sass": "^1.83.4",
54
54
  "storybook": "^8.4.7",
55
55
  "svelte": "^5.17.3",
56
56
  "svelte-awesome": "^3.3.5",