@esportsplus/ui 0.1.8 → 0.2.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/.github/dependabot.yml +23 -0
- package/.github/workflows/bump.yml +7 -0
- package/.github/workflows/publish.yml +14 -0
- package/build/components/alert/index.d.ts +1 -1
- package/build/components/alert/index.js +34 -36
- package/build/components/export/clipboard.js +1 -3
- package/build/components/export/index.js +3 -8
- package/build/components/export/json.js +1 -3
- package/build/components/field/checkbox.d.ts +1 -1
- package/build/components/field/checkbox.js +32 -37
- package/build/components/field/description.d.ts +1 -1
- package/build/components/field/description.js +4 -6
- package/build/components/field/error.d.ts +1 -1
- package/build/components/field/error.js +4 -6
- package/build/components/field/file.d.ts +1 -1
- package/build/components/field/file.js +36 -41
- package/build/components/field/index.d.ts +8 -8
- package/build/components/field/index.js +8 -13
- package/build/components/field/optional.d.ts +2 -2
- package/build/components/field/optional.js +8 -13
- package/build/components/field/select.d.ts +1 -1
- package/build/components/field/select.js +65 -70
- package/build/components/field/switch.d.ts +1 -1
- package/build/components/field/switch.js +3 -8
- package/build/components/field/text.d.ts +1 -1
- package/build/components/field/text.js +37 -42
- package/build/components/field/textarea.d.ts +1 -1
- package/build/components/field/textarea.js +3 -8
- package/build/components/field/title.d.ts +1 -1
- package/build/components/field/title.js +14 -19
- package/build/components/form/action.js +7 -13
- package/build/components/form/index.d.ts +1 -1
- package/build/components/form/index.js +4 -9
- package/build/components/form/input.js +1 -3
- package/build/components/form/layout.d.ts +1 -1
- package/build/components/form/layout.js +11 -13
- package/build/components/form/types.d.ts +1 -1
- package/build/components/form/types.js +1 -2
- package/build/components/number/index.js +2 -6
- package/build/components/page/index.js +2 -7
- package/build/components/root/index.js +3 -9
- package/build/components/root/onclick.js +1 -3
- package/build/components/scrollbar/index.d.ts +3 -3
- package/build/components/scrollbar/index.js +13 -15
- package/build/components/site/index.d.ts +1 -1
- package/build/components/site/index.js +10 -15
- package/build/components/tooltip/index.d.ts +5 -5
- package/build/components/tooltip/index.js +8 -13
- package/build/components/tooltip/menu.d.ts +1 -1
- package/build/components/tooltip/menu.js +34 -36
- package/build/index.js +11 -27
- package/lib.scss +1 -1
- package/package.json +25 -25
- package/src/components/accordion/scss/index.scss +16 -16
- package/src/components/accordion/scss/variables.scss +4 -4
- package/src/components/alert/index.ts +156 -156
- package/src/components/alert/scss/index.scss +54 -54
- package/src/components/alert/scss/variables.scss +8 -8
- package/src/components/anchor/scss/index.scss +41 -41
- package/src/components/anchor/scss/variables.scss +5 -5
- package/src/components/banner/scss/index.scss +40 -40
- package/src/components/banner/scss/variables.scss +5 -5
- package/src/components/border/scss/index.scss +10 -10
- package/src/components/border/scss/variables.scss +6 -6
- package/src/components/bubble/scss/index.scss +30 -30
- package/src/components/bubble/scss/variables.scss +19 -19
- package/src/components/button/scss/index.scss +92 -92
- package/src/components/button/scss/variables.scss +69 -69
- package/src/components/card/scss/index.scss +35 -35
- package/src/components/card/scss/variables.scss +42 -42
- package/src/components/container/scss/index.scss +10 -10
- package/src/components/container/scss/variables.scss +5 -5
- package/src/components/ellipsis/scss/index.scss +71 -71
- package/src/components/ellipsis/scss/variables.scss +2 -2
- package/src/components/export/clipboard.ts +11 -11
- package/src/components/export/index.ts +4 -4
- package/src/components/export/json.ts +14 -14
- package/src/components/field/checkbox.ts +60 -60
- package/src/components/field/description.ts +11 -11
- package/src/components/field/error.ts +13 -13
- package/src/components/field/file.ts +64 -64
- package/src/components/field/index.ts +9 -9
- package/src/components/field/optional.ts +26 -26
- package/src/components/field/scss/_check.scss +225 -225
- package/src/components/field/scss/_normalize.scss +36 -36
- package/src/components/field/scss/_text.scss +106 -106
- package/src/components/field/scss/index.scss +158 -158
- package/src/components/field/scss/variables.scss +138 -138
- package/src/components/field/select.ts +150 -150
- package/src/components/field/switch.ts +8 -8
- package/src/components/field/text.ts +68 -68
- package/src/components/field/textarea.ts +7 -7
- package/src/components/field/title.ts +22 -22
- package/src/components/form/action.ts +67 -67
- 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/group/scss/index.scss +36 -36
- package/src/components/group/scss/variables.scss +17 -17
- package/src/components/icon/scss/index.scss +17 -17
- package/src/components/icon/scss/variables.scss +7 -7
- package/src/components/link/scss/index.scss +28 -28
- package/src/components/link/scss/variables.scss +47 -47
- package/src/components/loading/scss/index.scss +24 -24
- package/src/components/loading/scss/variables.scss +31 -31
- package/src/components/modal/scss/index.scss +31 -31
- package/src/components/modal/scss/variables.scss +10 -10
- package/src/components/number/index.ts +23 -23
- package/src/components/page/index.ts +14 -14
- package/src/components/page/scss/index.scss +27 -27
- package/src/components/page/scss/variables.scss +27 -27
- package/src/components/processing/scss/index.scss +46 -46
- package/src/components/processing/scss/variables.scss +11 -11
- package/src/components/root/index.ts +4 -4
- package/src/components/root/onclick.ts +20 -20
- package/src/components/root/scss/index.scss +93 -93
- package/src/components/root/scss/variables.scss +55 -55
- package/src/components/row/scss/index.scss +7 -7
- package/src/components/scrollbar/index.ts +43 -43
- package/src/components/scrollbar/scss/index.scss +59 -59
- package/src/components/scrollbar/scss/variables.scss +6 -6
- package/src/components/sidebar/scss/index.scss +50 -50
- package/src/components/sidebar/scss/variables.scss +21 -21
- package/src/components/site/index.ts +26 -26
- package/src/components/site/scss/index.scss +3 -3
- package/src/components/text/scss/index.scss +12 -12
- package/src/components/text/scss/variables.scss +9 -9
- package/src/components/thumbnail/scss/index.scss +7 -7
- package/src/components/thumbnail/scss/variables.scss +7 -7
- package/src/components/tooltip/index.ts +93 -93
- package/src/components/tooltip/menu.ts +70 -70
- 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 +25 -25
- 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 +59 -59
- 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/slide/scss/index.scss +21 -21
- package/src/css-utilities/slide/scss/variables.scss +10 -10
- package/src/css-utilities/text/scss/index.scss +93 -93
- package/src/css-utilities/text/scss/variables.scss +31 -31
- package/src/css-utilities/transition/scss/variables.scss +14 -14
- 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 +11 -11
- 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 +13 -13
- package/src/lib/scss/list.scss +76 -76
- package/src/lib/scss/map.scss +1 -1
- package/src/lib/scss/position.scss +77 -77
- package/src/lib/scss/string.scss +33 -33
- 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 +13 -13
- package/src/tokens/scss/color.scss +64 -64
- package/src/tokens/scss/font-size.scss +12 -12
- 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 +8 -8
- package/src/tokens/scss/state.scss +86 -86
- package/src/tokens/scss/transition-duration.scss +5 -5
- package/storage/fonts/montserrat/index.css +79 -79
- package/tokens.scss +1 -1
- package/tsconfig.json +10 -10
- package/utilities/styles.css +1 -1
- package/utilities/variables.css +1 -1
- package/webpack.config.ts +25 -25
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
-
import { html } from '@esportsplus/template';
|
|
3
|
-
import form from '~/components/form';
|
|
4
|
-
import description from './description';
|
|
5
|
-
import error from './error';
|
|
6
|
-
import title from './title';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type Data = {
|
|
10
|
-
class?: string;
|
|
11
|
-
mask?: {
|
|
12
|
-
class?: string;
|
|
13
|
-
content?: any;
|
|
14
|
-
style?: string;
|
|
15
|
-
};
|
|
16
|
-
name?: string;
|
|
17
|
-
placeholder?: string;
|
|
18
|
-
style?: string;
|
|
19
|
-
tag?: {
|
|
20
|
-
class?: string;
|
|
21
|
-
};
|
|
22
|
-
textarea?: boolean;
|
|
23
|
-
type?: string;
|
|
24
|
-
value?: unknown;
|
|
25
|
-
} & Parameters<typeof description>[0] & Parameters<typeof title>[0];
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export default (data: Data) => {
|
|
29
|
-
let state = reactive({
|
|
30
|
-
active: false,
|
|
31
|
-
error: ''
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return html`
|
|
35
|
-
<div
|
|
36
|
-
class="field ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column"
|
|
37
|
-
onfocusin='${() => {
|
|
38
|
-
state.active = true;
|
|
39
|
-
}}'
|
|
40
|
-
onfocusout='${() => {
|
|
41
|
-
state.active = false;
|
|
42
|
-
}}'
|
|
43
|
-
style='${data?.style || ''}'
|
|
44
|
-
>
|
|
45
|
-
${title(data)}
|
|
46
|
-
|
|
47
|
-
<label
|
|
48
|
-
class='field-mask field-mask--input --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) ? '--margin-top' : ''} --margin-300'
|
|
49
|
-
style='${data?.mask?.style || ''}'
|
|
50
|
-
>
|
|
51
|
-
<${data?.textarea ? 'textarea' : 'input'}
|
|
52
|
-
class='field-tag --padding-400 ${data?.tag?.class || ''}'
|
|
53
|
-
name='${data?.name || ''}'
|
|
54
|
-
placeholder='${data?.placeholder || ''}'
|
|
55
|
-
onrender='${form.input.attributes(state)}'
|
|
56
|
-
type='${data?.type || 'string'}'
|
|
57
|
-
${!data?.textarea && data?.value !== undefined ? html`value='${data.value}'` : ''}
|
|
58
|
-
>
|
|
59
|
-
${data?.textarea ? html`${data?.value || ''}</textarea>` : ''}
|
|
60
|
-
|
|
61
|
-
${data?.mask?.content || ''}
|
|
62
|
-
</label>
|
|
63
|
-
|
|
64
|
-
${description(data)}
|
|
65
|
-
${error(state)}
|
|
66
|
-
</div>
|
|
67
|
-
`;
|
|
68
|
-
};
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html } from '@esportsplus/template';
|
|
3
|
+
import form from '~/components/form';
|
|
4
|
+
import description from './description';
|
|
5
|
+
import error from './error';
|
|
6
|
+
import title from './title';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
type Data = {
|
|
10
|
+
class?: string;
|
|
11
|
+
mask?: {
|
|
12
|
+
class?: string;
|
|
13
|
+
content?: any;
|
|
14
|
+
style?: string;
|
|
15
|
+
};
|
|
16
|
+
name?: string;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
style?: string;
|
|
19
|
+
tag?: {
|
|
20
|
+
class?: string;
|
|
21
|
+
};
|
|
22
|
+
textarea?: boolean;
|
|
23
|
+
type?: string;
|
|
24
|
+
value?: unknown;
|
|
25
|
+
} & Parameters<typeof description>[0] & Parameters<typeof title>[0];
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export default (data: Data) => {
|
|
29
|
+
let state = reactive({
|
|
30
|
+
active: false,
|
|
31
|
+
error: ''
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return html`
|
|
35
|
+
<div
|
|
36
|
+
class="field ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column"
|
|
37
|
+
onfocusin='${() => {
|
|
38
|
+
state.active = true;
|
|
39
|
+
}}'
|
|
40
|
+
onfocusout='${() => {
|
|
41
|
+
state.active = false;
|
|
42
|
+
}}'
|
|
43
|
+
style='${data?.style || ''}'
|
|
44
|
+
>
|
|
45
|
+
${title(data)}
|
|
46
|
+
|
|
47
|
+
<label
|
|
48
|
+
class='field-mask field-mask--input --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) ? '--margin-top' : ''} --margin-300'
|
|
49
|
+
style='${data?.mask?.style || ''}'
|
|
50
|
+
>
|
|
51
|
+
<${data?.textarea ? 'textarea' : 'input'}
|
|
52
|
+
class='field-tag --padding-400 ${data?.tag?.class || ''}'
|
|
53
|
+
name='${data?.name || ''}'
|
|
54
|
+
placeholder='${data?.placeholder || ''}'
|
|
55
|
+
onrender='${form.input.attributes(state)}'
|
|
56
|
+
type='${data?.type || 'string'}'
|
|
57
|
+
${!data?.textarea && data?.value !== undefined ? html`value='${data.value}'` : ''}
|
|
58
|
+
>
|
|
59
|
+
${data?.textarea ? html`${data?.value || ''}</textarea>` : ''}
|
|
60
|
+
|
|
61
|
+
${data?.mask?.content || ''}
|
|
62
|
+
</label>
|
|
63
|
+
|
|
64
|
+
${description(data)}
|
|
65
|
+
${error(state)}
|
|
66
|
+
</div>
|
|
67
|
+
`;
|
|
68
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import text from './text';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default (data: Parameters<typeof text>[0]) => {
|
|
5
|
-
data.textarea = true;
|
|
6
|
-
|
|
7
|
-
return text(data);
|
|
1
|
+
import text from './text';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export default (data: Parameters<typeof text>[0]) => {
|
|
5
|
+
data.textarea = true;
|
|
6
|
+
|
|
7
|
+
return text(data);
|
|
8
8
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { html } from '@esportsplus/template';
|
|
2
|
-
import tooltip from '~/components/tooltip';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default (data: { required?: boolean, title?: string }) => {
|
|
6
|
-
if (!data?.title) {
|
|
7
|
-
return '';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
let { attributes } = tooltip.onhover();
|
|
11
|
-
|
|
12
|
-
return html`
|
|
13
|
-
<div class="field-title --flex-horizontal-space-between --flex-vertical">
|
|
14
|
-
${data.title}
|
|
15
|
-
|
|
16
|
-
${data?.required && html`
|
|
17
|
-
<div class="bubble --background-primary --margin-left" ${attributes}>
|
|
18
|
-
<span class="tooltip-message tooltip-message--w">Required</span>
|
|
19
|
-
</div>
|
|
20
|
-
`}
|
|
21
|
-
</div>
|
|
22
|
-
`;
|
|
1
|
+
import { html } from '@esportsplus/template';
|
|
2
|
+
import tooltip from '~/components/tooltip';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default (data: { required?: boolean, title?: string }) => {
|
|
6
|
+
if (!data?.title) {
|
|
7
|
+
return '';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { attributes } = tooltip.onhover();
|
|
11
|
+
|
|
12
|
+
return html`
|
|
13
|
+
<div class="field-title --flex-horizontal-space-between --flex-vertical">
|
|
14
|
+
${data.title}
|
|
15
|
+
|
|
16
|
+
${data?.required && html`
|
|
17
|
+
<div class="bubble --background-primary --margin-left" ${attributes}>
|
|
18
|
+
<span class="tooltip-message tooltip-message--w">Required</span>
|
|
19
|
+
</div>
|
|
20
|
+
`}
|
|
21
|
+
</div>
|
|
22
|
+
`;
|
|
23
23
|
}
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Action } from './types';
|
|
3
|
-
import alert from '~/components/alert';
|
|
4
|
-
import input from './input';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function parse(input: Record<string, any>) {
|
|
8
|
-
let data: Record<string, any> = {};
|
|
9
|
-
|
|
10
|
-
for (let path in input) {
|
|
11
|
-
let bucket = data,
|
|
12
|
-
keys = path.indexOf('.') !== -1 ? path.split('.') : [path];
|
|
13
|
-
|
|
14
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
15
|
-
bucket = bucket[keys[i]] = bucket[keys[i]] || {};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
bucket[ keys[keys.length - 1] ] = input[path];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return data;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export default function(action: Action) {
|
|
26
|
-
return {
|
|
27
|
-
onclick: function(this: HTMLFormElement, event: Event) {
|
|
28
|
-
let trigger = event.target as HTMLButtonElement;
|
|
29
|
-
|
|
30
|
-
if (trigger?.type !== 'submit') {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// On initial page load both events will be dispatched without preventDefault
|
|
35
|
-
event.preventDefault();
|
|
36
|
-
|
|
37
|
-
this.dispatchEvent(
|
|
38
|
-
new SubmitEvent('submit', { cancelable: true, bubbles:true, submitter: trigger })
|
|
39
|
-
);
|
|
40
|
-
},
|
|
41
|
-
onsubmit: async function(this: HTMLFormElement, event: SubmitEvent) {
|
|
42
|
-
// TODO: Figure out processing
|
|
43
|
-
// - Could pass reactive value above and tie it to form layout handler
|
|
44
|
-
event.preventDefault();
|
|
45
|
-
event?.submitter?.classList.add('button--processing');
|
|
46
|
-
|
|
47
|
-
let { errors } = await action({
|
|
48
|
-
alert,
|
|
49
|
-
input: parse( Object.fromEntries( new FormData( this )?.entries() ) ),
|
|
50
|
-
response
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
for (let i = 0, n = errors.length; i < n; i++) {
|
|
54
|
-
let { message, path } = errors[i],
|
|
55
|
-
state = input.get( this[path] );
|
|
56
|
-
|
|
57
|
-
if (!state) {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
state.error = `${message[0].toUpperCase()}${message.substring(1)}`;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// TODO: replace with signal
|
|
65
|
-
event?.submitter?.classList.remove('button--processing');
|
|
66
|
-
}
|
|
67
|
-
};
|
|
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: Record<string, any>) {
|
|
8
|
+
let data: Record<string, any> = {};
|
|
9
|
+
|
|
10
|
+
for (let path in input) {
|
|
11
|
+
let bucket = data,
|
|
12
|
+
keys = path.indexOf('.') !== -1 ? path.split('.') : [path];
|
|
13
|
+
|
|
14
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
15
|
+
bucket = bucket[keys[i]] = bucket[keys[i]] || {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
bucket[ keys[keys.length - 1] ] = input[path];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return data;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export default function(action: Action) {
|
|
26
|
+
return {
|
|
27
|
+
onclick: function(this: HTMLFormElement, event: Event) {
|
|
28
|
+
let trigger = event.target as HTMLButtonElement;
|
|
29
|
+
|
|
30
|
+
if (trigger?.type !== 'submit') {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// On initial page load both events will be dispatched without preventDefault
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
|
|
37
|
+
this.dispatchEvent(
|
|
38
|
+
new SubmitEvent('submit', { cancelable: true, bubbles:true, submitter: trigger })
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
onsubmit: async function(this: HTMLFormElement, event: SubmitEvent) {
|
|
42
|
+
// TODO: Figure out processing
|
|
43
|
+
// - Could pass reactive value above and tie it to form layout handler
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
event?.submitter?.classList.add('button--processing');
|
|
46
|
+
|
|
47
|
+
let { errors } = await action({
|
|
48
|
+
alert,
|
|
49
|
+
input: parse( Object.fromEntries( new FormData( this )?.entries() ) ),
|
|
50
|
+
response
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
for (let i = 0, n = errors.length; i < n; i++) {
|
|
54
|
+
let { message, path } = errors[i],
|
|
55
|
+
state = input.get( this[path!] );
|
|
56
|
+
|
|
57
|
+
if (!state) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
state.error = `${message[0].toUpperCase()}${message.substring(1)}`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// TODO: replace with signal
|
|
65
|
+
event?.submitter?.classList.remove('button--processing');
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
68
|
};
|
|
@@ -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
|
|
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 { Action, Errors, Payload };
|
|
@@ -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
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
.icon {
|
|
2
|
-
color: var(--color);
|
|
3
|
-
display: flex;
|
|
4
|
-
flex: 0 0 var(--width);
|
|
5
|
-
height: var(--height);
|
|
6
|
-
pointer-events: none;
|
|
7
|
-
position: relative;
|
|
8
|
-
width: var(--width);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
svg {
|
|
12
|
-
color: currentColor;
|
|
13
|
-
fill: currentColor;
|
|
14
|
-
height: 100%;
|
|
15
|
-
width: 100%;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
.icon {
|
|
2
|
+
color: var(--color);
|
|
3
|
+
display: flex;
|
|
4
|
+
flex: 0 0 var(--width);
|
|
5
|
+
height: var(--height);
|
|
6
|
+
pointer-events: none;
|
|
7
|
+
position: relative;
|
|
8
|
+
width: var(--width);
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
svg {
|
|
12
|
+
color: currentColor;
|
|
13
|
+
fill: currentColor;
|
|
14
|
+
height: 100%;
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
.icon {
|
|
2
|
-
--color: inherit;
|
|
3
|
-
--height: var(--size);
|
|
4
|
-
--margin-horizontal: var(--size-300);
|
|
5
|
-
--size: var(--size-400);
|
|
6
|
-
--width: var(--size);
|
|
7
|
-
}
|
|
1
|
+
.icon {
|
|
2
|
+
--color: inherit;
|
|
3
|
+
--height: var(--size);
|
|
4
|
+
--margin-horizontal: var(--size-300);
|
|
5
|
+
--size: var(--size-400);
|
|
6
|
+
--width: var(--size);
|
|
7
|
+
}
|