hamzus-ui 0.0.241 → 0.0.242

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.241",
3
+ "version": "0.0.242",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -281,6 +281,9 @@
281
281
  <svelte:component this={component} selected={isSelected()} {...result} onClick={handleSelect}
282
282
  ></svelte:component>
283
283
  {/each}
284
+ {#if results.length === 0 && offset === 0}
285
+ <slot name="nothing"/>
286
+ {/if}
284
287
  {#if results.length < totalOfRows}
285
288
  <Button
286
289
  label="charger plus"
@@ -0,0 +1,31 @@
1
+ <script>
2
+ import { tooltip } from './store';
3
+
4
+ let state;
5
+
6
+ $: state = $tooltip;
7
+
8
+ $: if (state.visible && state.target) {
9
+ const rect = state.target.getBoundingClientRect();
10
+
11
+ x = rect.left + rect.width / 2;
12
+ y = rect.top;
13
+ }
14
+
15
+ let x = 0;
16
+ let y = 0;
17
+ </script>
18
+
19
+ {#if state.visible}
20
+ <div
21
+ class="tooltip"
22
+ style="
23
+ position:fixed;
24
+ left:{x}px;
25
+ top:{y}px;
26
+ transform:translate(-50%, -100%);
27
+ "
28
+ >
29
+ <svelte:component this={state.component} {...state.props} />
30
+ </div>
31
+ {/if}
@@ -0,0 +1,39 @@
1
+ import { tooltip as tooltipStore } from "./store";
2
+
3
+ export function tooltip(node, options) {
4
+
5
+ function show() {
6
+ tooltipStore.set({
7
+ visible: true,
8
+ target: node,
9
+ position:"bottom",
10
+ component: options.component,
11
+ props: options.props || {}
12
+ });
13
+ }
14
+
15
+ function hide() {
16
+ tooltipStore.set({
17
+ visible: false,
18
+ target: null,
19
+ position:"bottom",
20
+ component: null,
21
+ props: {}
22
+ });
23
+ }
24
+
25
+ node.addEventListener("mouseenter", show);
26
+ node.addEventListener("mouseleave", hide);
27
+
28
+ return {
29
+ update(newOptions) {
30
+ options = newOptions;
31
+ },
32
+
33
+ destroy() {
34
+ node.removeEventListener("mouseenter", show);
35
+ node.removeEventListener("mouseleave", hide);
36
+ hide();
37
+ }
38
+ };
39
+ }
@@ -0,0 +1,8 @@
1
+ import { writable } from "svelte/store";
2
+
3
+ export const tooltip = writable({
4
+ visible: false,
5
+ target: null,
6
+ component: null,
7
+ props: {}
8
+ });