@esportsplus/ui 0.0.23 → 0.0.24
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/field/checkbox.d.ts +21 -0
- package/build/components/field/checkbox.js +41 -0
- package/build/components/field/index.d.ts +136 -3
- package/build/components/field/index.js +4 -2
- package/build/components/field/optional.d.ts +97 -0
- package/build/components/field/optional.js +20 -0
- package/build/components/field/switch.d.ts +7 -0
- package/build/components/field/switch.js +6 -0
- package/package.json +1 -1
- package/src/components/field/checkbox.ts +61 -0
- package/src/components/field/index.ts +4 -2
- package/src/components/field/optional.ts +25 -0
- package/src/components/field/switch.ts +9 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import description from './description';
|
|
2
|
+
type Data = {
|
|
3
|
+
class?: string;
|
|
4
|
+
field?: {
|
|
5
|
+
content?: any;
|
|
6
|
+
};
|
|
7
|
+
mask?: {
|
|
8
|
+
class?: string;
|
|
9
|
+
style?: string;
|
|
10
|
+
};
|
|
11
|
+
name?: string;
|
|
12
|
+
style?: string;
|
|
13
|
+
title: string;
|
|
14
|
+
value?: any;
|
|
15
|
+
} & Parameters<typeof description>[0];
|
|
16
|
+
declare const _default: (data: Data) => {
|
|
17
|
+
content: string;
|
|
18
|
+
type: string;
|
|
19
|
+
values: never[];
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html } from '@esportsplus/template';
|
|
3
|
+
import description from './description';
|
|
4
|
+
export default (data) => {
|
|
5
|
+
let state = reactive({
|
|
6
|
+
active: false
|
|
7
|
+
});
|
|
8
|
+
return html `
|
|
9
|
+
<div
|
|
10
|
+
class="field --flex-column ${data?.class || ''} ${() => state.active ? '--active' : ''}"
|
|
11
|
+
onchange='${(e) => {
|
|
12
|
+
if (e.target.type !== 'checkbox') {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
state.active = e.target?.checked;
|
|
16
|
+
}}'
|
|
17
|
+
style='${data?.style || ''}'
|
|
18
|
+
>
|
|
19
|
+
<div class="field-title --flex-horizontal-space-between --flex-vertical">
|
|
20
|
+
${data.title}
|
|
21
|
+
|
|
22
|
+
<label
|
|
23
|
+
class="field-mask ${(data?.mask?.class || '').indexOf('field-mask--switch') === -1 ? 'field-mask--checkbox' : ''} --margin-left --margin-400 ${data?.mask?.class || ''}"
|
|
24
|
+
style='${data?.mask?.style || ''}'
|
|
25
|
+
>
|
|
26
|
+
<input
|
|
27
|
+
class='field-tag field-tag--hidden'
|
|
28
|
+
${data.name ? `name='${data.name}'` : ''}
|
|
29
|
+
type='checkbox'
|
|
30
|
+
value='1'
|
|
31
|
+
${(data?.class || '').indexOf('--active') !== -1 || data?.value ? 'checked' : ''}
|
|
32
|
+
>
|
|
33
|
+
</label>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
${data?.field?.content || ''}
|
|
37
|
+
|
|
38
|
+
${description(data)}
|
|
39
|
+
</div>
|
|
40
|
+
`;
|
|
41
|
+
};
|
|
@@ -1,6 +1,120 @@
|
|
|
1
|
-
import select from './select';
|
|
2
|
-
import text from './text';
|
|
3
1
|
declare const _default: {
|
|
2
|
+
checkbox: (data: {
|
|
3
|
+
class?: string | undefined;
|
|
4
|
+
field?: {
|
|
5
|
+
content?: any;
|
|
6
|
+
} | undefined;
|
|
7
|
+
mask?: {
|
|
8
|
+
class?: string | undefined;
|
|
9
|
+
style?: string | undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
name?: string | undefined;
|
|
12
|
+
style?: string | undefined;
|
|
13
|
+
title: string;
|
|
14
|
+
value?: any;
|
|
15
|
+
} & {
|
|
16
|
+
description?: string | undefined;
|
|
17
|
+
}) => {
|
|
18
|
+
content: string;
|
|
19
|
+
type: string;
|
|
20
|
+
values: never[];
|
|
21
|
+
};
|
|
22
|
+
optional: {
|
|
23
|
+
select: (data: {
|
|
24
|
+
class?: string | undefined;
|
|
25
|
+
field?: {
|
|
26
|
+
content?: any;
|
|
27
|
+
} | undefined;
|
|
28
|
+
mask?: {
|
|
29
|
+
class?: string | undefined;
|
|
30
|
+
style?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
name?: string | undefined;
|
|
33
|
+
style?: string | undefined;
|
|
34
|
+
title: string;
|
|
35
|
+
value?: any;
|
|
36
|
+
} & {
|
|
37
|
+
description?: string | undefined;
|
|
38
|
+
} & {
|
|
39
|
+
field: {
|
|
40
|
+
class?: string | undefined;
|
|
41
|
+
effect?: ((selected: string | number) => void) | undefined;
|
|
42
|
+
mask?: {
|
|
43
|
+
class?: string | undefined;
|
|
44
|
+
content?: any;
|
|
45
|
+
style?: string | undefined;
|
|
46
|
+
} | undefined;
|
|
47
|
+
name?: string | undefined;
|
|
48
|
+
options: Record<string | number, string | number>;
|
|
49
|
+
option?: {
|
|
50
|
+
class?: string | undefined;
|
|
51
|
+
style?: string | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
selected?: any;
|
|
54
|
+
scrollbar?: {
|
|
55
|
+
style?: string | undefined;
|
|
56
|
+
} | undefined;
|
|
57
|
+
style?: string | undefined;
|
|
58
|
+
text?: {
|
|
59
|
+
class?: string | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
tooltip?: {
|
|
62
|
+
class?: string | undefined;
|
|
63
|
+
direction?: any;
|
|
64
|
+
style?: string | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
} & {
|
|
67
|
+
description?: string | undefined;
|
|
68
|
+
} & {
|
|
69
|
+
required?: boolean | undefined;
|
|
70
|
+
title?: string | undefined;
|
|
71
|
+
};
|
|
72
|
+
}) => {
|
|
73
|
+
content: string;
|
|
74
|
+
type: string;
|
|
75
|
+
values: never[];
|
|
76
|
+
};
|
|
77
|
+
text: (data: {
|
|
78
|
+
class?: string | undefined;
|
|
79
|
+
field?: {
|
|
80
|
+
content?: any;
|
|
81
|
+
} | undefined;
|
|
82
|
+
mask?: {
|
|
83
|
+
class?: string | undefined;
|
|
84
|
+
style?: string | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
name?: string | undefined;
|
|
87
|
+
style?: string | undefined;
|
|
88
|
+
title: string;
|
|
89
|
+
value?: any;
|
|
90
|
+
} & {
|
|
91
|
+
description?: string | undefined;
|
|
92
|
+
} & {
|
|
93
|
+
field: {
|
|
94
|
+
active?: boolean | undefined;
|
|
95
|
+
class?: string | undefined;
|
|
96
|
+
mask?: {
|
|
97
|
+
class?: string | undefined;
|
|
98
|
+
content?: any;
|
|
99
|
+
style?: string | undefined;
|
|
100
|
+
} | undefined;
|
|
101
|
+
name?: string | undefined;
|
|
102
|
+
placeholder?: string | undefined;
|
|
103
|
+
style?: string | undefined;
|
|
104
|
+
type?: string | undefined;
|
|
105
|
+
value?: unknown;
|
|
106
|
+
} & {
|
|
107
|
+
description?: string | undefined;
|
|
108
|
+
} & {
|
|
109
|
+
required?: boolean | undefined;
|
|
110
|
+
title?: string | undefined;
|
|
111
|
+
};
|
|
112
|
+
}) => {
|
|
113
|
+
content: string;
|
|
114
|
+
type: string;
|
|
115
|
+
values: never[];
|
|
116
|
+
};
|
|
117
|
+
};
|
|
4
118
|
select: (data: {
|
|
5
119
|
class?: string | undefined;
|
|
6
120
|
effect?: ((selected: string | number) => void) | undefined;
|
|
@@ -38,6 +152,26 @@ declare const _default: {
|
|
|
38
152
|
type: string;
|
|
39
153
|
values: never[];
|
|
40
154
|
};
|
|
155
|
+
switch: (data: {
|
|
156
|
+
class?: string | undefined;
|
|
157
|
+
field?: {
|
|
158
|
+
content?: any;
|
|
159
|
+
} | undefined;
|
|
160
|
+
mask?: {
|
|
161
|
+
class?: string | undefined;
|
|
162
|
+
style?: string | undefined;
|
|
163
|
+
} | undefined;
|
|
164
|
+
name?: string | undefined;
|
|
165
|
+
style?: string | undefined;
|
|
166
|
+
title: string;
|
|
167
|
+
value?: any;
|
|
168
|
+
} & {
|
|
169
|
+
description?: string | undefined;
|
|
170
|
+
}) => {
|
|
171
|
+
content: string;
|
|
172
|
+
type: string;
|
|
173
|
+
values: never[];
|
|
174
|
+
};
|
|
41
175
|
text: (data: {
|
|
42
176
|
active?: boolean | undefined;
|
|
43
177
|
class?: string | undefined;
|
|
@@ -63,4 +197,3 @@ declare const _default: {
|
|
|
63
197
|
};
|
|
64
198
|
};
|
|
65
199
|
export default _default;
|
|
66
|
-
export { select, text };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import checkbox from './checkbox';
|
|
2
|
+
import optional from './optional';
|
|
1
3
|
import select from './select';
|
|
4
|
+
import s from './switch';
|
|
2
5
|
import text from './text';
|
|
3
|
-
export default { select, text };
|
|
4
|
-
export { select, text };
|
|
6
|
+
export default { checkbox, optional, select, switch: s, text };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
select: (data: {
|
|
3
|
+
class?: string | undefined;
|
|
4
|
+
field?: {
|
|
5
|
+
content?: any;
|
|
6
|
+
} | undefined;
|
|
7
|
+
mask?: {
|
|
8
|
+
class?: string | undefined;
|
|
9
|
+
style?: string | undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
name?: string | undefined;
|
|
12
|
+
style?: string | undefined;
|
|
13
|
+
title: string;
|
|
14
|
+
value?: any;
|
|
15
|
+
} & {
|
|
16
|
+
description?: string | undefined;
|
|
17
|
+
} & {
|
|
18
|
+
field: {
|
|
19
|
+
class?: string | undefined;
|
|
20
|
+
effect?: ((selected: string | number) => void) | undefined;
|
|
21
|
+
mask?: {
|
|
22
|
+
class?: string | undefined;
|
|
23
|
+
content?: any;
|
|
24
|
+
style?: string | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
name?: string | undefined;
|
|
27
|
+
options: Record<string | number, string | number>;
|
|
28
|
+
option?: {
|
|
29
|
+
class?: string | undefined;
|
|
30
|
+
style?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
selected?: any;
|
|
33
|
+
scrollbar?: {
|
|
34
|
+
style?: string | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
style?: string | undefined;
|
|
37
|
+
text?: {
|
|
38
|
+
class?: string | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
tooltip?: {
|
|
41
|
+
class?: string | undefined;
|
|
42
|
+
direction?: any;
|
|
43
|
+
style?: string | undefined;
|
|
44
|
+
} | undefined;
|
|
45
|
+
} & {
|
|
46
|
+
description?: string | undefined;
|
|
47
|
+
} & {
|
|
48
|
+
required?: boolean | undefined;
|
|
49
|
+
title?: string | undefined;
|
|
50
|
+
};
|
|
51
|
+
}) => {
|
|
52
|
+
content: string;
|
|
53
|
+
type: string;
|
|
54
|
+
values: never[];
|
|
55
|
+
};
|
|
56
|
+
text: (data: {
|
|
57
|
+
class?: string | undefined;
|
|
58
|
+
field?: {
|
|
59
|
+
content?: any;
|
|
60
|
+
} | undefined;
|
|
61
|
+
mask?: {
|
|
62
|
+
class?: string | undefined;
|
|
63
|
+
style?: string | undefined;
|
|
64
|
+
} | undefined;
|
|
65
|
+
name?: string | undefined;
|
|
66
|
+
style?: string | undefined;
|
|
67
|
+
title: string;
|
|
68
|
+
value?: any;
|
|
69
|
+
} & {
|
|
70
|
+
description?: string | undefined;
|
|
71
|
+
} & {
|
|
72
|
+
field: {
|
|
73
|
+
active?: boolean | undefined;
|
|
74
|
+
class?: string | undefined;
|
|
75
|
+
mask?: {
|
|
76
|
+
class?: string | undefined;
|
|
77
|
+
content?: any;
|
|
78
|
+
style?: string | undefined;
|
|
79
|
+
} | undefined;
|
|
80
|
+
name?: string | undefined;
|
|
81
|
+
placeholder?: string | undefined;
|
|
82
|
+
style?: string | undefined;
|
|
83
|
+
type?: string | undefined;
|
|
84
|
+
value?: unknown;
|
|
85
|
+
} & {
|
|
86
|
+
description?: string | undefined;
|
|
87
|
+
} & {
|
|
88
|
+
required?: boolean | undefined;
|
|
89
|
+
title?: string | undefined;
|
|
90
|
+
};
|
|
91
|
+
}) => {
|
|
92
|
+
content: string;
|
|
93
|
+
type: string;
|
|
94
|
+
values: never[];
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import sel from './select';
|
|
2
|
+
import s from './switch';
|
|
3
|
+
import tex from './text';
|
|
4
|
+
const select = (data) => {
|
|
5
|
+
return s(Object.assign(data, {
|
|
6
|
+
class: `field--optional ${data?.class || ''}`,
|
|
7
|
+
field: {
|
|
8
|
+
content: sel(data.field)
|
|
9
|
+
}
|
|
10
|
+
}));
|
|
11
|
+
};
|
|
12
|
+
const text = (data) => {
|
|
13
|
+
return s(Object.assign(data, {
|
|
14
|
+
class: `field--optional ${data?.class || ''}`,
|
|
15
|
+
field: {
|
|
16
|
+
content: tex(data.field)
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
export default { select, text };
|
package/package.json
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html } from '@esportsplus/template';
|
|
3
|
+
import description from './description';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
type Data = {
|
|
7
|
+
class?: string;
|
|
8
|
+
field?: {
|
|
9
|
+
content?: any;
|
|
10
|
+
};
|
|
11
|
+
mask?: {
|
|
12
|
+
class?: string;
|
|
13
|
+
style?: string;
|
|
14
|
+
};
|
|
15
|
+
name?: string;
|
|
16
|
+
style?: string;
|
|
17
|
+
title: string;
|
|
18
|
+
value?: any;
|
|
19
|
+
} & Parameters<typeof description>[0];
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export default (data: Data) => {
|
|
23
|
+
let state = reactive({
|
|
24
|
+
active: false
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return html`
|
|
28
|
+
<div
|
|
29
|
+
class="field --flex-column ${data?.class || ''} ${() => state.active ? '--active' : ''}"
|
|
30
|
+
onchange='${(e: Event) => {
|
|
31
|
+
if ((e.target as HTMLInputElement).type !== 'checkbox') {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
state.active = (e.target as HTMLInputElement)?.checked;
|
|
36
|
+
}}'
|
|
37
|
+
style='${data?.style || ''}'
|
|
38
|
+
>
|
|
39
|
+
<div class="field-title --flex-horizontal-space-between --flex-vertical">
|
|
40
|
+
${data.title}
|
|
41
|
+
|
|
42
|
+
<label
|
|
43
|
+
class="field-mask ${(data?.mask?.class || '').indexOf('field-mask--switch') === -1 ? 'field-mask--checkbox' : ''} --margin-left --margin-400 ${data?.mask?.class || ''}"
|
|
44
|
+
style='${data?.mask?.style || ''}'
|
|
45
|
+
>
|
|
46
|
+
<input
|
|
47
|
+
class='field-tag field-tag--hidden'
|
|
48
|
+
${data.name ? `name='${data.name}'` : ''}
|
|
49
|
+
type='checkbox'
|
|
50
|
+
value='1'
|
|
51
|
+
${(data?.class || '').indexOf('--active') !== -1 || data?.value ? 'checked' : ''}
|
|
52
|
+
>
|
|
53
|
+
</label>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
${data?.field?.content || ''}
|
|
57
|
+
|
|
58
|
+
${description(data)}
|
|
59
|
+
</div>
|
|
60
|
+
`
|
|
61
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import checkbox from './checkbox';
|
|
2
|
+
import optional from './optional';
|
|
1
3
|
import select from './select';
|
|
4
|
+
import s from './switch';
|
|
2
5
|
import text from './text';
|
|
3
6
|
|
|
4
7
|
|
|
5
|
-
export default { select, text };
|
|
6
|
-
export { select, text };
|
|
8
|
+
export default { checkbox, optional, select, switch: s, text };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import sel from './select';
|
|
2
|
+
import s from './switch';
|
|
3
|
+
import tex from './text';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const select = (data: Parameters<typeof s>[0] & { field: Parameters<typeof sel>[0] }) => {
|
|
7
|
+
return s(Object.assign(data, {
|
|
8
|
+
class: `field--optional ${data?.class || ''}`,
|
|
9
|
+
field: {
|
|
10
|
+
content: sel( data.field )
|
|
11
|
+
}
|
|
12
|
+
}));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const text = (data: Parameters<typeof s>[0] & { field: Parameters<typeof tex>[0] }) => {
|
|
16
|
+
return s(Object.assign(data, {
|
|
17
|
+
class: `field--optional ${data?.class || ''}`,
|
|
18
|
+
field: {
|
|
19
|
+
content: tex( data.field )
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export default { select, text };
|