@esportsplus/ui 0.0.64 → 0.0.66
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/build/components/form/types.d.ts +9 -3
- package/build/components/tooltip/index.d.ts +4 -4
- package/build/components/tooltip/index.js +1 -1
- package/build/components/tooltip/menu.d.ts +2 -2
- package/build/components/tooltip/menu.js +1 -1
- package/package.json +1 -1
- package/src/components/form/action.ts +2 -0
- package/src/components/form/types.ts +10 -3
- package/src/components/tooltip/index.ts +1 -1
- package/src/components/tooltip/menu.ts +2 -2
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { Response } from '@esportsplus/action';
|
|
2
|
-
|
|
1
|
+
import { response, Response } from '@esportsplus/action';
|
|
2
|
+
import alert from '../../components/alert';
|
|
3
|
+
type Action = (data: Payload) => Promise<Errors> | Errors;
|
|
3
4
|
type Errors = {
|
|
4
5
|
errors: Response<unknown>['errors'];
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
+
type Payload = {
|
|
8
|
+
alert: typeof alert;
|
|
9
|
+
input: Record<string, any>;
|
|
10
|
+
response: typeof response;
|
|
11
|
+
};
|
|
12
|
+
export { Action, Errors, Payload };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
onclick: ({ active, toggle }
|
|
2
|
+
onclick: ({ active, toggle }?: {
|
|
3
3
|
active?: boolean | undefined;
|
|
4
4
|
toggle?: boolean | undefined;
|
|
5
5
|
}) => {
|
|
@@ -27,9 +27,9 @@ declare const _default: {
|
|
|
27
27
|
text: string;
|
|
28
28
|
url?: string | undefined;
|
|
29
29
|
}[] | undefined;
|
|
30
|
-
state
|
|
31
|
-
active
|
|
32
|
-
};
|
|
30
|
+
state?: {
|
|
31
|
+
active?: boolean | undefined;
|
|
32
|
+
} | undefined;
|
|
33
33
|
style?: string | undefined;
|
|
34
34
|
}) => () => "" | {
|
|
35
35
|
content: string;
|
|
@@ -2,7 +2,7 @@ import { reactive } from '@esportsplus/reactivity';
|
|
|
2
2
|
import { html } from '@esportsplus/template';
|
|
3
3
|
import { root } from '../../components';
|
|
4
4
|
import menu from './menu';
|
|
5
|
-
const onclick = ({ active, toggle }) => {
|
|
5
|
+
const onclick = ({ active, toggle } = {}) => {
|
|
6
6
|
let state = reactive({
|
|
7
7
|
active: active || false
|
|
8
8
|
});
|
package/package.json
CHANGED
|
@@ -39,6 +39,8 @@ export default function(action: Action) {
|
|
|
39
39
|
new SubmitEvent('submit', { cancelable: true, bubbles:true, submitter: trigger })
|
|
40
40
|
);
|
|
41
41
|
},
|
|
42
|
+
// TODO: Figure out processing
|
|
43
|
+
// - Could pass reactive value above and tie it to form layout handler
|
|
42
44
|
onsubmit: async function(this: HTMLFormElement, event: SubmitEvent) {
|
|
43
45
|
event.preventDefault();
|
|
44
46
|
event?.submitter?.classList.add('button--processing');
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { Response } from '@esportsplus/action';
|
|
1
|
+
import { response, Response } from '@esportsplus/action';
|
|
2
|
+
import alert from '~/components/alert';
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
type Action =
|
|
5
|
+
type Action = (data: Payload) => Promise<Errors> | Errors;
|
|
5
6
|
|
|
6
7
|
type Errors = { errors: Response<unknown>['errors'] };
|
|
7
8
|
|
|
9
|
+
type Payload = {
|
|
10
|
+
alert: typeof alert;
|
|
11
|
+
input: Record<string, any>;
|
|
12
|
+
response: typeof response;
|
|
13
|
+
};
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
|
|
16
|
+
export { Action, Errors, Payload };
|
|
@@ -4,7 +4,7 @@ import { root } from '~/components';
|
|
|
4
4
|
import menu from './menu';
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
const onclick = ({ active, toggle }: { active?: boolean, toggle?: boolean }) => {
|
|
7
|
+
const onclick = ({ active, toggle }: { active?: boolean, toggle?: boolean } = {}) => {
|
|
8
8
|
let state = reactive({
|
|
9
9
|
active: active || false
|
|
10
10
|
});
|
|
@@ -17,7 +17,7 @@ type Data = {
|
|
|
17
17
|
text: string;
|
|
18
18
|
url?: string;
|
|
19
19
|
}[];
|
|
20
|
-
state
|
|
20
|
+
state?: { active?: boolean };
|
|
21
21
|
style?: string;
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -63,7 +63,7 @@ export default (data: Data) => {
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
effect(() => {
|
|
66
|
-
if (!data
|
|
66
|
+
if (!data?.state?.active || state.render) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
|