hamzus-ui 0.0.39 → 0.0.41

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.39",
3
+ "version": "0.0.41",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -6,6 +6,7 @@
6
6
  export let desabled = false;
7
7
  export let onClick = undefined;
8
8
  export let label = '';
9
+ export let type = 'button';
9
10
  export let avoidRipple = false;
10
11
  // local var
11
12
  let button;
@@ -42,7 +43,7 @@
42
43
  }
43
44
  </script>
44
45
 
45
- <button bind:this={button} on:click={handleClick} on:mousedown={createRipple} class="button h4" class:desabled class:loading {...$$restProps}>
46
+ <button bind:this={button} on:click={handleClick} on:mousedown={createRipple} class="button h4" class:desabled class:loading {...$$restProps} {type}>
46
47
  {#if label}
47
48
  <h4>{label}</h4>
48
49
  {:else}
@@ -8,6 +8,7 @@ import { onDestroy, onMount } from 'svelte';
8
8
  export let triggerFullWidth = false;
9
9
  export let direction = 'bottom';
10
10
  export let onOpen = undefined;
11
+ export let avoidOpening = false
11
12
  // locale var
12
13
  let display = false;
13
14
  let exit = false;
@@ -30,8 +31,12 @@ import { onDestroy, onMount } from 'svelte';
30
31
  };
31
32
  // function
32
33
  function handleDisplay(e) {
34
+ if (avoidOpening) {
35
+ return
36
+ }
33
37
  if (!calc[direction]) {
34
38
  console.error('Error : direction props not found !');
39
+ return
35
40
  }
36
41
 
37
42
  if (!display) {
@@ -63,6 +68,21 @@ import { onDestroy, onMount } from 'svelte';
63
68
  display = !display;
64
69
  }
65
70
 
71
+ export let open = ()=>{
72
+ if (display) {
73
+ return
74
+ }
75
+
76
+ toggleDisplay()
77
+ }
78
+ export let close = ()=>{
79
+ if (!display) {
80
+ return
81
+ }
82
+
83
+ toggleDisplay()
84
+ }
85
+
66
86
  const calc = {
67
87
  bottom: () => {
68
88
  // recuperer la taille du content