@iroco/ui 1.1.0 → 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.
@@ -9,7 +9,7 @@
9
9
 
10
10
  const { Story } = defineMeta({
11
11
 
12
- title: 'ImageArticle',
12
+ title: 'Iroco-UI/Components/ImageArticle',
13
13
  component: ImageArticle,
14
14
  argTypes: {
15
15
  reversed: {
@@ -4,7 +4,7 @@
4
4
  import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
5
5
 
6
6
  const { Story } = defineMeta({
7
- title: 'NavBar',
7
+ title: 'Iroco-UI/Components/NavBar',
8
8
  component: NavBar,
9
9
  argTypes: {
10
10
  type: {
@@ -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`),
@@ -1,18 +1,18 @@
1
1
  <script lang="ts">
2
2
  import { IconClose } from './index';
3
3
  import { createEventDispatcher } from 'svelte';
4
- import { NavigationItemType, NavigationItem } from './definition.js';
4
+ import { NavigationItem, NavigationItemType } from './definition.js';
5
5
  import type { MouseEventHandler } from 'svelte/elements';
6
6
 
7
7
  interface Props {
8
8
  navigationItems: Array<NavigationItem>;
9
9
  type: 'sidebar' | 'topbar';
10
10
  version?: string | null;
11
- navigating?: { to: { url: { pathname: string } } } | null;
11
+ currentRoute?: string| null;
12
12
  onclick?: MouseEventHandler<HTMLButtonElement>;
13
13
  }
14
14
 
15
- let { navigationItems, type, version = null, navigating = null, onclick }: Props = $props();
15
+ let { navigationItems, type, version = null,currentRoute=$bindable(null), onclick }: Props = $props();
16
16
 
17
17
  const dispatch = createEventDispatcher();
18
18
 
@@ -26,12 +26,16 @@
26
26
 
27
27
  function isActive(current: string, item: NavigationItem): boolean {
28
28
  if (typeof item.hrefOrCallback === 'string') {
29
- 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;
30
33
  }
31
34
  return false;
32
35
  }
33
36
 
34
- let active = $derived(navigating?.to.url.pathname ?? '');
37
+ let active = $derived(currentRoute ?? '');
38
+
35
39
  </script>
36
40
 
37
41
  <nav data-testid={type} class="nav__{type}">
@@ -41,7 +45,7 @@
41
45
 
42
46
  <ul class="nav__{type}__item-container">
43
47
  {#each navigationItems as item}
44
- <li class="nav__{type}__item" class:active={isActive(active, item)}>
48
+ <li class="nav__{type}__item" class:active={isActive(active, item)} aria-current={isActive(active, item)}>
45
49
  {#if item.type === NavigationItemType.FORM}
46
50
  <form method="POST" action={item.hrefOrCallback}>
47
51
  <button class="iroco-ui-link" type="submit">{item.name}</button>
@@ -4,13 +4,7 @@ interface Props {
4
4
  navigationItems: Array<NavigationItem>;
5
5
  type: 'sidebar' | 'topbar';
6
6
  version?: string | null;
7
- navigating?: {
8
- to: {
9
- url: {
10
- pathname: string;
11
- };
12
- };
13
- } | null;
7
+ currentRoute?: string | null;
14
8
  onclick?: MouseEventHandler<HTMLButtonElement>;
15
9
  }
16
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> {
@@ -30,6 +24,6 @@ declare const NavBar: $$__sveltets_2_IsomorphicComponent<Props, {
30
24
  click_link: CustomEvent<any>;
31
25
  } & {
32
26
  [evt: string]: CustomEvent<any>;
33
- }, {}, {}, "">;
27
+ }, {}, {}, "currentRoute">;
34
28
  type NavBar = InstanceType<typeof NavBar>;
35
29
  export default NavBar;
@@ -6,7 +6,7 @@
6
6
  const { Story } = defineMeta({
7
7
 
8
8
 
9
- title: 'Navigation',
9
+ title: 'Iroco-UI/Components/Navigation',
10
10
  component: Navigation,
11
11
  argTypes: {
12
12
  color: {
@@ -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.0",
3
+ "version": "1.1.2",
4
4
  "description": "Iroco design system based on Svelte",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  "format": "prettier --plugin-search-dir . --write .",
17
17
  "clean": "rm -rf dist && npm cache clean --force",
18
18
  "release": "npm run format && npm run build && release-it --only-version",
19
- "build-storybook": "storybook build"
19
+ "build-storybook": "storybook build --output-dir docs"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@ljcl/storybook-addon-cssprops": "^4.0.0",
@@ -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",