hamzus-ui 0.0.55 → 0.0.57

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hamzus-ui",
3
- "version": "0.0.55",
3
+ "version": "0.0.57",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -1,9 +1,11 @@
1
1
  <script>
2
+ import { blur } from "svelte/transition";
3
+
2
4
  export let width = "max-content"
3
5
  export let style;
4
6
  </script>
5
7
 
6
- <div class="content" style="--width:{width};{style}" {...$$restProps}>
8
+ <div transition:blur class="content" style="--width:{width};{style}" {...$$restProps}>
7
9
  <slot/>
8
10
  </div>
9
11
 
@@ -1,51 +1,63 @@
1
1
  <script>
2
- import SideBarBtn from "../SideBarBtn.svelte";
3
- import SideBarMenuBtn from "./SideBarMenuBtn.svelte";
4
- import { page } from "$app/stores";
5
-
6
- export let title = "";
7
- export let ref;
8
-
9
- let active = false;
10
- let open = false
11
- $: currentPath = $page.url.pathname;
12
-
13
- $: if (currentPath.startsWith(ref)) {
14
- active = true
15
- open = true
16
- }else{
17
- active = false
18
- }
19
-
20
-
21
-
2
+ import SideBarBtn from '../SideBarBtn.svelte';
3
+ import SideBarMenuBtn from './SideBarMenuBtn.svelte';
4
+ import { page } from '$app/stores';
5
+
6
+ export let title = '';
7
+ export let ref = "";
8
+
9
+ let active = false;
10
+ let open = false;
11
+ $: currentPath = $page.url.pathname;
12
+
13
+ $: if (ref && typeof ref === 'string') {
14
+ if (currentPath.startsWith(ref)) {
15
+ active = true;
16
+ open = true;
17
+ } else {
18
+ active = false;
19
+ }
20
+ } else {
21
+ // parcourir les ref parce que c est un array et verifier si il y a un match ?
22
+ let isActive = false
23
+ for (const route of ref) {
24
+ if (currentPath.startsWith(route)) {
25
+ isActive = true
26
+ active = true;
27
+ open = true;
28
+ break;
29
+ }
30
+ }
31
+ if (!isActive) {
32
+ active = false;
33
+ }
34
+ }
22
35
 
23
- function handleClick() {
24
- open = !open
25
-
26
- }
36
+ function handleClick() {
37
+ open = !open;
38
+ }
27
39
  </script>
28
40
 
29
41
  <div class="menu-list">
30
- <SideBarMenuBtn on:click={handleClick} {active} label={title} {open}>
31
- <slot name="icon" slot="icon"/>
32
- </SideBarMenuBtn>
33
- {#if open}
34
- <div class="content">
35
- <slot></slot>
36
- </div>
37
- {/if}
42
+ <SideBarMenuBtn on:click={handleClick} {active} label={title} {open}>
43
+ <slot name="icon" slot="icon" />
44
+ </SideBarMenuBtn>
45
+ {#if open}
46
+ <div class="content">
47
+ <slot></slot>
48
+ </div>
49
+ {/if}
38
50
  </div>
39
51
 
40
52
  <style>
41
- .menu-list{
42
- display: flex;
43
- flex-direction: column;
44
- width: 100%;
45
- }
46
- .content{
47
- display: flex;
48
- flex-direction: column;
49
- width: 100%;
50
- }
51
- </style>
53
+ .menu-list {
54
+ display: flex;
55
+ flex-direction: column;
56
+ width: 100%;
57
+ }
58
+ .content {
59
+ display: flex;
60
+ flex-direction: column;
61
+ width: 100%;
62
+ }
63
+ </style>