@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,24 +1,23 @@
|
|
|
1
1
|
import { effect, reactive } from '@esportsplus/reactivity'
|
|
2
|
-
import { html } from '@esportsplus/template';
|
|
2
|
+
import { html, type Attributes } from '@esportsplus/template';
|
|
3
|
+
import { omit } from '@esportsplus/utilities';
|
|
3
4
|
import './scss/index.scss';
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
let formatters: Record<string, Intl.NumberFormat> = {};
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export default (data: Attributes & {
|
|
8
11
|
currency?: 'IGNORE' | 'EUR' | 'GBP' | 'USD';
|
|
9
12
|
decimals?: number;
|
|
10
13
|
delay?: number;
|
|
11
14
|
max?: number;
|
|
15
|
+
state?: { value: number },
|
|
12
16
|
suffix?: string;
|
|
13
17
|
value: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let formatters: Record<string, Intl.NumberFormat> = {};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export default ({ attributes, currency, decimals, delay, max, suffix, value }: Options) => {
|
|
21
|
-
let api = reactive({ value: -1 }),
|
|
18
|
+
}) => {
|
|
19
|
+
let { currency, decimals, delay, max, suffix, value } = data,
|
|
20
|
+
api = data.state || reactive({ value: -1 }),
|
|
22
21
|
formatter = currency === 'IGNORE'
|
|
23
22
|
? undefined
|
|
24
23
|
: formatters[currency || 'USD'] ??= new Intl.NumberFormat('en-US', {
|
|
@@ -76,43 +75,40 @@ export default ({ attributes, currency, decimals, delay, max, suffix, value }: O
|
|
|
76
75
|
}
|
|
77
76
|
});
|
|
78
77
|
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
let n = state.length;
|
|
84
|
-
|
|
85
|
-
if (n === 0) {
|
|
86
|
-
return '';
|
|
87
|
-
}
|
|
78
|
+
return html`
|
|
79
|
+
<div class='counter' ${omit(data, ['currency', 'decimals', 'delay', 'max', 'state', 'suffix'])}>
|
|
80
|
+
${() => {
|
|
81
|
+
let n = state.length;
|
|
88
82
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<span class='counter-character counter-character--symbol'>
|
|
93
|
-
${value}
|
|
94
|
-
</span>
|
|
95
|
-
`;
|
|
96
|
-
}
|
|
83
|
+
if (n === 0) {
|
|
84
|
+
return '';
|
|
85
|
+
}
|
|
97
86
|
|
|
87
|
+
return html.reactive(state.render, function (value, i) {
|
|
88
|
+
if (isNaN(parseInt(value as string, 10))) {
|
|
98
89
|
return html`
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
counter-character
|
|
103
|
-
'
|
|
104
|
-
>
|
|
105
|
-
<div class='counter-character-track' style='${() => `--value: ${this[i]}`}'>
|
|
106
|
-
<span>9</span>
|
|
107
|
-
${[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((value) => html`<span>${value}</span>`)}
|
|
108
|
-
<span>0</span>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
90
|
+
<span class='counter-character counter-character--symbol'>
|
|
91
|
+
${value}
|
|
92
|
+
</span>
|
|
111
93
|
`;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return html`
|
|
97
|
+
<div
|
|
98
|
+
class='
|
|
99
|
+
${i > n - 3 && 'counter-character--fraction'}
|
|
100
|
+
counter-character
|
|
101
|
+
'
|
|
102
|
+
>
|
|
103
|
+
<div class='counter-character-track' style='${() => `--value: ${this[i]}`}'>
|
|
104
|
+
<span>9</span>
|
|
105
|
+
${[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((value) => html`<span>${value}</span>`)}
|
|
106
|
+
<span>0</span>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
`;
|
|
110
|
+
})
|
|
111
|
+
}}
|
|
112
|
+
</div>
|
|
113
|
+
`;
|
|
118
114
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { html } from '@esportsplus/template';
|
|
1
|
+
import { html, Attributes } from '@esportsplus/template';
|
|
2
2
|
import './scss/index.scss';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
export default (attributes?:
|
|
6
|
-
<div class=
|
|
5
|
+
export default (attributes?: Attributes) => html`
|
|
6
|
+
<div class='ellipsis' ${attributes}>
|
|
7
7
|
<span></span>
|
|
8
8
|
<span></span>
|
|
9
9
|
<span></span>
|
|
@@ -1,71 +1,86 @@
|
|
|
1
1
|
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
-
import { html } from '@esportsplus/template';
|
|
3
|
-
import { omit } from '@esportsplus/utilities';
|
|
4
|
-
import
|
|
2
|
+
import { html, type Attributes, type Renderable } from '@esportsplus/template';
|
|
3
|
+
import { omit, pick } from '@esportsplus/utilities';
|
|
4
|
+
import template from '~/components/template';
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
description?: Parameters<typeof description>[0]['description'];
|
|
11
|
-
mask?: Record<string, unknown>;
|
|
7
|
+
type A = Attributes & {
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
12
10
|
name?: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
title: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
type?: string;
|
|
16
13
|
value?: unknown;
|
|
17
|
-
}
|
|
14
|
+
};
|
|
18
15
|
|
|
19
16
|
|
|
20
|
-
const
|
|
17
|
+
const TAG_KEYS = ['checked', 'disabled', 'name', 'required'];
|
|
21
18
|
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
let state = reactive({
|
|
25
|
-
active: false
|
|
26
|
-
});
|
|
27
|
-
|
|
20
|
+
function mask(attributes: A, modifier: string, state: { active: boolean }) {
|
|
28
21
|
return html`
|
|
29
22
|
<div
|
|
30
23
|
class='
|
|
31
|
-
${
|
|
32
|
-
field
|
|
33
|
-
--flex-column
|
|
24
|
+
${`field-mask--${modifier}`}
|
|
25
|
+
field-mask
|
|
34
26
|
'
|
|
35
|
-
|
|
36
|
-
if ((e.target as HTMLInputElement).type !== 'checkbox') {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
state.active = (e.target as HTMLInputElement)?.checked;
|
|
41
|
-
}}'
|
|
42
|
-
${omit(data, FIELD_OMIT)}
|
|
27
|
+
${omit(attributes, TAG_KEYS)}
|
|
43
28
|
>
|
|
44
|
-
<
|
|
45
|
-
${
|
|
29
|
+
<input
|
|
30
|
+
${attributes.checked || attributes.value || state.active && 'checked'}
|
|
31
|
+
class='field-mask-tag field-mask-tag--hidden'
|
|
32
|
+
type='${modifier === 'radio' ? 'radio' : 'checkbox'}'
|
|
33
|
+
value='${attributes.value || 1}'
|
|
34
|
+
${pick(attributes, TAG_KEYS)}
|
|
35
|
+
>
|
|
36
|
+
</div>
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
46
39
|
|
|
47
|
-
<label
|
|
48
|
-
class='
|
|
49
|
-
${data.mask?.class && String(data.mask.class).indexOf('field-mask--switch') !== -1 && 'field-mask--switch'}
|
|
50
|
-
field-mask
|
|
51
|
-
--margin-left --margin-400
|
|
52
|
-
'
|
|
53
|
-
${data.mask}
|
|
54
|
-
>
|
|
55
|
-
<input
|
|
56
|
-
${(data.class && data.class.indexOf('--active') !== -1) || data.value ? 'checked' : ''}
|
|
57
|
-
${data.name && `name='${data.name}'`}
|
|
58
|
-
class='field-tag field-tag--hidden'
|
|
59
|
-
type='checkbox'
|
|
60
|
-
value='1'
|
|
61
|
-
${data.tag}
|
|
62
|
-
>
|
|
63
|
-
</label>
|
|
64
|
-
</div>
|
|
65
40
|
|
|
66
|
-
|
|
41
|
+
const field = template.factory<
|
|
42
|
+
Attributes & { state?: { active: boolean } },
|
|
43
|
+
(mask: ((attributes: A) => Renderable)) => Renderable
|
|
44
|
+
>(
|
|
45
|
+
function(
|
|
46
|
+
this: ((attributes: A, state: { active: boolean }) => Renderable),
|
|
47
|
+
attributes,
|
|
48
|
+
content
|
|
49
|
+
) {
|
|
50
|
+
let state = attributes.state || reactive({
|
|
51
|
+
active: false
|
|
52
|
+
});
|
|
67
53
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
54
|
+
return html`
|
|
55
|
+
<label
|
|
56
|
+
class='
|
|
57
|
+
${() => state.active && '--active'}
|
|
58
|
+
field
|
|
59
|
+
'
|
|
60
|
+
onchange='${(e: Event) => {
|
|
61
|
+
if ((e.target as HTMLInputElement).type !== 'checkbox') {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
state.active = (e.target as HTMLInputElement)?.checked;
|
|
66
|
+
}}'
|
|
67
|
+
${omit(attributes, ['state'])}
|
|
68
|
+
>
|
|
69
|
+
${content((attributes: A) => this(attributes, state))}
|
|
70
|
+
</label>
|
|
71
|
+
`
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
export default {
|
|
77
|
+
checkbox: field.bind((attributes: A, state: { active: boolean }) => {
|
|
78
|
+
return mask(attributes, 'checkbox', state);
|
|
79
|
+
}),
|
|
80
|
+
radio: field.bind((attributes: A, state: { active: boolean }) => {
|
|
81
|
+
return mask(attributes, 'radio', state);
|
|
82
|
+
}),
|
|
83
|
+
switch: field.bind((attributes: A, state: { active: boolean }) => {
|
|
84
|
+
return mask(attributes, 'switch', state);
|
|
85
|
+
}),
|
|
71
86
|
};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { html } from '@esportsplus/template';
|
|
1
|
+
import { html, type Attributes } from '@esportsplus/template';
|
|
2
|
+
import template from '~/components/template';
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
export default (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return html`
|
|
10
|
-
<div class='field-description' ${data.description.attributes}>
|
|
11
|
-
${data.description.content}
|
|
5
|
+
export default template.factory<Attributes>(
|
|
6
|
+
(attributes, content) => html`
|
|
7
|
+
<div class='field-description' ${attributes}>
|
|
8
|
+
${content}
|
|
12
9
|
</div>
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
`
|
|
11
|
+
);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { html } from '@esportsplus/template';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
export default (
|
|
4
|
+
export default (state: { error: unknown }) => {
|
|
5
5
|
return () => {
|
|
6
|
-
if (!
|
|
6
|
+
if (!state.error) {
|
|
7
7
|
return '';
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
return html`
|
|
11
11
|
<div class='field-error --text-bold'>
|
|
12
|
-
${
|
|
12
|
+
${state.error}
|
|
13
13
|
</div>
|
|
14
14
|
`;
|
|
15
15
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import checkbox from './checkbox';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import description from './description';
|
|
3
|
+
import input from './input';
|
|
4
4
|
import select from './select';
|
|
5
|
-
import
|
|
6
|
-
import textarea from './textarea';
|
|
7
|
-
import text from './text';
|
|
5
|
+
import title from './title';
|
|
8
6
|
import './scss/index.scss';
|
|
9
7
|
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
const { checkbox: cb, radio, switch: sw } = checkbox;
|
|
10
|
+
|
|
11
|
+
const { file, text, textarea } = input;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export default { checkbox: cb, description, file, radio, select, switch: sw, textarea, text, title };
|
|
15
|
+
export { cb as checkbox, description, file, radio, select, sw as switch, textarea, text, title };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html, type Attributes, type Renderable } from '@esportsplus/template';
|
|
3
|
+
import { omit, pick } from '@esportsplus/utilities';
|
|
4
|
+
import form from '~/components/form';
|
|
5
|
+
import template from '~/components/template';
|
|
6
|
+
import error from './error';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const FILE_TAG_KEYS = ['accept', 'disabled', 'name', 'required', 'value'];
|
|
10
|
+
|
|
11
|
+
const TEXT_TAG_KEYS = [
|
|
12
|
+
'autocapitalize',
|
|
13
|
+
'autocomplete',
|
|
14
|
+
'autocorrect',
|
|
15
|
+
'autofocus',
|
|
16
|
+
'disabled',
|
|
17
|
+
'maxlength',
|
|
18
|
+
'minlength',
|
|
19
|
+
'name',
|
|
20
|
+
'placeholder',
|
|
21
|
+
'readonly',
|
|
22
|
+
'required',
|
|
23
|
+
'spellcheck',
|
|
24
|
+
'type',
|
|
25
|
+
'value',
|
|
26
|
+
'wrap'
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const field = template.factory<
|
|
31
|
+
Attributes & { state?: { active: boolean, error: string } },
|
|
32
|
+
(mask: typeof file | typeof text | typeof textarea) => Renderable
|
|
33
|
+
>(
|
|
34
|
+
function(
|
|
35
|
+
this: typeof text | typeof textarea,
|
|
36
|
+
attributes,
|
|
37
|
+
content
|
|
38
|
+
) {
|
|
39
|
+
let state = attributes.state || reactive({
|
|
40
|
+
active: false,
|
|
41
|
+
error: ''
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return html`
|
|
45
|
+
<div
|
|
46
|
+
class='
|
|
47
|
+
${() => state.active && '--active'}
|
|
48
|
+
field
|
|
49
|
+
'
|
|
50
|
+
onfocusin='${() => {
|
|
51
|
+
state.active = true;
|
|
52
|
+
}}'
|
|
53
|
+
onfocusout='${() => {
|
|
54
|
+
state.active = false;
|
|
55
|
+
}}'
|
|
56
|
+
${omit(attributes, ['state'])}
|
|
57
|
+
>
|
|
58
|
+
${content(
|
|
59
|
+
((...args: any[]) => (this.call as any)(state, ...args))
|
|
60
|
+
)}
|
|
61
|
+
${error(state)}
|
|
62
|
+
</div>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const file = template.factory<Attributes>(
|
|
68
|
+
function(this: { active: boolean, error: string }, attributes, content) {
|
|
69
|
+
return html`
|
|
70
|
+
<label
|
|
71
|
+
class='field-mask field-mask--file'
|
|
72
|
+
${omit(attributes, FILE_TAG_KEYS)}
|
|
73
|
+
>
|
|
74
|
+
<input
|
|
75
|
+
class='field-mask-tag field-mask-tag--hidden'
|
|
76
|
+
onrender='${form.input.onrender(this)}'
|
|
77
|
+
type='file'
|
|
78
|
+
${pick(attributes, FILE_TAG_KEYS)}
|
|
79
|
+
>
|
|
80
|
+
|
|
81
|
+
${content}
|
|
82
|
+
</label>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const text = template.factory<Attributes>(
|
|
88
|
+
function(this: { active: boolean, error: string }, attributes, content) {
|
|
89
|
+
return html`
|
|
90
|
+
<label class='field-mask field-mask--input' ${omit(attributes, TEXT_TAG_KEYS)}>
|
|
91
|
+
<input
|
|
92
|
+
class='field-mask-tag'
|
|
93
|
+
onrender='${form.input.onrender(this)}'
|
|
94
|
+
type='${attributes.type || 'text'}'
|
|
95
|
+
${pick(attributes, TEXT_TAG_KEYS)}
|
|
96
|
+
>
|
|
97
|
+
${content}
|
|
98
|
+
</label>
|
|
99
|
+
`;
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const textarea = template.factory<Attributes>(
|
|
104
|
+
function(this: { active: boolean, error: string }, attributes, content) {
|
|
105
|
+
return html`
|
|
106
|
+
<label class='field-mask field-mask--textarea' ${omit(attributes, TEXT_TAG_KEYS)}>
|
|
107
|
+
<textarea
|
|
108
|
+
class='field-mask-tag'
|
|
109
|
+
onrender='${form.input.onrender(this)}'
|
|
110
|
+
${pick(attributes, TEXT_TAG_KEYS)}
|
|
111
|
+
>
|
|
112
|
+
${attributes.value}
|
|
113
|
+
</textarea>
|
|
114
|
+
${content}
|
|
115
|
+
</label>
|
|
116
|
+
`;
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
export default {
|
|
122
|
+
file: field.bind(file),
|
|
123
|
+
text: field.bind(text),
|
|
124
|
+
textarea: field.bind(textarea)
|
|
125
|
+
};
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
@mixin css() {
|
|
5
5
|
&-mask {
|
|
6
|
-
|
|
7
6
|
&--checkbox,
|
|
8
7
|
&--radio,
|
|
9
8
|
&--switch {
|
|
@@ -38,7 +37,7 @@
|
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
// Hide HTML Field Element
|
|
41
|
-
.field-tag {
|
|
40
|
+
.field-mask-tag {
|
|
42
41
|
@include lib.position(absolute, 0 null null 0);
|
|
43
42
|
height: 0px;
|
|
44
43
|
opacity: 0;
|
|
@@ -83,7 +82,6 @@
|
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
@mixin variables() {
|
|
86
|
-
|
|
87
85
|
label#{&},
|
|
88
86
|
#{tokens.state(inactive, '.field:not(label)')} &-mask {
|
|
89
87
|
@include tokens.state(hover) {
|
|
@@ -106,7 +104,6 @@
|
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
&-mask {
|
|
109
|
-
|
|
110
107
|
&--checkbox,
|
|
111
108
|
&--radio,
|
|
112
109
|
&--switch {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
@use '/lib';
|
|
2
2
|
@use '/tokens';
|
|
3
3
|
@use 'check' as check;
|
|
4
|
-
@use 'normalize'
|
|
4
|
+
@use 'normalize';
|
|
5
5
|
@use 'text' as text;
|
|
6
|
-
@use '
|
|
7
|
-
|
|
8
|
-
@include normalize();
|
|
6
|
+
@use 'variables';
|
|
9
7
|
|
|
10
8
|
.field {
|
|
11
9
|
display: flex;
|
|
10
|
+
flex-flow: column;
|
|
12
11
|
gap: var(--margin-vertical) var(--margin-horizontal);
|
|
13
12
|
position: relative;
|
|
14
13
|
transition:
|
|
@@ -29,25 +28,6 @@
|
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
|
|
32
|
-
&--optional {
|
|
33
|
-
max-height: var(--max-height);
|
|
34
|
-
opacity: 0;
|
|
35
|
-
pointer-events: none;
|
|
36
|
-
transition:
|
|
37
|
-
background var(--transition-duration) ease-in-out,
|
|
38
|
-
border-color var(--transition-duration) ease-in-out,
|
|
39
|
-
box-shadow var(--transition-duration) ease-in-out,
|
|
40
|
-
color var(--transition-duration) ease-in-out,
|
|
41
|
-
max-height var(--transition-duration) ease-in-out,
|
|
42
|
-
opacity var(--transition-duration) ease-in-out;
|
|
43
|
-
|
|
44
|
-
#{tokens.state(active, '.field')} & {
|
|
45
|
-
opacity: 1;
|
|
46
|
-
pointer-events: auto;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
31
|
&-description,
|
|
52
32
|
&-error,
|
|
53
33
|
&-title {
|
|
@@ -94,7 +74,6 @@
|
|
|
94
74
|
}
|
|
95
75
|
|
|
96
76
|
&-mask {
|
|
97
|
-
|
|
98
77
|
// Pseudo Element Box Shadow
|
|
99
78
|
&::after {
|
|
100
79
|
@include lib.position(absolute, full);
|
|
@@ -129,6 +108,18 @@
|
|
|
129
108
|
z-index: 1;
|
|
130
109
|
}
|
|
131
110
|
}
|
|
111
|
+
|
|
112
|
+
&-tag {
|
|
113
|
+
&--hidden {
|
|
114
|
+
@include lib.position(absolute, 0 null null 0);
|
|
115
|
+
appearance: none;
|
|
116
|
+
height: 0px;
|
|
117
|
+
opacity: 0;
|
|
118
|
+
pointer-events: none;
|
|
119
|
+
width: 0px;
|
|
120
|
+
z-index: -1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
132
123
|
}
|
|
133
124
|
|
|
134
125
|
&-required {
|
|
@@ -138,18 +129,6 @@
|
|
|
138
129
|
width: var(--size);
|
|
139
130
|
}
|
|
140
131
|
|
|
141
|
-
&-tag {
|
|
142
|
-
&--hidden {
|
|
143
|
-
@include lib.position(absolute, 0 null null 0);
|
|
144
|
-
appearance: none;
|
|
145
|
-
height: 0px;
|
|
146
|
-
opacity: 0;
|
|
147
|
-
pointer-events: none;
|
|
148
|
-
width: 0px;
|
|
149
|
-
z-index: -1;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
132
|
&-title {
|
|
154
133
|
font-weight: var(--font-weight);
|
|
155
134
|
z-index: 1;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
button,
|
|
2
|
+
input,
|
|
3
|
+
select,
|
|
4
|
+
textarea {
|
|
5
|
+
background: transparent;
|
|
6
|
+
border-radius: 0;
|
|
7
|
+
border: 0;
|
|
8
|
+
font-family: inherit;
|
|
9
|
+
font-size: inherit;
|
|
10
|
+
line-height: inherit;
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
|
|
14
|
+
&,
|
|
15
|
+
&:active,
|
|
16
|
+
&:focus,
|
|
17
|
+
&:hover {
|
|
18
|
+
outline: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:invalid {
|
|
22
|
+
box-shadow: none;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
form {
|
|
27
|
+
margin: 0;
|
|
28
|
+
padding: 0;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
label {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|