@esportsplus/ui 0.0.21 → 0.0.23
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/field/description.d.ts +8 -0
- package/build/components/field/description.js +9 -0
- package/build/components/field/error.d.ts +8 -0
- package/build/components/field/error.js +11 -0
- package/build/components/field/index.d.ts +66 -0
- package/build/components/field/index.js +4 -0
- package/build/components/field/select.d.ts +36 -0
- package/build/components/field/select.js +100 -0
- package/build/components/field/text.d.ts +22 -0
- package/build/components/field/text.js +45 -0
- package/build/components/field/title.d.ts +9 -0
- package/build/components/field/title.js +18 -0
- package/build/components/form/layout.d.ts +2 -2
- package/build/components/index.d.ts +3 -0
- package/build/components/index.js +3 -0
- package/build/components/overlay/index.d.ts +10 -0
- package/build/components/overlay/index.js +6 -0
- package/build/components/page/header.d.ts +2 -3
- package/build/components/page/header.js +8 -8
- package/build/components/page/index.d.ts +1 -1
- package/build/components/page/layout.d.ts +2 -3
- package/build/components/root/index.d.ts +1 -19
- package/build/components/root/index.js +2 -3
- package/build/components/site/index.d.ts +13 -0
- package/build/components/site/index.js +14 -0
- package/build/components/tooltip/index.d.ts +4 -6
- package/build/components/tooltip/index.js +1 -15
- package/build/components/tooltip/menu.d.ts +4 -1
- package/build/components/tooltip/menu.js +44 -29
- package/package.json +1 -1
- package/src/components/field/description.ts +12 -0
- package/src/components/field/error.ts +14 -0
- package/src/components/field/index.ts +6 -0
- package/src/components/field/select.ts +146 -0
- package/src/components/field/text.ts +64 -0
- package/src/components/field/title.ts +21 -0
- package/src/components/form/layout.ts +2 -2
- package/src/components/index.ts +3 -0
- package/src/components/overlay/index.ts +14 -0
- package/src/components/page/header.ts +8 -15
- package/src/components/page/layout.ts +1 -7
- package/src/components/root/index.ts +2 -3
- package/src/components/site/index.ts +26 -0
- package/src/components/tooltip/index.ts +1 -17
- package/src/components/tooltip/menu.ts +50 -29
- package/src/components/root/layout.ts +0 -36
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import select from './select';
|
|
2
|
+
import text from './text';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
select: (data: {
|
|
5
|
+
class?: string | undefined;
|
|
6
|
+
effect?: ((selected: string | number) => void) | undefined;
|
|
7
|
+
mask?: {
|
|
8
|
+
class?: string | undefined;
|
|
9
|
+
content?: any;
|
|
10
|
+
style?: string | undefined;
|
|
11
|
+
} | undefined;
|
|
12
|
+
name?: string | undefined;
|
|
13
|
+
options: Record<string | number, string | number>;
|
|
14
|
+
option?: {
|
|
15
|
+
class?: string | undefined;
|
|
16
|
+
style?: string | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
selected?: any;
|
|
19
|
+
scrollbar?: {
|
|
20
|
+
style?: string | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
style?: string | undefined;
|
|
23
|
+
text?: {
|
|
24
|
+
class?: string | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
tooltip?: {
|
|
27
|
+
class?: string | undefined;
|
|
28
|
+
direction?: any;
|
|
29
|
+
style?: string | undefined;
|
|
30
|
+
} | undefined;
|
|
31
|
+
} & {
|
|
32
|
+
description?: string | undefined;
|
|
33
|
+
} & {
|
|
34
|
+
required?: boolean | undefined;
|
|
35
|
+
title?: string | undefined;
|
|
36
|
+
}) => {
|
|
37
|
+
content: string;
|
|
38
|
+
type: string;
|
|
39
|
+
values: never[];
|
|
40
|
+
};
|
|
41
|
+
text: (data: {
|
|
42
|
+
active?: boolean | undefined;
|
|
43
|
+
class?: string | undefined;
|
|
44
|
+
mask?: {
|
|
45
|
+
class?: string | undefined;
|
|
46
|
+
content?: any;
|
|
47
|
+
style?: string | undefined;
|
|
48
|
+
} | undefined;
|
|
49
|
+
name?: string | undefined;
|
|
50
|
+
placeholder?: string | undefined;
|
|
51
|
+
style?: string | undefined;
|
|
52
|
+
type?: string | undefined;
|
|
53
|
+
value?: unknown;
|
|
54
|
+
} & {
|
|
55
|
+
description?: string | undefined;
|
|
56
|
+
} & {
|
|
57
|
+
required?: boolean | undefined;
|
|
58
|
+
title?: string | undefined;
|
|
59
|
+
}) => {
|
|
60
|
+
content: string;
|
|
61
|
+
type: string;
|
|
62
|
+
values: never[];
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export default _default;
|
|
66
|
+
export { select, text };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import description from './description';
|
|
2
|
+
import title from './title';
|
|
3
|
+
type Data = {
|
|
4
|
+
class?: string;
|
|
5
|
+
effect?: (selected: number | string) => void;
|
|
6
|
+
mask?: {
|
|
7
|
+
class?: string;
|
|
8
|
+
content?: any;
|
|
9
|
+
style?: string;
|
|
10
|
+
};
|
|
11
|
+
name?: string;
|
|
12
|
+
options: Record<number | string, number | string>;
|
|
13
|
+
option?: {
|
|
14
|
+
class?: string;
|
|
15
|
+
style?: string;
|
|
16
|
+
};
|
|
17
|
+
selected?: any;
|
|
18
|
+
scrollbar?: {
|
|
19
|
+
style?: string;
|
|
20
|
+
};
|
|
21
|
+
style?: string;
|
|
22
|
+
text?: {
|
|
23
|
+
class?: string;
|
|
24
|
+
};
|
|
25
|
+
tooltip?: {
|
|
26
|
+
class?: string;
|
|
27
|
+
direction?: any;
|
|
28
|
+
style?: string;
|
|
29
|
+
};
|
|
30
|
+
} & Parameters<typeof description>[0] & Parameters<typeof title>[0];
|
|
31
|
+
declare const _default: (data: Data) => {
|
|
32
|
+
content: string;
|
|
33
|
+
type: string;
|
|
34
|
+
values: never[];
|
|
35
|
+
};
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html } from '@esportsplus/template';
|
|
3
|
+
import { form, scrollbar, root } from '../../components';
|
|
4
|
+
import description from './description';
|
|
5
|
+
import error from './error';
|
|
6
|
+
import title from './title';
|
|
7
|
+
function options(keys, selected) {
|
|
8
|
+
let options = {};
|
|
9
|
+
for (let key of keys) {
|
|
10
|
+
options[key] = false;
|
|
11
|
+
}
|
|
12
|
+
options[selected] = true;
|
|
13
|
+
return options;
|
|
14
|
+
}
|
|
15
|
+
function template(data, state) {
|
|
16
|
+
let { attributes: a, html: h } = scrollbar({
|
|
17
|
+
fixed: true,
|
|
18
|
+
style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
|
|
19
|
+
});
|
|
20
|
+
return html `
|
|
21
|
+
<div class='tooltip-content tooltip-content--${data?.tooltip?.direction || 's'} ${data?.tooltip?.class || ''} --flex-column --width-full'>
|
|
22
|
+
<div
|
|
23
|
+
class='row --flex-column'
|
|
24
|
+
onclick='${(e) => {
|
|
25
|
+
let key = e?.target?.dataset?.key;
|
|
26
|
+
if (key === undefined) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
state.options[key] = true;
|
|
30
|
+
state.options[state.selected] = false;
|
|
31
|
+
state.active = false;
|
|
32
|
+
state.selected = key;
|
|
33
|
+
if (data.effect) {
|
|
34
|
+
data.effect(key);
|
|
35
|
+
}
|
|
36
|
+
}}'
|
|
37
|
+
style='${data?.tooltip?.style || ''}'
|
|
38
|
+
${a}
|
|
39
|
+
>
|
|
40
|
+
${Object.keys(state.options).map((key) => html `
|
|
41
|
+
<div
|
|
42
|
+
class='link ${data?.option?.class || ''} ${() => state.options[key] ? '--active' : ''} --flex-vertical' data-key='${key}'
|
|
43
|
+
style='${data?.option?.style || ''}'
|
|
44
|
+
>
|
|
45
|
+
<span class="--text-truncate">
|
|
46
|
+
${data.options[key]}
|
|
47
|
+
</span>
|
|
48
|
+
</div>
|
|
49
|
+
`)}
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
${h}
|
|
53
|
+
</div>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
export default (data) => {
|
|
57
|
+
let state = reactive({
|
|
58
|
+
active: false,
|
|
59
|
+
error: '',
|
|
60
|
+
options: options(Object.keys(data.options || {}), data.selected),
|
|
61
|
+
render: false,
|
|
62
|
+
selected: data.selected
|
|
63
|
+
});
|
|
64
|
+
return html `
|
|
65
|
+
<div class="field tooltip ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column" style='${data?.style || ''}'>
|
|
66
|
+
${title(data)}
|
|
67
|
+
|
|
68
|
+
<label
|
|
69
|
+
class="field-mask field-mask--select --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) && '--margin-top'} --margin-300 --padding-400"
|
|
70
|
+
onclick='${() => {
|
|
71
|
+
state.render = true;
|
|
72
|
+
state.active = !state.active;
|
|
73
|
+
if (state.active) {
|
|
74
|
+
root.queue.onclick(() => state.active = false);
|
|
75
|
+
}
|
|
76
|
+
}}'
|
|
77
|
+
style='${data?.mask?.style || ''}'
|
|
78
|
+
>
|
|
79
|
+
<input
|
|
80
|
+
class='field-tag field-tag--hidden'
|
|
81
|
+
name='${data.name}'
|
|
82
|
+
onclick='${() => { }}'
|
|
83
|
+
value='${() => state.selected}'
|
|
84
|
+
${form.input.attributes(state)}
|
|
85
|
+
>
|
|
86
|
+
|
|
87
|
+
<div class="field-text ${data?.text?.class || ''}" style='pointer-events: none'>
|
|
88
|
+
${() => data.options[state.selected] || '-'}
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<div class='field-mask-arrow'></div>
|
|
92
|
+
|
|
93
|
+
${() => state.render ? template(data, state) : ''}
|
|
94
|
+
</label>
|
|
95
|
+
|
|
96
|
+
${description(data)}
|
|
97
|
+
${error(state)}
|
|
98
|
+
</div>
|
|
99
|
+
`;
|
|
100
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import description from './description';
|
|
2
|
+
import title from './title';
|
|
3
|
+
type Data = {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
class?: string;
|
|
6
|
+
mask?: {
|
|
7
|
+
class?: string;
|
|
8
|
+
content?: any;
|
|
9
|
+
style?: string;
|
|
10
|
+
};
|
|
11
|
+
name?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
style?: string;
|
|
14
|
+
type?: string;
|
|
15
|
+
value?: unknown;
|
|
16
|
+
} & Parameters<typeof description>[0] & Parameters<typeof title>[0];
|
|
17
|
+
declare const _default: (data: Data) => {
|
|
18
|
+
content: string;
|
|
19
|
+
type: string;
|
|
20
|
+
values: never[];
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html } from '@esportsplus/template';
|
|
3
|
+
import { form } from '../../components';
|
|
4
|
+
import description from './description';
|
|
5
|
+
import error from './error';
|
|
6
|
+
import title from './title';
|
|
7
|
+
export default (data) => {
|
|
8
|
+
let state = reactive({
|
|
9
|
+
active: (data?.active || false),
|
|
10
|
+
error: ''
|
|
11
|
+
});
|
|
12
|
+
return html `
|
|
13
|
+
<div
|
|
14
|
+
class="field --flex-column ${data?.class || ''} ${() => state.active ? '--active' : ''}"
|
|
15
|
+
onfocusin='${() => {
|
|
16
|
+
state.active = true;
|
|
17
|
+
}}'
|
|
18
|
+
onfocusout='${() => {
|
|
19
|
+
state.active = false;
|
|
20
|
+
}}'
|
|
21
|
+
style='${data?.style || ''}'
|
|
22
|
+
>
|
|
23
|
+
${title(data)}
|
|
24
|
+
|
|
25
|
+
<label
|
|
26
|
+
class='field-mask field-mask--input --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) && '--margin-top'} --margin-300'
|
|
27
|
+
style='${data?.mask?.style || ''}'
|
|
28
|
+
>
|
|
29
|
+
<input
|
|
30
|
+
class='field-tag --padding-400'
|
|
31
|
+
name='${data?.name || ''}'
|
|
32
|
+
placeholder='${data?.placeholder || ''}'
|
|
33
|
+
type='${data?.type || 'string'}'
|
|
34
|
+
${data?.value !== undefined ? `value='${data.value}'` : ''}
|
|
35
|
+
${form.input.attributes(state)}
|
|
36
|
+
>
|
|
37
|
+
|
|
38
|
+
${data?.mask?.content || ''}
|
|
39
|
+
</label>
|
|
40
|
+
|
|
41
|
+
${description(data)}
|
|
42
|
+
${error(state)}
|
|
43
|
+
</div>
|
|
44
|
+
`;
|
|
45
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { html } from '@esportsplus/template';
|
|
2
|
+
import { tooltip } from '../../components';
|
|
3
|
+
export default (data) => {
|
|
4
|
+
if (!data?.title) {
|
|
5
|
+
return '';
|
|
6
|
+
}
|
|
7
|
+
return html `
|
|
8
|
+
<div class="field-title --flex-horizontal-space-between --flex-vertical">
|
|
9
|
+
${data.title}
|
|
10
|
+
|
|
11
|
+
${data?.required && html `
|
|
12
|
+
<div class="bubble --background-primary --margin-left" ${tooltip.onhover()}>
|
|
13
|
+
<span class="tooltip-message tooltip-message--w">Required</span>
|
|
14
|
+
</div>
|
|
15
|
+
`}
|
|
16
|
+
</div>
|
|
17
|
+
`;
|
|
18
|
+
};
|
|
@@ -8,8 +8,8 @@ type Data = {
|
|
|
8
8
|
};
|
|
9
9
|
class?: string;
|
|
10
10
|
content?: any;
|
|
11
|
-
};
|
|
12
|
-
declare const _default: (data: Data
|
|
11
|
+
} & Parameters<typeof header>[0];
|
|
12
|
+
declare const _default: (data: Data) => {
|
|
13
13
|
content: string;
|
|
14
14
|
type: string;
|
|
15
15
|
values: never[];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { default as alert } from './alert';
|
|
2
|
+
export { default as field } from './field';
|
|
2
3
|
export { default as form } from './form';
|
|
4
|
+
export { default as overlay } from './overlay';
|
|
3
5
|
export { default as page } from './page';
|
|
4
6
|
export { default as root } from './root';
|
|
5
7
|
export { default as scrollbar } from './scrollbar';
|
|
8
|
+
export { default as site } from './site';
|
|
6
9
|
export { default as tooltip } from './tooltip';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { default as alert } from './alert';
|
|
2
|
+
export { default as field } from './field';
|
|
2
3
|
export { default as form } from './form';
|
|
4
|
+
export { default as overlay } from './overlay';
|
|
3
5
|
export { default as page } from './page';
|
|
4
6
|
export { default as root } from './root';
|
|
5
7
|
export { default as scrollbar } from './scrollbar';
|
|
8
|
+
export { default as site } from './site';
|
|
6
9
|
export { default as tooltip } from './tooltip';
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { html } from '@esportsplus/template';
|
|
2
|
-
export default (
|
|
3
|
-
${suptitle ? html `
|
|
2
|
+
export default (data) => html `
|
|
3
|
+
${data?.suptitle ? html `
|
|
4
4
|
<span class="page-suptitle --text-bold --text-crop --text-uppercase --text-200" style="--color-default: var(--color-primary-400);letter-spacing: 0.24px;">
|
|
5
|
-
${suptitle}
|
|
5
|
+
${data?.suptitle}
|
|
6
6
|
</span>
|
|
7
7
|
` : ''}
|
|
8
8
|
|
|
9
|
-
${title ? html `
|
|
10
|
-
<h1 class="page-title --line-height-200 --margin-300 ${!subtitle && '--text-crop-bottom'} ${suptitle ? '--margin-top' : '--text-crop-top'}">
|
|
11
|
-
${title}
|
|
9
|
+
${data?.title ? html `
|
|
10
|
+
<h1 class="page-title --line-height-200 --margin-300 ${!data?.subtitle && '--text-crop-bottom'} ${data?.suptitle ? '--margin-top' : '--text-crop-top'}">
|
|
11
|
+
${data?.title}
|
|
12
12
|
</h1>
|
|
13
13
|
` : ''}
|
|
14
14
|
|
|
15
|
-
${subtitle ? html `
|
|
15
|
+
${data?.subtitle ? html `
|
|
16
16
|
<span class="page-subtitle --margin-top --margin-300 --text-crop-bottom">
|
|
17
|
-
${subtitle}
|
|
17
|
+
${data?.subtitle}
|
|
18
18
|
</span>
|
|
19
19
|
` : ''}
|
|
20
20
|
`;
|
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
import layout from './layout';
|
|
2
1
|
import queue from './queue';
|
|
3
2
|
declare const _default: {
|
|
4
|
-
layout: (data?: {
|
|
5
|
-
overlay?: {
|
|
6
|
-
class?: string | undefined;
|
|
7
|
-
content?: any;
|
|
8
|
-
} | undefined;
|
|
9
|
-
site?: {
|
|
10
|
-
class?: string | undefined;
|
|
11
|
-
content?: any;
|
|
12
|
-
scrollbar?: {
|
|
13
|
-
style?: string | undefined;
|
|
14
|
-
} | undefined;
|
|
15
|
-
} | undefined;
|
|
16
|
-
}) => {
|
|
17
|
-
content: string;
|
|
18
|
-
type: string;
|
|
19
|
-
values: never[];
|
|
20
|
-
};
|
|
21
3
|
queue: {
|
|
22
4
|
onclick: (fn: VoidFunction) => void;
|
|
23
5
|
};
|
|
24
6
|
};
|
|
25
7
|
export default _default;
|
|
26
|
-
export {
|
|
8
|
+
export { queue };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { html } from '@esportsplus/template';
|
|
2
|
+
import { scrollbar } from '../../components';
|
|
3
|
+
export default (data) => {
|
|
4
|
+
let { attributes: a, html: h } = scrollbar({
|
|
5
|
+
fixed: true,
|
|
6
|
+
style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
|
|
7
|
+
});
|
|
8
|
+
return html `
|
|
9
|
+
<section class='site ${data?.class || ''}' ${a}>
|
|
10
|
+
${data?.content || ''}
|
|
11
|
+
${h}
|
|
12
|
+
</section>
|
|
13
|
+
`;
|
|
14
|
+
};
|
|
@@ -7,11 +7,6 @@ declare const _default: {
|
|
|
7
7
|
type: string;
|
|
8
8
|
values: never[];
|
|
9
9
|
};
|
|
10
|
-
onfocus: (active?: boolean) => {
|
|
11
|
-
content: string;
|
|
12
|
-
type: string;
|
|
13
|
-
values: never[];
|
|
14
|
-
};
|
|
15
10
|
onhover: (active?: boolean) => {
|
|
16
11
|
content: string;
|
|
17
12
|
type: string;
|
|
@@ -32,8 +27,11 @@ declare const _default: {
|
|
|
32
27
|
text: string;
|
|
33
28
|
url?: string | undefined;
|
|
34
29
|
}[] | undefined;
|
|
30
|
+
state: {
|
|
31
|
+
active: boolean;
|
|
32
|
+
};
|
|
35
33
|
style?: string | undefined;
|
|
36
|
-
}) => {
|
|
34
|
+
}) => () => "" | {
|
|
37
35
|
content: string;
|
|
38
36
|
type: string;
|
|
39
37
|
values: never[];
|
|
@@ -22,20 +22,6 @@ const onclick = ({ active, toggle }) => {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
const onfocus = (active = false) => {
|
|
26
|
-
let state = reactive({ active });
|
|
27
|
-
return html({
|
|
28
|
-
class: () => {
|
|
29
|
-
return `tooltip ${state.active ? '--active' : ''}`;
|
|
30
|
-
},
|
|
31
|
-
onfocusin: () => {
|
|
32
|
-
state.active = true;
|
|
33
|
-
},
|
|
34
|
-
onfocusout: () => {
|
|
35
|
-
state.active = false;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
25
|
const onhover = (active = false) => {
|
|
40
26
|
let state = reactive({ active });
|
|
41
27
|
return html({
|
|
@@ -50,4 +36,4 @@ const onhover = (active = false) => {
|
|
|
50
36
|
}
|
|
51
37
|
});
|
|
52
38
|
};
|
|
53
|
-
export default { onclick,
|
|
39
|
+
export default { onclick, onhover, menu };
|
|
@@ -13,9 +13,12 @@ type Data = {
|
|
|
13
13
|
text: string;
|
|
14
14
|
url?: string;
|
|
15
15
|
}[];
|
|
16
|
+
state: {
|
|
17
|
+
active: boolean;
|
|
18
|
+
};
|
|
16
19
|
style?: string;
|
|
17
20
|
};
|
|
18
|
-
declare const _default: (data: Data) => {
|
|
21
|
+
declare const _default: (data: Data) => () => "" | {
|
|
19
22
|
content: string;
|
|
20
23
|
type: string;
|
|
21
24
|
values: never[];
|
|
@@ -1,32 +1,47 @@
|
|
|
1
|
+
import { effect, reactive } from '@esportsplus/reactivity';
|
|
1
2
|
import { html } from '@esportsplus/template';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
${
|
|
5
|
-
${
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<${item.url ? 'a' : 'div'}
|
|
16
|
-
class='link --flex-vertical ${item?.class}' ${item?.onclick ? html `onclick='${item.onclick}'` : ''}
|
|
17
|
-
style='${item?.style || ''}'
|
|
18
|
-
${item?.url ? `href='${item.url}' target='${item.target || '_blank'}'` : ''}
|
|
19
|
-
>
|
|
20
|
-
${item?.svg ? html `
|
|
21
|
-
<div class="icon --margin-right --margin-300" style='margin-left: var(--size-100)'>
|
|
22
|
-
${item.svg}
|
|
23
|
-
</div>
|
|
3
|
+
function template(data) {
|
|
4
|
+
return html `
|
|
5
|
+
<div class="tooltip-content tooltip-content--${data?.direction || 's'} --flex-column --width-full ${data?.class || ''}" style='${data?.style || ''}'>
|
|
6
|
+
${(data?.items || []).map(item => html `
|
|
7
|
+
${item?.border ? html `
|
|
8
|
+
<div
|
|
9
|
+
class="border ${item?.border?.class || ''}"
|
|
10
|
+
style='
|
|
11
|
+
margin-left: calc(var(--margin-horizontal) * -1);
|
|
12
|
+
width: calc(100% + var(--margin-horizontal) * 2);
|
|
13
|
+
'
|
|
14
|
+
></div>
|
|
24
15
|
` : ''}
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
${item.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
<${item?.url ? 'a' : 'div'}
|
|
18
|
+
class='link --flex-vertical ${item?.class}' ${item?.onclick ? html({ onclick: item.onclick }) : ''}
|
|
19
|
+
style='${item?.style || ''}'
|
|
20
|
+
${item?.url ? `href='${item.url}' target='${item.target || '_blank'}'` : ''}
|
|
21
|
+
>
|
|
22
|
+
${item?.svg ? html `
|
|
23
|
+
<div class="icon --margin-right --margin-300" style='margin-left: var(--size-100)'>
|
|
24
|
+
${item.svg}
|
|
25
|
+
</div>
|
|
26
|
+
` : ''}
|
|
27
|
+
|
|
28
|
+
<div class="text --color-text --flex-fill">
|
|
29
|
+
${item.text}
|
|
30
|
+
</div>
|
|
31
|
+
</${item?.url ? 'a' : 'div'}>
|
|
32
|
+
`)}
|
|
33
|
+
</div>
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
export default (data) => {
|
|
37
|
+
let state = reactive({
|
|
38
|
+
render: false
|
|
39
|
+
});
|
|
40
|
+
effect(() => {
|
|
41
|
+
if (!data.state.active || state.render) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
state.render = true;
|
|
45
|
+
});
|
|
46
|
+
return () => state.render ? template(data) : '';
|
|
47
|
+
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { html } from '@esportsplus/template';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export default (data: { description?: string }) => {
|
|
5
|
+
if (!data?.description) {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return html`
|
|
10
|
+
<div class='field-description --margin-top --margin-300'>${data.description}</div>
|
|
11
|
+
`;
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { html } from '@esportsplus/template';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export default (data: { error: string }) => {
|
|
5
|
+
return () => {
|
|
6
|
+
if (!data.error) {
|
|
7
|
+
return '';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return html`
|
|
11
|
+
<div class='field-error --margin-top --margin-300 --text-bold'>${data.error}</div>
|
|
12
|
+
`;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html } from '@esportsplus/template';
|
|
3
|
+
import { form, scrollbar, root } from '~/components';
|
|
4
|
+
import description from './description';
|
|
5
|
+
import error from './error';
|
|
6
|
+
import title from './title';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
type Data = {
|
|
10
|
+
class?: string;
|
|
11
|
+
effect?: (selected: number | string) => void;
|
|
12
|
+
mask?: {
|
|
13
|
+
class?: string;
|
|
14
|
+
content?: any;
|
|
15
|
+
style?: string;
|
|
16
|
+
};
|
|
17
|
+
name?: string;
|
|
18
|
+
options: Record<number | string, number | string>;
|
|
19
|
+
option?: {
|
|
20
|
+
class?: string;
|
|
21
|
+
style?: string;
|
|
22
|
+
};
|
|
23
|
+
selected?: any;
|
|
24
|
+
scrollbar?: {
|
|
25
|
+
style?: string;
|
|
26
|
+
};
|
|
27
|
+
style?: string;
|
|
28
|
+
text?: {
|
|
29
|
+
class?: string;
|
|
30
|
+
};
|
|
31
|
+
tooltip?: {
|
|
32
|
+
class?: string;
|
|
33
|
+
direction?: any;
|
|
34
|
+
style?: string;
|
|
35
|
+
};
|
|
36
|
+
} & Parameters<typeof description>[0] & Parameters<typeof title>[0];
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
function options(keys: (number | string)[], selected: number | string) {
|
|
40
|
+
let options: Record<string, boolean> = {};
|
|
41
|
+
|
|
42
|
+
for (let key of keys) {
|
|
43
|
+
options[key] = false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
options[selected] = true;
|
|
47
|
+
|
|
48
|
+
return options;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function template(data: Data, state: { active: boolean, options: Record<number | string, boolean>, selected: number | string }) {
|
|
52
|
+
let { attributes: a, html: h } = scrollbar({
|
|
53
|
+
fixed: true,
|
|
54
|
+
style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return html`
|
|
58
|
+
<div class='tooltip-content tooltip-content--${data?.tooltip?.direction || 's'} ${data?.tooltip?.class || ''} --flex-column --width-full'>
|
|
59
|
+
<div
|
|
60
|
+
class='row --flex-column'
|
|
61
|
+
onclick='${(e: Event) => {
|
|
62
|
+
let key = (e?.target as HTMLElement)?.dataset?.key;
|
|
63
|
+
|
|
64
|
+
if (key === undefined) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Swap active
|
|
69
|
+
state.options[key] = true;
|
|
70
|
+
state.options[state.selected] = false;
|
|
71
|
+
|
|
72
|
+
state.active = false;
|
|
73
|
+
state.selected = key;
|
|
74
|
+
|
|
75
|
+
if (data.effect) {
|
|
76
|
+
data.effect(key);
|
|
77
|
+
}
|
|
78
|
+
}}'
|
|
79
|
+
style='${data?.tooltip?.style || ''}'
|
|
80
|
+
${a}
|
|
81
|
+
>
|
|
82
|
+
${Object.keys( state.options ).map((key: number | string) => html`
|
|
83
|
+
<div
|
|
84
|
+
class='link ${data?.option?.class || ''} ${() => state.options[key] ? '--active' : ''} --flex-vertical' data-key='${key}'
|
|
85
|
+
style='${data?.option?.style || ''}'
|
|
86
|
+
>
|
|
87
|
+
<span class="--text-truncate">
|
|
88
|
+
${data.options[key]}
|
|
89
|
+
</span>
|
|
90
|
+
</div>
|
|
91
|
+
`)}
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
${h}
|
|
95
|
+
</div>
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
export default (data: Data) => {
|
|
101
|
+
let state = reactive({
|
|
102
|
+
active: false,
|
|
103
|
+
error: '',
|
|
104
|
+
options: options(Object.keys( data.options || {} ), data.selected),
|
|
105
|
+
render: false,
|
|
106
|
+
selected: data.selected
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return html`
|
|
110
|
+
<div class="field tooltip ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column" style='${data?.style || ''}'>
|
|
111
|
+
${title(data)}
|
|
112
|
+
|
|
113
|
+
<label
|
|
114
|
+
class="field-mask field-mask--select --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) && '--margin-top'} --margin-300 --padding-400"
|
|
115
|
+
onclick='${() => {
|
|
116
|
+
state.render = true;
|
|
117
|
+
state.active = !state.active;
|
|
118
|
+
|
|
119
|
+
if (state.active) {
|
|
120
|
+
root.queue.onclick(() => state.active = false);
|
|
121
|
+
}
|
|
122
|
+
}}'
|
|
123
|
+
style='${data?.mask?.style || ''}'
|
|
124
|
+
>
|
|
125
|
+
<input
|
|
126
|
+
class='field-tag field-tag--hidden'
|
|
127
|
+
name='${data.name}'
|
|
128
|
+
onclick='${() => { /* Prevent double click events from firing */ }}'
|
|
129
|
+
value='${() => state.selected}'
|
|
130
|
+
${form.input.attributes(state)}
|
|
131
|
+
>
|
|
132
|
+
|
|
133
|
+
<div class="field-text ${data?.text?.class || ''}" style='pointer-events: none'>
|
|
134
|
+
${() => data.options[ state.selected ] || '-'}
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<div class='field-mask-arrow'></div>
|
|
138
|
+
|
|
139
|
+
${() => state.render ? template(data, state) : ''}
|
|
140
|
+
</label>
|
|
141
|
+
|
|
142
|
+
${description(data)}
|
|
143
|
+
${error(state)}
|
|
144
|
+
</div>
|
|
145
|
+
`;
|
|
146
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html } from '@esportsplus/template';
|
|
3
|
+
import { form } from '~/components';
|
|
4
|
+
import description from './description';
|
|
5
|
+
import error from './error';
|
|
6
|
+
import title from './title';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
type Data = {
|
|
10
|
+
active?: boolean;
|
|
11
|
+
class?: string;
|
|
12
|
+
mask?: {
|
|
13
|
+
class?: string;
|
|
14
|
+
content?: any;
|
|
15
|
+
style?: string;
|
|
16
|
+
};
|
|
17
|
+
name?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
style?: string;
|
|
20
|
+
type?: string;
|
|
21
|
+
value?: unknown;
|
|
22
|
+
} & Parameters<typeof description>[0] & Parameters<typeof title>[0];
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export default (data: Data) => {
|
|
26
|
+
let state = reactive({
|
|
27
|
+
active: (data?.active || false),
|
|
28
|
+
error: ''
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return html`
|
|
32
|
+
<div
|
|
33
|
+
class="field --flex-column ${data?.class || ''} ${() => state.active ? '--active' : ''}"
|
|
34
|
+
onfocusin='${() => {
|
|
35
|
+
state.active = true;
|
|
36
|
+
}}'
|
|
37
|
+
onfocusout='${() => {
|
|
38
|
+
state.active = false;
|
|
39
|
+
}}'
|
|
40
|
+
style='${data?.style || ''}'
|
|
41
|
+
>
|
|
42
|
+
${title(data)}
|
|
43
|
+
|
|
44
|
+
<label
|
|
45
|
+
class='field-mask field-mask--input --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) && '--margin-top'} --margin-300'
|
|
46
|
+
style='${data?.mask?.style || ''}'
|
|
47
|
+
>
|
|
48
|
+
<input
|
|
49
|
+
class='field-tag --padding-400'
|
|
50
|
+
name='${data?.name || ''}'
|
|
51
|
+
placeholder='${data?.placeholder || ''}'
|
|
52
|
+
type='${data?.type || 'string'}'
|
|
53
|
+
${data?.value !== undefined ? `value='${data.value}'` : ''}
|
|
54
|
+
${form.input.attributes(state)}
|
|
55
|
+
>
|
|
56
|
+
|
|
57
|
+
${data?.mask?.content || ''}
|
|
58
|
+
</label>
|
|
59
|
+
|
|
60
|
+
${description(data)}
|
|
61
|
+
${error(state)}
|
|
62
|
+
</div>
|
|
63
|
+
`;
|
|
64
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { html } from '@esportsplus/template';
|
|
2
|
+
import { tooltip } from '~/components';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default (data: { required?: boolean, title?: string }) => {
|
|
6
|
+
if (!data?.title) {
|
|
7
|
+
return '';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return html`
|
|
11
|
+
<div class="field-title --flex-horizontal-space-between --flex-vertical">
|
|
12
|
+
${data.title}
|
|
13
|
+
|
|
14
|
+
${data?.required && html`
|
|
15
|
+
<div class="bubble --background-primary --margin-left" ${tooltip.onhover()}>
|
|
16
|
+
<span class="tooltip-message tooltip-message--w">Required</span>
|
|
17
|
+
</div>
|
|
18
|
+
`}
|
|
19
|
+
</div>
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
@@ -11,10 +11,10 @@ type Data = {
|
|
|
11
11
|
};
|
|
12
12
|
class?: string;
|
|
13
13
|
content?: any;
|
|
14
|
-
};
|
|
14
|
+
} & Parameters<typeof header>[0];
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
export default (data: Data
|
|
17
|
+
export default (data: Data) => html`
|
|
18
18
|
${header(data)}
|
|
19
19
|
|
|
20
20
|
<form class='${data?.class}' ${data?.action || ''}>
|
package/src/components/index.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { default as alert }from './alert';
|
|
2
|
+
export { default as field }from './field';
|
|
2
3
|
export { default as form }from './form';
|
|
4
|
+
export { default as overlay }from './overlay';
|
|
3
5
|
export { default as page }from './page';
|
|
4
6
|
export { default as root }from './root';
|
|
5
7
|
export { default as scrollbar }from './scrollbar';
|
|
8
|
+
export { default as site }from './site';
|
|
6
9
|
export { default as tooltip }from './tooltip';
|
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
import { html } from '@esportsplus/template';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
suptitle?: string;
|
|
7
|
-
title?: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export default ({ subtitle, suptitle, title }: Data) => html`
|
|
12
|
-
${suptitle ? html`
|
|
4
|
+
export default (data: { subtitle?: string, suptitle?: string, title?: string }) => html`
|
|
5
|
+
${data?.suptitle ? html`
|
|
13
6
|
<span class="page-suptitle --text-bold --text-crop --text-uppercase --text-200" style="--color-default: var(--color-primary-400);letter-spacing: 0.24px;">
|
|
14
|
-
${suptitle}
|
|
7
|
+
${data?.suptitle}
|
|
15
8
|
</span>
|
|
16
9
|
` : ''}
|
|
17
10
|
|
|
18
|
-
${title ? html`
|
|
19
|
-
<h1 class="page-title --line-height-200 --margin-300 ${!subtitle && '--text-crop-bottom'} ${suptitle ? '--margin-top' : '--text-crop-top'}">
|
|
20
|
-
${title}
|
|
11
|
+
${data?.title ? html`
|
|
12
|
+
<h1 class="page-title --line-height-200 --margin-300 ${!data?.subtitle && '--text-crop-bottom'} ${data?.suptitle ? '--margin-top' : '--text-crop-top'}">
|
|
13
|
+
${data?.title}
|
|
21
14
|
</h1>
|
|
22
15
|
` : ''}
|
|
23
16
|
|
|
24
|
-
${subtitle ? html`
|
|
17
|
+
${data?.subtitle ? html`
|
|
25
18
|
<span class="page-subtitle --margin-top --margin-300 --text-crop-bottom">
|
|
26
|
-
${subtitle}
|
|
19
|
+
${data?.subtitle}
|
|
27
20
|
</span>
|
|
28
21
|
` : ''}
|
|
29
22
|
`;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { html } from '@esportsplus/template';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
class?: string;
|
|
6
|
-
content?: any;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export default (data: Data = {}) => html`
|
|
4
|
+
export default (data: { class?: string, content?: any } = {}) => html`
|
|
11
5
|
<section class='page ${data?.class}'>
|
|
12
6
|
${data?.content}
|
|
13
7
|
</section>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { html } from '@esportsplus/template';
|
|
2
|
+
import { scrollbar } from '~/components';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
type Data = {
|
|
6
|
+
class?: string;
|
|
7
|
+
content?: any;
|
|
8
|
+
scrollbar?: {
|
|
9
|
+
style?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export default (data: Data) => {
|
|
15
|
+
let { attributes: a, html: h } = scrollbar({
|
|
16
|
+
fixed: true,
|
|
17
|
+
style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return html`
|
|
21
|
+
<section class='site ${data?.class || ''}' ${a}>
|
|
22
|
+
${data?.content || ''}
|
|
23
|
+
${h}
|
|
24
|
+
</section>
|
|
25
|
+
`;
|
|
26
|
+
};
|
|
@@ -29,22 +29,6 @@ const onclick = ({ active, toggle }: { active?: boolean, toggle?: boolean }) =>
|
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const onfocus = (active: boolean = false) => {
|
|
33
|
-
let state = reactive({ active });
|
|
34
|
-
|
|
35
|
-
return html({
|
|
36
|
-
class: () => {
|
|
37
|
-
return `tooltip ${state.active ? '--active' : ''}`;
|
|
38
|
-
},
|
|
39
|
-
onfocusin: () => {
|
|
40
|
-
state.active = true;
|
|
41
|
-
},
|
|
42
|
-
onfocusout: () => {
|
|
43
|
-
state.active = false;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
|
|
48
32
|
const onhover = (active: boolean = false) => {
|
|
49
33
|
let state = reactive({ active });
|
|
50
34
|
|
|
@@ -62,4 +46,4 @@ const onhover = (active: boolean = false) => {
|
|
|
62
46
|
};
|
|
63
47
|
|
|
64
48
|
|
|
65
|
-
export default { onclick,
|
|
49
|
+
export default { onclick, onhover, menu };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { effect, reactive } from '@esportsplus/reactivity';
|
|
1
2
|
import { html } from '@esportsplus/template';
|
|
2
3
|
|
|
3
4
|
|
|
@@ -16,38 +17,58 @@ type Data = {
|
|
|
16
17
|
text: string;
|
|
17
18
|
url?: string;
|
|
18
19
|
}[];
|
|
20
|
+
state: { active: boolean };
|
|
19
21
|
style?: string;
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
${
|
|
26
|
-
${
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<${item.url ? 'a' : 'div'}
|
|
37
|
-
class='link --flex-vertical ${item?.class}' ${item?.onclick ? html`onclick='${item.onclick}'` : ''}
|
|
38
|
-
style='${item?.style || ''}'
|
|
39
|
-
${item?.url ? `href='${item.url}' target='${item.target || '_blank'}'` : ''}
|
|
40
|
-
>
|
|
41
|
-
${item?.svg ? html`
|
|
42
|
-
<div class="icon --margin-right --margin-300" style='margin-left: var(--size-100)'>
|
|
43
|
-
${item.svg}
|
|
44
|
-
</div>
|
|
25
|
+
function template(data: Data) {
|
|
26
|
+
return html`
|
|
27
|
+
<div class="tooltip-content tooltip-content--${data?.direction || 's'} --flex-column --width-full ${data?.class || ''}" style='${data?.style || ''}'>
|
|
28
|
+
${(data?.items || []).map(item => html`
|
|
29
|
+
${item?.border ? html`
|
|
30
|
+
<div
|
|
31
|
+
class="border ${item?.border?.class || ''}"
|
|
32
|
+
style='
|
|
33
|
+
margin-left: calc(var(--margin-horizontal) * -1);
|
|
34
|
+
width: calc(100% + var(--margin-horizontal) * 2);
|
|
35
|
+
'
|
|
36
|
+
></div>
|
|
45
37
|
` : ''}
|
|
46
38
|
|
|
47
|
-
|
|
48
|
-
${item.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
<${item?.url ? 'a' : 'div'}
|
|
40
|
+
class='link --flex-vertical ${item?.class}' ${item?.onclick ? html({ onclick: item.onclick }) : ''}
|
|
41
|
+
style='${item?.style || ''}'
|
|
42
|
+
${item?.url ? `href='${item.url}' target='${item.target || '_blank'}'` : ''}
|
|
43
|
+
>
|
|
44
|
+
${item?.svg ? html`
|
|
45
|
+
<div class="icon --margin-right --margin-300" style='margin-left: var(--size-100)'>
|
|
46
|
+
${item.svg}
|
|
47
|
+
</div>
|
|
48
|
+
` : ''}
|
|
49
|
+
|
|
50
|
+
<div class="text --color-text --flex-fill">
|
|
51
|
+
${item.text}
|
|
52
|
+
</div>
|
|
53
|
+
</${item?.url ? 'a' : 'div'}>
|
|
54
|
+
`)}
|
|
55
|
+
</div>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
export default (data: Data) => {
|
|
61
|
+
let state = reactive({
|
|
62
|
+
render: false
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
effect(() => {
|
|
66
|
+
if (!data.state.active || state.render) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
state.render = true;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return () => state.render ? template(data) : '';
|
|
74
|
+
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { html } from '@esportsplus/template';
|
|
2
|
-
import { scrollbar } from '~/components';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Data = {
|
|
6
|
-
overlay?: {
|
|
7
|
-
class?: string;
|
|
8
|
-
content?: any;
|
|
9
|
-
};
|
|
10
|
-
site?: {
|
|
11
|
-
class?: string;
|
|
12
|
-
content?: any;
|
|
13
|
-
scrollbar?: {
|
|
14
|
-
style?: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export default (data: Data = {}) => {
|
|
21
|
-
let s = scrollbar({
|
|
22
|
-
fixed: true,
|
|
23
|
-
style: data?.site?.scrollbar?.style || '--background-default: var(--color-black-400);'
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return html`
|
|
27
|
-
<section class='site ${data?.site?.class || ''}' ${s.attributes}>
|
|
28
|
-
${data?.site?.content || ''}
|
|
29
|
-
${s.html}
|
|
30
|
-
</section>
|
|
31
|
-
|
|
32
|
-
<section class='overlay ${data?.overlay?.class || ''}'>
|
|
33
|
-
${data?.overlay?.content || ''}
|
|
34
|
-
</section>
|
|
35
|
-
`;
|
|
36
|
-
};
|