@esportsplus/ui 0.7.16 → 0.8.2
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/.editorconfig +9 -9
- package/.gitattributes +2 -2
- package/build/components/clipboard/index.d.ts +1 -0
- package/build/components/clipboard/index.js +1 -0
- package/build/components/counter/index.js +16 -16
- package/build/components/ellipsis/index.js +6 -6
- package/build/components/footer/index.js +46 -46
- package/build/components/form/layout.js +10 -10
- package/build/components/link/hover.js +8 -8
- package/build/components/loader/index.js +15 -15
- package/build/components/loading/index.js +2 -2
- package/build/components/magnet/index.js +7 -7
- package/build/components/scrollbar/index.js +9 -9
- package/build/components/site/index.js +5 -5
- package/components/styles.css +1 -2
- package/components/variables.css +1 -3
- package/lib.scss +1 -1
- package/package.json +4 -1
- package/src/components/accordion/index.ts +34 -34
- package/src/components/accordion/scss/index.scss +16 -16
- package/src/components/accordion/scss/variables.scss +9 -9
- package/src/components/anchor/scss/index.scss +41 -41
- package/src/components/anchor/scss/variables.scss +4 -4
- package/src/components/banner/scss/index.scss +40 -40
- package/src/components/banner/scss/variables.scss +9 -9
- package/src/components/button/scss/index.scss +114 -114
- package/src/components/button/scss/variables.scss +66 -66
- package/src/components/card/scss/index.scss +35 -35
- package/src/components/card/scss/variables.scss +41 -41
- package/src/components/clipboard/index.ts +4 -3
- package/src/components/clipboard/scss/index.scss +3 -0
- package/src/components/clipboard/write.ts +8 -8
- package/src/components/container/scss/index.scss +8 -8
- package/src/components/container/scss/variables.scss +5 -5
- package/src/components/counter/index.ts +93 -93
- package/src/components/counter/scss/index.scss +61 -61
- package/src/components/counter/scss/variables.scss +26 -26
- package/src/components/ellipsis/index.ts +9 -9
- package/src/components/ellipsis/scss/index.scss +27 -27
- package/src/components/ellipsis/scss/variables.scss +4 -4
- package/src/components/footer/index.ts +78 -78
- package/src/components/footer/scss/index.scss +25 -25
- package/src/components/form/action.ts +80 -80
- package/src/components/form/index.ts +5 -5
- package/src/components/form/input.ts +14 -14
- package/src/components/form/layout.ts +25 -25
- package/src/components/form/types.ts +15 -15
- package/src/components/frame/scss/index.scss +11 -11
- package/src/components/grid/scss/index.scss +9 -9
- package/src/components/grid/scss/variables.scss +5 -5
- package/src/components/group/scss/index.scss +36 -36
- package/src/components/group/scss/variables.scss +17 -17
- package/src/components/highlight/index.ts +47 -47
- package/src/components/highlight/scss/index.scss +4 -4
- package/src/components/highlight/scss/variables.scss +3 -3
- package/src/components/icon/scss/index.scss +16 -16
- package/src/components/icon/scss/variables.scss +7 -7
- package/src/components/json/download.ts +14 -14
- package/src/components/json/index.ts +3 -3
- package/src/components/link/hover.ts +18 -18
- package/src/components/link/index.ts +3 -3
- package/src/components/link/scss/index.scss +65 -65
- package/src/components/link/scss/variables.scss +46 -46
- package/src/components/loader/index.ts +34 -34
- package/src/components/loader/scss/index.scss +68 -68
- package/src/components/loader/scss/variables.scss +5 -5
- package/src/components/loading/index.ts +7 -7
- package/src/components/loading/scss/index.scss +16 -16
- package/src/components/loading/scss/variables.scss +5 -5
- package/src/components/magnet/index.ts +54 -54
- package/src/components/magnet/scss/index.scss +16 -16
- package/src/components/magnet/scss/variables.scss +4 -4
- package/src/components/modal/scss/index.scss +34 -34
- package/src/components/modal/scss/variables.scss +6 -6
- package/src/components/number/index.ts +23 -23
- package/src/components/page/index.ts +14 -14
- package/src/components/page/scss/index.scss +31 -31
- package/src/components/page/scss/variables.scss +15 -15
- package/src/components/root/index.ts +4 -4
- package/src/components/root/onclick.ts +20 -20
- package/src/components/root/scss/index.scss +94 -94
- package/src/components/root/scss/variables.scss +100 -100
- package/src/components/row/scss/index.scss +7 -7
- package/src/components/scrollbar/index.ts +43 -43
- package/src/components/scrollbar/scss/index.scss +70 -70
- package/src/components/scrollbar/scss/variables.scss +6 -6
- package/src/components/sidebar/scss/index.scss +49 -49
- package/src/components/sidebar/scss/variables.scss +20 -20
- package/src/components/site/index.ts +26 -26
- package/src/components/site/scss/index.scss +3 -3
- package/src/components/text/scss/index.scss +9 -9
- package/src/components/text/scss/variables.scss +8 -8
- package/src/components/thumbnail/scss/index.scss +7 -7
- package/src/components/thumbnail/scss/variables.scss +7 -7
- package/src/components/tooltip/index.ts +84 -84
- package/src/components/tooltip/scss/_center.scss +13 -13
- package/src/components/tooltip/scss/_east.scss +34 -34
- package/src/components/tooltip/scss/_north.scss +34 -34
- package/src/components/tooltip/scss/_south.scss +35 -35
- package/src/components/tooltip/scss/_west.scss +34 -34
- package/src/components/tooltip/scss/index.scss +93 -93
- package/src/components/tooltip/scss/variables.scss +24 -24
- package/src/components/truncate/index.ts +13 -13
- package/src/components/typewriter/index.ts +53 -53
- package/src/components/typewriter/scss/index.scss +14 -14
- package/src/css-utilities/[margin,padding]/scss/index.scss +41 -41
- package/src/css-utilities/[margin,padding]/scss/variables.scss +54 -54
- package/src/css-utilities/absolute/scss/index.scss +36 -36
- package/src/css-utilities/background/scss/variables.scss +27 -27
- package/src/css-utilities/border/scss/index.scss +21 -21
- package/src/css-utilities/border/scss/variables.scss +66 -66
- package/src/css-utilities/color/scss/variables.scss +31 -31
- package/src/css-utilities/disabled/scss/index.scss +4 -4
- package/src/css-utilities/flex/scss/index.scss +65 -65
- package/src/css-utilities/glass/scss/index.scss +2 -2
- package/src/css-utilities/glass/scss/variables.scss +2 -2
- package/src/css-utilities/hidden/scss/index.scss +28 -28
- package/src/css-utilities/index.scss +14 -14
- package/src/css-utilities/inline/scss/index.scss +7 -7
- package/src/css-utilities/line-height/scss/variables.scss +10 -10
- package/src/css-utilities/not-allowed/scss/index.scss +7 -7
- package/src/css-utilities/overflow/scss/index.scss +4 -4
- package/src/css-utilities/pointer/scss/index.scss +5 -5
- package/src/css-utilities/size/scss/variables.scss +12 -12
- package/src/css-utilities/squircle/scss/index.scss +4 -4
- package/src/css-utilities/text/scss/index.scss +89 -89
- package/src/css-utilities/text/scss/variables.scss +31 -31
- package/src/css-utilities/viewport/scss/index.scss +4 -4
- package/src/css-utilities/width/scss/index.scss +3 -3
- package/src/css-utilities/width/scss/variables.scss +9 -9
- package/src/index.ts +18 -18
- package/src/lib/index.scss +7 -7
- package/src/lib/scss/breakpoint.scss +41 -41
- package/src/lib/scss/color.scss +1 -1
- package/src/lib/scss/css-variables.scss +16 -16
- package/src/lib/scss/list.scss +77 -77
- package/src/lib/scss/map.scss +1 -1
- package/src/lib/scss/position.scss +55 -55
- package/src/lib/scss/string.scss +34 -34
- package/src/tokens/index.scss +11 -11
- package/src/tokens/scss/border-radius.scss +12 -12
- package/src/tokens/scss/border-width.scss +6 -6
- package/src/tokens/scss/box-shadow.scss +39 -21
- package/src/tokens/scss/color.scss +64 -65
- package/src/tokens/scss/font-size.scss +16 -16
- package/src/tokens/scss/font-weight.scss +6 -6
- package/src/tokens/scss/line-height.scss +6 -6
- package/src/tokens/scss/size.scss +13 -13
- package/src/tokens/scss/spacer.scss +10 -8
- package/src/tokens/scss/state.scss +87 -87
- package/src/tokens/scss/transition-duration.scss +1 -1
- package/storage/fonts/montserrat/index.css +79 -79
- package/storage/psd/Color Palette.psd +0 -0
- package/tokens.scss +1 -1
- package/tsconfig.json +2 -2
- package/utilities/styles.css +1 -1
- package/utilities/variables.css +1 -1
- package/webpack.config.ts +25 -25
- package/.github/dependabot.yml +0 -23
- package/.github/workflows/bump.yml +0 -7
- package/.github/workflows/publish.yml +0 -14
- package/src/components/border/scss/index.scss +0 -10
- package/src/components/border/scss/variables.scss +0 -6
- package/src/components/bubble/scss/index.scss +0 -30
- package/src/components/bubble/scss/variables.scss +0 -19
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { html, svg } from '@esportsplus/template';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type Data = {
|
|
5
|
-
copyright: {
|
|
6
|
-
attributes?: Record<string, unknown>;
|
|
7
|
-
brand: string;
|
|
8
|
-
};
|
|
9
|
-
footer?: {
|
|
10
|
-
attributes: Record<string, unknown>;
|
|
11
|
-
};
|
|
12
|
-
nav?: {
|
|
13
|
-
attributes?: Record<string, unknown>;
|
|
14
|
-
links: { text: string, url: string }[];
|
|
15
|
-
};
|
|
16
|
-
social?: {
|
|
17
|
-
attributes?: Record<string, unknown>;
|
|
18
|
-
links: { icon: string, url: string }[]
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
function copy({ attributes, brand }: Data['copyright']) {
|
|
24
|
-
return html`
|
|
25
|
-
<div class='footer-copyright group-item --flex-center'>
|
|
26
|
-
<div class='text --padding-vertical --padding-300 --text-300' style='--color-default: var(--color-grey-500);' ${attributes}>
|
|
27
|
-
© ${`${new Date().getFullYear()} ${brand}, All rights reserved`}
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
`;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export default ({ copyright, footer, nav, social }: Data) => {
|
|
35
|
-
return html`
|
|
36
|
-
<footer class='footer' ${footer?.attributes}>
|
|
37
|
-
<div class='container'>
|
|
38
|
-
<div class='group group--offset-top --flex-center --margin-400'>
|
|
39
|
-
|
|
40
|
-
${nav
|
|
41
|
-
? nav.links.map(({ text, url }) => html`
|
|
42
|
-
<div class='group-item'>
|
|
43
|
-
<a
|
|
44
|
-
class='link --color-white --padding-vertical-300 --text-300'
|
|
45
|
-
href='${url}'
|
|
46
|
-
style='--color-default: var(--color-grey-500);'
|
|
47
|
-
${nav.attributes}
|
|
48
|
-
>
|
|
49
|
-
${text}
|
|
50
|
-
</a>
|
|
51
|
-
</div>
|
|
52
|
-
`)
|
|
53
|
-
: copy(copyright)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
<div class='footer-break'></div>
|
|
57
|
-
|
|
58
|
-
${social?.links && social.links.map(({ icon, url }) => html`
|
|
59
|
-
<div class='group-item'>
|
|
60
|
-
<a
|
|
61
|
-
class='link --color-white --padding-0px'
|
|
62
|
-
href='${url}'
|
|
63
|
-
style='--color-default: var(--color-grey-500);'
|
|
64
|
-
${social.attributes}
|
|
65
|
-
>
|
|
66
|
-
<div class='icon --size-500'>
|
|
67
|
-
${svg.sprite(icon)}
|
|
68
|
-
</div>
|
|
69
|
-
</a>
|
|
70
|
-
</div>
|
|
71
|
-
`)}
|
|
72
|
-
|
|
73
|
-
${nav && copy(copyright)}
|
|
74
|
-
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</footer>
|
|
78
|
-
`;
|
|
1
|
+
import { html, svg } from '@esportsplus/template';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
type Data = {
|
|
5
|
+
copyright: {
|
|
6
|
+
attributes?: Record<string, unknown>;
|
|
7
|
+
brand: string;
|
|
8
|
+
};
|
|
9
|
+
footer?: {
|
|
10
|
+
attributes: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
nav?: {
|
|
13
|
+
attributes?: Record<string, unknown>;
|
|
14
|
+
links: { text: string, url: string }[];
|
|
15
|
+
};
|
|
16
|
+
social?: {
|
|
17
|
+
attributes?: Record<string, unknown>;
|
|
18
|
+
links: { icon: string, url: string }[]
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
function copy({ attributes, brand }: Data['copyright']) {
|
|
24
|
+
return html`
|
|
25
|
+
<div class='footer-copyright group-item --flex-center'>
|
|
26
|
+
<div class='text --padding-vertical --padding-300 --text-300' style='--color-default: var(--color-grey-500);' ${attributes}>
|
|
27
|
+
© ${`${new Date().getFullYear()} ${brand}, All rights reserved`}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export default ({ copyright, footer, nav, social }: Data) => {
|
|
35
|
+
return html`
|
|
36
|
+
<footer class='footer' ${footer?.attributes}>
|
|
37
|
+
<div class='container'>
|
|
38
|
+
<div class='group group--offset-top --flex-center --margin-400'>
|
|
39
|
+
|
|
40
|
+
${nav
|
|
41
|
+
? nav.links.map(({ text, url }) => html`
|
|
42
|
+
<div class='group-item'>
|
|
43
|
+
<a
|
|
44
|
+
class='link --color-white --padding-vertical-300 --text-300'
|
|
45
|
+
href='${url}'
|
|
46
|
+
style='--color-default: var(--color-grey-500);'
|
|
47
|
+
${nav.attributes}
|
|
48
|
+
>
|
|
49
|
+
${text}
|
|
50
|
+
</a>
|
|
51
|
+
</div>
|
|
52
|
+
`)
|
|
53
|
+
: copy(copyright)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
<div class='footer-break'></div>
|
|
57
|
+
|
|
58
|
+
${social?.links && social.links.map(({ icon, url }) => html`
|
|
59
|
+
<div class='group-item'>
|
|
60
|
+
<a
|
|
61
|
+
class='link --color-white --padding-0px'
|
|
62
|
+
href='${url}'
|
|
63
|
+
style='--color-default: var(--color-grey-500);'
|
|
64
|
+
${social.attributes}
|
|
65
|
+
>
|
|
66
|
+
<div class='icon --size-500'>
|
|
67
|
+
${svg.sprite(icon)}
|
|
68
|
+
</div>
|
|
69
|
+
</a>
|
|
70
|
+
</div>
|
|
71
|
+
`)}
|
|
72
|
+
|
|
73
|
+
${nav && copy(copyright)}
|
|
74
|
+
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</footer>
|
|
78
|
+
`;
|
|
79
79
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
.footer {
|
|
2
|
-
&,
|
|
3
|
-
&-break {
|
|
4
|
-
width: 100%;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
&-copyright {
|
|
8
|
-
&:first-child {
|
|
9
|
-
@media (max-width: 640px) {
|
|
10
|
-
--width: 100%;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@media (min-width: 640px) {
|
|
14
|
-
margin-right: auto;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
+ .footer-break {
|
|
18
|
-
display: none;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&:last-child {
|
|
23
|
-
--width: 100%;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
.footer {
|
|
2
|
+
&,
|
|
3
|
+
&-break {
|
|
4
|
+
width: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
&-copyright {
|
|
8
|
+
&:first-child {
|
|
9
|
+
@media (max-width: 640px) {
|
|
10
|
+
--width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (min-width: 640px) {
|
|
14
|
+
margin-right: auto;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
+ .footer-break {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:last-child {
|
|
23
|
+
--width: 100%;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
26
|
}
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import response from '@esportsplus/action';
|
|
2
|
-
import { Action } from './types';
|
|
3
|
-
// import alert from '~/components/alert';
|
|
4
|
-
import input from './input';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function parse(input: ReturnType<FormData['entries']>) {
|
|
8
|
-
let data: Record<string, any> = {};
|
|
9
|
-
|
|
10
|
-
for (let [path, value] of input) {
|
|
11
|
-
let bucket = data,
|
|
12
|
-
segments = path.indexOf('.') !== -1 ? path.split('.') : [path];
|
|
13
|
-
|
|
14
|
-
for (let i = 0; i < segments.length - 1; i++) {
|
|
15
|
-
bucket = bucket[ segments[i] ] = bucket[ segments[i] ] || {};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let key = segments.at(-1)!;
|
|
19
|
-
|
|
20
|
-
if (path.endsWith('[]')) {
|
|
21
|
-
if (typeof value === 'string' && value.trim() === '') {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
bucket = bucket[ key.substring(0, key.length - 2) ] ??= [];
|
|
26
|
-
bucket.push(value);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
bucket[key] = value;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return data;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export default function(action: Action) {
|
|
38
|
-
return {
|
|
39
|
-
onclick: function(this: HTMLFormElement, event: Event) {
|
|
40
|
-
let trigger = event.target as HTMLButtonElement;
|
|
41
|
-
|
|
42
|
-
if (trigger?.type !== 'submit') {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// On initial page load both events will be dispatched without preventDefault
|
|
47
|
-
event.preventDefault();
|
|
48
|
-
|
|
49
|
-
this.dispatchEvent(
|
|
50
|
-
new SubmitEvent('submit', { cancelable: true, bubbles:true, submitter: trigger })
|
|
51
|
-
);
|
|
52
|
-
},
|
|
53
|
-
onsubmit: async function(this: HTMLFormElement, event: SubmitEvent) {
|
|
54
|
-
// TODO: Figure out button--processing
|
|
55
|
-
// - Could pass reactive value above and tie it to form layout handler
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
event?.submitter?.classList.add('button--processing');
|
|
58
|
-
|
|
59
|
-
let { errors } = await action({
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
alert: null,
|
|
62
|
-
input: parse( new FormData( this ).entries() ),
|
|
63
|
-
response
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
for (let i = 0, n = errors.length; i < n; i++) {
|
|
67
|
-
let { message, path } = errors[i],
|
|
68
|
-
state = input.get( this[path!] );
|
|
69
|
-
|
|
70
|
-
if (!state) {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
state.error = `${message[0].toUpperCase()}${message.substring(1)}`;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// TODO: replace with signal
|
|
78
|
-
event?.submitter?.classList.remove('button--processing');
|
|
79
|
-
}
|
|
80
|
-
};
|
|
1
|
+
import response from '@esportsplus/action';
|
|
2
|
+
import { Action } from './types';
|
|
3
|
+
// import alert from '~/components/alert';
|
|
4
|
+
import input from './input';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function parse(input: ReturnType<FormData['entries']>) {
|
|
8
|
+
let data: Record<string, any> = {};
|
|
9
|
+
|
|
10
|
+
for (let [path, value] of input) {
|
|
11
|
+
let bucket = data,
|
|
12
|
+
segments = path.indexOf('.') !== -1 ? path.split('.') : [path];
|
|
13
|
+
|
|
14
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
15
|
+
bucket = bucket[ segments[i] ] = bucket[ segments[i] ] || {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let key = segments.at(-1)!;
|
|
19
|
+
|
|
20
|
+
if (path.endsWith('[]')) {
|
|
21
|
+
if (typeof value === 'string' && value.trim() === '') {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
bucket = bucket[ key.substring(0, key.length - 2) ] ??= [];
|
|
26
|
+
bucket.push(value);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
bucket[key] = value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return data;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export default function(action: Action) {
|
|
38
|
+
return {
|
|
39
|
+
onclick: function(this: HTMLFormElement, event: Event) {
|
|
40
|
+
let trigger = event.target as HTMLButtonElement;
|
|
41
|
+
|
|
42
|
+
if (trigger?.type !== 'submit') {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// On initial page load both events will be dispatched without preventDefault
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
|
|
49
|
+
this.dispatchEvent(
|
|
50
|
+
new SubmitEvent('submit', { cancelable: true, bubbles:true, submitter: trigger })
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
onsubmit: async function(this: HTMLFormElement, event: SubmitEvent) {
|
|
54
|
+
// TODO: Figure out button--processing
|
|
55
|
+
// - Could pass reactive value above and tie it to form layout handler
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
event?.submitter?.classList.add('button--processing');
|
|
58
|
+
|
|
59
|
+
let { errors } = await action({
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
alert: null,
|
|
62
|
+
input: parse( new FormData( this ).entries() ),
|
|
63
|
+
response
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
for (let i = 0, n = errors.length; i < n; i++) {
|
|
67
|
+
let { message, path } = errors[i],
|
|
68
|
+
state = input.get( this[path!] );
|
|
69
|
+
|
|
70
|
+
if (!state) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
state.error = `${message[0].toUpperCase()}${message.substring(1)}`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// TODO: replace with signal
|
|
78
|
+
event?.submitter?.classList.remove('button--processing');
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
81
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import action from './action';
|
|
2
|
-
import input from './input';
|
|
3
|
-
import layout from './layout';
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import action from './action';
|
|
2
|
+
import input from './input';
|
|
3
|
+
import layout from './layout';
|
|
4
|
+
|
|
5
|
+
|
|
6
6
|
export default { action, input, layout };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
let cache = new WeakMap<HTMLInputElement | HTMLSelectElement, { error: string }>();
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const attributes = (reactive: { error: string }) => {
|
|
5
|
-
return (element: HTMLInputElement | HTMLSelectElement) => {
|
|
6
|
-
cache.set(element, reactive);
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const get = (element?: HTMLInputElement | HTMLSelectElement) => {
|
|
11
|
-
return element ? cache.get(element) : undefined;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
let cache = new WeakMap<HTMLInputElement | HTMLSelectElement, { error: string }>();
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const attributes = (reactive: { error: string }) => {
|
|
5
|
+
return (element: HTMLInputElement | HTMLSelectElement) => {
|
|
6
|
+
cache.set(element, reactive);
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const get = (element?: HTMLInputElement | HTMLSelectElement) => {
|
|
11
|
+
return element ? cache.get(element) : undefined;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
|
|
15
15
|
export default { attributes, get };
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { html } from '@esportsplus/template';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type Data = {
|
|
5
|
-
action?: any;
|
|
6
|
-
button?: {
|
|
7
|
-
class?: string;
|
|
8
|
-
content?: any;
|
|
9
|
-
style?: string;
|
|
10
|
-
};
|
|
11
|
-
class?: string;
|
|
12
|
-
content?: any;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export default (data: Data) => html`
|
|
17
|
-
<form class='${data?.class}' ${data?.action || ''}>
|
|
18
|
-
${data?.content || ''}
|
|
19
|
-
|
|
20
|
-
${data?.button?.content ? html`
|
|
21
|
-
<button class="button ${data?.button?.class || ''}" style='${data?.button?.style || ''}'>
|
|
22
|
-
${data?.button?.content || ''}
|
|
23
|
-
</button>
|
|
24
|
-
` : ''}
|
|
25
|
-
</form>
|
|
1
|
+
import { html } from '@esportsplus/template';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
type Data = {
|
|
5
|
+
action?: any;
|
|
6
|
+
button?: {
|
|
7
|
+
class?: string;
|
|
8
|
+
content?: any;
|
|
9
|
+
style?: string;
|
|
10
|
+
};
|
|
11
|
+
class?: string;
|
|
12
|
+
content?: any;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export default (data: Data) => html`
|
|
17
|
+
<form class='${data?.class}' ${data?.action || ''}>
|
|
18
|
+
${data?.content || ''}
|
|
19
|
+
|
|
20
|
+
${data?.button?.content ? html`
|
|
21
|
+
<button class="button ${data?.button?.class || ''}" style='${data?.button?.style || ''}'>
|
|
22
|
+
${data?.button?.content || ''}
|
|
23
|
+
</button>
|
|
24
|
+
` : ''}
|
|
25
|
+
</form>
|
|
26
26
|
`;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import response, { Response } from '@esportsplus/action';
|
|
2
|
-
// import alert from '~/components/alert';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Action = (data: Payload) => Promise<Errors> | Errors;
|
|
6
|
-
|
|
7
|
-
type Errors = { errors: Response<unknown>['errors'] };
|
|
8
|
-
|
|
9
|
-
type Payload = {
|
|
10
|
-
alert: typeof alert;
|
|
11
|
-
input: Record<string, any>;
|
|
12
|
-
response: typeof response;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import response, { Response } from '@esportsplus/action';
|
|
2
|
+
// import alert from '~/components/alert';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
type Action = (data: Payload) => Promise<Errors> | Errors;
|
|
6
|
+
|
|
7
|
+
type Errors = { errors: Response<unknown>['errors'] };
|
|
8
|
+
|
|
9
|
+
type Payload = {
|
|
10
|
+
alert: typeof alert;
|
|
11
|
+
input: Record<string, any>;
|
|
12
|
+
response: typeof response;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
|
|
16
16
|
export type { Action, Errors, Payload };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
.frame {
|
|
2
|
-
display: none;
|
|
3
|
-
flex-wrap: wrap;
|
|
4
|
-
justify-content: flex-start;
|
|
5
|
-
position: relative;
|
|
6
|
-
width: 100%;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
&.--active {
|
|
10
|
-
display: flex;
|
|
11
|
-
}
|
|
1
|
+
.frame {
|
|
2
|
+
display: none;
|
|
3
|
+
flex-wrap: wrap;
|
|
4
|
+
justify-content: flex-start;
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
&.--active {
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
12
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
.grid {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-gap: var(--margin-horizontal) var(--margin-vertical);
|
|
4
|
-
grid-template-columns: repeat(auto-fit, minmax(var(--min-width), var(--max-width)));
|
|
5
|
-
position: relative;
|
|
6
|
-
|
|
7
|
-
.grid-item {
|
|
8
|
-
width: 100%;
|
|
9
|
-
}
|
|
1
|
+
.grid {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-gap: var(--margin-horizontal) var(--margin-vertical);
|
|
4
|
+
grid-template-columns: repeat(auto-fit, minmax(var(--min-width), var(--max-width)));
|
|
5
|
+
position: relative;
|
|
6
|
+
|
|
7
|
+
.grid-item {
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
.grid {
|
|
2
|
-
--margin-horizontal: var(--size-400);
|
|
3
|
-
--margin-vertical: var(--size-400);
|
|
4
|
-
--max-width: 1fr;
|
|
5
|
-
--min-width: 200px;
|
|
1
|
+
.grid {
|
|
2
|
+
--margin-horizontal: var(--size-400);
|
|
3
|
+
--margin-vertical: var(--size-400);
|
|
4
|
+
--max-width: 1fr;
|
|
5
|
+
--min-width: 200px;
|
|
6
6
|
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
.group {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-wrap: wrap;
|
|
4
|
-
justify-content: flex-start;
|
|
5
|
-
margin: 0 calc(var(--margin-horizontal) / -2);
|
|
6
|
-
position: relative;
|
|
7
|
-
width: calc(100% + var(--margin-horizontal));
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
&--offset {
|
|
11
|
-
@each $direction in 'bottom' 'top' {
|
|
12
|
-
&-#{$direction} {
|
|
13
|
-
margin-#{$direction}: calc(var(--margin-vertical) * -1);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&--scroller {
|
|
19
|
-
flex-flow: row;
|
|
20
|
-
margin-bottom: calc(var(--scrollbar-width) * -1);
|
|
21
|
-
overflow-y: hidden;
|
|
22
|
-
padding-bottom: var(--scrollbar-width);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
&-item {
|
|
27
|
-
display: flex;
|
|
28
|
-
margin: var(--margin-vertical) calc(var(--margin-horizontal) / 2) 0;
|
|
29
|
-
position: relative;
|
|
30
|
-
width: var(--width);
|
|
31
|
-
|
|
32
|
-
&[class*='--width'] {
|
|
33
|
-
width: calc(var(--width) - var(--margin-horizontal));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
.group {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-wrap: wrap;
|
|
4
|
+
justify-content: flex-start;
|
|
5
|
+
margin: 0 calc(var(--margin-horizontal) / -2);
|
|
6
|
+
position: relative;
|
|
7
|
+
width: calc(100% + var(--margin-horizontal));
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
&--offset {
|
|
11
|
+
@each $direction in 'bottom' 'top' {
|
|
12
|
+
&-#{$direction} {
|
|
13
|
+
margin-#{$direction}: calc(var(--margin-vertical) * -1);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&--scroller {
|
|
19
|
+
flex-flow: row;
|
|
20
|
+
margin-bottom: calc(var(--scrollbar-width) * -1);
|
|
21
|
+
overflow-y: hidden;
|
|
22
|
+
padding-bottom: var(--scrollbar-width);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
&-item {
|
|
27
|
+
display: flex;
|
|
28
|
+
margin: var(--margin-vertical) calc(var(--margin-horizontal) / 2) 0;
|
|
29
|
+
position: relative;
|
|
30
|
+
width: var(--width);
|
|
31
|
+
|
|
32
|
+
&[class*='--width'] {
|
|
33
|
+
width: calc(var(--width) - var(--margin-horizontal));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
.group {
|
|
2
|
-
--margin-horizontal: var(--size-400);
|
|
3
|
-
--width: auto;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
&.--flex-column {
|
|
7
|
-
.group-item {
|
|
8
|
-
--width: 100%;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
&--scroller {
|
|
13
|
-
.group-item {
|
|
14
|
-
--margin-vertical: 0px;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
.group {
|
|
2
|
+
--margin-horizontal: var(--size-400);
|
|
3
|
+
--width: auto;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
&.--flex-column {
|
|
7
|
+
.group-item {
|
|
8
|
+
--width: 100%;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&--scroller {
|
|
13
|
+
.group-item {
|
|
14
|
+
--margin-vertical: 0px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|