@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
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
@mixin css() {
|
|
4
4
|
&-mask {
|
|
5
|
+
&--file,
|
|
5
6
|
&--input,
|
|
6
|
-
&--select
|
|
7
|
+
&--select,
|
|
8
|
+
&--textarea {
|
|
7
9
|
align-items: center;
|
|
8
10
|
background: var(--background);
|
|
9
11
|
border: var(--border-width) var(--border-style) var(--border-color);
|
|
@@ -21,26 +23,27 @@
|
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
&,
|
|
24
|
-
.field-tag {
|
|
26
|
+
.field-mask-tag {
|
|
25
27
|
color: var(--color);
|
|
26
28
|
}
|
|
27
|
-
}
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
// Truncate Overflowing Text
|
|
31
|
+
&.field-text {
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
text-overflow: ellipsis;
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
}
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
&--
|
|
38
|
+
&--file,
|
|
39
|
+
&--input,
|
|
40
|
+
&--textarea {
|
|
38
41
|
cursor: text;
|
|
39
42
|
// Necessary To Maintain Height Of Hidden Password Fields In Floating Modals
|
|
40
43
|
// - Password Managers Cause Problems When Fields Are Not Using 'display:hidden' On Password Fields
|
|
41
44
|
min-height: calc((var(--padding-vertical) * 2) + var(--size));
|
|
42
45
|
|
|
43
|
-
.field-tag {
|
|
46
|
+
.field-mask-tag {
|
|
44
47
|
flex: 1 1 auto;
|
|
45
48
|
padding: var(--padding-vertical) var(--padding-horizontal);
|
|
46
49
|
min-width: 0;
|
|
@@ -50,11 +53,15 @@
|
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
textarea.field-tag {
|
|
56
|
+
textarea.field-mask-tag {
|
|
54
57
|
white-space: normal;
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
|
|
61
|
+
&--file {
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
}
|
|
64
|
+
|
|
58
65
|
&--select {
|
|
59
66
|
cursor: pointer;
|
|
60
67
|
padding: var(--padding-vertical) calc((var(--padding-horizontal) / 1.5) + var(--arrow-size)) var(--padding-vertical) var(--padding-horizontal);
|
|
@@ -75,22 +82,29 @@
|
|
|
75
82
|
transform: translateY(50%) rotate(45deg);
|
|
76
83
|
width: var(--arrow-size);
|
|
77
84
|
}
|
|
78
|
-
}
|
|
79
85
|
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
&-text {
|
|
87
|
+
padding-right: var(--padding-horizontal);
|
|
88
|
+
pointer-events: none;
|
|
89
|
+
}
|
|
82
90
|
}
|
|
83
91
|
}
|
|
84
92
|
|
|
85
93
|
@mixin variables() {
|
|
86
94
|
&-mask {
|
|
95
|
+
&--file,
|
|
87
96
|
&--input,
|
|
88
|
-
&--select
|
|
97
|
+
&--select,
|
|
98
|
+
&--textarea {
|
|
89
99
|
--font-size: var(--font-size-400);
|
|
90
100
|
--line-height: var(--line-height-400);
|
|
101
|
+
--padding-horizontal: var(--padding-horizontal-400);
|
|
102
|
+
--padding-vertical: var(--padding-vertical-400);
|
|
91
103
|
}
|
|
92
104
|
|
|
93
|
-
&--
|
|
105
|
+
&--file,
|
|
106
|
+
&--input,
|
|
107
|
+
&--textarea {
|
|
94
108
|
--size: var(--size-400);
|
|
95
109
|
}
|
|
96
110
|
|
|
@@ -8,16 +8,6 @@
|
|
|
8
8
|
--width: 100%;
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
&--optional {
|
|
12
|
-
--max-height: 0;
|
|
13
|
-
--max-height-active: 0;
|
|
14
|
-
|
|
15
|
-
#{tokens.state(active, '.field')} & {
|
|
16
|
-
--max-height: var(--max-height-active);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
11
|
&-description,
|
|
22
12
|
&-error {
|
|
23
13
|
--font-size: var(--font-size-300);
|
|
@@ -1,175 +1,187 @@
|
|
|
1
1
|
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
-
import { html } from '@esportsplus/template';
|
|
3
|
-
import {
|
|
2
|
+
import { html, type Attributes, type Renderable } from '@esportsplus/template';
|
|
3
|
+
import { isObject, omit, pick, toArray } from '@esportsplus/utilities';
|
|
4
4
|
import form from '~/components/form';
|
|
5
5
|
import root from '~/components/root';
|
|
6
6
|
import scrollbar from '~/components/scrollbar';
|
|
7
|
-
import
|
|
7
|
+
import template from '~/components/template';
|
|
8
8
|
import error from './error';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
description?: Parameters<typeof description>[0]['description'];
|
|
16
|
-
effect?: (selected: number | string) => void;
|
|
17
|
-
mask?: Record<string, unknown>;
|
|
18
|
-
name?: string;
|
|
19
|
-
options: T;
|
|
20
|
-
option?: Record<string, unknown>;
|
|
21
|
-
required?: boolean;
|
|
22
|
-
selected: T[keyof T];
|
|
23
|
-
scrollbar?: Record<string, unknown>;
|
|
24
|
-
style?: string;
|
|
25
|
-
tag?: Record<string, unknown>;
|
|
26
|
-
text?: Record<string, unknown>;
|
|
27
|
-
title?: Parameters<typeof title>[0]['title'];
|
|
28
|
-
tooltip?: {
|
|
29
|
-
content?: Record<string, unknown>;
|
|
30
|
-
} & Record<string, unknown>;
|
|
31
|
-
} & Parameters<typeof scrollbar>[0] & Record<string, unknown>;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const FIELD_OMIT: (keyof Data<any>)[] = [
|
|
35
|
-
'content',
|
|
36
|
-
'description',
|
|
37
|
-
'effect',
|
|
38
|
-
'mask',
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const TAG_KEYS = [
|
|
12
|
+
'autocomplete',
|
|
13
|
+
'autofocus',
|
|
14
|
+
'disabled',
|
|
39
15
|
'name',
|
|
40
|
-
'options', 'option',
|
|
41
16
|
'required',
|
|
42
|
-
'
|
|
43
|
-
'tag', 'text', 'title', 'tooltip'
|
|
17
|
+
'type'
|
|
44
18
|
];
|
|
45
19
|
|
|
46
20
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
options[key] = false;
|
|
21
|
+
const select = template.factory<
|
|
22
|
+
Attributes & Parameters<typeof scrollbar>[0] & {
|
|
23
|
+
text?: Attributes;
|
|
24
|
+
'tooltip-content'?: Attributes & { direction?: string };
|
|
52
25
|
}
|
|
26
|
+
>(
|
|
27
|
+
function(
|
|
28
|
+
this: {
|
|
29
|
+
options: Record<number | string, Attributes & { content: unknown }>;
|
|
30
|
+
option?: Attributes;
|
|
31
|
+
state: {
|
|
32
|
+
active: boolean;
|
|
33
|
+
error: string;
|
|
34
|
+
render: boolean;
|
|
35
|
+
selected: string | number;
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
data,
|
|
39
|
+
content
|
|
40
|
+
) {
|
|
41
|
+
let { option, options, state } = this;
|
|
42
|
+
|
|
43
|
+
return html`
|
|
44
|
+
<label
|
|
45
|
+
class='field-mask field-mask--select'
|
|
46
|
+
onclick='${() => {
|
|
47
|
+
state.active = !state.active;
|
|
48
|
+
state.render = true;
|
|
49
|
+
|
|
50
|
+
if (state.active) {
|
|
51
|
+
root.onclick.push(() => state.active = false);
|
|
52
|
+
}
|
|
53
|
+
}}'
|
|
54
|
+
${omit(data, TAG_KEYS)}
|
|
55
|
+
>
|
|
56
|
+
<input
|
|
57
|
+
class='field-mask-tag field-mask-tag--hidden'
|
|
58
|
+
name='${data.name}'
|
|
59
|
+
onclick='${() => { /* Prevent double click events from firing */ }}'
|
|
60
|
+
onrender='${form.input.onrender(state)}'
|
|
61
|
+
value='${() => state.selected}'
|
|
62
|
+
${pick(data, TAG_KEYS)}
|
|
63
|
+
>
|
|
53
64
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function template<T extends Record<number | string, number | string>>(data: Data<T>, state: { active: boolean, options: Record<number | string, boolean>, selected: number | string }) {
|
|
63
|
-
data.scrollbar ??= {};
|
|
64
|
-
data.scrollbar.style ??= '--background-default: var(--color-black-400);';
|
|
65
|
-
data.tooltip ??= {};
|
|
65
|
+
${content || html`
|
|
66
|
+
<div class='field-mask-text' ${data.text}>
|
|
67
|
+
${() => options[ state.selected ] || '-'}
|
|
68
|
+
</div>
|
|
69
|
+
`}
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
<div class='field-mask-arrow'></div>
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
${() => {
|
|
74
|
+
if (!state.render) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let attributes = {
|
|
79
|
+
...data['tooltip-content'],
|
|
80
|
+
scrollbar: { ...data['scrollbar'] },
|
|
81
|
+
'scrollbar-container-content': { ...data['scrollbar-container-content'] }
|
|
82
|
+
},
|
|
83
|
+
keys = Object.keys(options),
|
|
84
|
+
selected = reactive(
|
|
85
|
+
Object.fromEntries( keys.map(key => [key, false]) )
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
attributes.class = toArray(attributes.class);
|
|
89
|
+
attributes.class.push(`tooltip-content tooltip-content--${attributes.direction || 's'} --flex-column --width-full`);
|
|
90
|
+
|
|
91
|
+
attributes.onclick = (e: Event) => {
|
|
92
|
+
let key = (e?.target as HTMLElement)?.dataset?.key;
|
|
93
|
+
|
|
94
|
+
if (key === undefined) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let previous = state.selected;
|
|
99
|
+
|
|
100
|
+
state.selected = key;
|
|
101
|
+
state.active = false;
|
|
102
|
+
|
|
103
|
+
selected[key] = true;
|
|
104
|
+
selected[previous] = false;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return scrollbar(attributes, keys.map((key) => html`
|
|
108
|
+
<div
|
|
109
|
+
class='
|
|
110
|
+
${() => selected[key] && '--active'}
|
|
111
|
+
link
|
|
112
|
+
'
|
|
113
|
+
data-key='${key}'
|
|
114
|
+
${omit(options[key], ['content'])}
|
|
115
|
+
${option}
|
|
116
|
+
>
|
|
117
|
+
<span class='--text-truncate'>
|
|
118
|
+
${options[key]}
|
|
119
|
+
</span>
|
|
120
|
+
</div>
|
|
121
|
+
`));
|
|
122
|
+
}}
|
|
123
|
+
</label>
|
|
124
|
+
`;
|
|
74
125
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<div
|
|
101
|
-
class='
|
|
102
|
-
${() => state.options[key] && '--active'}
|
|
103
|
-
link
|
|
104
|
-
--flex-vertical
|
|
105
|
-
'
|
|
106
|
-
data-key='${key}'
|
|
107
|
-
${data.option}
|
|
108
|
-
>
|
|
109
|
-
<span class='--text-truncate'>
|
|
110
|
-
${data.options[key]}
|
|
111
|
-
</span>
|
|
112
|
-
</div>
|
|
113
|
-
`)}
|
|
114
|
-
</div>
|
|
115
|
-
`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
export default <T extends Record<number | string, number | string>>(data: Data<T>) => {
|
|
120
|
-
let state = reactive(
|
|
121
|
-
Object.assign({
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
export default template.factory<
|
|
130
|
+
Attributes & {
|
|
131
|
+
options: Record<number | string, number | string | Attributes & { content: unknown }>;
|
|
132
|
+
option?: Attributes;
|
|
133
|
+
} & (
|
|
134
|
+
{
|
|
135
|
+
selected?: number | string;
|
|
136
|
+
state?: never;
|
|
137
|
+
} |
|
|
138
|
+
{
|
|
139
|
+
state: {
|
|
140
|
+
active: boolean;
|
|
141
|
+
error: string;
|
|
142
|
+
selected?: number | string;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
(mask: typeof select) => Renderable
|
|
147
|
+
>(
|
|
148
|
+
(data, content) => {
|
|
149
|
+
let options = data.options,
|
|
150
|
+
state = data.state || reactive({
|
|
122
151
|
active: false,
|
|
123
152
|
error: '',
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
parse(Object.keys( data.options || {} ), data.selected))
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
data.mask ??= {};
|
|
130
|
-
data.mask.onclick = () => {
|
|
131
|
-
state.render = true;
|
|
132
|
-
state.active = !state.active;
|
|
133
|
-
|
|
134
|
-
if (state.active) {
|
|
135
|
-
root.onclick.push(() => state.active = false);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
data.tag ??= {};
|
|
140
|
-
data.tag.name = data.name;
|
|
141
|
-
data.tag.onclick = () => { /* Prevent double click events from firing */ };
|
|
142
|
-
data.tag.onrender = form.input.onrender(state);
|
|
143
|
-
data.tag.value = () => state.selected;
|
|
144
|
-
|
|
145
|
-
return html`
|
|
146
|
-
<div class='
|
|
147
|
-
${() => state.active ? '--active' : ''}
|
|
148
|
-
field
|
|
149
|
-
tooltip
|
|
150
|
-
--flex-column
|
|
151
|
-
'
|
|
152
|
-
${omit(data, FIELD_OMIT)}
|
|
153
|
-
>
|
|
154
|
-
${title(data)}
|
|
155
|
-
|
|
156
|
-
<label
|
|
157
|
-
class='field-mask field-mask--select --flex-row --padding-400'
|
|
158
|
-
${data.mask}
|
|
159
|
-
>
|
|
160
|
-
<input class='field-tag field-tag--hidden' ${data.tag}>
|
|
153
|
+
selected: data.selected || Object.keys(options)[0]
|
|
154
|
+
});
|
|
161
155
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
156
|
+
for (let key in options) {
|
|
157
|
+
if (isObject(options[key])) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
165
160
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
${() => state.render && template(data, state)}
|
|
169
|
-
</label>
|
|
161
|
+
options[key] = { content: options[key] };
|
|
162
|
+
}
|
|
170
163
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
164
|
+
return html`
|
|
165
|
+
<div
|
|
166
|
+
class='
|
|
167
|
+
${() => state.active && '--active'}
|
|
168
|
+
field
|
|
169
|
+
tooltip
|
|
170
|
+
'
|
|
171
|
+
${omit(data, ['options', 'state'])}
|
|
172
|
+
>
|
|
173
|
+
${content(
|
|
174
|
+
(...args: any[]) => (select.call as any)(
|
|
175
|
+
{
|
|
176
|
+
option: data.option,
|
|
177
|
+
options: data.options,
|
|
178
|
+
state
|
|
179
|
+
},
|
|
180
|
+
...args
|
|
181
|
+
)
|
|
182
|
+
)}
|
|
183
|
+
${error(state)}
|
|
184
|
+
</div>
|
|
185
|
+
`;
|
|
186
|
+
}
|
|
187
|
+
);
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { html } from '@esportsplus/template';
|
|
1
|
+
import { html, Attributes } from '@esportsplus/template';
|
|
2
|
+
import { omit } from '@esportsplus/utilities';
|
|
2
3
|
import tooltip from '~/components/tooltip';
|
|
4
|
+
import template from '~/components/template';
|
|
3
5
|
|
|
4
6
|
|
|
5
|
-
export default
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
export default template.factory<Attributes & { required?: boolean }>(
|
|
8
|
+
(attributes, content) => html`
|
|
9
|
+
<div class='field-title --flex-horizontal-space-between --flex-vertical' ${omit(attributes, ['required'])}>
|
|
10
|
+
${content}
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
<div class='field-title --flex-horizontal-space-between --flex-vertical' ${data.title.attributes}>
|
|
12
|
-
${data.title.content}
|
|
13
|
-
|
|
14
|
-
${data?.required && tooltip.onhover({ class: 'bubble --background-primary --margin-left' }, html`
|
|
12
|
+
${attributes.required && tooltip.onhover({ class: 'bubble --background-primary --margin-left' }, html`
|
|
15
13
|
<span class='tooltip-message tooltip-message--w'>Required</span>
|
|
16
14
|
`)}
|
|
17
15
|
</div>
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
`
|
|
17
|
+
);
|
|
@@ -1,35 +1,25 @@
|
|
|
1
|
-
import { html, svg } from '@esportsplus/template';
|
|
1
|
+
import { html, Attributes, svg } from '@esportsplus/template';
|
|
2
2
|
import './scss/index.scss';
|
|
3
|
+
import { omit } from '@esportsplus/utilities';
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
type Data = {
|
|
6
|
-
copyright: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
footer?: {
|
|
11
|
-
attributes: Record<string, unknown>;
|
|
12
|
-
};
|
|
13
|
-
nav?: {
|
|
14
|
-
attributes?: Record<string, unknown>;
|
|
15
|
-
links: { text: string, url: string }[];
|
|
16
|
-
};
|
|
17
|
-
social?: {
|
|
18
|
-
attributes?: Record<string, unknown>;
|
|
19
|
-
links: { icon: string, url: string }[]
|
|
20
|
-
};
|
|
7
|
+
copyright: Attributes & { brand: string };
|
|
8
|
+
footer?: Attributes;
|
|
9
|
+
nav?: Attributes & { links: { text: string, url: string }[] };
|
|
10
|
+
social?: Attributes & { links: { icon: string, url: string }[] };
|
|
21
11
|
};
|
|
22
12
|
|
|
23
13
|
|
|
24
|
-
function copy(
|
|
14
|
+
function copy(data: Data['copyright']) {
|
|
25
15
|
return html`
|
|
26
16
|
<div class='footer-copyright group-item --flex-center'>
|
|
27
17
|
<div
|
|
28
18
|
class='text --padding-vertical --padding-300 --text-300'
|
|
29
19
|
style='--color-default: var(--color-grey-500);'
|
|
30
|
-
${
|
|
20
|
+
${omit(data, ['brand'])}
|
|
31
21
|
>
|
|
32
|
-
© ${`${new Date().getFullYear()} ${brand}, All rights reserved`}
|
|
22
|
+
© ${`${new Date().getFullYear()} ${data.brand}, All rights reserved`}
|
|
33
23
|
</div>
|
|
34
24
|
</div>
|
|
35
25
|
`;
|
|
@@ -38,7 +28,7 @@ function copy({ attributes, brand }: Data['copyright']) {
|
|
|
38
28
|
|
|
39
29
|
export default ({ copyright, footer, nav, social }: Data) => {
|
|
40
30
|
return html`
|
|
41
|
-
<footer class='footer' ${footer
|
|
31
|
+
<footer class='footer' ${footer}>
|
|
42
32
|
<div class='container'>
|
|
43
33
|
<div class='group group--offset-top --flex-center --margin-400'>
|
|
44
34
|
|
|
@@ -49,7 +39,7 @@ export default ({ copyright, footer, nav, social }: Data) => {
|
|
|
49
39
|
class='link --color-white --padding-vertical-300 --text-300'
|
|
50
40
|
href='${url}'
|
|
51
41
|
style='--color-default: var(--color-grey-500);'
|
|
52
|
-
${nav
|
|
42
|
+
${omit(nav, ['links'])}
|
|
53
43
|
>
|
|
54
44
|
${text}
|
|
55
45
|
</a>
|
|
@@ -66,7 +56,7 @@ export default ({ copyright, footer, nav, social }: Data) => {
|
|
|
66
56
|
class='link --color-white --padding-0px'
|
|
67
57
|
href='${url}'
|
|
68
58
|
style='--color-default: var(--color-grey-500);'
|
|
69
|
-
${social
|
|
59
|
+
${omit(social, ['links'])}
|
|
70
60
|
>
|
|
71
61
|
<div class='icon --size-500'>
|
|
72
62
|
${svg.sprite(icon)}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
import { Element } from '@esportsplus/template';
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
let key = Symbol();
|
|
2
5
|
|
|
3
6
|
|
|
4
|
-
const get = (element?:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
const get = (element?: Element): { error: string } | undefined => {
|
|
8
|
+
if (element) {
|
|
9
|
+
return element[key] as { error: string } | undefined;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return undefined;
|
|
7
13
|
};
|
|
8
14
|
|
|
9
15
|
const onrender = (reactive: { error: string }) => {
|
|
10
|
-
return (element:
|
|
11
|
-
// @ts-ignore
|
|
16
|
+
return (element: Element) => {
|
|
12
17
|
element[key] = reactive;
|
|
13
18
|
};
|
|
14
19
|
};
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import { toArray } from '@esportsplus/utilities';
|
|
2
|
+
import scrollbar from '~/components/scrollbar';
|
|
3
|
+
import template from '~/components/template';
|
|
4
|
+
import './scss/index.scss';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export default template.factory<Parameters<typeof scrollbar>[0]>(
|
|
8
|
+
(attributes, content) => {
|
|
9
|
+
attributes.class = toArray(attributes.class);
|
|
10
|
+
attributes.class.push('frame');
|
|
11
|
+
|
|
12
|
+
return scrollbar(attributes, content);
|
|
13
|
+
}
|
|
14
|
+
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { reactive } from '@esportsplus/reactivity'
|
|
2
|
+
import { Element } from '@esportsplus/template';
|
|
2
3
|
import './scss/index.scss';
|
|
3
4
|
|
|
4
5
|
|
|
@@ -39,7 +40,7 @@ export default (background: string) => {
|
|
|
39
40
|
return {
|
|
40
41
|
attributes: {
|
|
41
42
|
class: 'highlight',
|
|
42
|
-
onrender: function(element:
|
|
43
|
+
onrender: function(element: Element) {
|
|
43
44
|
element[key] = state;
|
|
44
45
|
observer!.observe(element);
|
|
45
46
|
},
|