@esportsplus/ui 0.15.10 → 0.17.0

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.
@@ -1,11 +1,12 @@
1
1
  import './scss/index.scss';
2
2
  declare const _default: {
3
3
  onclick: (data: Record<string, unknown> & {
4
- active?: boolean;
5
4
  toggle?: boolean;
6
- }, content: unknown) => import("@esportsplus/template/build/types").RenderableTemplate;
7
- onhover: (data: Record<string, unknown> & {
8
- active?: boolean;
9
- }, content: unknown) => import("@esportsplus/template/build/types").RenderableTemplate;
5
+ }, content: unknown, state?: {
6
+ active: boolean;
7
+ }) => import("@esportsplus/template/build/types").RenderableTemplate;
8
+ onhover: (data: Record<string, unknown>, content: unknown, state?: {
9
+ active: boolean;
10
+ }) => import("@esportsplus/template/build/types").RenderableTemplate;
10
11
  };
11
12
  export default _default;
@@ -15,10 +15,7 @@ function frame() {
15
15
  }
16
16
  running = false;
17
17
  }
18
- const onclick = (data, content) => {
19
- let state = reactive({
20
- active: data.active || false
21
- });
18
+ const onclick = (data, content, state = reactive({ active: false })) => {
22
19
  if (!isArray(data.class)) {
23
20
  data.class = data.class ? [data.class] : [];
24
21
  }
@@ -33,7 +30,10 @@ const onclick = (data, content) => {
33
30
  if (data.toggle && (this.contains(node) || this.isSameNode(node))) {
34
31
  active = !state.active;
35
32
  }
36
- frame();
33
+ if (this.parentElement?.closest('.tooltip')) { }
34
+ else {
35
+ frame();
36
+ }
37
37
  state.active = active;
38
38
  if (active) {
39
39
  queue.push(() => state.active = false);
@@ -52,8 +52,7 @@ const onclick = (data, content) => {
52
52
  </div>
53
53
  `;
54
54
  };
55
- const onhover = (data, content) => {
56
- let state = reactive({ active: data.active || false });
55
+ const onhover = (data, content, state = reactive({ active: false })) => {
57
56
  if (!isArray(data.class)) {
58
57
  data.class = data.class ? [data.class] : [];
59
58
  }
package/package.json CHANGED
@@ -47,7 +47,7 @@
47
47
  "private": false,
48
48
  "sideEffects": false,
49
49
  "type": "module",
50
- "version": "0.15.10",
50
+ "version": "0.17.0",
51
51
  "scripts": {
52
52
  "build": "run-s build:vite build:ts",
53
53
  "build:ts": "tsc && tsc-alias",
@@ -27,11 +27,10 @@ function frame() {
27
27
  }
28
28
 
29
29
 
30
- const onclick = (data: Record<string, unknown> & { active?: boolean, toggle?: boolean }, content: unknown) => {
31
- let state = reactive({
32
- active: data.active || false
33
- });
34
-
30
+ const onclick = (
31
+ data: Record<string, unknown> & { toggle?: boolean }, content: unknown,
32
+ state: { active: boolean } = reactive({ active: false })
33
+ ) => {
35
34
  if (!isArray(data.class)) {
36
35
  data.class = data.class ? [data.class] : [];
37
36
  }
@@ -51,7 +50,11 @@ const onclick = (data: Record<string, unknown> & { active?: boolean, toggle?: bo
51
50
  active = !state.active;
52
51
  }
53
52
 
54
- frame();
53
+ if (this.parentElement?.closest('.tooltip')) {}
54
+ else {
55
+ frame();
56
+ }
57
+
55
58
  state.active = active;
56
59
 
57
60
  if (active) {
@@ -73,9 +76,11 @@ const onclick = (data: Record<string, unknown> & { active?: boolean, toggle?: bo
73
76
  `;
74
77
  };
75
78
 
76
- const onhover = (data: Record<string, unknown> & { active?: boolean }, content: unknown) => {
77
- let state = reactive({ active: data.active || false });
78
-
79
+ const onhover = (
80
+ data: Record<string, unknown>,
81
+ content: unknown,
82
+ state: { active: boolean } = reactive({ active: false })
83
+ ) => {
79
84
  if (!isArray(data.class)) {
80
85
  data.class = data.class ? [data.class] : [];
81
86
  }