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,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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
36
|
+
function handleClick() {
|
|
37
|
+
open = !open;
|
|
38
|
+
}
|
|
27
39
|
</script>
|
|
28
40
|
|
|
29
41
|
<div class="menu-list">
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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>
|