@esportsplus/ui 0.17.7 → 0.18.1
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/accordion/index.d.ts +2 -2
- package/build/components/counter/index.d.ts +7 -10
- package/build/components/counter/index.js +34 -36
- package/build/components/ellipsis/index.d.ts +2 -1
- package/build/components/ellipsis/index.js +1 -1
- package/build/components/field/checkbox.d.ts +354 -11
- package/build/components/field/checkbox.js +45 -40
- package/build/components/field/description.d.ts +5 -6
- package/build/components/field/description.js +5 -9
- package/build/components/field/error.d.ts +1 -1
- package/build/components/field/error.js +3 -3
- package/build/components/field/index.d.ts +3329 -67
- package/build/components/field/index.js +7 -6
- package/build/components/field/input.d.ts +364 -0
- package/build/components/field/input.js +97 -0
- package/build/components/field/scss/index.scss +1 -1
- package/build/components/field/select.d.ts +245 -24
- package/build/components/field/select.js +99 -109
- package/build/components/field/title.d.ts +113 -7
- package/build/components/field/title.js +7 -10
- package/build/components/footer/index.d.ts +5 -9
- package/build/components/footer/index.js +7 -6
- package/build/components/form/index.d.ts +4 -2
- package/build/components/form/input.d.ts +5 -2
- package/build/components/form/input.js +4 -1
- package/build/components/frame/index.d.ts +115 -0
- package/build/components/frame/index.js +8 -0
- package/build/components/frame/scss/index.scss +1 -1
- package/build/components/highlight/index.d.ts +2 -1
- package/build/components/icon/index.d.ts +5 -2
- package/build/components/icon/index.js +7 -6
- package/build/components/index.d.ts +1 -2
- package/build/components/index.js +1 -2
- package/build/components/json/download.d.ts +1 -1
- package/build/components/json/index.d.ts +1 -1
- package/build/components/link/index.d.ts +0 -12
- package/build/components/link/index.js +0 -2
- package/build/components/link/scss/index.scss +1 -1
- package/build/components/loader/index.d.ts +5 -4
- package/build/components/loader/index.js +20 -20
- package/build/components/loading/index.d.ts +2 -1
- package/build/components/overlay/index.d.ts +114 -2
- package/build/components/overlay/index.js +7 -8
- package/build/components/scrollbar/index.d.ts +115 -4
- package/build/components/scrollbar/index.js +26 -25
- package/build/components/scrollbar/scss/index.scss +1 -1
- package/build/components/sidebar/index.d.ts +114 -2
- package/build/components/sidebar/index.js +7 -8
- package/build/components/site/index.d.ts +114 -2
- package/build/components/site/index.js +9 -10
- package/build/components/template/index.d.ts +8 -0
- package/build/components/template/index.js +15 -0
- package/build/components/tooltip/index.d.ts +355 -8
- package/build/components/tooltip/index.js +54 -37
- package/build/components/typewriter/index.d.ts +1 -1
- package/build/css-utilities/flex/scss/index.scss +1 -1
- package/package.json +7 -7
- package/src/components/accordion/scss/index.scss +1 -1
- package/src/components/anchor/scss/index.scss +1 -1
- package/src/components/banner/scss/index.scss +1 -1
- package/src/components/border/scss/index.scss +1 -1
- package/src/components/button/scss/index.scss +1 -1
- package/src/components/card/scss/index.scss +1 -1
- package/src/components/container/scss/index.scss +1 -1
- package/src/components/counter/index.ts +42 -46
- package/src/components/counter/scss/index.scss +1 -1
- package/src/components/ellipsis/index.ts +3 -3
- package/src/components/ellipsis/scss/index.scss +1 -1
- package/src/components/field/checkbox.ts +68 -53
- package/src/components/field/description.ts +8 -11
- package/src/components/field/error.ts +3 -3
- package/src/components/field/index.ts +10 -6
- package/src/components/field/input.ts +125 -0
- package/src/components/field/scss/{_check.scss → check.scss} +1 -4
- package/src/components/field/scss/index.scss +15 -36
- package/src/components/field/scss/normalize.scss +34 -0
- package/src/components/field/scss/{_text.scss → text.scss} +31 -17
- package/src/components/field/scss/variables.scss +0 -10
- package/src/components/field/select.ts +167 -155
- package/src/components/field/title.ts +10 -12
- package/src/components/footer/index.ts +12 -22
- package/src/components/form/input.ts +10 -5
- package/src/components/frame/index.ts +14 -1
- package/src/components/frame/scss/index.scss +2 -0
- package/src/components/grid/scss/index.scss +1 -1
- package/src/components/group/scss/index.scss +1 -1
- package/src/components/highlight/index.ts +2 -1
- package/src/components/highlight/scss/index.scss +1 -1
- package/src/components/icon/index.ts +11 -8
- package/src/components/icon/scss/index.scss +1 -1
- package/src/components/index.ts +1 -2
- package/src/components/json/download.ts +1 -1
- package/src/components/link/index.ts +1 -5
- package/src/components/link/scss/index.scss +1 -20
- package/src/components/loader/index.ts +35 -33
- package/src/components/loader/scss/index.scss +1 -1
- package/src/components/loading/index.ts +2 -2
- package/src/components/loading/scss/index.scss +1 -1
- package/src/components/modal/scss/index.scss +1 -1
- package/src/components/overlay/index.ts +9 -9
- package/src/components/page/scss/index.scss +1 -1
- package/src/components/root/scss/index.scss +1 -1
- package/src/components/scrollbar/index.ts +44 -42
- package/src/components/scrollbar/scss/index.scss +1 -1
- package/src/components/scrollbar/scss/variables.scss +1 -1
- package/src/components/sidebar/index.ts +9 -9
- package/src/components/sidebar/scss/index.scss +1 -1
- package/src/components/site/index.ts +11 -11
- package/src/components/template/index.ts +26 -0
- package/src/components/text/scss/index.scss +1 -1
- package/src/components/thumbnail/scss/index.scss +1 -1
- package/src/components/tooltip/index.ts +116 -86
- package/src/components/tooltip/scss/index.scss +1 -1
- package/src/css-utilities/flex/scss/index.scss +7 -7
- package/build/components/field/file.d.ts +0 -19
- package/build/components/field/file.js +0 -51
- package/build/components/field/optional.d.ts +0 -12
- package/build/components/field/optional.js +0 -16
- package/build/components/field/switch.d.ts +0 -3
- package/build/components/field/switch.js +0 -6
- package/build/components/field/text.d.ts +0 -19
- package/build/components/field/text.js +0 -64
- package/build/components/field/textarea.d.ts +0 -3
- package/build/components/field/textarea.js +0 -5
- package/build/components/link/hover.d.ts +0 -10
- package/build/components/link/hover.js +0 -17
- package/build/components/magnet/index.d.ts +0 -11
- package/build/components/magnet/index.js +0 -51
- package/build/components/magnet/scss/index.scss +0 -2
- package/src/components/field/file.ts +0 -77
- package/src/components/field/optional.ts +0 -23
- package/src/components/field/scss/_normalize.scss +0 -36
- package/src/components/field/switch.ts +0 -9
- package/src/components/field/text.ts +0 -92
- package/src/components/field/textarea.ts +0 -8
- package/src/components/link/hover.ts +0 -19
- package/src/components/magnet/index.ts +0 -60
- package/src/components/magnet/scss/index.scss +0 -17
- package/src/components/magnet/scss/variables.scss +0 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
-
import { html } from '@esportsplus/template';
|
|
3
|
-
import {
|
|
2
|
+
import { html, type Attributes } from '@esportsplus/template';
|
|
3
|
+
import { omit, toArray } from '@esportsplus/utilities';
|
|
4
4
|
import { root } from '@esportsplus/ui';
|
|
5
|
+
import template from '~/components/template';
|
|
5
6
|
import './scss/index.scss';
|
|
6
7
|
|
|
7
8
|
|
|
@@ -38,92 +39,121 @@ function frame() {
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
const menu = template.factory<
|
|
43
|
+
Attributes & {
|
|
44
|
+
options: (Attributes & { content: unknown })[],
|
|
45
|
+
option?: Attributes,
|
|
46
|
+
state?: { active: boolean },
|
|
47
|
+
toggle?: boolean,
|
|
48
|
+
'tooltip-content': Attributes & { direction?: string }
|
|
47
49
|
}
|
|
48
|
-
|
|
49
|
-
(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return html`
|
|
54
|
-
<div
|
|
55
|
-
class='tooltip'
|
|
56
|
-
onclick='${function(this: HTMLElement, e: Event) {
|
|
57
|
-
let active = true,
|
|
58
|
-
node = e.target as Node | null;
|
|
59
|
-
|
|
60
|
-
if (this === node || (data.toggle && this.contains(node))) {
|
|
61
|
-
active = !state.active;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (parent !== this && !parent?.contains(this)) {
|
|
65
|
-
parent = this.parentElement?.closest('.tooltip');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
frame();
|
|
69
|
-
|
|
70
|
-
if (parent === this) {
|
|
71
|
-
parent = null;
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
state.active = active;
|
|
76
|
-
|
|
77
|
-
if (active) {
|
|
78
|
-
queue.push({
|
|
79
|
-
fn: () => state.active = false,
|
|
80
|
-
tooltip: this
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (!scheduled) {
|
|
85
|
-
root.onclick.push(() => {
|
|
86
|
-
frame();
|
|
87
|
-
scheduled = false;
|
|
88
|
-
});
|
|
89
|
-
scheduled = true;
|
|
90
|
-
}
|
|
91
|
-
}}}'
|
|
92
|
-
${omit(data, ['active', 'toggle'])}
|
|
93
|
-
>
|
|
50
|
+
>(
|
|
51
|
+
(attributes, content) => onclick(
|
|
52
|
+
omit(attributes, ['options', 'option', 'tooltip-content']),
|
|
53
|
+
html`
|
|
94
54
|
${content}
|
|
95
|
-
</div>
|
|
96
|
-
`;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const onhover = (
|
|
100
|
-
data: Record<string, unknown>,
|
|
101
|
-
content: unknown,
|
|
102
|
-
state: { active: boolean } = reactive({ active: false })
|
|
103
|
-
) => {
|
|
104
|
-
if (!isArray(data.class)) {
|
|
105
|
-
data.class = data.class ? [data.class] : [];
|
|
106
|
-
}
|
|
107
55
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
56
|
+
<div
|
|
57
|
+
class='tooltip-content ${`tooltip-content--${attributes['tooltip-content']?.direction || 'nw'}`}'
|
|
58
|
+
${omit(attributes['tooltip-content'], ['direction'])}
|
|
59
|
+
>
|
|
60
|
+
${attributes.options.map((option) => html`
|
|
61
|
+
<div
|
|
62
|
+
class='link --width-full'
|
|
63
|
+
${omit(option, ['content'])}
|
|
64
|
+
${attributes.option}
|
|
65
|
+
>
|
|
66
|
+
${option.content}
|
|
67
|
+
</div>
|
|
68
|
+
`)}
|
|
69
|
+
</div>
|
|
70
|
+
`
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const onclick = template.factory<Attributes & { state?: { active: boolean }, toggle?: boolean }>(
|
|
75
|
+
(attributes, content) => {
|
|
76
|
+
let state = attributes.state || reactive({ active: false });
|
|
77
|
+
|
|
78
|
+
attributes.class = toArray(attributes.class);
|
|
79
|
+
attributes.class.push(() => {
|
|
80
|
+
return state.active && '--active';
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
attributes.onclick = function(this: HTMLElement, e) {
|
|
84
|
+
let active = true,
|
|
85
|
+
node = e.target as Node | null;
|
|
86
|
+
|
|
87
|
+
if (this === node || (attributes.toggle && this.contains(node))) {
|
|
88
|
+
active = !state.active;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (parent !== this && !parent?.contains(this)) {
|
|
92
|
+
parent = this.parentElement?.closest('.tooltip');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
frame();
|
|
96
|
+
|
|
97
|
+
if (parent === this) {
|
|
98
|
+
parent = null;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
state.active = active;
|
|
103
|
+
|
|
104
|
+
if (active) {
|
|
105
|
+
queue.push({
|
|
106
|
+
fn: () => state.active = false,
|
|
107
|
+
tooltip: this
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!scheduled) {
|
|
112
|
+
root.onclick.push(() => {
|
|
113
|
+
frame();
|
|
114
|
+
scheduled = false;
|
|
115
|
+
});
|
|
116
|
+
scheduled = true;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return html`
|
|
121
|
+
<div
|
|
122
|
+
class='tooltip'
|
|
123
|
+
${omit(attributes, ['state', 'toggle'])}
|
|
124
|
+
>
|
|
125
|
+
${content}
|
|
126
|
+
</div>
|
|
127
|
+
`;
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
const onhover = template.factory<Attributes & { state?: { active: boolean } }>(
|
|
132
|
+
(attributes, content) => {
|
|
133
|
+
let state = attributes.state || reactive({ active: false });
|
|
134
|
+
|
|
135
|
+
attributes.class = toArray(attributes.class);
|
|
136
|
+
attributes.class.push(() => {
|
|
137
|
+
return state.active && '--active';
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
attributes.onmouseover = () => {
|
|
141
|
+
state.active = true;
|
|
142
|
+
};
|
|
143
|
+
attributes.onmouseout = () => {
|
|
144
|
+
state.active = false;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
return html`
|
|
148
|
+
<div
|
|
149
|
+
class='tooltip'
|
|
150
|
+
${omit(attributes, ['active', 'state', 'toggle'])}
|
|
151
|
+
>
|
|
152
|
+
${content}
|
|
153
|
+
</div>
|
|
154
|
+
`;
|
|
155
|
+
}
|
|
156
|
+
);
|
|
127
157
|
|
|
128
158
|
|
|
129
|
-
export default { onclick, onhover };
|
|
159
|
+
export default { menu, onclick, onhover };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
&-center {
|
|
3
3
|
align-content: center;
|
|
4
4
|
display: flex;
|
|
5
|
-
flex-
|
|
5
|
+
flex-flow: row wrap;
|
|
6
6
|
justify-content: center;
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
&-end {
|
|
15
15
|
display: flex;
|
|
16
|
-
flex-
|
|
16
|
+
flex-flow: row wrap;
|
|
17
17
|
justify-content: flex-end;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
|
|
31
31
|
&-horizontal {
|
|
32
32
|
display: flex;
|
|
33
|
-
flex-
|
|
33
|
+
flex-flow: row wrap;
|
|
34
34
|
justify-content: center;
|
|
35
35
|
|
|
36
36
|
&-space-between {
|
|
37
37
|
display: flex;
|
|
38
|
-
flex-
|
|
38
|
+
flex-flow: row wrap;
|
|
39
39
|
justify-content: space-between;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -47,19 +47,19 @@
|
|
|
47
47
|
|
|
48
48
|
&-start {
|
|
49
49
|
display: flex;
|
|
50
|
-
flex-
|
|
50
|
+
flex-flow: row wrap;
|
|
51
51
|
justify-content: flex-start;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
&-vertical {
|
|
55
55
|
align-items: center;
|
|
56
56
|
display: flex;
|
|
57
|
-
flex-
|
|
57
|
+
flex-flow: row wrap;
|
|
58
58
|
|
|
59
59
|
&-space-between {
|
|
60
60
|
align-items: space-between;
|
|
61
61
|
display: flex;
|
|
62
|
-
flex-
|
|
62
|
+
flex-flow: row wrap;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import description from './description.js';
|
|
2
|
-
import title from './title.js';
|
|
3
|
-
type Data = {
|
|
4
|
-
accept?: string;
|
|
5
|
-
class?: string;
|
|
6
|
-
description?: Parameters<typeof description>[0]['description'];
|
|
7
|
-
mask?: {
|
|
8
|
-
content?: unknown;
|
|
9
|
-
} & Record<string, unknown>;
|
|
10
|
-
name?: string;
|
|
11
|
-
placeholder?: string;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
style?: string;
|
|
14
|
-
tag?: Record<string, unknown>;
|
|
15
|
-
title?: Parameters<typeof title>[0]['title'];
|
|
16
|
-
value?: unknown;
|
|
17
|
-
} & Record<string, unknown>;
|
|
18
|
-
declare const _default: (data: Data) => import("@esportsplus/template/build/types").RenderableTemplate;
|
|
19
|
-
export default _default;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
-
import { html } from '@esportsplus/template';
|
|
3
|
-
import { omit, pick } from '@esportsplus/utilities';
|
|
4
|
-
import form from '../../components/form/index.js';
|
|
5
|
-
import description from './description.js';
|
|
6
|
-
import error from './error.js';
|
|
7
|
-
import title from './title.js';
|
|
8
|
-
const FIELD_OMIT = ['accept', 'mask', 'name', 'placeholder', 'value'];
|
|
9
|
-
const MASK_OMIT = ['content'];
|
|
10
|
-
const TAG_PICK = ['accept', 'name', 'required', 'value'];
|
|
11
|
-
export default (data) => {
|
|
12
|
-
let state = reactive({
|
|
13
|
-
active: false,
|
|
14
|
-
error: ''
|
|
15
|
-
});
|
|
16
|
-
data.mask ??= {};
|
|
17
|
-
data.tag ??= {};
|
|
18
|
-
data.tag.type = 'file';
|
|
19
|
-
data.tag.onrender = form.input.onrender(state);
|
|
20
|
-
return html `
|
|
21
|
-
<div
|
|
22
|
-
class='${() => state.active && '--active'} field --flex-column'
|
|
23
|
-
onfocusin='${() => {
|
|
24
|
-
state.active = true;
|
|
25
|
-
}}'
|
|
26
|
-
onfocusout='${() => {
|
|
27
|
-
state.active = false;
|
|
28
|
-
}}'
|
|
29
|
-
${omit(data, FIELD_OMIT)}
|
|
30
|
-
>
|
|
31
|
-
${title(data)}
|
|
32
|
-
|
|
33
|
-
<label
|
|
34
|
-
class='field-mask field-mask--input --flex-row'
|
|
35
|
-
style='cursor:pointer;'
|
|
36
|
-
${omit(data.mask, MASK_OMIT)}
|
|
37
|
-
>
|
|
38
|
-
<input
|
|
39
|
-
class='field-tag field-tag--hidden'
|
|
40
|
-
${pick(data, TAG_PICK)}
|
|
41
|
-
${data.tag}
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
${data.mask?.content || ''}
|
|
45
|
-
</label>
|
|
46
|
-
|
|
47
|
-
${description(data)}
|
|
48
|
-
${error(state)}
|
|
49
|
-
</div>
|
|
50
|
-
`;
|
|
51
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import s from './select.js';
|
|
2
|
-
import sw from './switch.js';
|
|
3
|
-
import t from './text.js';
|
|
4
|
-
declare const _default: {
|
|
5
|
-
select: (data: Parameters<typeof sw>[0] & {
|
|
6
|
-
field: Parameters<typeof s>[0];
|
|
7
|
-
}) => import("@esportsplus/template/build/types").RenderableTemplate;
|
|
8
|
-
text: (data: Parameters<typeof sw>[0] & {
|
|
9
|
-
field: Parameters<typeof t>[0];
|
|
10
|
-
}) => import("@esportsplus/template/build/types").RenderableTemplate;
|
|
11
|
-
};
|
|
12
|
-
export default _default;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import s from './select.js';
|
|
2
|
-
import sw from './switch.js';
|
|
3
|
-
import t from './text.js';
|
|
4
|
-
const select = (data) => {
|
|
5
|
-
data.field ??= {};
|
|
6
|
-
data.field.class = `field--optional ${data.field?.class || ''}`;
|
|
7
|
-
data.field.content = s(data.field);
|
|
8
|
-
return sw(data);
|
|
9
|
-
};
|
|
10
|
-
const text = (data) => {
|
|
11
|
-
data.field ??= {};
|
|
12
|
-
data.field.class = `field--optional ${data.field?.class || ''}`;
|
|
13
|
-
data.field.content = t(data.field);
|
|
14
|
-
return sw(data);
|
|
15
|
-
};
|
|
16
|
-
export default { select, text };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import description from './description.js';
|
|
2
|
-
import title from './title.js';
|
|
3
|
-
type Data = {
|
|
4
|
-
class?: string;
|
|
5
|
-
content?: unknown;
|
|
6
|
-
description?: Parameters<typeof description>[0]['description'];
|
|
7
|
-
mask?: Record<string, unknown>;
|
|
8
|
-
name?: string;
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
style?: string;
|
|
12
|
-
tag?: Record<string, unknown>;
|
|
13
|
-
textarea?: boolean;
|
|
14
|
-
title?: Parameters<typeof title>[0]['title'];
|
|
15
|
-
type?: string;
|
|
16
|
-
value?: unknown;
|
|
17
|
-
} & Record<string, unknown>;
|
|
18
|
-
declare const _default: (data: Data) => import("@esportsplus/template/build/types").RenderableTemplate;
|
|
19
|
-
export default _default;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
-
import { html } from '@esportsplus/template';
|
|
3
|
-
import { omit, pick } from '@esportsplus/utilities';
|
|
4
|
-
import form from '../../components/form/index.js';
|
|
5
|
-
import description from './description.js';
|
|
6
|
-
import error from './error.js';
|
|
7
|
-
import title from './title.js';
|
|
8
|
-
const FIELD_OMIT = [
|
|
9
|
-
'content',
|
|
10
|
-
'description',
|
|
11
|
-
'mask',
|
|
12
|
-
'name',
|
|
13
|
-
'placeholder',
|
|
14
|
-
'required',
|
|
15
|
-
'tag', 'textarea', 'title', 'type',
|
|
16
|
-
'value'
|
|
17
|
-
];
|
|
18
|
-
const INPUT_PICK = ['name', 'placeholder', 'required', 'type', 'value'];
|
|
19
|
-
const TEXTAREA_PICK = ['name', 'placeholder'];
|
|
20
|
-
export default (data) => {
|
|
21
|
-
let state = reactive({
|
|
22
|
-
active: false,
|
|
23
|
-
error: ''
|
|
24
|
-
});
|
|
25
|
-
data.onfocusin = () => {
|
|
26
|
-
state.active = true;
|
|
27
|
-
};
|
|
28
|
-
data.onfocusout = () => {
|
|
29
|
-
state.active = false;
|
|
30
|
-
};
|
|
31
|
-
data.tag ??= {};
|
|
32
|
-
data.tag.class = `field-tag --padding-400 ${data.tag.class || ''}`;
|
|
33
|
-
data.tag.onrender = form.input.onrender(state);
|
|
34
|
-
data.type ??= 'string';
|
|
35
|
-
data.value ??= '';
|
|
36
|
-
return html `
|
|
37
|
-
<div
|
|
38
|
-
class='
|
|
39
|
-
${() => state.active && '--active'}
|
|
40
|
-
field
|
|
41
|
-
--flex-column
|
|
42
|
-
'
|
|
43
|
-
${omit(data, FIELD_OMIT)}
|
|
44
|
-
>
|
|
45
|
-
${title(data)}
|
|
46
|
-
|
|
47
|
-
<label class='field-mask field-mask--input --flex-row' ${data.mask}>
|
|
48
|
-
${data.textarea
|
|
49
|
-
? html `
|
|
50
|
-
<textarea ${data.tag} ${pick(data, TEXTAREA_PICK)}>
|
|
51
|
-
${data.value}
|
|
52
|
-
</textarea>
|
|
53
|
-
`
|
|
54
|
-
: html `
|
|
55
|
-
<input ${data.tag} ${pick(data, INPUT_PICK)}>
|
|
56
|
-
`}
|
|
57
|
-
${data.content || ''}
|
|
58
|
-
</label>
|
|
59
|
-
|
|
60
|
-
${description(data)}
|
|
61
|
-
${error(state)}
|
|
62
|
-
</div>
|
|
63
|
-
`;
|
|
64
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { html } from '@esportsplus/template';
|
|
2
|
-
export default ({ attributes, content }) => {
|
|
3
|
-
return {
|
|
4
|
-
attributes: {
|
|
5
|
-
class: 'link--hover'
|
|
6
|
-
},
|
|
7
|
-
html: html `
|
|
8
|
-
<span class='link-hover link-hover--one' ${attributes}>
|
|
9
|
-
${content}
|
|
10
|
-
</span>
|
|
11
|
-
|
|
12
|
-
<span class='link-hover link-hover--two' ${attributes}>
|
|
13
|
-
${content}
|
|
14
|
-
</span>
|
|
15
|
-
`
|
|
16
|
-
};
|
|
17
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import './scss/index.scss';
|
|
2
|
-
declare const _default: ({ attributes, hide }: {
|
|
3
|
-
attributes?: Record<string, unknown>;
|
|
4
|
-
hide?: boolean;
|
|
5
|
-
}) => {
|
|
6
|
-
html: import("@esportsplus/template/build/types").RenderableTemplate;
|
|
7
|
-
sibling: {
|
|
8
|
-
attributes: Record<string, Function>;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
-
import { html } from '@esportsplus/template';
|
|
3
|
-
import './scss/index.scss';
|
|
4
|
-
export default ({ attributes, hide }) => {
|
|
5
|
-
let active = false, events = {
|
|
6
|
-
onmouseover: function () {
|
|
7
|
-
let { offsetHeight, offsetLeft, offsetTop, offsetWidth } = this;
|
|
8
|
-
active = true;
|
|
9
|
-
state.height = offsetHeight;
|
|
10
|
-
state.left = offsetLeft;
|
|
11
|
-
state.opacity = 1;
|
|
12
|
-
state.top = offsetTop;
|
|
13
|
-
state.width = offsetWidth;
|
|
14
|
-
}
|
|
15
|
-
}, state = reactive({
|
|
16
|
-
height: null,
|
|
17
|
-
hide: true,
|
|
18
|
-
left: 0,
|
|
19
|
-
opacity: 0,
|
|
20
|
-
top: 0,
|
|
21
|
-
width: 0
|
|
22
|
-
});
|
|
23
|
-
if (hide === true) {
|
|
24
|
-
events.onmouseout = () => {
|
|
25
|
-
active = false;
|
|
26
|
-
setTimeout(() => {
|
|
27
|
-
if (active === true) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
state.opacity = 0;
|
|
31
|
-
}, 50);
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
html: html `
|
|
36
|
-
<div
|
|
37
|
-
class='magnet'
|
|
38
|
-
style='${() => `
|
|
39
|
-
height: ${state.height ? `${state.height}px` : '100%'};
|
|
40
|
-
opacity: ${state.opacity};
|
|
41
|
-
transform: translate(${state.left}px, ${state.top}px);
|
|
42
|
-
width: ${state.width}px;
|
|
43
|
-
`}'
|
|
44
|
-
${attributes}
|
|
45
|
-
></div>
|
|
46
|
-
`,
|
|
47
|
-
sibling: {
|
|
48
|
-
attributes: events
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
@layer components {.magnet{--background:transparent;--border-radius:var(--border-radius-400);--timing-function:var(--timing-circ);background:var(--background);border-radius:var(--border-radius);opacity:0;height:0;transition:height var(--transition-duration)var(--timing-function),opacity var(--transition-duration)var(--timing-function),transform var(--transition-duration)var(--timing-function),width var(--transition-duration)var(--timing-function);z-index:-1;width:0;position:absolute;top:0;left:0}}
|
|
2
|
-
/*$vite$:1*/
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
-
import { html } from '@esportsplus/template';
|
|
3
|
-
import { omit, pick } from '@esportsplus/utilities';
|
|
4
|
-
import form from '~/components/form';
|
|
5
|
-
import description from './description';
|
|
6
|
-
import error from './error';
|
|
7
|
-
import title from './title';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type Data = {
|
|
11
|
-
accept?: string;
|
|
12
|
-
class?: string;
|
|
13
|
-
description?: Parameters<typeof description>[0]['description'];
|
|
14
|
-
mask?: {
|
|
15
|
-
content?: unknown;
|
|
16
|
-
} & Record<string, unknown>;
|
|
17
|
-
name?: string;
|
|
18
|
-
placeholder?: string;
|
|
19
|
-
required?: boolean;
|
|
20
|
-
style?: string;
|
|
21
|
-
tag?: Record<string, unknown>;
|
|
22
|
-
title?: Parameters<typeof title>[0]['title'];
|
|
23
|
-
value?: unknown;
|
|
24
|
-
} & Record<string, unknown>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const FIELD_OMIT: (keyof Data)[] = ['accept', 'mask', 'name', 'placeholder', 'value'];
|
|
28
|
-
|
|
29
|
-
const MASK_OMIT: (keyof NonNullable<Data['mask']>)[] = ['content'];
|
|
30
|
-
|
|
31
|
-
const TAG_PICK: (keyof Data)[] = ['accept', 'name', 'required', 'value'];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export default (data: Data) => {
|
|
35
|
-
let state = reactive({
|
|
36
|
-
active: false,
|
|
37
|
-
error: ''
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
data.mask ??= {};
|
|
41
|
-
|
|
42
|
-
data.tag ??= {};
|
|
43
|
-
data.tag.type = 'file';
|
|
44
|
-
data.tag.onrender = form.input.onrender(state);
|
|
45
|
-
|
|
46
|
-
return html`
|
|
47
|
-
<div
|
|
48
|
-
class='${() => state.active && '--active'} field --flex-column'
|
|
49
|
-
onfocusin='${() => {
|
|
50
|
-
state.active = true;
|
|
51
|
-
}}'
|
|
52
|
-
onfocusout='${() => {
|
|
53
|
-
state.active = false;
|
|
54
|
-
}}'
|
|
55
|
-
${omit(data, FIELD_OMIT)}
|
|
56
|
-
>
|
|
57
|
-
${title(data)}
|
|
58
|
-
|
|
59
|
-
<label
|
|
60
|
-
class='field-mask field-mask--input --flex-row'
|
|
61
|
-
style='cursor:pointer;'
|
|
62
|
-
${omit(data.mask, MASK_OMIT)}
|
|
63
|
-
>
|
|
64
|
-
<input
|
|
65
|
-
class='field-tag field-tag--hidden'
|
|
66
|
-
${pick(data, TAG_PICK)}
|
|
67
|
-
${data.tag}
|
|
68
|
-
>
|
|
69
|
-
|
|
70
|
-
${data.mask?.content || ''}
|
|
71
|
-
</label>
|
|
72
|
-
|
|
73
|
-
${description(data)}
|
|
74
|
-
${error(state)}
|
|
75
|
-
</div>
|
|
76
|
-
`;
|
|
77
|
-
};
|