@esportsplus/ui 0.0.76 → 0.0.78

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.
@@ -126,6 +126,7 @@ declare const _default: {
126
126
  tag?: {
127
127
  class?: string | undefined;
128
128
  } | undefined;
129
+ textarea?: boolean | undefined;
129
130
  type?: string | undefined;
130
131
  value?: unknown;
131
132
  } & {
@@ -197,6 +198,32 @@ declare const _default: {
197
198
  type: string;
198
199
  values: never[];
199
200
  };
201
+ textarea: (data: {
202
+ class?: string | undefined;
203
+ mask?: {
204
+ class?: string | undefined;
205
+ content?: any;
206
+ style?: string | undefined;
207
+ } | undefined;
208
+ name?: string | undefined;
209
+ placeholder?: string | undefined;
210
+ style?: string | undefined;
211
+ tag?: {
212
+ class?: string | undefined;
213
+ } | undefined;
214
+ textarea?: boolean | undefined;
215
+ type?: string | undefined;
216
+ value?: unknown;
217
+ } & {
218
+ description?: string | undefined;
219
+ } & {
220
+ required?: boolean | undefined;
221
+ title?: string | undefined;
222
+ }) => {
223
+ content: string;
224
+ type: string;
225
+ values: never[];
226
+ };
200
227
  text: (data: {
201
228
  class?: string | undefined;
202
229
  mask?: {
@@ -210,6 +237,7 @@ declare const _default: {
210
237
  tag?: {
211
238
  class?: string | undefined;
212
239
  } | undefined;
240
+ textarea?: boolean | undefined;
213
241
  type?: string | undefined;
214
242
  value?: unknown;
215
243
  } & {
@@ -3,5 +3,6 @@ import file from './file';
3
3
  import optional from './optional';
4
4
  import select from './select';
5
5
  import s from './switch';
6
+ import textarea from './textarea';
6
7
  import text from './text';
7
- export default { checkbox, file, optional, select, switch: s, text };
8
+ export default { checkbox, file, optional, select, switch: s, textarea, text };
@@ -82,6 +82,7 @@ declare const _default: {
82
82
  tag?: {
83
83
  class?: string | undefined;
84
84
  } | undefined;
85
+ textarea?: boolean | undefined;
85
86
  type?: string | undefined;
86
87
  value?: unknown;
87
88
  } & {
@@ -13,6 +13,7 @@ type Data = {
13
13
  tag?: {
14
14
  class?: string;
15
15
  };
16
+ textarea?: boolean;
16
17
  type?: string;
17
18
  value?: unknown;
18
19
  } & Parameters<typeof description>[0] & Parameters<typeof title>[0];
@@ -8,10 +8,7 @@ export default (data) => {
8
8
  let state = reactive({
9
9
  active: false,
10
10
  error: ''
11
- }), type = data?.type || 'string';
12
- if (type === 'textarea') {
13
- type = 'string';
14
- }
11
+ }), value = data?.value !== undefined ? `value='${data.value}'` : '';
15
12
  return html `
16
13
  <div
17
14
  class="field ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column"
@@ -29,14 +26,15 @@ export default (data) => {
29
26
  class='field-mask field-mask--input --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) ? '--margin-top' : ''} --margin-300'
30
27
  style='${data?.mask?.style || ''}'
31
28
  >
32
- <${data?.type === 'textarea' ? 'textarea' : 'input'}
29
+ <${data?.textarea ? 'textarea' : 'input'}
33
30
  class='field-tag --padding-400 ${data?.tag?.class || ''}'
34
31
  name='${data?.name || ''}'
35
32
  placeholder='${data?.placeholder || ''}'
36
33
  onrender='${form.input.attributes(state)}'
37
- type='${type}'
38
- ${data?.value !== undefined ? `value='${data.value}'` : ''}
34
+ type='${data?.type || 'string'}'
35
+ ${!data?.textarea && value}
39
36
  >
37
+ ${data?.textarea ? html `${value}</textarea>` : ''}
40
38
 
41
39
  ${data?.mask?.content || ''}
42
40
  </label>
@@ -0,0 +1,7 @@
1
+ import text from './text';
2
+ declare const _default: (data: Parameters<typeof text>[0]) => {
3
+ content: string;
4
+ type: string;
5
+ values: never[];
6
+ };
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import text from './text';
2
+ export default (data) => {
3
+ data.textarea = true;
4
+ return text(data);
5
+ };
package/package.json CHANGED
@@ -22,5 +22,5 @@
22
22
  "prepublishOnly": "npm run build"
23
23
  },
24
24
  "types": "build/index.d.ts",
25
- "version": "0.0.76"
25
+ "version": "0.0.78"
26
26
  }
@@ -3,7 +3,8 @@ import file from './file';
3
3
  import optional from './optional';
4
4
  import select from './select';
5
5
  import s from './switch';
6
+ import textarea from './textarea';
6
7
  import text from './text';
7
8
 
8
9
 
9
- export default { checkbox, file, optional, select, switch: s, text };
10
+ export default { checkbox, file, optional, select, switch: s, textarea, text };
@@ -19,6 +19,7 @@ type Data = {
19
19
  tag?: {
20
20
  class?: string;
21
21
  };
22
+ textarea?: boolean;
22
23
  type?: string;
23
24
  value?: unknown;
24
25
  } & Parameters<typeof description>[0] & Parameters<typeof title>[0];
@@ -29,11 +30,7 @@ export default (data: Data) => {
29
30
  active: false,
30
31
  error: ''
31
32
  }),
32
- type = data?.type || 'string';
33
-
34
- if (type === 'textarea') {
35
- type = 'string';
36
- }
33
+ value = data?.value !== undefined ? `value='${data.value}'` : '';
37
34
 
38
35
  return html`
39
36
  <div
@@ -52,14 +49,15 @@ export default (data: Data) => {
52
49
  class='field-mask field-mask--input --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) ? '--margin-top' : ''} --margin-300'
53
50
  style='${data?.mask?.style || ''}'
54
51
  >
55
- <${data?.type === 'textarea' ? 'textarea' : 'input'}
52
+ <${data?.textarea ? 'textarea' : 'input'}
56
53
  class='field-tag --padding-400 ${data?.tag?.class || ''}'
57
54
  name='${data?.name || ''}'
58
55
  placeholder='${data?.placeholder || ''}'
59
56
  onrender='${form.input.attributes(state)}'
60
- type='${type}'
61
- ${data?.value !== undefined ? `value='${data.value}'` : ''}
57
+ type='${data?.type || 'string'}'
58
+ ${!data?.textarea && value}
62
59
  >
60
+ ${data?.textarea ? html`${value}</textarea>` : ''}
63
61
 
64
62
  ${data?.mask?.content || ''}
65
63
  </label>
@@ -0,0 +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);
8
+ };