iconograph-ui 1.7.6 → 1.7.9
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.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { json } from '@sveltejs/kit';
|
|
3
3
|
|
|
4
4
|
export async function GET({ request, cookies, params, url }) {
|
|
5
|
-
let search = url.searchParams.get('
|
|
5
|
+
let search = url.searchParams.get('name')
|
|
6
6
|
|
|
7
7
|
let users = [
|
|
8
8
|
{ id: 1, firstname: "Alice", lastname:"Dupont", avatar: "https://i.pravatar.cc/40?u=alice" },
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import UserPicture from '../user/UserPicture.svelte';
|
|
6
6
|
import {clickOutside} from '../utils/clickOutside.js';
|
|
7
7
|
import { createEventDispatcher } from 'svelte'
|
|
8
|
+
import loaderIcon from '../assets/icons/loader-ring-grey.svg?url';
|
|
8
9
|
|
|
9
10
|
const dispatch = createEventDispatcher()
|
|
10
11
|
|
|
@@ -23,8 +24,10 @@
|
|
|
23
24
|
let coords = { top: 0, left: 0, width: 0 };
|
|
24
25
|
|
|
25
26
|
async function handleFilter() {
|
|
26
|
-
|
|
27
|
+
if (search.length < 1)
|
|
28
|
+
return;
|
|
27
29
|
|
|
30
|
+
waiting = true;
|
|
28
31
|
const response = await fetch(`${uri}limit=50&page=1&name=${search}`, {
|
|
29
32
|
method: 'GET',
|
|
30
33
|
headers: { 'Content-Type': 'application/json' }
|
|
@@ -66,18 +69,24 @@
|
|
|
66
69
|
<Portal target="#main-container">
|
|
67
70
|
<div class="list" style="position: absolute; top:{coords.top - 1}px; left:{coords.left - 85}px; width: {coords.width - 2}px;" >
|
|
68
71
|
<!-- Options -->
|
|
69
|
-
{#
|
|
70
|
-
<div class="option"
|
|
71
|
-
{
|
|
72
|
-
<UserPicture user={r} size={24}></UserPicture>
|
|
73
|
-
<span>{r.firstname} {r.lastname}</span>
|
|
74
|
-
{:else}
|
|
75
|
-
<span>{r.name}</span>
|
|
76
|
-
{/if}
|
|
72
|
+
{#if waiting}
|
|
73
|
+
<div class="option waiting">
|
|
74
|
+
<span style:background-image={`url("${loaderIcon}")`}>Recherche en cours...</span>
|
|
77
75
|
</div>
|
|
78
76
|
{:else}
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
{#each results as r}
|
|
78
|
+
<div class="option" on:click={() => selectResult(r)}>
|
|
79
|
+
{#if type == 'user'}
|
|
80
|
+
<UserPicture user={r} size={24}></UserPicture>
|
|
81
|
+
<span>{r.firstname} {r.lastname}</span>
|
|
82
|
+
{:else}
|
|
83
|
+
<span>{r.name}</span>
|
|
84
|
+
{/if}
|
|
85
|
+
</div>
|
|
86
|
+
{:else}
|
|
87
|
+
<div class="option"><span>Aucun résultat</span></div>
|
|
88
|
+
{/each}
|
|
89
|
+
{/if}
|
|
81
90
|
</div>
|
|
82
91
|
</Portal>
|
|
83
92
|
{/if}
|
|
@@ -159,4 +168,20 @@
|
|
|
159
168
|
.option:hover {
|
|
160
169
|
background: var(--theme-input-bg-highlight);
|
|
161
170
|
}
|
|
171
|
+
.option.waiting {
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: center;
|
|
175
|
+
}
|
|
176
|
+
.option.waiting > span {
|
|
177
|
+
background-size: 20px auto;
|
|
178
|
+
background-repeat: no-repeat;
|
|
179
|
+
background-position: 0px center;
|
|
180
|
+
padding-left: 28px;
|
|
181
|
+
color: #999;
|
|
182
|
+
}
|
|
183
|
+
.option.waiting:hover {
|
|
184
|
+
background-color: transparent;
|
|
185
|
+
}
|
|
186
|
+
|
|
162
187
|
</style>
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
</button>
|
|
16
16
|
{:else}
|
|
17
17
|
{#if clickEvent}
|
|
18
|
-
|
|
18
|
+
<!-- Hide icon if icon == null -->
|
|
19
|
+
<button on:click|stopPropagation={clickEvent} class="{style} {icon ? 'icon' : ''}"
|
|
20
|
+
style={ loaderIcon ? { backgroundImage: `url("${loaderIcon}")` } : {} }
|
|
21
|
+
>
|
|
19
22
|
{label}
|
|
20
23
|
</button>
|
|
21
24
|
{:else}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
|
|
2
4
|
export let tabs;
|
|
3
5
|
export let currentTab;
|
|
6
|
+
|
|
7
|
+
$: if (currentTab) {
|
|
8
|
+
history.replaceState(null, '', `#${currentTab}`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
onMount(() => {
|
|
12
|
+
const hash = window.location.hash.replace('#', '');
|
|
13
|
+
|
|
14
|
+
if (hash && Object.keys(tabs).includes(hash))
|
|
15
|
+
currentTab = hash;
|
|
16
|
+
});
|
|
17
|
+
|
|
4
18
|
</script>
|
|
5
19
|
|
|
6
20
|
<aside class="horizontal-navbar">
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
import UserPicture from './UserPicture.svelte';
|
|
4
4
|
import SearchSelect from "../inputs/SearchSelect.svelte";
|
|
5
|
+
import crossIcon from '../assets/icons/icon-close-cross.svg?url';
|
|
5
6
|
|
|
6
7
|
export let name;
|
|
7
8
|
export let value = null;
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
</a>
|
|
43
44
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
44
45
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
45
|
-
<div on:click={() => handleRemove(v.id)}
|
|
46
|
+
<div on:click={() => handleRemove(v.id)} class="cross" style:background-image={`url("${crossIcon}")`}></div>
|
|
46
47
|
</div>
|
|
47
48
|
</div>
|
|
48
49
|
{/each}
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
</a>
|
|
63
64
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
64
65
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
65
|
-
<div on:click={handleRemove}
|
|
66
|
+
<div on:click={handleRemove} class="cross" style:background-image={`url("${crossIcon}")`}></div>
|
|
66
67
|
</div>
|
|
67
68
|
{/if}
|
|
68
69
|
</div>
|
|
@@ -112,23 +113,21 @@
|
|
|
112
113
|
.user-label a, .user-label span {
|
|
113
114
|
flex: 1;
|
|
114
115
|
}
|
|
115
|
-
.
|
|
116
|
+
.cross {
|
|
116
117
|
cursor: pointer;
|
|
117
|
-
margin-left: 8px;
|
|
118
118
|
height: 16px;
|
|
119
119
|
width: 16px;
|
|
120
|
-
|
|
121
|
-
background-color: #ddd;
|
|
120
|
+
background-color: #e0e0e0;
|
|
122
121
|
border-radius: 20px;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
122
|
+
background-position: center center;
|
|
123
|
+
background-size: 16px auto;
|
|
124
|
+
background-repeat: no-repeat;
|
|
125
|
+
transition: all ease-in-out 0.10s;
|
|
126
|
+
position: relative;
|
|
127
|
+
left: 8px;
|
|
129
128
|
}
|
|
130
|
-
.
|
|
131
|
-
background-color: #
|
|
129
|
+
.cross:hover {
|
|
130
|
+
background-color: #d0d0d0;
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
</style>
|