@esportsplus/ui 0.0.23 → 0.0.25

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.
@@ -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,119 @@
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
+ class?: string | undefined;
95
+ mask?: {
96
+ class?: string | undefined;
97
+ content?: any;
98
+ style?: string | undefined;
99
+ } | undefined;
100
+ name?: string | undefined;
101
+ placeholder?: string | undefined;
102
+ style?: string | undefined;
103
+ type?: string | undefined;
104
+ value?: unknown;
105
+ } & {
106
+ description?: string | undefined;
107
+ } & {
108
+ required?: boolean | undefined;
109
+ title?: string | undefined;
110
+ };
111
+ }) => {
112
+ content: string;
113
+ type: string;
114
+ values: never[];
115
+ };
116
+ };
4
117
  select: (data: {
5
118
  class?: string | undefined;
6
119
  effect?: ((selected: string | number) => void) | undefined;
@@ -38,8 +151,27 @@ declare const _default: {
38
151
  type: string;
39
152
  values: never[];
40
153
  };
154
+ switch: (data: {
155
+ class?: string | undefined;
156
+ field?: {
157
+ content?: any;
158
+ } | undefined;
159
+ mask?: {
160
+ class?: string | undefined;
161
+ style?: string | undefined;
162
+ } | undefined;
163
+ name?: string | undefined;
164
+ style?: string | undefined;
165
+ title: string;
166
+ value?: any;
167
+ } & {
168
+ description?: string | undefined;
169
+ }) => {
170
+ content: string;
171
+ type: string;
172
+ values: never[];
173
+ };
41
174
  text: (data: {
42
- active?: boolean | undefined;
43
175
  class?: string | undefined;
44
176
  mask?: {
45
177
  class?: string | undefined;
@@ -63,4 +195,3 @@ declare const _default: {
63
195
  };
64
196
  };
65
197
  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,96 @@
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
+ class?: string | undefined;
74
+ mask?: {
75
+ class?: string | undefined;
76
+ content?: any;
77
+ style?: string | undefined;
78
+ } | undefined;
79
+ name?: string | undefined;
80
+ placeholder?: string | undefined;
81
+ style?: string | undefined;
82
+ type?: string | undefined;
83
+ value?: unknown;
84
+ } & {
85
+ description?: string | undefined;
86
+ } & {
87
+ required?: boolean | undefined;
88
+ title?: string | undefined;
89
+ };
90
+ }) => {
91
+ content: string;
92
+ type: string;
93
+ values: never[];
94
+ };
95
+ };
96
+ 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 };
@@ -18,7 +18,10 @@ function template(data, state) {
18
18
  style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
19
19
  });
20
20
  return html `
21
- <div class='tooltip-content tooltip-content--${data?.tooltip?.direction || 's'} ${data?.tooltip?.class || ''} --flex-column --width-full'>
21
+ <div
22
+ class='tooltip-content tooltip-content--${data?.tooltip?.direction || 's'} ${data?.tooltip?.class || ''} --flex-column --width-full'
23
+ style='${data?.tooltip?.style || ''}'
24
+ >
22
25
  <div
23
26
  class='row --flex-column'
24
27
  onclick='${(e) => {
@@ -34,10 +37,9 @@ function template(data, state) {
34
37
  data.effect(key);
35
38
  }
36
39
  }}'
37
- style='${data?.tooltip?.style || ''}'
38
40
  ${a}
39
41
  >
40
- ${Object.keys(state.options).map((key) => html `
42
+ ${Object.keys(data.options || {}).map((key) => html `
41
43
  <div
42
44
  class='link ${data?.option?.class || ''} ${() => state.options[key] ? '--active' : ''} --flex-vertical' data-key='${key}'
43
45
  style='${data?.option?.style || ''}'
@@ -0,0 +1,7 @@
1
+ import checkbox from './checkbox';
2
+ declare const _default: (data: Parameters<typeof checkbox>[0]) => {
3
+ content: string;
4
+ type: string;
5
+ values: never[];
6
+ };
7
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import checkbox from './checkbox';
2
+ export default (data) => {
3
+ data.mask = data.mask || {};
4
+ data.mask.class = `field-mask--switch ${data.mask?.class || ''}`;
5
+ return checkbox(data);
6
+ };
@@ -1,7 +1,6 @@
1
1
  import description from './description';
2
2
  import title from './title';
3
3
  type Data = {
4
- active?: boolean;
5
4
  class?: string;
6
5
  mask?: {
7
6
  class?: string;
@@ -6,12 +6,12 @@ import error from './error';
6
6
  import title from './title';
7
7
  export default (data) => {
8
8
  let state = reactive({
9
- active: (data?.active || false),
9
+ active: false,
10
10
  error: ''
11
11
  });
12
12
  return html `
13
13
  <div
14
- class="field --flex-column ${data?.class || ''} ${() => state.active ? '--active' : ''}"
14
+ class="field ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column"
15
15
  onfocusin='${() => {
16
16
  state.active = true;
17
17
  }}'
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "@esportsplus/action": "^0.0.31",
5
5
  "@esportsplus/delegated-events": "^0.0.16",
6
6
  "@esportsplus/reactivity": "^0.0.18",
7
- "@esportsplus/template": "^0.0.11",
7
+ "@esportsplus/template": "^0.0.12",
8
8
  "autoprefixer": "^10.4.13",
9
9
  "clean-webpack-plugin": "^4.0.0",
10
10
  "css-loader": "^6.7.3",
@@ -37,5 +37,5 @@
37
37
  "prepublishOnly": "npm run build"
38
38
  },
39
39
  "types": "./build/index.d.ts",
40
- "version": "0.0.23"
40
+ "version": "0.0.25"
41
41
  }
@@ -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 };
@@ -55,7 +55,10 @@ function template(data: Data, state: { active: boolean, options: Record<number |
55
55
  });
56
56
 
57
57
  return html`
58
- <div class='tooltip-content tooltip-content--${data?.tooltip?.direction || 's'} ${data?.tooltip?.class || ''} --flex-column --width-full'>
58
+ <div
59
+ class='tooltip-content tooltip-content--${data?.tooltip?.direction || 's'} ${data?.tooltip?.class || ''} --flex-column --width-full'
60
+ style='${data?.tooltip?.style || ''}'
61
+ >
59
62
  <div
60
63
  class='row --flex-column'
61
64
  onclick='${(e: Event) => {
@@ -76,10 +79,9 @@ function template(data: Data, state: { active: boolean, options: Record<number |
76
79
  data.effect(key);
77
80
  }
78
81
  }}'
79
- style='${data?.tooltip?.style || ''}'
80
82
  ${a}
81
83
  >
82
- ${Object.keys( state.options ).map((key: number | string) => html`
84
+ ${Object.keys( data.options || {} ).map((key: number | string) => html`
83
85
  <div
84
86
  class='link ${data?.option?.class || ''} ${() => state.options[key] ? '--active' : ''} --flex-vertical' data-key='${key}'
85
87
  style='${data?.option?.style || ''}'
@@ -0,0 +1,9 @@
1
+ import checkbox from './checkbox';
2
+
3
+
4
+ export default (data: Parameters<typeof checkbox>[0]) => {
5
+ data.mask = data.mask || {};
6
+ data.mask.class = `field-mask--switch ${data.mask?.class || ''}`;
7
+
8
+ return checkbox(data);
9
+ };
@@ -7,7 +7,6 @@ import title from './title';
7
7
 
8
8
 
9
9
  type Data = {
10
- active?: boolean;
11
10
  class?: string;
12
11
  mask?: {
13
12
  class?: string;
@@ -24,13 +23,13 @@ type Data = {
24
23
 
25
24
  export default (data: Data) => {
26
25
  let state = reactive({
27
- active: (data?.active || false),
26
+ active: false,
28
27
  error: ''
29
28
  });
30
29
 
31
30
  return html`
32
31
  <div
33
- class="field --flex-column ${data?.class || ''} ${() => state.active ? '--active' : ''}"
32
+ class="field ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column"
34
33
  onfocusin='${() => {
35
34
  state.active = true;
36
35
  }}'